Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E Maintenance #1182

Merged
merged 26 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
68a44cb
chore: enabling failing tests
zenit2001 Oct 7, 2024
82f57d0
fix: changing place order logic
zenit2001 Oct 7, 2024
fae4c4e
fix: changing selector for giftcards
zenit2001 Oct 7, 2024
91ae10a
fix: timeout added
zenit2001 Oct 7, 2024
d37c019
fix: changing submit payment
zenit2001 Oct 7, 2024
14dc7f0
fix: changing waitForLoad with a timeout
zenit2001 Oct 7, 2024
6c12117
fix: enabling paypal and cashapp
zenit2001 Oct 7, 2024
f71f852
chore: enabling sepa in the pipeline
zenit2001 Oct 7, 2024
4334c0d
chore: changing paypal initiation
zenit2001 Oct 7, 2024
56b9bf6
chore: reverting paypal change
zenit2001 Oct 7, 2024
a443eb4
fix: ensuring visibility and adding a slight delay to paypal
zenit2001 Oct 7, 2024
3f32ba5
fix: adding some timeout to popup
zenit2001 Oct 8, 2024
fcb3a2b
fix: locator change
zenit2001 Oct 8, 2024
435e0b9
fix: testing paypal click with a higher timeout time
zenit2001 Oct 8, 2024
2248f61
fix: adjusting global timeout to see output
zenit2001 Oct 8, 2024
d7c84f5
chore: activating klarna tests
zenit2001 Oct 8, 2024
2a8cf7c
fix: adjusting submitPayment
zenit2001 Oct 8, 2024
d278eb5
chore: enabling amazonpay, skipping sepa due to flakiness
zenit2001 Oct 8, 2024
34f5f11
fix: adding a bit more timeout due to sandbox flakiness
zenit2001 Oct 8, 2024
dcf6f57
feat: updating playwright version
zenit2001 Oct 8, 2024
03a2ad5
fix: changing workers and updating the expect timeout
zenit2001 Oct 8, 2024
5d9ebff
fix: adjusting/removing some timeouts
zenit2001 Oct 8, 2024
a53a8e1
fix: removing some more unnecessary timeouts
zenit2001 Oct 8, 2024
39d67e3
fix: changing popup logic
zenit2001 Oct 8, 2024
b510c39
chore: linting and changing timeout location
zenit2001 Oct 8, 2024
f18e84f
chore: moving back waitForTimeout
zenit2001 Oct 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions tests/playwright/fixtures/USD.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ for (const environment of environments) {
await checkoutPage.expectRefusal();
});

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

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

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

