Fixed browser tests

refs 6378d7d66f

- the buttons have been renamed and split apart into separate ones
This commit is contained in:
Daniel Lockyer 2024-07-01 14:34:35 +02:00 committed by Daniel Lockyer
parent 09f2ccfca4
commit 60f37ed118
2 changed files with 11 additions and 6 deletions

View File

@ -80,7 +80,8 @@ test.describe('Admin', () => {
await tierModal.getByLabel('Description').fill(updatedDescription);
await tierModal.getByLabel('Monthly price').fill(updatedMonthlyPrice);
await tierModal.getByLabel('Yearly price').fill(updatedYearlyPrice);
await tierModal.getByRole('button', {name: 'Save & close'}).click();
await tierModal.getByRole('button', {name: 'Save'}).click();
await tierModal.getByRole('button', {name: 'Close'}).click();
});
const portalFrame = await test.step('Go to website and open portal', async () => {
@ -128,7 +129,8 @@ test.describe('Admin', () => {
const tierModal = await openTierModal(sharedPage, {slug});
await tierModal.getByRole('button', {name: 'Archive tier'}).click();
await sharedPage.getByTestId('confirmation-modal').getByRole('button', {name: 'Archive'}).click();
await tierModal.getByRole('button', {name: 'Save & close'}).click();
await tierModal.getByRole('button', {name: 'Save'}).click();
await tierModal.getByRole('button', {name: 'Close'}).click();
});
await test.step('Archived tier should not be available in active tiers', async () => {
@ -156,7 +158,8 @@ test.describe('Admin', () => {
const tierModal = await openTierModal(sharedPage, {slug});
await tierModal.getByRole('button', {name: 'Reactivate tier'}).click();
await sharedPage.getByTestId('confirmation-modal').getByRole('button', {name: 'Reactivate'}).click();
await tierModal.getByRole('button', {name: 'Save & close'}).click();
await tierModal.getByRole('button', {name: 'Save'}).click();
await tierModal.getByRole('button', {name: 'Close'}).click();
});
await test.step('Unarchived tier should be available in active tiers', async () => {

View File

@ -195,7 +195,8 @@ const createTier = async (page, {name, monthlyPrice, yearlyPrice, trialDays}, en
await page.getByTestId('tier-detail-modal').getByRole('button', {name: 'Archive tier'}).click();
await page.getByTestId('confirmation-modal').getByRole('button', {name: 'Archive'}).click();
await page.getByTestId('tier-detail-modal').getByRole('button', {name: 'Reactivate tier'}).waitFor();
await page.getByTestId('tier-detail-modal').getByRole('button', {name: 'Save & close'}).click();
await page.getByTestId('tier-detail-modal').getByRole('button', {name: 'Save'}).click();
await page.getByTestId('tier-detail-modal').getByRole('button', {name: 'Close'}).click();
}
// Add the tier
@ -209,7 +210,8 @@ const createTier = async (page, {name, monthlyPrice, yearlyPrice, trialDays}, en
await modal.getByLabel('Add a free trial').check();
await modal.getByLabel('Trial days').fill(`${trialDays}`);
}
await modal.getByRole('button', {name: 'Save & close'}).click();
await modal.getByRole('button', {name: 'Save'}).click();
await modal.getByRole('button', {name: 'Close'}).click();
await page.locator('[data-testid="tier-card"]:visible').filter({hasText: name}).waitFor();
// Enable the tier in portal
@ -267,7 +269,7 @@ const createOffer = async (page, {name, tierName, offerType, amount, discountTyp
// only one of these buttons is ever available - either 'Add offer' or 'Manage offers'
const hasExistingOffers = await page.getByTestId('offers').getByRole('button', {name: 'Manage offers'}).isVisible();
const isCTA = await page.getByTestId('offers').getByRole('button', {name: 'Add offer'}).isVisible();
// Archive other offers to keep the list tidy
// We only need 1 offer to be active at a time
// Either the list of active offers loads, or the CTA when no offers exist