-
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.
- Loading branch information
Showing
12 changed files
with
253 additions
and
20 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
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
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,49 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { visitAdminPage } from '@wordpress/e2e-test-utils'; | ||
|
||
const inputSelector = '#unsplash_access_key'; | ||
const btnSelect = '#submit.button-primary'; | ||
|
||
describe( 'Settings', () => { | ||
beforeEach( async () => { | ||
await visitAdminPage( 'options-general.php', 'page=unsplash' ); | ||
await page.evaluate( selector => { | ||
document.querySelector( selector ).value = ''; | ||
}, inputSelector ); | ||
await page.evaluate( selector => { | ||
document.querySelector( selector ).click(); | ||
}, btnSelect ); | ||
await page.waitForNavigation(); | ||
} ); | ||
|
||
afterEach( async () => { | ||
await visitAdminPage( 'options-general.php', 'page=unsplash' ); | ||
await page.evaluate( selector => { | ||
document.querySelector( selector ).value = ''; | ||
}, inputSelector ); | ||
await page.evaluate( selector => { | ||
document.querySelector( selector ).click(); | ||
}, btnSelect ); | ||
await page.waitForNavigation(); | ||
} ); | ||
|
||
it( 'page input exist', async () => { | ||
// Wait input tab. | ||
await expect( page ).toMatchElement( inputSelector ); | ||
} ); | ||
|
||
it( 'Valid key the input exist', async () => { | ||
await page.focus( inputSelector ); | ||
await page.keyboard.type( 'valid-key' ); | ||
await page.evaluate( selector => { | ||
document.querySelector( selector ).click(); | ||
}, btnSelect ); | ||
await page.waitForNavigation(); | ||
|
||
const NO_RESULTS = '.notice-error.notice-unsplash'; | ||
await page.waitForSelector( NO_RESULTS ); | ||
await expect( page ).toMatchElement( NO_RESULTS ); | ||
} ); | ||
} ); |
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,31 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { visitAdminPage } from '@wordpress/e2e-test-utils'; | ||
import { activatePlugin, deactivatePlugin } from '../../utils'; | ||
|
||
describe( 'Classic editor', () => { | ||
beforeAll( async () => { | ||
await activatePlugin( 'classic-editor' ); | ||
} ); | ||
|
||
afterAll( async () => { | ||
await deactivatePlugin( 'classic-editor' ); | ||
} ); | ||
|
||
beforeEach( async () => { | ||
await visitAdminPage( 'post-new.php', {} ); | ||
} ); | ||
|
||
it( 'should the tab exist', async () => { | ||
const MEDIA_LIBRARY_BUTTON = '#set-post-thumbnail'; | ||
const UNSPLASH_LIBRARY_BUTTON = '#menu-item-unsplash'; | ||
|
||
// Click the media library button and wait for tab. | ||
await page.waitForSelector( MEDIA_LIBRARY_BUTTON ); | ||
await page.click( MEDIA_LIBRARY_BUTTON ); | ||
await page.waitForSelector( '.media-modal' ); | ||
await page.waitForSelector( UNSPLASH_LIBRARY_BUTTON ); | ||
await expect( page ).toMatchElement( UNSPLASH_LIBRARY_BUTTON ); | ||
} ); | ||
} ); |
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,24 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createNewPost, insertBlock } from '@wordpress/e2e-test-utils'; | ||
import { clickButton } from '../../utils'; | ||
|
||
describe( 'Cover Block', () => { | ||
beforeEach( async () => { | ||
await createNewPost( {} ); | ||
} ); | ||
|
||
it( 'should the tab exist', async () => { | ||
const UNSPLASH_LIBRARY_BUTTON = '#menu-item-unsplash'; | ||
|
||
// Insert cover block. | ||
await insertBlock( 'Cover' ); | ||
|
||
// Click the media library button and wait for tab. | ||
await clickButton( 'Media Library' ); | ||
await page.waitForSelector( '.media-modal' ); | ||
await page.waitForSelector( UNSPLASH_LIBRARY_BUTTON ); | ||
await expect( page ).toMatchElement( UNSPLASH_LIBRARY_BUTTON ); | ||
} ); | ||
} ); |
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,24 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createNewPost } from '@wordpress/e2e-test-utils'; | ||
import { clickButton } from '../../utils'; | ||
|
||
/** | ||
* Tests the notices for the featured image. | ||
*/ | ||
describe( 'Featured Image', () => { | ||
beforeEach( async () => { | ||
await createNewPost(); | ||
await clickButton( 'Document' ); | ||
await clickButton( 'Featured image' ); | ||
await clickButton( 'Set featured image' ); | ||
} ); | ||
|
||
it( 'should the tab exist', async () => { | ||
const UNSPLASH_LIBRARY_BUTTON = '#menu-item-unsplash'; | ||
await page.waitForSelector( '.media-modal' ); | ||
await page.waitForSelector( UNSPLASH_LIBRARY_BUTTON ); | ||
await expect( page ).toMatchElement( UNSPLASH_LIBRARY_BUTTON ); | ||
} ); | ||
} ); |
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,24 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createNewPost, insertBlock } from '@wordpress/e2e-test-utils'; | ||
import { clickButton } from '../../utils'; | ||
|
||
const UNSPLASH_LIBRARY_BUTTON = '#menu-item-unsplash'; | ||
|
||
describe( 'Image Block', () => { | ||
beforeEach( async () => { | ||
await createNewPost( {} ); | ||
|
||
// Insert image block. | ||
await insertBlock( 'Gallery' ); | ||
|
||
// Click the media library button and wait for tab. | ||
await clickButton( 'Media Library' ); | ||
await page.waitForSelector( '.media-modal' ); | ||
} ); | ||
|
||
it( 'should the tab not exist', async () => { | ||
await expect( page ).not.toMatchElement( UNSPLASH_LIBRARY_BUTTON ); | ||
} ); | ||
} ); |
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