-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(testcafe): Create empty album scenario
- Loading branch information
1 parent
0944a9e
commit 44eafc0
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { photosUser } from '../helpers/roles' | ||
import { TESTCAFE_PHOTOS_URL } from '../helpers/utils' | ||
import { ALBUM_DATE_TIME } from '../helpers/data' | ||
import PhotoPage from '../pages/photos-model' | ||
import AlbumPage from '../pages/photos-album-model' | ||
|
||
const photoPage = new PhotoPage() | ||
const photoAlbumPage = new AlbumPage() | ||
|
||
fixture`Create new album with photos`.page`${TESTCAFE_PHOTOS_URL}/`.beforeEach( | ||
async t => { | ||
await t.useRole(photosUser) | ||
await photoPage.initPhotoPage() | ||
} | ||
) | ||
|
||
test('Go into Album view, and check that there is no album', async () => { | ||
await photoPage.goToAlbums() | ||
await photoAlbumPage.checkEmptyAlbum() | ||
}) | ||
|
||
test('Go into Album view, and create new empty album', async () => { | ||
await photoPage.goToAlbums() | ||
await photoAlbumPage.addNewAlbum(ALBUM_DATE_TIME, 0) | ||
await photoAlbumPage.checkAlbumPage(ALBUM_DATE_TIME, 0) | ||
//we need to check the album page, just after the redirection from album creation, hence this step being in this test | ||
}) | ||
|
||
test('Go to ALBUM_DATE_TIME, and rename it (exit by pressing "enter")', async t => { | ||
await photoPage.goToAlbums() | ||
await photoAlbumPage.goToAlbum(ALBUM_DATE_TIME) | ||
await photoAlbumPage.checkAlbumPage(ALBUM_DATE_TIME, 0) | ||
await photoAlbumPage.renameAlbum(ALBUM_DATE_TIME, `New_${ALBUM_DATE_TIME}`) | ||
await t.pressKey('enter') | ||
await photoAlbumPage.checkAlbumPage(`New_${ALBUM_DATE_TIME}`, 0) | ||
}) | ||
|
||
test('Go to New_ALBUM_DATE_TIME, and rename it (exit by clicking away)', async t => { | ||
await photoPage.goToAlbums() | ||
await photoAlbumPage.goToAlbum(`New_${ALBUM_DATE_TIME}`) | ||
await photoAlbumPage.checkAlbumPage(`New_${ALBUM_DATE_TIME}`, 0) | ||
await photoAlbumPage.renameAlbum( | ||
`New_${ALBUM_DATE_TIME}`, | ||
`New2_${ALBUM_DATE_TIME}` | ||
) | ||
await t.click(photoAlbumPage.mainContent) | ||
await photoAlbumPage.checkAlbumPage(`New2_${ALBUM_DATE_TIME}`, 0) | ||
}) | ||
|
||
test('Go to New2_ALBUM_DATE_TIME, and add 2 more photos', async () => { | ||
await photoPage.goToAlbums() | ||
await photoAlbumPage.goToAlbum(`New2_${ALBUM_DATE_TIME}`) | ||
await photoAlbumPage.addPhotosToAlbum(`New2_${ALBUM_DATE_TIME}`, 0, 2) | ||
await photoAlbumPage.backToAlbumsList() | ||
await photoAlbumPage.isAlbumExistsAndVisible(`New2_${ALBUM_DATE_TIME}`, 2) | ||
}) | ||
|
||
test('Go to New2_ALBUM_DATE_TIME, and remove the 1st photos', async () => { | ||
await photoPage.goToAlbums() | ||
await photoAlbumPage.goToAlbum(`New2_${ALBUM_DATE_TIME}`) | ||
await photoAlbumPage.removePhoto(1) | ||
}) | ||
|
||
test('Go to New2_ALBUM_DATE_TIME, and delete it', async () => { | ||
await photoPage.goToAlbums() | ||
await photoAlbumPage.goToAlbum(`New2_${ALBUM_DATE_TIME}`) | ||
await photoAlbumPage.deleteAlbum() | ||
await photoAlbumPage.waitForLoading() | ||
await photoAlbumPage.checkEmptyAlbum() //There is no more album | ||
}) |