mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
🐛 Removed free trial message shown on portal for invite only sites
closes https://github.com/TryGhost/Team/issues/2361 If a free trial tier existed on site and its set to 'Invite only' in membership settings, the free trial copy still showed on portal. - removes free trial copy from portal if site is invite only - adds playwright test to make sure free trial copy is not shown for invite only sites
This commit is contained in:
parent
017f3e1257
commit
f5aa07a095
4 changed files with 20 additions and 6 deletions
|
@ -122,7 +122,7 @@
|
|||
name="free-trial"
|
||||
{{on "click" this.setFreeTrialEnabled}}
|
||||
/>
|
||||
<span class="input-toggle-component"></span>
|
||||
<span class="input-toggle-component" data-test-toggle="free-trial"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const {expect, test} = require('@playwright/test');
|
||||
const {createPostDraft} = require('../utils');
|
||||
const {createPostDraft, createTier} = require('../utils');
|
||||
|
||||
const changeSubscriptionAccess = async (page, access) => {
|
||||
// Go to settings page
|
||||
|
@ -34,6 +34,12 @@ test.describe('Site Settings', () => {
|
|||
test.describe('Subscription Access', () => {
|
||||
test('Invite only', async ({page}) => {
|
||||
await page.goto('/ghost');
|
||||
await createTier(page, {
|
||||
name: 'Free tier trial',
|
||||
monthlyPrice: 100,
|
||||
yearlyPrice: 1000,
|
||||
trialDays: 5
|
||||
}, true);
|
||||
|
||||
await changeSubscriptionAccess(page, 'invite');
|
||||
|
||||
|
@ -45,6 +51,9 @@ test.describe('Site Settings', () => {
|
|||
// 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.');
|
||||
|
||||
// Check free trial message is not shown for invite only
|
||||
await expect(portalFrame.locator('.gh-portal-free-trial-notification')).not.toBeVisible();
|
||||
|
||||
// Check portal script loaded (just a negative test for the following test to test the test)
|
||||
await checkPortalScriptLoaded(page, true);
|
||||
});
|
||||
|
|
|
@ -175,8 +175,9 @@ const impersonateMember = async (page) => {
|
|||
* @param {string} tier.name
|
||||
* @param {number} tier.monthlyPrice
|
||||
* @param {number} tier.yearlyPrice
|
||||
* @param {number} [tier.trialDays]
|
||||
*/
|
||||
const createTier = async (page, {name, monthlyPrice, yearlyPrice}, enableInPortal = true) => {
|
||||
const createTier = async (page, {name, monthlyPrice, yearlyPrice, trialDays}, enableInPortal = true) => {
|
||||
// Navigate to the member settings
|
||||
await page.locator('.gh-nav a[href="#/settings/"]').click();
|
||||
await page.locator('.gh-setting-group').filter({hasText: 'Membership'}).click();
|
||||
|
@ -201,6 +202,10 @@ const createTier = async (page, {name, monthlyPrice, yearlyPrice}, enableInPorta
|
|||
await modal.locator('input#name').first().fill(name);
|
||||
await modal.locator('#monthlyPrice').fill(`${monthlyPrice}`);
|
||||
await modal.locator('#yearlyPrice').fill(`${yearlyPrice}`);
|
||||
if (trialDays) {
|
||||
await modal.locator('[data-test-toggle="free-trial"]').click();
|
||||
await modal.locator('#trial').fill(`${trialDays}`);
|
||||
}
|
||||
await modal.getByRole('button', {name: 'Add tier'}).click();
|
||||
await page.waitForSelector('.modal-content input#name', {state: 'detached'});
|
||||
|
||||
|
|
|
@ -457,7 +457,7 @@ class SignupPage extends React.Component {
|
|||
|
||||
renderFreeTrialMessage() {
|
||||
const {site} = this.context;
|
||||
if (hasFreeTrialTier({site})) {
|
||||
if (hasFreeTrialTier({site}) && !isInviteOnlySite({site})) {
|
||||
return (
|
||||
<p className='gh-portal-free-trial-notification'>After a free trial ends, you will be charged the regular price for the tier you’ve chosen. You can always cancel before then.</p>
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue