-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #168 from xwp/fix/add-media-library-tests
Add e2e to for media library.
- Loading branch information
Showing
2 changed files
with
38 additions
and
2 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,36 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { visitAdminPage } from '@wordpress/e2e-test-utils'; | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { UNSPLASH_MODAL } from '../../constants'; | ||
|
||
const CONTAINER = '.attachments'; | ||
|
||
describe( 'Media Library', () => { | ||
beforeEach( async () => { | ||
await visitAdminPage( 'upload.php', 'mode=grid' ); | ||
await page.waitForSelector( CONTAINER, { | ||
visible: true, | ||
} ); | ||
} ); | ||
|
||
it( 'attachment details has unsplash link', async () => { | ||
const btnSelector = | ||
CONTAINER + ' .attachment-preview.type-image:first-of-type'; | ||
await page.waitForSelector( btnSelector ); | ||
await page.evaluate( selector => { | ||
document.querySelector( selector ).click(); | ||
}, btnSelector ); | ||
|
||
await page.waitForSelector( UNSPLASH_MODAL, { | ||
visible: true, | ||
} ); | ||
|
||
const blockClass = '.unsplash-author-link'; | ||
await page.waitForSelector( blockClass ); | ||
await expect( page ).toMatchElement( blockClass ); | ||
} ); | ||
} ); |