test.skip('CashApp Renders', async ({page}) => {
test('CashApp Renders', async ({page}) => {
if (environment.name.indexOf('v5') !== -1) {
await checkoutPage.setEmail();
}
Expand Down Expand Up @@ -265,7 +265,7 @@ for (const environment of environments) {
await redirectShopper.doPayPalPayment(true, false, true);
if (environment.name.indexOf('v5') !== -1) {
await page.locator("button[value='place-order']").click();
await page.locator(".order-thank-you-msg").isVisible({timeout: 20000});
await page.locator(".order-thank-you-msg").isVisible();
} else {
await checkoutPage.expectSuccess();
}
Expand All @@ -279,7 +279,7 @@ for (const environment of environments) {
await redirectShopper.doPayPalPayment(true, true, true);
if (environment.name.indexOf('v5') !== -1) {
await page.locator("button[value='place-order']").click();
await page.locator(".order-thank-you-msg").isVisible({timeout: 20000});
await page.locator(".order-thank-you-msg").isVisible();
} else {
await checkoutPage.expectSuccess();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/playwright/fixtures/countriesEUR/DE.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ for (const environment of environments) {
}
});

test.skip('Klarna Success @quick', async ({ page }) => {
test('Klarna Success @quick', async ({ page }) => {
redirectShopper = new RedirectShopper(page);
await redirectShopper.doKlarnaPayment();
await checkoutPage.completeCheckout();
Expand Down
2 changes: 1 addition & 1 deletion tests/playwright/fixtures/countriesEUR/FR.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test.describe.parallel(`${environment.name} EUR FR`, () => {
cards = new Cards(page);
});

test.skip('No 3DS Amazon Pay @quick', async ({ page }) => {
test('No 3DS Amazon Pay @quick', async ({ page }) => {
await checkoutPage.goToCheckoutPageWithFullCart(regionsEnum.EU);
await checkoutPage.setShopperDetails(shopperData.FR);
if (environment.name.indexOf('v5') !== -1) {
Expand Down
2 changes: 1 addition & 1 deletion tests/playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"yazl": "^2.5.1"
},
"devDependencies": {
"@playwright/test": "^1.38.0"
"@playwright/test": "^1.42.1"
},
"scripts": {
"test": "npx playwright test",
Expand Down
6 changes: 2 additions & 4 deletions tests/playwright/pages/AccountPageSFRA.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class AccountPageSFRA {
.locator('.input-field')
.type(cardInput.cvc);
}
await this.page.waitForLoadState('networkidle', { timeout: 20000 });
await this.page.waitForLoadState('networkidle');
await this.page.click('button[name="save"]');
};

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

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

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

await cardElement.waitFor({
state: 'visible',
timeout: 20000,
});
};

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

await cardElement.waitFor({
state: 'detached',
timeout: 20000,
});
};

Expand Down
34 changes: 17 additions & 17 deletions tests/playwright/pages/CheckoutPageSFRA5.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default class CheckoutPageSFRA5 {

isPaymentModalShown = async (imgAltValue) => {
await expect(this.paymentModal.locator(`img[alt='${imgAltValue}']`))
.toBeVisible({ timeout: 20000 });
.toBeVisible();
}

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

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

await this.navigateToCheckout(locale);
await this.checkoutGuest.click();
Expand Down Expand Up @@ -166,20 +166,20 @@ export default class CheckoutPageSFRA5 {
};

submitShipping = async () => {
await this.page.waitForLoadState('networkidle', { timeout: 20000 });
await this.page.waitForLoadState('networkidle');
await this.shippingSubmit.click();
await this.page.waitForNavigation({ waitUntil: "networkidle", timeout: 20000 });
await this.page.waitForNavigation({ waitUntil: "networkidle" });

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

submitPayment = async () => {
await this.page.waitForLoadState('load', { timeout: 30000 });
await this.page.waitForLoadState('load');
await this.submitPaymentButton.click();
};
placeOrder = async () => {
await this.page.waitForLoadState('load', { timeout: 30000 });
await this.page.waitForLoadState('load');
await this.placeOrderButton.click();
};

Expand All @@ -193,7 +193,7 @@ export default class CheckoutPageSFRA5 {
};

goBackAndSubmitShipping = async () => {
await this.page.waitForNavigation('load', { timeout: 20000 });
await this.page.waitForNavigation('load');
await this.navigateBack();
await this.submitShipping();
};
Expand All @@ -203,40 +203,40 @@ export default class CheckoutPageSFRA5 {
url: /Order-Confirm/,
timeout: 20000,
});
await expect(this.thankYouMessage).toBeVisible({ timeout: 20000 });
await expect(this.thankYouMessage).toBeVisible();
};

expectNonRedirectSuccess = async () => {
await expect(this.thankYouMessage).toBeVisible({ timeout: 20000 });
await expect(this.thankYouMessage).toBeVisible();
};

expectRefusal = async () => {
await expect(this.errorMessage).not.toBeEmpty({ timeout: 25000 });
await expect(this.errorMessage).not.toBeEmpty();
};

expectVoucher = async () => {
await expect(this.voucherCode).toBeVisible({ timeout: 20000 });
await expect(this.voucherCode).toBeVisible();
};

expectQRcode = async () => {
await this.qrLoader.waitFor({ state: 'attached', timeout: 20000 });
await expect(this.qrLoaderAmount).toBeVisible({ timeout: 20000 });
await expect(this.qrImg).toBeVisible({ timeout: 20000 });
await this.qrLoader.waitFor({ state: 'attached'});
await expect(this.qrLoaderAmount).toBeVisible();
await expect(this.qrImg).toBeVisible();
};

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

getLocation = async () => {
await this.page.waitForLoadState('load', { timeout: 20000 });
await this.page.waitForLoadState('load');
return await this.page.url();
};

navigateBack = async () => {
await this.page.waitForLoadState('networkidle', { timeout: 20000 });
await this.page.waitForLoadState('networkidle');
await this.page.goBack();
await this.page.waitForLoadState('networkidle', { timeout: 20000 });
await this.page.waitForLoadState('networkidle');
};

loginUser = async (credentials) => {
Expand Down
52 changes: 23 additions & 29 deletions tests/playwright/pages/CheckoutPageSFRA6.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class CheckoutPageSFRA {

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

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

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

isPaymentModalShown = async (imgAltValue) => {
await expect(this.paymentModal.locator(`img[alt='${imgAltValue}']`))
.toBeVisible({ timeout: 20000 });
.toBeVisible();
}

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

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

await this.navigateToCheckout(locale);
await this.setEmail(email);
Expand All @@ -127,7 +127,7 @@ export default class CheckoutPageSFRA {
};

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


await this.checkoutPageUserFirstNameInput.type(
Expand Down Expand Up @@ -175,31 +175,26 @@ export default class CheckoutPageSFRA {
};

submitShipping = async () => {
await this.page.waitForLoadState('networkidle', { timeout: 20000 });
await this.page.waitForLoadState('networkidle');
await this.shippingSubmit.click();
await this.page.waitForNavigation({ waitUntil: "networkidle", timeout: 20000 });
await this.page.waitForNavigation({ waitUntil: "networkidle" });

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

submitPayment = async () => {
await this.page.waitForLoadState('load', { timeout: 30000 });
await this.submitPaymentButton.click();
await this.page.waitForFunction(() => {
const button = document.querySelector('.submit-payment');
return button && !button.disabled;
});

await this.submitPaymentButton.click();
};

placeOrder = async () => {
let retries = 3;
while (retries > 0) {
try {
await this.page.waitForLoadState('load', { timeout: 30000 });
await this.placeOrderButton.click();
break; // Break out of the loop if successful
} catch (error) {
retries--;
await this.page.reload();
}
}
await this.page.waitForLoadState('load');
await this.placeOrderButton.click();
};

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

goBackAndSubmitShipping = async () => {
await this.page.waitForNavigation('load', { timeout: 20000 });
await this.page.waitForNavigation('load');
await this.navigateBack();
await this.submitShipping();
};
Expand All @@ -221,35 +216,34 @@ export default class CheckoutPageSFRA {
expectSuccess = async () => {
await this.page.waitForNavigation({
url: /Order-Confirm/,
timeout: 20000,
});
await expect(this.thankYouMessage).toBeVisible({ timeout: 20000 });
await expect(this.thankYouMessage).toBeVisible();
};

expectNonRedirectSuccess = async () => {
await expect(this.thankYouMessage).toBeVisible({ timeout: 20000 });
await expect(this.thankYouMessage).toBeVisible();
};

expectRefusal = async () => {
await expect(this.errorMessage).not.toBeEmpty({ timeout: 25000 });
await expect(this.errorMessage).not.toBeEmpty();
};

expectVoucher = async () => {
await expect(this.voucherCode).toBeVisible({ timeout: 20000 });
await expect(this.voucherCode).toBeVisible();
};

expectQRcode = async () => {
await this.qrLoader.waitFor({ state: 'attached', timeout: 20000 });
await expect(this.qrLoaderAmount).toBeVisible({ timeout: 20000 });
await expect(this.qrImg).toBeVisible({ timeout: 20000 });
await this.qrLoader.waitFor({ state: 'attached' });
await expect(this.qrLoaderAmount).toBeVisible();
await expect(this.qrImg).toBeVisible();
};

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

getLocation = async () => {
await this.page.waitForLoadState('load', { timeout: 20000 });
await this.page.waitForLoadState('load');
return await this.page.url();
};

Expand Down
Loading
Loading