0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Added playwright test for creating additional tier

refs TryGhost/Team#2371

- Tests that an additional tier can be created and that it'll appear in portal settings unselected by default
This commit is contained in:
Djordje Vlaisavljevic 2022-12-07 17:26:02 +01:00
parent b6db85a5d6
commit 2464d45b4a
2 changed files with 26 additions and 2 deletions

View file

@ -43,7 +43,7 @@
</div>
</GhFormGroup>
{{#if this.membersUtils.isStripeEnabled}}
<div {{did-insert this.refreshAfterStripeConnected}}>
<div {{did-insert this.refreshAfterStripeConnected}} data-test-tiers-at-signup>
<div class="mb3 mt5">
<h4 class="gh-portal-setting-title">Tiers available at signup</h4>
</div>
@ -69,7 +69,7 @@
</label>
</div>
{{#each this.tiers as |tier|}}
<div class="form-group mb0 for-checkbox">
<div class="form-group mb0 for-checkbox" data-test-tier-at-signup>
<label
class="checkbox"
for={{tier.id}}

View file

@ -23,5 +23,29 @@ test.describe('Admin', () => {
await expect(page.locator('.gh-offers-list')).toContainText(tierName);
await expect(page.locator('.gh-offers-list')).toContainText(offerName);
});
test('Can create additional Tier', async ({page}) => {
await page.goto('/ghost');
const tierName = 'New Test Tier';
const enableInPortal = false;
await createTier(page, {
name: tierName,
monthlyPrice: 5,
yearlyPrice: 50
}, enableInPortal);
// Open Portal settings
await page.locator('.gh-nav a[href="#/settings/"]').click();
await page.locator('.gh-setting-group').filter({hasText: 'Membership'}).click();
await page.locator('[data-test-toggle="portal-settings"]').click();
// Wait until the list of tiers available at signup is visible
await page.locator('[data-test-tiers-at-signup]').first().waitFor({state: 'visible', timeout: 1000});
// Make sure newly created tier is in the list
await expect(page.locator('[data-test-tier-at-signup] > label > p').last()).toContainText(tierName);
// Make sure newly created tier is in not selected
expect(await page.locator('[data-test-tier-at-signup] > label > input').last().isChecked()).toBeFalsy();
});
});
});