2022-12-06 15:05:58 +03:00
|
|
|
const {expect, test} = require('@playwright/test');
|
|
|
|
const {createTier, createOffer} = require('../utils');
|
|
|
|
|
2022-12-06 15:18:16 +03:00
|
|
|
test.describe('Admin', () => {
|
|
|
|
test.describe('Tiers', () => {
|
|
|
|
test('Can create a Tier and Offer', async ({page}) => {
|
|
|
|
await page.goto('/ghost');
|
|
|
|
const tierName = 'New Test Tier';
|
|
|
|
await createTier(page, {
|
|
|
|
name: tierName,
|
|
|
|
monthlyPrice: 5,
|
|
|
|
yearlyPrice: 50
|
|
|
|
});
|
|
|
|
const offerName = await createOffer(page, {
|
|
|
|
name: 'Get 5% Off!',
|
|
|
|
tierName,
|
2022-12-07 07:29:05 +03:00
|
|
|
offerType: 'discount',
|
|
|
|
amount: 5
|
2022-12-06 15:18:16 +03:00
|
|
|
});
|
2022-12-06 15:05:58 +03:00
|
|
|
|
2022-12-06 15:18:16 +03:00
|
|
|
await page.locator('.gh-nav a[href="#/offers/"]').click();
|
|
|
|
await page.locator('.gh-offers-list').waitFor({state: 'visible', timeout: 1000});
|
|
|
|
await expect(page.locator('.gh-offers-list')).toContainText(tierName);
|
|
|
|
await expect(page.locator('.gh-offers-list')).toContainText(offerName);
|
|
|
|
});
|
2022-12-06 15:05:58 +03:00
|
|
|
});
|
|
|
|
});
|