0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Added Playwright test for invite only sites

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

Tests if an invite only site disables sign up.
This commit is contained in:
Simon Backx 2022-12-08 17:27:30 +01:00
parent f5aae1e2c5
commit 6af149120a

View file

@ -0,0 +1,31 @@
const {expect, test} = require('@playwright/test');
const changeSubscriptionAccess = async (page, access) => {
await page.locator('[data-test-nav="settings"]').click();
await page.locator('[data-test-nav="members-membership"]').click();
// click data-test-members-subscription-option="all"
await page.locator('[data-test-members-subscription-option="all"]').click();
await page.locator(`[data-test-members-subscription-option="${access}"]`).click();
// save
await page.locator('[data-test-button="save-settings"]').click();
};
test.describe('Site Settings', () => {
test.describe('Subscription Access', () => {
test('Invite only', async ({page}) => {
await page.goto('/ghost');
await changeSubscriptionAccess(page, 'invite');
// Go to the sigup page
await page.goto('/#/portal/signup');
const portalFrame = page.frameLocator('#ghost-portal-root div iframe');
// Check sign up is disabled and a message is shown
await expect(portalFrame.locator('.gh-portal-invite-only-notification')).toHaveText('This site is invite-only, contact the owner for access.');
});
});
});