-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(playwright): Convert Cypress tests to Playwright - 3
- Loading branch information
1 parent
94e6306
commit ca8a52d
Showing
14 changed files
with
269 additions
and
151 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,47 @@ | ||
import { expect, Locator, Page } from "@playwright/test"; | ||
|
||
import { Dialog } from "./Dialog"; | ||
|
||
export class AddTabDialog extends Dialog { | ||
readonly idInput: Locator; | ||
|
||
constructor(page: Page) { | ||
super(page, { | ||
title: "Add Tab", | ||
submitName: "Save", | ||
}); | ||
|
||
/** | ||
* Components | ||
*/ | ||
// Handle components here | ||
|
||
/** | ||
* Static locators | ||
*/ | ||
this.idInput = this.dialog.getByPlaceholder( | ||
"A label for selecting the tab (i.e. not used in the API)", | ||
{ exact: true }, | ||
); | ||
} | ||
|
||
/** | ||
* Dynamic locators | ||
*/ | ||
// Handle dynamic locators here | ||
|
||
/** | ||
* Actions | ||
*/ | ||
async createTab(name: string) { | ||
await expect(this.title).toBeVisible(); | ||
await this.idInput.fill(name); | ||
await this.submitButton.click(); | ||
await expect(this.title).not.toBeVisible(); | ||
} | ||
|
||
/** | ||
* Assertions | ||
*/ | ||
// Handle assertions here | ||
} |
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 @@ | ||
import { expect, Locator, Page } from "@playwright/test"; | ||
|
||
import { Dialog } from "./Dialog"; | ||
|
||
export class SelectExistingSlicesDialog extends Dialog { | ||
readonly sharedSliceCard: Locator; | ||
readonly addedMessage: Locator; | ||
|
||
constructor(page: Page) { | ||
super(page, { | ||
title: `Select existing slices`, | ||
submitName: "Add", | ||
}); | ||
|
||
/** | ||
* Static locators | ||
*/ | ||
this.sharedSliceCard = this.dialog.getByTestId("shared-slice-card"); | ||
this.addedMessage = page.getByText("Slice(s) added to slice zone", { | ||
exact: true, | ||
}); | ||
} | ||
|
||
/** | ||
* Dynamic locators | ||
*/ | ||
// Handle dynamic locators here | ||
|
||
/** | ||
* Actions | ||
*/ | ||
async selectExistingSlices(names: string[]) { | ||
await expect(this.title).toBeVisible(); | ||
for (const name of names) { | ||
await this.sharedSliceCard.getByText(name, { exact: true }).click(); | ||
} | ||
await this.submitButton.click(); | ||
await this.checkCreatedMessage(); | ||
await expect(this.title).not.toBeVisible(); | ||
} | ||
|
||
/** | ||
* Assertions | ||
*/ | ||
async checkCreatedMessage() { | ||
await expect(this.addedMessage).toBeVisible(); | ||
await expect(this.addedMessage).not.toBeVisible(); | ||
} | ||
} |
Oops, something went wrong.