mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Fixed broken playwright tests
refs https://github.com/TryGhost/Team/issues/2371 - playwright tests were broken due to state changes based on prev tests that were not accounted for - in case of multiple newsletters, portal tests expected another step between stripe checkout for newsletter selection - site settings test was disabling members, but not re-enabling it back
This commit is contained in:
parent
8b92b49363
commit
4e766e2584
3 changed files with 19 additions and 3 deletions
|
@ -14,6 +14,10 @@ const changeSubscriptionAccess = async (page, access) => {
|
|||
|
||||
// Save settings
|
||||
await page.locator('[data-test-button="save-settings"]').click();
|
||||
await page.getByRole('button', {name: 'Saved'}).waitFor({
|
||||
state: 'visible',
|
||||
timeout: 1000
|
||||
});
|
||||
};
|
||||
|
||||
const checkPortalScriptLoaded = async (page, loaded = true) => {
|
||||
|
@ -66,6 +70,9 @@ test.describe('Site Settings', () => {
|
|||
await page.locator('[data-test-button="publish-flow"]').click();
|
||||
await expect(page.locator('[data-test-setting="publish-type"] > button')).toHaveCount(0);
|
||||
await expect(page.locator('[data-test-setting="email-recipients"]')).toHaveCount(0);
|
||||
// reset back to all
|
||||
await page.goto('/ghost');
|
||||
await changeSubscriptionAccess(page, 'all');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -31,7 +31,10 @@ test.describe('Portal', () => {
|
|||
await portalFrame.locator('#input-name').fill('Testy McTesterson');
|
||||
await portalFrame.locator('#input-email').fill('testy@example.com');
|
||||
await portalFrame.getByRole('button', {name: 'Start 14-day free trial'}).click();
|
||||
|
||||
const hasContinueBtn = await portalFrame.locator('text="Continue"').isVisible();
|
||||
if (hasContinueBtn) {
|
||||
await portalFrame.getByRole('button', {name: 'Continue'}).click();
|
||||
}
|
||||
await completeStripeSubscription(page);
|
||||
|
||||
await page.waitForSelector('h1.site-title', {state: 'visible'});
|
||||
|
@ -75,7 +78,10 @@ test.describe('Portal', () => {
|
|||
await portalFrame.locator('#input-name').fill('Testy McTesterson');
|
||||
await portalFrame.locator('#input-email').fill('testy@example.com');
|
||||
await portalFrame.getByRole('button', {name: 'Continue'}).click();
|
||||
|
||||
const hasContinueBtn = await portalFrame.locator('text="Continue"').isVisible();
|
||||
if (hasContinueBtn) {
|
||||
await portalFrame.getByRole('button', {name: 'Continue'}).click();
|
||||
}
|
||||
await completeStripeSubscription(page);
|
||||
|
||||
await page.waitForSelector('h1.site-title', {state: 'visible'});
|
||||
|
|
|
@ -18,7 +18,10 @@ test.describe('Portal', () => {
|
|||
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-button="select-tier"]').nth(1).click();
|
||||
|
||||
const hasContinueBtn = await portalFrame.locator('text="Continue"').isVisible();
|
||||
if (hasContinueBtn) {
|
||||
await portalFrame.getByRole('button', {name: 'Continue'}).click();
|
||||
}
|
||||
// complete the stripe checkout flow
|
||||
await completeStripeSubscription(page);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue