Skip to content

Commit 8017d91

Browse files
authored
E2E Maintenance (#1182)
1 parent 3b8c818 commit 8017d91

11 files changed

Lines changed: 84 additions & 102 deletions

File tree

tests/playwright/fixtures/USD.spec.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ for (const environment of environments) {
7878
await checkoutPage.expectRefusal();
7979
});
8080

81-
test.skip('PayPal Success @quick', async ({page}) => {
81+
test('PayPal Success @quick', async ({page}) => {
8282
redirectShopper = new RedirectShopper(page);
8383
await redirectShopper.doPayPalPayment(false, false, true);
8484
await checkoutPage.expectSuccess();
@@ -93,7 +93,7 @@ for (const environment of environments) {
9393
await page.goto(`${environment.urlExtension}`);
9494
});
9595

96-
test.skip('GiftCard Only Success @quick', async () => {
96+
test('GiftCard Only Success @quick', async () => {
9797
await goToBillingWithFullCartGuestUser();
9898
if (environment.name.indexOf('v5') !== -1) {
9999
await checkoutPage.setEmail();
@@ -103,7 +103,7 @@ for (const environment of environments) {
103103
await checkoutPage.expectSuccess();
104104
});
105105

106-
test.skip('GiftCard & Card Success @quick', async () => {
106+
test('GiftCard & Card Success @quick', async () => {
107107
await goToBillingWithFullCartGuestUser(3);
108108
if (environment.name.indexOf('v5') !== -1) {
109109
await checkoutPage.setEmail();
@@ -164,7 +164,7 @@ for (const environment of environments) {
164164
await checkoutPage.expectRefusal();
165165
});
166166

167-
test.skip('CashApp Renders', async ({page}) => {
167+
test('CashApp Renders', async ({page}) => {
168168
if (environment.name.indexOf('v5') !== -1) {
169169
await checkoutPage.setEmail();
170170
}
@@ -265,7 +265,7 @@ for (const environment of environments) {
265265
await redirectShopper.doPayPalPayment(true, false, true);
266266
if (environment.name.indexOf('v5') !== -1) {
267267
await page.locator("button[value='place-order']").click();
268-
await page.locator(".order-thank-you-msg").isVisible({timeout: 20000});
268+
await page.locator(".order-thank-you-msg").isVisible();
269269
} else {
270270
await checkoutPage.expectSuccess();
271271
}
@@ -279,7 +279,7 @@ for (const environment of environments) {
279279
await redirectShopper.doPayPalPayment(true, true, true);
280280
if (environment.name.indexOf('v5') !== -1) {
281281
await page.locator("button[value='place-order']").click();
282-
await page.locator(".order-thank-you-msg").isVisible({timeout: 20000});
282+
await page.locator(".order-thank-you-msg").isVisible();
283283
} else {
284284
await checkoutPage.expectSuccess();
285285
}

tests/playwright/fixtures/countriesEUR/DE.spec.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ for (const environment of environments) {
2424
}
2525
});
2626

27-
test.skip('Klarna Success @quick', async ({ page }) => {
27+
test('Klarna Success @quick', async ({ page }) => {
2828
redirectShopper = new RedirectShopper(page);
2929
await redirectShopper.doKlarnaPayment();
3030
await checkoutPage.completeCheckout();

tests/playwright/fixtures/countriesEUR/FR.spec.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ test.describe.parallel(`${environment.name} EUR FR`, () => {
5252
cards = new Cards(page);
5353
});
5454

55-
test.skip('No 3DS Amazon Pay @quick', async ({ page }) => {
55+
test('No 3DS Amazon Pay @quick', async ({ page }) => {
5656
await checkoutPage.goToCheckoutPageWithFullCart(regionsEnum.EU);
5757
await checkoutPage.setShopperDetails(shopperData.FR);
5858
if (environment.name.indexOf('v5') !== -1) {

tests/playwright/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
"yazl": "^2.5.1"
107107
},
108108
"devDependencies": {
109-
"@playwright/test": "^1.38.0"
109+
"@playwright/test": "^1.42.1"
110110
},
111111
"scripts": {
112112
"test": "npx playwright test",

tests/playwright/pages/AccountPageSFRA.mjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default class AccountPageSFRA {
2828
.locator('.input-field')
2929
.type(cardInput.cvc);
3030
}
31-
await this.page.waitForLoadState('networkidle', { timeout: 20000 });
31+
await this.page.waitForLoadState('networkidle');
3232
await this.page.click('button[name="save"]');
3333
};
3434

@@ -41,7 +41,7 @@ export default class AccountPageSFRA {
4141
const cardElement = this.savedCardElementGenerator(cardData);
4242
const deleteButton = cardElement.locator('../../button');
4343

44-
await this.page.waitForLoadState('networkidle', { timeout: 20000 });
44+
await this.page.waitForLoadState('networkidle');
4545

4646
await deleteButton.click();
4747
await this.page.click('.delete-confirmation-btn');
@@ -52,7 +52,6 @@ export default class AccountPageSFRA {
5252

5353
await cardElement.waitFor({
5454
state: 'visible',
55-
timeout: 20000,
5655
});
5756
};
5857

@@ -65,7 +64,6 @@ export default class AccountPageSFRA {
6564

6665
await cardElement.waitFor({
6766
state: 'detached',
68-
timeout: 20000,
6967
});
7068
};
7169

tests/playwright/pages/CheckoutPageSFRA5.mjs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export default class CheckoutPageSFRA5 {
8888

8989
isPaymentModalShown = async (imgAltValue) => {
9090
await expect(this.paymentModal.locator(`img[alt='${imgAltValue}']`))
91-
.toBeVisible({ timeout: 20000 });
91+
.toBeVisible();
9292
}
9393

9494
navigateToCheckout = async (locale) => {
@@ -101,7 +101,7 @@ export default class CheckoutPageSFRA5 {
101101

102102
goToCheckoutPageWithFullCart = async (locale, itemCount = 1) => {
103103
await this.addProductToCart(locale, itemCount);
104-
await this.successMessage.waitFor({ visible: true, timeout: 20000 });
104+
await this.successMessage.waitFor({ visible: true });
105105

106106
await this.navigateToCheckout(locale);
107107
await this.checkoutGuest.click();
@@ -166,20 +166,20 @@ export default class CheckoutPageSFRA5 {
166166
};
167167

168168
submitShipping = async () => {
169-
await this.page.waitForLoadState('networkidle', { timeout: 20000 });
169+
await this.page.waitForLoadState('networkidle');
170170
await this.shippingSubmit.click();
171-
await this.page.waitForNavigation({ waitUntil: "networkidle", timeout: 20000 });
171+
await this.page.waitForNavigation({ waitUntil: "networkidle" });
172172

173173
// Ugly wait since the submit button takes time to mount.
174174
await new Promise(r => setTimeout(r, 2000));
175175
};
176176

177177
submitPayment = async () => {
178-
await this.page.waitForLoadState('load', { timeout: 30000 });
178+
await this.page.waitForLoadState('load');
179179
await this.submitPaymentButton.click();
180180
};
181181
placeOrder = async () => {
182-
await this.page.waitForLoadState('load', { timeout: 30000 });
182+
await this.page.waitForLoadState('load');
183183
await this.placeOrderButton.click();
184184
};
185185

@@ -193,7 +193,7 @@ export default class CheckoutPageSFRA5 {
193193
};
194194

195195
goBackAndSubmitShipping = async () => {
196-
await this.page.waitForNavigation('load', { timeout: 20000 });
196+
await this.page.waitForNavigation('load');
197197
await this.navigateBack();
198198
await this.submitShipping();
199199
};
@@ -203,40 +203,40 @@ export default class CheckoutPageSFRA5 {
203203
url: /Order-Confirm/,
204204
timeout: 20000,
205205
});
206-
await expect(this.thankYouMessage).toBeVisible({ timeout: 20000 });
206+
await expect(this.thankYouMessage).toBeVisible();
207207
};
208208

209209
expectNonRedirectSuccess = async () => {
210-
await expect(this.thankYouMessage).toBeVisible({ timeout: 20000 });
210+
await expect(this.thankYouMessage).toBeVisible();
211211
};
212212

213213
expectRefusal = async () => {
214-
await expect(this.errorMessage).not.toBeEmpty({ timeout: 25000 });
214+
await expect(this.errorMessage).not.toBeEmpty();
215215
};
216216

217217
expectVoucher = async () => {
218-
await expect(this.voucherCode).toBeVisible({ timeout: 20000 });
218+
await expect(this.voucherCode).toBeVisible();
219219
};
220220

221221
expectQRcode = async () => {
222-
await this.qrLoader.waitFor({ state: 'attached', timeout: 20000 });
223-
await expect(this.qrLoaderAmount).toBeVisible({ timeout: 20000 });
224-
await expect(this.qrImg).toBeVisible({ timeout: 20000 });
222+
await this.qrLoader.waitFor({ state: 'attached'});
223+
await expect(this.qrLoaderAmount).toBeVisible();
224+
await expect(this.qrImg).toBeVisible();
225225
};
226226

227227
expectGiftCardWarning = async () => {
228228
await expect(this.giftCardWarning).not.toBeEmpty();
229229
};
230230

231231
getLocation = async () => {
232-
await this.page.waitForLoadState('load', { timeout: 20000 });
232+
await this.page.waitForLoadState('load');
233233
return await this.page.url();
234234
};
235235

236236
navigateBack = async () => {
237-
await this.page.waitForLoadState('networkidle', { timeout: 20000 });
237+
await this.page.waitForLoadState('networkidle');
238238
await this.page.goBack();
239-
await this.page.waitForLoadState('networkidle', { timeout: 20000 });
239+
await this.page.waitForLoadState('networkidle');
240240
};
241241

242242
loginUser = async (credentials) => {

tests/playwright/pages/CheckoutPageSFRA6.mjs

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default class CheckoutPageSFRA {
5757

5858
this.shippingSubmit = page.locator("button[value='submit-shipping']");
5959

60-
this.submitPaymentButton = page.locator("button[value='submit-payment']");
60+
this.submitPaymentButton = page.locator('.submit-payment');
6161
this.placeOrderButton = page.locator("button[value='place-order']");
6262

6363
this.errorMessage = page.locator('.error-message-text');
@@ -89,7 +89,7 @@ export default class CheckoutPageSFRA {
8989

9090
isPaymentModalShown = async (imgAltValue) => {
9191
await expect(this.paymentModal.locator(`img[alt='${imgAltValue}']`))
92-
.toBeVisible({ timeout: 20000 });
92+
.toBeVisible();
9393
}
9494

9595
navigateToCheckout = async (locale) => {
@@ -102,7 +102,7 @@ export default class CheckoutPageSFRA {
102102

103103
goToCheckoutPageWithFullCart = async (locale, itemCount = 1, email) => {
104104
await this.addProductToCart(locale, itemCount);
105-
await this.successMessage.waitFor({ visible: true, timeout: 20000 });
105+
await this.successMessage.waitFor({ visible: true });
106106

107107
await this.navigateToCheckout(locale);
108108
await this.setEmail(email);
@@ -127,7 +127,7 @@ export default class CheckoutPageSFRA {
127127
};
128128

129129
setShopperDetails = async (shopperDetails) => {
130-
await this.customerInfoSection.waitFor({ visible: true, timeout: 20000 });
130+
await this.customerInfoSection.waitFor({ visible: true });
131131

132132

133133
await this.checkoutPageUserFirstNameInput.type(
@@ -175,31 +175,26 @@ export default class CheckoutPageSFRA {
175175
};
176176

177177
submitShipping = async () => {
178-
await this.page.waitForLoadState('networkidle', { timeout: 20000 });
178+
await this.page.waitForLoadState('networkidle');
179179
await this.shippingSubmit.click();
180-
await this.page.waitForNavigation({ waitUntil: "networkidle", timeout: 20000 });
180+
await this.page.waitForNavigation({ waitUntil: "networkidle" });
181181

182182
// Ugly wait since the submit button takes time to mount.
183183
await new Promise(r => setTimeout(r, 2000));
184184
};
185185

186186
submitPayment = async () => {
187-
await this.page.waitForLoadState('load', { timeout: 30000 });
188-
await this.submitPaymentButton.click();
187+
await this.page.waitForFunction(() => {
188+
const button = document.querySelector('.submit-payment');
189+
return button && !button.disabled;
190+
});
191+
192+
await this.submitPaymentButton.click();
189193
};
190194

191195
placeOrder = async () => {
192-
let retries = 3;
193-
while (retries > 0) {
194-
try {
195-
await this.page.waitForLoadState('load', { timeout: 30000 });
196-
await this.placeOrderButton.click();
197-
break; // Break out of the loop if successful
198-
} catch (error) {
199-
retries--;
200-
await this.page.reload();
201-
}
202-
}
196+
await this.page.waitForLoadState('load');
197+
await this.placeOrderButton.click();
203198
};
204199

205200
completeCheckoutLoggedInUser = async () => {
@@ -212,7 +207,7 @@ export default class CheckoutPageSFRA {
212207
};
213208

214209
goBackAndSubmitShipping = async () => {
215-
await this.page.waitForNavigation('load', { timeout: 20000 });
210+
await this.page.waitForNavigation('load');
216211
await this.navigateBack();
217212
await this.submitShipping();
218213
};
@@ -221,35 +216,34 @@ export default class CheckoutPageSFRA {
221216
expectSuccess = async () => {
222217
await this.page.waitForNavigation({
223218
url: /Order-Confirm/,
224-
timeout: 20000,
225219
});
226-
await expect(this.thankYouMessage).toBeVisible({ timeout: 20000 });
220+
await expect(this.thankYouMessage).toBeVisible();
227221
};
228222

229223
expectNonRedirectSuccess = async () => {
230-
await expect(this.thankYouMessage).toBeVisible({ timeout: 20000 });
224+
await expect(this.thankYouMessage).toBeVisible();
231225
};
232226

233227
expectRefusal = async () => {
234-
await expect(this.errorMessage).not.toBeEmpty({ timeout: 25000 });
228+
await expect(this.errorMessage).not.toBeEmpty();
235229
};
236230

237231
expectVoucher = async () => {
238-
await expect(this.voucherCode).toBeVisible({ timeout: 20000 });
232+
await expect(this.voucherCode).toBeVisible();
239233
};
240234

241235
expectQRcode = async () => {
242-
await this.qrLoader.waitFor({ state: 'attached', timeout: 20000 });
243-
await expect(this.qrLoaderAmount).toBeVisible({ timeout: 20000 });
244-
await expect(this.qrImg).toBeVisible({ timeout: 20000 });
236+
await this.qrLoader.waitFor({ state: 'attached' });
237+
await expect(this.qrLoaderAmount).toBeVisible();
238+
await expect(this.qrImg).toBeVisible();
245239
};
246240

247241
expectGiftCardWarning = async () => {
248242
await expect(this.giftCardWarning).not.toBeEmpty();
249243
};
250244

251245
getLocation = async () => {
252-
await this.page.waitForLoadState('load', { timeout: 20000 });
246+
await this.page.waitForLoadState('load');
253247
return await this.page.url();
254248
};
255249

0 commit comments

Comments
 (0)