Skip to content

Commit c904cf0

Browse files
committed
add multiple users to make parellel tests more stable
1 parent 6917458 commit c904cf0

File tree

7 files changed

+21
-20
lines changed

7 files changed

+21
-20
lines changed

.github/workflows/e2e.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Install dependencies
4242
run: npm install
4343
- name: Install Playwright Browsers
44-
run: npx playwright install --with-deps
44+
run: npx playwright install --with-deps chromium
4545

4646
- name: Wait for Magento Store
4747
uses: mydea/[email protected]

Test/End-2-End/Components/Admin/AdminLogin.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@ export default class AdminLogin {
55
this.page = page;
66
}
77

8-
async login() {
8+
async login(username) {
99
await this.page.goto("./admin");
10-
await this.page.getByPlaceholder('user name').fill('admin');
10+
await this.page.getByPlaceholder('user name').fill(username);
1111
await this.page.getByPlaceholder('password').fill('password1');
1212
await this.page.getByPlaceholder('password').press('Enter');
1313
await this.page.waitForTimeout(1000);
1414
await expect(this.page.locator('.admin__form-loading-mask > .spinner').first()).toBeHidden();
1515
try {
1616
await expect(this.page.getByRole('button', {name: "Don't Allow"})).toBeVisible({timeout: 1000});
17-
console.log("Detected Magento Usage Popup, clicking don't allow.")
1817
await this.page.getByRole('button', {name: "Don't Allow"}).click();
1918
} catch (e) {
20-
console.log("No Magento Usage popup, so ignoring it.")
19+
//ignore
2120
}
2221
}
2322
}

Test/End-2-End/Components/GoTo.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ export default class GoTo {
55
constructor(page) {
66
this.page = page;
77
this.product = new GoToProduct(page);
8-
this.admin = new GoToAdmin(page);
8+
}
9+
10+
admin(username) {
11+
return new GoToAdmin(this.page, username);
912
}
1013

1114
async checkout() {
@@ -27,12 +30,13 @@ class GoToProduct {
2730
}
2831

2932
class GoToAdmin {
30-
constructor(page) {
33+
constructor(page, username) {
3134
this.page = page;
35+
this.username = username;
3236
}
3337

3438
async ordersList() {
35-
await new AdminLogin(this.page).login();
39+
await new AdminLogin(this.page).login(this.username);
3640

3741
await this.page.getByRole('link', {name: 'Sales'}).click();
3842
await this.page.getByRole('link', {name: 'Orders'}).click();

Test/End-2-End/payment-link.spec.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ import GoTo from "./Components/GoTo";
33
import {v7 as uuidv7} from 'uuid';
44
import CardCheckout from "./Components/PaymentMethods/CardCheckout";
55

6-
test.describe.configure({mode: 'serial'});
7-
8-
96
test("payment link order", async ({browser, page}) => {
10-
await new GoTo(page).admin.ordersList();
7+
await new GoTo(page).admin('e2e-tests-payment-link').ordersList();
118

129
await page.getByRole('button', {name: 'Create New Order'}).click();
1310
await page.getByRole('button', {name: 'Create New Customer'}).click();

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import RvvupMethodCheckout from "./Components/PaymentMethods/RvvupMethodCheckout
44
import OrderConfirmation from "./Components/OrderConfirmation";
55
import GoTo from "./Components/GoTo";
66

7-
test.describe.configure({ mode: 'serial' });
8-
97
test("full refund", async ({
108
page,
119
}) => {
@@ -16,7 +14,7 @@ test("full refund", async ({
1614

1715
const orderId = await new OrderConfirmation(page).expectOnOrderConfirmation();
1816

19-
await new GoTo(page).admin.creditMemoForOrder(orderId);
17+
await new GoTo(page).admin('e2e-tests-refunds').creditMemoForOrder(orderId);
2018

2119

2220
await page.getByRole('button', { name: 'Refund', exact: true }).click();
@@ -34,7 +32,7 @@ test("partial refund", async ({
3432

3533
const orderId = await new OrderConfirmation(page).expectOnOrderConfirmation();
3634

37-
await new GoTo(page).admin.creditMemoForOrder(orderId);
35+
await new GoTo(page).admin('e2e-tests-partial-refunds').creditMemoForOrder(orderId);
3836

3937
await page.locator('#shipping_amount').fill('0');
4038
await page.locator('#shipping_amount').press('Enter');

Test/End-2-End/virtual-terminal.spec.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ import GoTo from "./Components/GoTo";
33
import {v7 as uuidv7} from 'uuid';
44
import CardCheckout from "./Components/PaymentMethods/CardCheckout";
55

6-
test.describe.configure({mode: 'serial'});
7-
8-
96
test("virtual terminal order", async ({page}) => {
10-
await new GoTo(page).admin.ordersList();
7+
await new GoTo(page).admin('e2e-tests-virtual-terminal').ordersList();
118
await page.getByRole('button', {name: 'Create New Order'}).click();
129
await page.getByRole('button', {name: 'Create New Customer'}).click();
1310
await page.getByRole('button', {name: 'Add Products'}).click();

docker/scripts/configure-base-store.sh

+6
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,10 @@ bin/magento config:set system/smtp/transport smtp
2828
bin/magento config:set system/smtp/host $MAGENTO_SMTP_HOST
2929
bin/magento config:set system/smtp/port $MAGENTO_SMTP_PORT
3030

31+
echo "Registering Test Users"
32+
bin/magento admin:user:create --admin-user=e2e-tests-payment-link --admin-password=password1 [email protected] --admin-firstname=E2E --admin-lastname=PaymentLinks
33+
bin/magento admin:user:create --admin-user=e2e-tests-refunds --admin-password=password1 [email protected] --admin-firstname=E2E --admin-lastname=Refunds
34+
bin/magento admin:user:create --admin-user=e2e-tests-partial-refunds --admin-password=password1 [email protected] --admin-firstname=E2E --admin-lastname=PartialRefunds
35+
bin/magento admin:user:create --admin-user=e2e-tests-virtual-terminal --admin-password=password1 [email protected] --admin-firstname=E2E --admin-lastname=VirtualTerminal
36+
3137
bin/magento sampledata:deploy

0 commit comments

Comments
 (0)