-
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.
Fix E2E test that opens page template (#89057)
- Loading branch information
Showing
4 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
packages/calypso-e2e/src/lib/components/full-side-editor-data-views-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,35 @@ | ||
import { Page } from 'playwright'; | ||
import { EditorComponent } from './editor-component'; | ||
|
||
const selectors = { | ||
primaryFieldByText: ( primaryFieldText: string ) => | ||
`.dataviews-view-table__primary-field:has-text("${ primaryFieldText }")`, | ||
}; | ||
|
||
/** | ||
* Represents an instance of the WordPress.com FSE Editor's DataViews. | ||
* This is used for data layouts (e.g. tables, grids, and lists). | ||
*/ | ||
export class FullSiteEditorDataViewsComponent { | ||
private page: Page; | ||
private editor: EditorComponent; | ||
|
||
/** | ||
* Constructs an instance of the component. | ||
* | ||
* @param {Page} page The underlying page. | ||
* @param {EditorComponent} editor The EditorComponent instance. | ||
*/ | ||
constructor( page: Page, editor: EditorComponent ) { | ||
this.page = page; | ||
this.editor = editor; | ||
} | ||
|
||
/** | ||
* Clicks on a button with the exact name. | ||
*/ | ||
async clickPrimaryFieldByExactText( primaryFieldText: string ): Promise< void > { | ||
const editorParent = await this.editor.parent(); | ||
await editorParent.locator( selectors.primaryFieldByText( primaryFieldText ) ).click(); | ||
} | ||
} |
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