-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove duplicate views: Fix E2E tests (#98279)
- Forces redirects from Calypso to WP Admin for the E2E tests - Updates the E2E tests to use the WP Admin UI
- Loading branch information
Showing
7 changed files
with
101 additions
and
78 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
45 changes: 45 additions & 0 deletions
45
packages/calypso-e2e/src/lib/components/wp-admin-notice-component.ts
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,45 @@ | ||
import { Page } from 'playwright'; | ||
|
||
type NoticeType = 'Updated'; | ||
|
||
/** | ||
* Represents the Notification component. | ||
*/ | ||
export class WpAdminNoticeComponent { | ||
private page: Page; | ||
|
||
/** | ||
* Creates an instance of the component. | ||
* | ||
* @param {Page} page Object representing the base page. | ||
*/ | ||
constructor( page: Page ) { | ||
this.page = page; | ||
} | ||
|
||
/** | ||
* Verifies the content in a notification on the page. | ||
* | ||
* This method requires either full or partial text of | ||
* the notification to be supplied as parameter. | ||
* | ||
* Optionally, it is possible to specify the `type` parameter to limit | ||
* validation to a certain type of notifications eg. `error`. | ||
* | ||
* @param {string} text Full or partial text to validate on page. | ||
* @param param1 Optional parameters. | ||
* @param {NoticeType} param1.type Type of notice to limit validation to. | ||
* @param {number} param1.timeout Custom timeout value. | ||
*/ | ||
async noticeShown( | ||
text: string, | ||
{ type, timeout }: { type?: NoticeType; timeout?: number } = {} | ||
): Promise< void > { | ||
const noticeType = type ? `.${ type.toLowerCase() }` : ''; | ||
|
||
const selector = `div.notice${ noticeType } :text("${ text }")`; | ||
|
||
const locator = this.page.locator( selector ); | ||
await locator.waitFor( { state: 'visible', timeout: timeout } ); | ||
} | ||
} |
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