mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add new home page cards
Summary: New cards on the home page link to useful resources like the welcome video, tutorial, webinars, and the Help Center. They are shown by default to new and exisiting users, and may be hidden via a toggle. Test Plan: Browser tests. Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D4340
This commit is contained in:
@@ -2301,15 +2301,6 @@ describe('ApiServer', function() {
|
||||
assert.deepEqual(resp.data[0].docs.map((doc: any) => doc.name), ['Lightweight CRM']);
|
||||
assert.deepEqual(resp.data[1].docs.map((doc: any) => doc.name), ['Expense Report', 'Timesheet']);
|
||||
|
||||
// Make a request to retrieve only the featured (pinned) templates.
|
||||
const resp2 = await axios.get(`${homeUrl}/api/templates/?onlyFeatured=1`, nobody);
|
||||
// Assert that the response includes only pinned documents.
|
||||
assert.equal(resp2.status, 200);
|
||||
assert.lengthOf(resp2.data, 2);
|
||||
assert.deepEqual(resp.data.map((ws: any) => ws.name), ['CRM', 'Invoice']);
|
||||
assert.deepEqual(resp2.data[0].docs.map((doc: any) => doc.name), ['Lightweight CRM']);
|
||||
assert.deepEqual(resp2.data[1].docs, []);
|
||||
|
||||
// Add a new document to the CRM workspace, but don't share it with everyone.
|
||||
await axios.post(`${homeUrl}/api/workspaces/${crmWsId}/docs`,
|
||||
{name: 'Draft CRM Template', isPinned: true}, support);
|
||||
|
||||
@@ -148,15 +148,14 @@ describe('BehavioralPrompts', function() {
|
||||
describe('for the Add New button', function() {
|
||||
it('should not be shown if site is empty', async function() {
|
||||
session = await gu.session().user('user4').login({showTips: true});
|
||||
await gu.dismissCoachingCall();
|
||||
await driver.navigate().refresh();
|
||||
await gu.loadDocMenu('/');
|
||||
await session.loadDocMenu('/');
|
||||
await assertPromptTitle(null);
|
||||
});
|
||||
|
||||
it('should be shown if site has documents', async function() {
|
||||
await session.tempNewDoc(cleanup, 'BehavioralPromptsAddNew');
|
||||
await session.loadDocMenu('/');
|
||||
await driver.find('.test-bc-workspace').click();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
await assertPromptTitle('Add New');
|
||||
});
|
||||
|
||||
@@ -166,16 +165,31 @@ describe('BehavioralPrompts', function() {
|
||||
await assertPromptTitle(null);
|
||||
});
|
||||
|
||||
it('should only be shown once each visit to the doc menu', async function() {
|
||||
// Navigate to another page without reloading; the tip should now be shown.
|
||||
await driver.find('.test-dm-all-docs').click();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
it('should only be shown on the All Documents page if intro is hidden', async function() {
|
||||
await session.loadDocMenu('/');
|
||||
await assertPromptTitle(null);
|
||||
await driver.find('.test-welcome-menu').click();
|
||||
await driver.find('.test-welcome-menu-only-show-documents').click();
|
||||
await gu.waitForServer();
|
||||
await assertPromptTitle(null);
|
||||
await gu.loadDocMenu('/');
|
||||
await assertPromptTitle('Add New');
|
||||
});
|
||||
|
||||
it('should only be shown once on each visit', async function() {
|
||||
// Navigate to the home page for the first time; the tip should be shown.
|
||||
await gu.loadDocMenu('/');
|
||||
await assertPromptTitle('Add New');
|
||||
|
||||
// Navigate to another page; the tip should no longer be shown.
|
||||
// Switch to a different page; the tip should no longer be shown.
|
||||
await driver.findContent('.test-dm-workspace', /Home/).click();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
await assertPromptTitle(null);
|
||||
|
||||
// Reload the page; the tip should be shown again.
|
||||
await driver.navigate().refresh();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
await assertPromptTitle('Add New');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -49,16 +49,8 @@ describe('DocTutorial', function () {
|
||||
|
||||
it('shows a tutorial card', async function() {
|
||||
await viewerSession.loadDocMenu('/');
|
||||
assert.isTrue(await driver.find('.test-onboarding-tutorial-card').isDisplayed());
|
||||
assert.equal(await driver.find('.test-onboarding-tutorial-percent-complete').getText(), '0%');
|
||||
});
|
||||
|
||||
it('can dismiss tutorial card', async function() {
|
||||
await driver.find('.test-onboarding-dismiss-cards').click();
|
||||
assert.isFalse(await driver.find('.test-onboarding-tutorial-card').isPresent());
|
||||
await driver.navigate().refresh();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
assert.isFalse(await driver.find('.test-onboarding-tutorial-card').isPresent());
|
||||
assert.isTrue(await driver.find('.test-intro-tutorial').isDisplayed());
|
||||
assert.equal(await driver.find('.test-intro-tutorial-percent-complete').getText(), '0%');
|
||||
});
|
||||
|
||||
it('shows a link to tutorial', async function() {
|
||||
@@ -84,9 +76,9 @@ describe('DocTutorial', function () {
|
||||
afterEach(() => gu.checkForErrors());
|
||||
|
||||
it('shows a tutorial card', async function() {
|
||||
assert.isTrue(await driver.find('.test-onboarding-tutorial-card').isDisplayed());
|
||||
assert.isTrue(await driver.find('.test-intro-tutorial').isDisplayed());
|
||||
await gu.waitToPass(async () =>
|
||||
assert.equal(await driver.find('.test-onboarding-tutorial-percent-complete').getText(), '0%'),
|
||||
assert.equal(await driver.find('.test-intro-tutorial-percent-complete').getText(), '0%'),
|
||||
2000
|
||||
);
|
||||
});
|
||||
@@ -454,7 +446,7 @@ describe('DocTutorial', function () {
|
||||
await gu.waitForServer();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
await gu.waitToPass(async () =>
|
||||
assert.equal(await driver.find('.test-onboarding-tutorial-percent-complete').getText(), '15%'),
|
||||
assert.equal(await driver.find('.test-intro-tutorial-percent-complete').getText(), '15%'),
|
||||
2000
|
||||
);
|
||||
await driver.find('.test-dm-basic-tutorial').click();
|
||||
@@ -567,12 +559,12 @@ describe('DocTutorial', function () {
|
||||
await gu.waitForDocMenuToLoad();
|
||||
assert.match(await driver.getCurrentUrl(), /o\/docs\/$/);
|
||||
await gu.waitToPass(async () =>
|
||||
assert.equal(await driver.find('.test-onboarding-tutorial-percent-complete').getText(), '0%'),
|
||||
assert.equal(await driver.find('.test-intro-tutorial-percent-complete').getText(), '0%'),
|
||||
2000
|
||||
);
|
||||
await ownerSession.loadDocMenu('/');
|
||||
await gu.waitToPass(async () =>
|
||||
assert.equal(await driver.find('.test-onboarding-tutorial-percent-complete').getText(), '100%'),
|
||||
assert.equal(await driver.find('.test-intro-tutorial-percent-complete').getText(), '100%'),
|
||||
2000
|
||||
);
|
||||
});
|
||||
|
||||
@@ -22,24 +22,12 @@ describe('HomeIntro', function() {
|
||||
|
||||
// Check message specific to anon
|
||||
assert.equal(await driver.find('.test-welcome-title').getText(), 'Welcome to Grist!');
|
||||
assert.match(await driver.find('.test-welcome-text').getText(), /Sign up.*Visit our Help Center/);
|
||||
|
||||
// Check the sign-up link.
|
||||
const signUp = await driver.findContent('.test-welcome-text a', 'Sign up');
|
||||
assert.include(await signUp.getAttribute('href'), '/signin');
|
||||
|
||||
// Check that the link takes us to a Grist login page.
|
||||
await signUp.click();
|
||||
await gu.checkLoginPage();
|
||||
await driver.navigate().back();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
});
|
||||
|
||||
it('should should intro screen for anon', () => testIntroScreen({team: false}));
|
||||
it('should should intro screen for anon', () => testIntroScreen({anon: true, team: false}));
|
||||
it('should not show Other Sites section', testOtherSitesSection);
|
||||
it('should allow create/import from intro screen', testCreateImport.bind(null, false));
|
||||
it('should allow collapsing examples and remember the state', testExamplesCollapsing);
|
||||
it('should show examples workspace with the intro', testExamplesSection);
|
||||
it('should link to examples page from the intro', testExamplesPage);
|
||||
it('should render selected Examples workspace specially', testSelectedExamplesPage);
|
||||
});
|
||||
|
||||
@@ -61,15 +49,12 @@ describe('HomeIntro', function() {
|
||||
|
||||
// Check message specific to logged-in user
|
||||
assert.match(await driver.find('.test-welcome-title').getText(), new RegExp(`Welcome.* ${session.name}`));
|
||||
assert.match(await driver.find('.test-welcome-text').getText(), /Visit our Help Center/);
|
||||
assert.notMatch(await driver.find('.test-welcome-text').getText(), /sign up/i);
|
||||
});
|
||||
|
||||
it('should not show Other Sites section', testOtherSitesSection);
|
||||
it('should show intro screen for empty org', () => testIntroScreen({team: false}));
|
||||
it('should show intro screen for empty org', () => testIntroScreen({anon: false, team: false}));
|
||||
it('should allow create/import from intro screen', testCreateImport.bind(null, true));
|
||||
it('should allow collapsing examples and remember the state', testExamplesCollapsing);
|
||||
it('should show examples workspace with the intro', testExamplesSection);
|
||||
it('should link to examples page from the intro', testExamplesPage);
|
||||
it('should allow copying examples', testCopyingExamples.bind(null, undefined));
|
||||
it('should render selected Examples workspace specially', testSelectedExamplesPage);
|
||||
it('should show empty workspace info', testEmptyWorkspace.bind(null, {buttons: true}));
|
||||
@@ -87,14 +72,12 @@ describe('HomeIntro', function() {
|
||||
|
||||
// Check message specific to logged-in user and an empty team site.
|
||||
assert.match(await driver.find('.test-welcome-title').getText(), new RegExp(`Welcome.* ${session.orgName}`));
|
||||
assert.match(await driver.find('.test-welcome-text').getText(), /Learn more/);
|
||||
assert.notMatch(await driver.find('.test-welcome-text').getText(), /sign up/);
|
||||
});
|
||||
|
||||
it('should not show Other Sites section', testOtherSitesSection);
|
||||
it('should show intro screen for empty org', () => testIntroScreen({team: true}));
|
||||
it('should show intro screen for empty org', () => testIntroScreen({anon: false, team: true}));
|
||||
it('should allow create/import from intro screen', testCreateImport.bind(null, true));
|
||||
it('should show examples workspace with the intro', testExamplesSection);
|
||||
it('should link to examples page from the intro', testExamplesPage);
|
||||
it('should allow copying examples', testCopyingExamples.bind(null, gu.session().teamSite.orgName));
|
||||
it('should render selected Examples workspace specially', testSelectedExamplesPage);
|
||||
it('should show empty workspace info', testEmptyWorkspace);
|
||||
@@ -105,22 +88,41 @@ describe('HomeIntro', function() {
|
||||
assert.isFalse(await driver.find('.test-dm-other-sites-header').isPresent());
|
||||
}
|
||||
|
||||
async function testIntroScreen(options: {team: boolean}) {
|
||||
async function testIntroScreen(options: {anon: boolean; team: boolean}) {
|
||||
// TODO There is no longer a thumbnail + video link on an empty site, but it's a good place to
|
||||
// check for the presence and functionality of the planned links that open an intro video.
|
||||
|
||||
// Check link to Help Center
|
||||
assert.include(await driver.findContent('.test-welcome-text a', /Help Center/).getAttribute('href'),
|
||||
assert.isTrue(await driver.find('.test-intro-cards').isDisplayed());
|
||||
assert.isTrue(await driver.find('.test-intro-video-tour').isDisplayed());
|
||||
assert.isFalse(await driver.find('.test-intro-tutorial').isDisplayed());
|
||||
assert.isTrue(await driver.find('.test-intro-create-doc').isDisplayed());
|
||||
assert.isTrue(await driver.find('.test-intro-import-doc').isDisplayed());
|
||||
assert.isTrue(await driver.find('.test-intro-templates').isDisplayed());
|
||||
assert.include(await driver.find('.test-intro-webinars').getAttribute('href'),
|
||||
'www.getgrist.com/webinars');
|
||||
assert.include(await driver.find('.test-intro-help-center').getAttribute('href'),
|
||||
'support.getgrist.com');
|
||||
|
||||
if (options.team) {
|
||||
assert.equal(await driver.find('.test-intro-invite').getText(), 'Invite Team Members');
|
||||
assert.equal(await driver.find('.test-topbar-manage-team').getText(), 'Manage Team');
|
||||
assert.equal(await driver.find('.test-topbar-manage-team').getText(), 'Manage team');
|
||||
} else {
|
||||
assert.equal(await driver.find('.test-intro-invite').isPresent(), false);
|
||||
assert.equal(await driver.find('.test-topbar-manage-team').isPresent(), false);
|
||||
assert.equal(await driver.find('.test-intro-templates').getText(), 'Browse Templates');
|
||||
assert.include(await driver.find('.test-intro-templates').getAttribute('href'), '/p/templates');
|
||||
}
|
||||
|
||||
if (options.anon) {
|
||||
assert.isFalse(await driver.find('.test-welcome-menu').isPresent());
|
||||
} else {
|
||||
await driver.find('.test-welcome-menu').click();
|
||||
await driver.find('.test-welcome-menu-only-show-documents').click();
|
||||
await gu.waitForServer();
|
||||
assert.isFalse(await driver.find('.test-intro-cards').isPresent());
|
||||
await driver.navigate().refresh();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
assert.isFalse(await driver.find('.test-intro-cards').isPresent());
|
||||
await driver.find('.test-welcome-menu').click();
|
||||
await driver.find('.test-welcome-menu-only-show-documents').click();
|
||||
await gu.waitForServer();
|
||||
assert.isTrue(await driver.find('.test-intro-cards').isDisplayed());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,49 +161,16 @@ describe('HomeIntro', function() {
|
||||
assert.isAbove(Number(await img.getAttribute('naturalWidth')), 0);
|
||||
});
|
||||
|
||||
|
||||
|
||||
async function testExamplesCollapsing() {
|
||||
assert.equal(await driver.find('.test-dm-pinned-doc-name').isDisplayed(), true);
|
||||
|
||||
// Collapse the templates section, check it's collapsed
|
||||
await driver.find('.test-dm-all-docs-templates-header').click();
|
||||
assert.equal(await driver.find('.test-dm-pinned-doc-name').isPresent(), false);
|
||||
|
||||
// Reload and check it's still collapsed.
|
||||
await driver.navigate().refresh();
|
||||
async function testExamplesPage() {
|
||||
// Make sure we can get to the templates page from the home page.
|
||||
await driver.find('.test-intro-templates').click();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
assert.equal(await driver.find('.test-dm-pinned-doc-name').isPresent(), false);
|
||||
|
||||
// Expand back, and check.
|
||||
await driver.find('.test-dm-all-docs-templates-header').click();
|
||||
assert.equal(await driver.find('.test-dm-pinned-doc-name').isDisplayed(), true);
|
||||
|
||||
// Reload and check it's still expanded.
|
||||
await driver.navigate().refresh();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
assert.equal(await driver.find('.test-dm-pinned-doc-name').isDisplayed(), true);
|
||||
}
|
||||
|
||||
async function testExamplesSection() {
|
||||
// Check rendering and functionality of the examples and templates section
|
||||
assert(gu.testCurrentUrl(/p\/templates/));
|
||||
|
||||
// Check titles.
|
||||
assert.includeMembers(await driver.findAll('.test-dm-pinned-doc-name', (el) => el.getText()),
|
||||
['Lightweight CRM']);
|
||||
|
||||
// Check the Discover More Templates button is shown.
|
||||
const discoverMoreButton = await driver.find('.test-dm-all-docs-templates-discover-more');
|
||||
assert(await discoverMoreButton.isPresent());
|
||||
assert.include(await discoverMoreButton.getAttribute('href'), '/p/templates');
|
||||
|
||||
// Check that the button takes us to the templates page, then go back.
|
||||
await discoverMoreButton.click();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
assert(gu.testCurrentUrl(/p\/templates/));
|
||||
await driver.navigate().back();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
|
||||
// Check images.
|
||||
const docItem = await driver.findContent('.test-dm-pinned-doc', /Lightweight CRM/);
|
||||
assert.equal(await docItem.find('img').isPresent(), true);
|
||||
@@ -223,8 +192,9 @@ describe('HomeIntro', function() {
|
||||
}
|
||||
|
||||
async function testCopyingExamples(destination?: string) {
|
||||
// Open the example to copy it. Note that we no longer support copying examples from doc menu.
|
||||
// Make full copy of the example.
|
||||
// Open the example and make a full copy of it.
|
||||
await driver.find('.test-dm-templates-page').click();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
await driver.findContent('.test-dm-pinned-doc-name', /Lightweight CRM/).click();
|
||||
await gu.waitForDocToLoad();
|
||||
await driver.findWait('.test-tb-share-action', 500).click();
|
||||
@@ -232,9 +202,11 @@ describe('HomeIntro', function() {
|
||||
await checkDocAndRestore(true, async () => {
|
||||
assert.match(await gu.getCell('Company', 1).getText(), /Sporer/);
|
||||
assert.match(await driver.find('.test-bc-doc').value(), /LCRM Copy/);
|
||||
}, 2);
|
||||
}, 3);
|
||||
|
||||
// Make a template copy of the example.
|
||||
await driver.find('.test-dm-templates-page').click();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
await driver.findContent('.test-dm-pinned-doc-name', /Lightweight CRM/).click();
|
||||
await gu.waitForDocToLoad();
|
||||
await driver.findWait('.test-tb-share-action', 500).click();
|
||||
@@ -244,7 +216,7 @@ describe('HomeIntro', function() {
|
||||
// No data, because the file was copied as a template.
|
||||
assert.equal(await gu.getCell(0, 1).getText(), '');
|
||||
assert.match(await driver.find('.test-bc-doc').value(), /LCRM Template Copy/);
|
||||
}, 2);
|
||||
}, 3);
|
||||
}
|
||||
|
||||
async function testSelectedExamplesPage() {
|
||||
@@ -328,8 +300,6 @@ async function checkDocAndRestore(
|
||||
await gu.waitForDocMenuToLoad();
|
||||
// If not logged in, we create docs "unsaved" and don't see them in doc-menu.
|
||||
if (isLoggedIn) {
|
||||
// Freshly-created users will see a tip for the Add New button; dismiss it.
|
||||
await gu.dismissBehavioralPrompts();
|
||||
// Delete the first doc we find. We expect exactly one to exist.
|
||||
await deleteFirstDoc();
|
||||
}
|
||||
|
||||
@@ -3,50 +3,29 @@ import * as gu from 'test/nbrowser/gristUtils';
|
||||
import {setupTestSuite} from 'test/nbrowser/testUtils';
|
||||
|
||||
describe('HomeIntroWithoutPlayground', function() {
|
||||
this.timeout(40000);
|
||||
this.timeout(20000);
|
||||
setupTestSuite({samples: true});
|
||||
gu.withEnvironmentSnapshot({'GRIST_ANON_PLAYGROUND': false});
|
||||
|
||||
describe("Anonymous on merged-org", function() {
|
||||
it('should show welcome page with signin and signup buttons and "add new" button disabled', async function () {
|
||||
// Sign out
|
||||
it('should show welcome page', async function () {
|
||||
const session = await gu.session().personalSite.anon.login();
|
||||
|
||||
// Open doc-menu
|
||||
await session.loadDocMenu('/');
|
||||
|
||||
assert.equal(await driver.find('.test-welcome-title').getText(), 'Welcome to Grist!');
|
||||
assert.match(
|
||||
await driver.find('.test-welcome-text-no-playground').getText(),
|
||||
/Visit our Help Center.*about Grist./
|
||||
);
|
||||
|
||||
// Check the sign-up and sign-in buttons.
|
||||
const getSignUp = async () => await driver.findContent('.test-intro-sign-up', 'Sign up');
|
||||
const getSignIn = async () => await driver.findContent('.test-intro-sign-in', 'Sign in');
|
||||
// Check that these buttons take us to a Grist login page.
|
||||
for (const getButton of [getSignUp, getSignIn]) {
|
||||
const button = await getButton();
|
||||
await button.click();
|
||||
await gu.checkLoginPage();
|
||||
await driver.navigate().back();
|
||||
await gu.waitForDocMenuToLoad();
|
||||
}
|
||||
});
|
||||
|
||||
it('should not allow creating new documents', async function () {
|
||||
// Sign out
|
||||
const session = await gu.session().personalSite.anon.login();
|
||||
|
||||
// Open doc-menu
|
||||
await session.loadDocMenu('/');
|
||||
|
||||
// Check that add-new button is disabled
|
||||
// Check that the Add New button is disabled.
|
||||
assert.equal(await driver.find('.test-dm-add-new').matches('[class*=-disabled]'), true);
|
||||
|
||||
// Check that add-new menu is not displayed
|
||||
await driver.find('.test-dm-add-new').doClick();
|
||||
assert.equal(await driver.find('.test-dm-new-doc').isPresent(), false);
|
||||
|
||||
// Check that the intro buttons are also disabled.
|
||||
assert.equal(await driver.find('.test-intro-create-doc').getAttribute('disabled'), 'true');
|
||||
assert.equal(await driver.find('.test-intro-import-doc').getAttribute('disabled'), 'true');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ async function openMainPage() {
|
||||
await driver.get(`${server.getHost()}`);
|
||||
while (true) { // eslint-disable-line no-constant-condition
|
||||
try {
|
||||
if (await driver.findContent('button', /Create Empty Document/).isPresent()) {
|
||||
if (await driver.find('.test-intro-create-doc').isPresent()) {
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -31,7 +31,7 @@ describe("Smoke", function() {
|
||||
it('can create, edit, and reopen a document', async function() {
|
||||
this.timeout(20000);
|
||||
await openMainPage();
|
||||
await driver.findContent('button', /Create Empty Document/).click();
|
||||
await driver.find('.test-intro-create-doc').click();
|
||||
await gu.waitForDocToLoad(20000);
|
||||
await gu.dismissWelcomeTourIfNeeded();
|
||||
await gu.getCell('A', 1).click();
|
||||
|
||||
@@ -38,8 +38,7 @@ describe('SupportGrist', function() {
|
||||
await session.loadDocMenu('/');
|
||||
});
|
||||
|
||||
it('does not show a nudge on the doc menu', async function() {
|
||||
await assertNudgeCardShown(false);
|
||||
it('shows a button in the top bar', async function() {
|
||||
await assertSupportButtonShown(true, {isSponsorLink: true});
|
||||
});
|
||||
|
||||
@@ -56,34 +55,15 @@ describe('SupportGrist', function() {
|
||||
await session.loadDocMenu('/');
|
||||
});
|
||||
|
||||
it('shows a nudge on the doc menu', async function() {
|
||||
// Check that the nudge is expanded by default.
|
||||
await assertSupportButtonShown(false);
|
||||
await assertNudgeCardShown(true);
|
||||
|
||||
// Reload the doc menu and check that it's still expanded.
|
||||
await session.loadDocMenu('/');
|
||||
await assertSupportButtonShown(false);
|
||||
await assertNudgeCardShown(true);
|
||||
|
||||
// Close the nudge and check that it's now collapsed.
|
||||
await driver.find('.test-support-nudge-close').click();
|
||||
it('shows a button in the top bar', async function() {
|
||||
await assertSupportButtonShown(true, {isSponsorLink: false});
|
||||
await assertNudgeCardShown(false);
|
||||
|
||||
// Reload again, and check that it's still collapsed.
|
||||
await session.loadDocMenu('/');
|
||||
await assertSupportButtonShown(true, {isSponsorLink: false});
|
||||
await assertNudgeCardShown(false);
|
||||
|
||||
// Dismiss the contribute button and check that it's now gone, even after reloading.
|
||||
// Dismiss the button and check that it's now gone, even after reloading.
|
||||
await driver.find('.test-support-grist-button').mouseMove();
|
||||
await driver.find('.test-support-grist-button-dismiss').click();
|
||||
await assertSupportButtonShown(false);
|
||||
await assertNudgeCardShown(false);
|
||||
await session.loadDocMenu('/');
|
||||
await assertSupportButtonShown(false);
|
||||
await assertNudgeCardShown(false);
|
||||
});
|
||||
|
||||
it('shows a link to Admin Panel and Support Grist in the user menu', async function() {
|
||||
@@ -92,35 +72,30 @@ describe('SupportGrist', function() {
|
||||
await assertMenuHasSupportGrist(true);
|
||||
});
|
||||
|
||||
it('supports opting in to telemetry from the nudge', async function() {
|
||||
// Reset all dismissed popups, including the telemetry nudge.
|
||||
it('supports opting in to telemetry', async function() {
|
||||
// Reset all dismissed popups, which includes the telemetry button.
|
||||
await driver.executeScript('resetDismissedPopups();');
|
||||
await gu.waitForServer();
|
||||
await session.loadDocMenu('/');
|
||||
|
||||
// Opt in to telemetry and reload the page.
|
||||
await driver.find('.test-support-grist-button').click();
|
||||
await driver.find('.test-support-nudge-opt-in').click();
|
||||
await driver.findWait('.test-support-nudge-close-button', 1000).click();
|
||||
await assertSupportButtonShown(false);
|
||||
await assertNudgeCardShown(false);
|
||||
await session.loadDocMenu('/');
|
||||
|
||||
// Check that the nudge is no longer shown and telemetry is set to "limited".
|
||||
// Check that the button is no longer shown and telemetry is set to "limited".
|
||||
await assertSupportButtonShown(false);
|
||||
await assertNudgeCardShown(false);
|
||||
await assertTelemetryLevel('limited');
|
||||
});
|
||||
|
||||
it('does not show the nudge if telemetry is enabled', async function() {
|
||||
// Reset all dismissed popups, including the telemetry nudge.
|
||||
it('does not show the button if telemetry is enabled', async function() {
|
||||
await driver.executeScript('resetDismissedPopups();');
|
||||
await gu.waitForServer();
|
||||
|
||||
// Reload the doc menu and check that the nudge still isn't shown.
|
||||
// Reload the doc menu and check that We show the "Support Grist" button linking to sponsorship page.
|
||||
await session.loadDocMenu('/');
|
||||
await assertNudgeCardShown(false);
|
||||
|
||||
// We still show the "Support Grist" button linking to sponsorship page.
|
||||
await assertSupportButtonShown(true, {isSponsorLink: true});
|
||||
|
||||
// Disable telemetry from the Support Grist page.
|
||||
@@ -133,10 +108,9 @@ describe('SupportGrist', function() {
|
||||
'.test-support-grist-page-telemetry-section button', /Opt out of Telemetry/, 2000).click();
|
||||
await driver.findContentWait('.test-support-grist-page-telemetry-section button', /Opt in to Telemetry/, 2000);
|
||||
|
||||
// Reload the doc menu and check that the nudge is now shown.
|
||||
// Reload the doc menu and check that the button is now shown.
|
||||
await gu.loadDocMenu('/');
|
||||
await assertSupportButtonShown(false);
|
||||
await assertNudgeCardShown(true);
|
||||
await assertSupportButtonShown(true, {isSponsorLink: false});
|
||||
});
|
||||
|
||||
it('shows sponsorship link when no telemetry nudge, and allows dismissing it', async function() {
|
||||
@@ -156,16 +130,14 @@ describe('SupportGrist', function() {
|
||||
|
||||
// We still show the "Support Grist" button linking to sponsorship page.
|
||||
await assertSupportButtonShown(true, {isSponsorLink: true});
|
||||
await assertNudgeCardShown(false);
|
||||
|
||||
// we can dismiss it.
|
||||
// We can dismiss it.
|
||||
await driver.find('.test-support-grist-button').mouseMove();
|
||||
await driver.find('.test-support-grist-button-dismiss').click();
|
||||
await assertSupportButtonShown(false);
|
||||
|
||||
// And this will get remembered.
|
||||
await session.loadDocMenu('/');
|
||||
await assertNudgeCardShown(false);
|
||||
await assertSupportButtonShown(false);
|
||||
});
|
||||
});
|
||||
@@ -185,9 +157,8 @@ describe('SupportGrist', function() {
|
||||
oldEnv.restore();
|
||||
});
|
||||
|
||||
it('does not show a nudge on the doc menu', async function() {
|
||||
it('does not show a button in the top bar', async function() {
|
||||
await assertSupportButtonShown(false);
|
||||
await assertNudgeCardShown(false);
|
||||
});
|
||||
|
||||
it('shows Admin Panel but not Support Grist in the user menu for admin', async function() {
|
||||
@@ -219,9 +190,8 @@ describe('SupportGrist', function() {
|
||||
oldEnv.restore();
|
||||
});
|
||||
|
||||
it('does not show a nudge on the doc menu', async function() {
|
||||
it('does not show a button in the top bar', async function() {
|
||||
await assertSupportButtonShown(false);
|
||||
await assertNudgeCardShown(false);
|
||||
});
|
||||
|
||||
it('shows Admin Panel but not Support Grist page in the user menu', async function() {
|
||||
@@ -242,11 +212,6 @@ async function assertSupportButtonShown(isShown: boolean, opts?: {isSponsorLink:
|
||||
}
|
||||
}
|
||||
|
||||
async function assertNudgeCardShown(isShown: boolean) {
|
||||
const card = driver.find('.test-support-nudge');
|
||||
assert.equal(await card.isPresent() && await card.isDisplayed(), isShown);
|
||||
}
|
||||
|
||||
async function assertMenuHasAdminPanel(isShown: boolean) {
|
||||
const elem = driver.find('.test-usermenu-admin-panel');
|
||||
assert.equal(await elem.isPresent() && await elem.isDisplayed(), isShown);
|
||||
|
||||
Reference in New Issue
Block a user