-
Notifications
You must be signed in to change notification settings - Fork 116
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 #1547 from xwp/fix/1545-local-environment-path
Fix local environment path
- Loading branch information
Showing
6 changed files
with
106 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ tests/data/tmp/* | |
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ | ||
/playwright/.auth/ |
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,56 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { test, expect } from '@wordpress/e2e-test-utils-playwright'; | ||
|
||
let page; | ||
|
||
test.describe.configure( { mode: 'serial' } ); | ||
|
||
test.beforeAll( async ( { browser } ) => { | ||
page = await browser.newPage(); | ||
} ); | ||
|
||
test.afterAll( async () => { | ||
await page.goto( 'http://stream.wpenv.net/wp-admin/network/plugins.php' ); | ||
const isActive = await page | ||
.getByLabel( 'Network Deactivate Stream' ) | ||
.isVisible(); | ||
|
||
if ( isActive ) { | ||
// eslint-disable-next-line no-console | ||
console.log( 'Deactivating Stream after Network tests.' ); | ||
await page.getByLabel( 'Network Deactivate Stream' ).click(); | ||
} | ||
} ); | ||
|
||
test.describe( 'Network: shows network activated states', () => { | ||
// Do we have a published row? | ||
test( 'does not show stream in network admin when deactivated', async () => { | ||
await page.goto( 'http://stream.wpenv.net/wp-admin/network/index.php' ); | ||
// Expects Stream log to not have the Network Settings. | ||
await expect( | ||
page.locator( '[href*="admin.php?page=wp_stream"]' ), | ||
).not.toBeVisible(); | ||
} ); | ||
|
||
// We should not have an updated row. This times out which makes it fail. | ||
test( 'does not have updated row', async () => { | ||
await page.goto( 'http://stream.wpenv.net/wp-admin/network/plugins.php' ); | ||
const isInactive = await page | ||
.getByLabel( 'Network Activate Stream' ) | ||
.isVisible(); | ||
|
||
if ( isInactive ) { | ||
// eslint-disable-next-line no-console | ||
console.log( 'Activating Stream for next tests.' ); | ||
await page.getByLabel( 'Network Activate Stream' ).click(); | ||
} | ||
|
||
await page.goto( 'http://stream.wpenv.net/wp-admin/network/index.php' ); | ||
// Expects Stream log to not have the Network Settings. | ||
await expect( | ||
page.locator( '[href*="admin.php?page=wp_stream_network_settings"]' ), | ||
).toBeVisible(); | ||
} ); | ||
} ); |
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,41 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { test as setup } from '@playwright/test'; | ||
|
||
const authFile = 'playwright/.auth/user.json'; | ||
|
||
/** | ||
* Log in before all the tests. | ||
* @see https://playwright.dev/docs/auth | ||
*/ | ||
setup( 'authenticate', async ( { page } ) => { | ||
// Log in. | ||
await page.goto( 'http://stream.wpenv.net/wp-login.php' ); | ||
await page.getByLabel( 'Username or Email Address' ).fill( 'admin' ); | ||
await page.getByLabel( 'Password', { exact: true } ).fill( 'password' ); | ||
await page.getByRole( 'button', { name: 'Log In' } ).click(); | ||
// Wait until the page receives the cookies. | ||
|
||
// Sometimes login flow sets cookies in the process of several redirects. | ||
// Wait for the final URL to ensure that the cookies are actually set. | ||
await page.waitForURL( 'http://stream.wpenv.net/wp-admin/' ); | ||
|
||
await page.goto( 'http://stream.wpenv.net/wp-admin/network/plugins.php' ); | ||
const isActive = await page.getByLabel( 'Network Deactivate Stream' ).isVisible(); | ||
|
||
// eslint-disable-next-line no-console | ||
console.log( `Stream is currently active: ${ isActive }` ); | ||
|
||
if ( isActive ) { | ||
// eslint-disable-next-line no-console | ||
console.log( 'Deactivating Stream before tests.' ); | ||
await page.getByLabel( 'Network Deactivate Stream' ).click(); | ||
} | ||
|
||
// End of authentication steps. | ||
await page.context().storageState( { path: authFile } ); | ||
|
||
// eslint-disable-next-line no-console | ||
console.log( 'Done with network setup.' ); | ||
} ); |