Skip to content

Commit 726644b

Browse files
Update Tests to use unique email every run (#72)
1 parent a36d3b0 commit 726644b

File tree

4 files changed

+122
-9
lines changed

4 files changed

+122
-9
lines changed

Test/End-2-End/Pages/VisitCheckoutPayment.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { expect } from "@playwright/test";
1+
import {expect} from "@playwright/test";
22
import Cart from "../Components/Cart";
3+
import {v7 as uuidv7} from 'uuid';
34

45
export default class VisitCheckoutPayment {
56
constructor(page) {
@@ -13,7 +14,7 @@ export default class VisitCheckoutPayment {
1314

1415
await this.page
1516
.getByLabel("Email address", { exact: true })
16-
.fill("johndoe@example.com");
17+
.fill(uuidv7() + "@example.com");
1718
await this.page.getByLabel("First name").fill("John");
1819
await this.page.getByLabel("Last name").fill("Doe");
1920
await this.page.getByLabel("Street address").fill("123 Main St");

Test/End-2-End/clearpay.spec.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { test, expect } from "@playwright/test";
1+
import {expect, test} from "@playwright/test";
22
import VisitCheckoutPayment from "./Pages/VisitCheckoutPayment";
33
import Cart from "./Components/Cart";
4-
4+
import {v7 as uuidv7} from 'uuid';
55
// This test is quite far, but the Clearpay modal is quite a bit flakey. It sometimes works, sometimes doesn't.
66
test.skip("Can place an order", async ({ page, browser }) => {
77
const visitCheckoutPayment = new VisitCheckoutPayment(page);
@@ -21,12 +21,9 @@ test.skip("Can place an order", async ({ page, browser }) => {
2121
const frame = page.frameLocator("iframe.rvvup-modal");
2222
await frame.getByRole("button", { name: "Accept All" }).click();
2323

24-
const randomString =
25-
Math.random().toString(36).substring(2, 15) +
26-
Math.random().toString(36).substring(2, 15);
2724
await frame
2825
.getByLabel("Email or mobile number")
29-
.fill("playwright-" + randomString + "@example.com");
26+
.fill(uuidv7() + "@example.com");
3027
await frame.getByRole("button", { name: "Continue" }).click();
3128

3229
await frame

package-lock.json

Lines changed: 114 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"devDependencies": {
1313
"@playwright/test": "^1.41.1",
1414
"@types/node": "^20.11.8",
15-
"prettier": "3.3.3"
15+
"prettier": "3.3.3",
16+
"uuid": "^10.0.0"
1617
}
1718
}

0 commit comments

Comments
 (0)