Fixed offers playwright test for redemption count

- updates check of redemption count using data test attributes to avoid unreliable member count check
This commit is contained in:
Rishabh 2023-01-06 18:39:25 +05:30
parent 6593c3e4a6
commit 54b27f7d55
3 changed files with 5 additions and 5 deletions

View File

@ -54,7 +54,7 @@
</thead>
<tbody>
{{#each this.filteredOffers as |offer|}}
<tr class="gh-list-row" data-test-list="offers-list-item">
<tr class="gh-list-row" data-test-list="offers-list-item" data-test-offer="{{offer.name}}">
<LinkTo @route="offer" @model={{offer}} class="gh-list-data" data-test-list="offer-name">
<h3>{{offer.name}}</h3>
</LinkTo>
@ -92,7 +92,7 @@
<span class="midgrey strike ml2">{{currency-symbol offer.finalCurrency}}{{gh-price-amount offer.originalPrice}}</span>
{{/if}}
</LinkTo>
<LinkTo @route="offer" @model={{offer}} class="gh-list-data">
<LinkTo @route="offer" @model={{offer}} class="gh-list-data" data-test-list="redemption-count">
<span class="midgrey">{{offer.redemptionCount}}</span>
</LinkTo>
<div class="gh-list-data gh-list-cellwidth-10 gh-list-chevron">

View File

@ -53,7 +53,7 @@ test.describe('Portal', () => {
// Ensure the offer redemption count was bumped
await page.locator('.gh-nav a[href="#/offers/"]').click();
const locator = page.locator('[data-test-list="offers-list-item"] a:nth-child(5) span').last();
const locator = page.locator(`[data-test-offer="${offerName}"]`).locator('[data-test-list="redemption-count"]').locator('span');
await expect(locator).toContainText('1');
});

View File

@ -16,7 +16,7 @@ test.describe('Portal', () => {
// fill out signup form and submit
await portalFrame.locator('[data-test-input="input-name"]').fill('Testy McTesterson');
await portalFrame.locator('[data-test-input="input-email"]').fill('testy@example.com');
await portalFrame.locator('[data-test-input="input-email"]').fill('testy+paidsignup@example.com');
await portalFrame.locator('[data-test-button="select-tier"]').nth(1).click();
const hasContinueBtn = await portalFrame.locator('text="Continue"').isVisible();
if (hasContinueBtn) {
@ -28,7 +28,7 @@ test.describe('Portal', () => {
// come back to the website, open portal and check member is logged in and has paid
await page.waitForSelector('h1.site-title', {state: 'visible'});
await portalTriggerButton.click();
await expect(portalFrame.getByText('testy@example.com')).toBeVisible();
await expect(portalFrame.getByText('testy+paidsignup@example.com')).toBeVisible();
await expect(portalFrame.getByRole('heading', {name: 'Billing info'})).toBeVisible();
await expect(portalFrame.getByText('**** **** **** 4242')).toBeVisible();
});