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

fix(functional-test): update failing coupon tests #16988

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 6 additions & 2 deletions packages/functional-tests/pages/products/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ export class SubscribePage extends BaseLayout {
return this.page.getByRole('heading', { name: 'Promo Code Applied' });
}

async getCouponStatusByDataTestId(dataTestId: string) {
return this.page.locator(`[data-testid="${dataTestId}"]`);
get couponError() {
return this.page.getByTestId('coupon-error');
}

get removeCouponButton() {
return this.page.getByTestId('coupon-remove-button');
}

async visitSignIn() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ test.describe('severity-2 #smoke', () => {
// 'autoexpired' coupon is an expired coupon for a 6mo plan
await subscribe.addCouponCode('autoexpired');

await expect(
await subscribe.getCouponStatusByDataTestId('coupon-error')
).toBeVisible({
timeout: 5000,
await expect(subscribe.couponError).toBeVisible({
timeout: 10000,
});

// Verifying the correct error message
Expand All @@ -52,10 +50,8 @@ test.describe('severity-2 #smoke', () => {
// But valid for a 12mo plan
await subscribe.addCouponCode('autoinvalid');

await expect(
await subscribe.getCouponStatusByDataTestId('coupon-error')
).toBeVisible({
timeout: 5000,
await expect(subscribe.couponError).toBeVisible({
timeout: 10000,
});

// Asserting that the code is invalid for a 6mo plan
Expand Down Expand Up @@ -228,10 +224,8 @@ test.describe('severity-2 #smoke', () => {
await subscribe.addCouponCode('auto50ponetime');

// Verify the coupon is applied successfully
await expect(
await subscribe.getCouponStatusByDataTestId('coupon-remove-button')
).toBeVisible({
timeout: 5000,
await expect(subscribe.removeCouponButton).toBeVisible({
timeout: 10000,
});
expect(await subscribe.oneTimeDiscountSuccess()).toBe(true);

Expand Down