Added extra assertions to Offers tests (#15956)

refs. https://github.com/TryGhost/Team/issues/2371

- two extra assertion was needed for discount and free-trials to check
if the offers are listed in ‘Active’ offers and the URLs load portal
This commit is contained in:
Peter Zimon 2022-12-09 08:56:41 +01:00 committed by GitHub
parent ffd07ea744
commit 527d718b76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,11 +20,14 @@ test.describe('Portal', () => {
amount: 14 amount: 14
}); });
await expect(page.getByRole('link', {name: offerName}), 'Should have free-trial offer').toBeVisible();
await page.locator('.gh-offers-list .gh-list-row').filter({hasText: offerName}).click(); await page.locator('.gh-offers-list .gh-list-row').filter({hasText: offerName}).click();
const portalUrl = await page.locator('input#url').inputValue(); const portalUrl = await page.locator('input#url').inputValue();
await page.goto(portalUrl); await page.goto(portalUrl);
const portalFrame = page.frameLocator('#ghost-portal-root div iframe'); const portalFrame = page.frameLocator('#ghost-portal-root div iframe');
await expect(portalFrame.locator('.gh-portal-offer-title'), 'URL should open Portal with free-trial offer').toBeVisible();
await portalFrame.locator('#input-name').fill('Testy McTesterson'); await portalFrame.locator('#input-name').fill('Testy McTesterson');
await portalFrame.locator('#input-email').fill('testy@example.com'); await portalFrame.locator('#input-email').fill('testy@example.com');
await portalFrame.getByRole('button', {name: 'Start 14-day free trial'}).click(); await portalFrame.getByRole('button', {name: 'Start 14-day free trial'}).click();
@ -61,11 +64,14 @@ test.describe('Portal', () => {
amount: 10 amount: 10
}); });
await expect(page.getByRole('link', {name: offerName}), 'Should have discount offer').toBeVisible();
await page.locator('.gh-offers-list .gh-list-row').filter({hasText: offerName}).click(); await page.locator('.gh-offers-list .gh-list-row').filter({hasText: offerName}).click();
const portalUrl = await page.locator('input#url').inputValue(); const portalUrl = await page.locator('input#url').inputValue();
await page.goto(portalUrl); await page.goto(portalUrl);
const portalFrame = page.frameLocator('#ghost-portal-root div iframe'); const portalFrame = page.frameLocator('#ghost-portal-root div iframe');
await expect(portalFrame.locator('.gh-portal-offer-title'), 'URL should open Portal with discount offer').toBeVisible();
await portalFrame.locator('#input-name').fill('Testy McTesterson'); await portalFrame.locator('#input-name').fill('Testy McTesterson');
await portalFrame.locator('#input-email').fill('testy@example.com'); await portalFrame.locator('#input-email').fill('testy@example.com');
await portalFrame.getByRole('button', {name: 'Continue'}).click(); await portalFrame.getByRole('button', {name: 'Continue'}).click();