mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-27 18:52:14 +03:00
Added e2e tests for archive/unarchive tiers (#16101)
refs TryGhost/Team#2371
This commit is contained in:
parent
f8fe009f9f
commit
a3f7188369
@ -11,6 +11,7 @@
|
||||
@triggerClass="gh-contentfilter-menu-trigger gh-contentfilter-menu-trigger-tiers"
|
||||
@dropdownClass="gh-contentfilter-menu-dropdown"
|
||||
@matchTriggerWidth={{false}}
|
||||
data-test-select-tiers-list
|
||||
as |type|
|
||||
>
|
||||
{{#if type.name}}{{type.name}}{{else}}<span class="red">Unknown type</span>{{/if}}
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
<div class="modal-content" {{on-key "Enter" (perform this.archiveTierTask)}}>
|
||||
<div class="modal-content" data-test-modal="archive-tier" {{on-key "Enter" (perform this.archiveTierTask)}}>
|
||||
<header class="modal-header">
|
||||
<h1>Archive tier</h1>
|
||||
</header>
|
||||
@ -21,6 +21,7 @@
|
||||
@successText="Archived"
|
||||
@task={{this.archiveTierTask}}
|
||||
@class="gh-btn gh-btn-black gh-btn-icon"
|
||||
data-test-button="archive-tier"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
<div class="modal-content" {{on-key "Enter" (perform this.unarchiveTask)}}>
|
||||
<div class="modal-content" data-test-modal="unarchive-tier" {{on-key "Enter" (perform this.unarchiveTask)}}>
|
||||
<header class="modal-header">
|
||||
<h1>Reactivate tier</h1>
|
||||
</header>
|
||||
@ -20,6 +20,7 @@
|
||||
@buttonText="Reactivate"
|
||||
@task={{this.unarchiveTask}}
|
||||
@class="gh-btn gh-btn-black gh-btn-icon"
|
||||
data-test-button="unarchive-tier"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -2,6 +2,7 @@
|
||||
{{#unless this.tier.isNew}}
|
||||
<button
|
||||
type="button"
|
||||
data-test-button="archive-tier"
|
||||
{{on "click" this.handleArchiveTier}}
|
||||
>
|
||||
<span>Archive</span>
|
||||
@ -10,6 +11,7 @@
|
||||
{{else}}
|
||||
<button
|
||||
type="button"
|
||||
data-test-button="unarchive-tier"
|
||||
{{on "click" this.handleUnarchiveTier}}
|
||||
>
|
||||
<span>Reactivate</span>
|
||||
|
@ -58,12 +58,11 @@ test.describe('Admin', () => {
|
||||
const updatedMonthlyPrice = '66';
|
||||
const updatedYearlyPrice = '666';
|
||||
const updatedDescription = 'Updated description text';
|
||||
const enableInPortal = true;
|
||||
await createTier(page, {
|
||||
name: tierName,
|
||||
monthlyPrice: 5,
|
||||
yearlyPrice: 50
|
||||
}, enableInPortal);
|
||||
});
|
||||
|
||||
await test.step('Open Membership settings', async () => {
|
||||
await page.locator('[data-test-nav="settings"]').click();
|
||||
@ -119,5 +118,74 @@ test.describe('Admin', () => {
|
||||
await expect(portalTierCard.locator('.amount').first()).toHaveText(updatedMonthlyPrice);
|
||||
});
|
||||
});
|
||||
|
||||
test('Can archive and unarchive a Tier', async ({page}) => {
|
||||
await page.goto('/ghost');
|
||||
const tierName = getUniqueName('Archive Tier');
|
||||
const tierId = getSlug(tierName);
|
||||
await createTier(page, {
|
||||
name: tierName,
|
||||
monthlyPrice: 5,
|
||||
yearlyPrice: 50
|
||||
});
|
||||
|
||||
await test.step('Open Membership settings', async () => {
|
||||
await page.locator('[data-test-nav="settings"]').click();
|
||||
await page.locator('[data-test-nav="members-membership"]').click();
|
||||
// Tiers request can take time, so waiting until there is no connections before interacting with them
|
||||
await page.waitForLoadState('networkidle');
|
||||
});
|
||||
|
||||
const tierCard = await test.step('Expand the premium tier list and find the new tier', async () => {
|
||||
await page.locator('[data-test-toggle-pub-info]').click();
|
||||
await page.waitForSelector(`[data-test-tier-card="${tierId}"]`);
|
||||
|
||||
return await page.locator(`[data-test-tier-card="${tierId}"]`);
|
||||
});
|
||||
|
||||
await test.step('Archive tier', async () => {
|
||||
await tierCard.locator('[data-test-button="tiers-actions"]').click();
|
||||
await tierCard.locator('[data-test-button="archive-tier"]').click();
|
||||
const modal = page.locator('[data-test-modal="archive-tier"]');
|
||||
await modal.locator('[data-test-button="archive-tier"]').click();
|
||||
});
|
||||
|
||||
await test.step('Archived tier should not be available in active tiers', async () => {
|
||||
await expect(page.locator(`[data-test-tier-card="${tierId}"]`)).toBeHidden();
|
||||
});
|
||||
|
||||
await test.step('Archived tier should be available in archived tiers', async () => {
|
||||
const tiersSelect = await page.locator('[data-test-select-tiers-list]');
|
||||
await tiersSelect.click();
|
||||
await page.getByRole('option', {name: 'Archived'}).click();
|
||||
await expect(page.locator(`[data-test-tier-card="${tierId}"]`)).toBeVisible();
|
||||
});
|
||||
|
||||
await test.step('Archived tier should not be available in portal settings', async () => {
|
||||
await expect(page.locator(`[data-test-settings-tier-label="${tierName}"]`)).toBeHidden();
|
||||
});
|
||||
|
||||
await test.step('Unarchive tier', async () => {
|
||||
await tierCard.locator('[data-test-button="tiers-actions"]').click();
|
||||
await tierCard.locator('[data-test-button="unarchive-tier"]').click();
|
||||
const modal = page.locator('[data-test-modal="unarchive-tier"]');
|
||||
await modal.locator('[data-test-button="unarchive-tier"]').click();
|
||||
});
|
||||
|
||||
await test.step('Unarchived tier should be available in active tiers', async () => {
|
||||
await expect(page.locator(`[data-test-tier-card="${tierId}"]`)).toBeVisible();
|
||||
});
|
||||
|
||||
await test.step('Open Portal settings', async () => {
|
||||
await page.locator('[data-test-toggle="portal-settings"]').click();
|
||||
// Wait until the list of tiers available at signup is visible
|
||||
await page.waitForSelector('[data-test-tiers-at-signup]');
|
||||
});
|
||||
|
||||
await test.step('Unarchived tier should be available in portal settings', async () => {
|
||||
await page.locator(`[data-test-settings-tier-label="${tierName}"]`);
|
||||
expect(await page.locator(`[data-test-settings-tier-input="${tierName}"]`).isChecked()).toBeFalsy();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user