mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Tweak navbar, breadcrumbs, and sign-in buttons
Summary: The changes are intended to smooth over some sharp edges when a signed-out user is using Grist (particularly while on the templates site). Test Plan: Browser tests. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3957
This commit is contained in:
@@ -139,6 +139,12 @@ describe("DuplicateDocument", function() {
|
||||
await gu.session().teamSite2.createHomeApi().updateOrgPermissions('current', {users: {
|
||||
[session2.email]: 'owners',
|
||||
}});
|
||||
|
||||
// Reset tracking of the last visited site. We seem to need this now to get consistent
|
||||
// behavior across Jenkins and local test runs. (May have something to do with newer
|
||||
// versions of chromedriver and headless Chrome.)
|
||||
await driver.executeScript('window.sessionStorage.clear();');
|
||||
|
||||
await session2.login();
|
||||
await session2.loadDoc(`/doc/${urlId}`);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { EnvironmentSnapshot } from 'test/server/testUtils';
|
||||
|
||||
describe('Features', function () {
|
||||
this.timeout(20000);
|
||||
setupTestSuite();
|
||||
setupTestSuite({samples: true});
|
||||
|
||||
let session: gu.Session;
|
||||
let oldEnv: EnvironmentSnapshot;
|
||||
@@ -21,6 +21,7 @@ describe('Features', function () {
|
||||
});
|
||||
|
||||
it('can be enabled with the GRIST_UI_FEATURES env variable', async function () {
|
||||
process.env.GRIST_TEMPLATE_ORG = 'templates';
|
||||
process.env.GRIST_UI_FEATURES = 'helpCenter,templates';
|
||||
await server.restart();
|
||||
await session.loadDocMenu('/');
|
||||
|
||||
@@ -89,12 +89,12 @@ describe("Fork", function() {
|
||||
for (const mode of ['anonymous', 'logged in']) {
|
||||
for (const content of ['empty', 'imported']) {
|
||||
it(`can create an ${content} unsaved document when ${mode}`, async function() {
|
||||
let name: string;
|
||||
let visitedSites: string[];
|
||||
if (mode === 'anonymous') {
|
||||
name = '@Guest';
|
||||
visitedSites = ['Grist Templates'];
|
||||
await personal.anon.login();
|
||||
} else {
|
||||
name = `@${personal.name}`;
|
||||
visitedSites = ['Test Grist', `@${personal.name}`];
|
||||
await personal.login();
|
||||
}
|
||||
const anonApi = personal.anon.createHomeApi();
|
||||
@@ -106,8 +106,10 @@ describe("Fork", function() {
|
||||
await gu.dismissWelcomeTourIfNeeded();
|
||||
// check that the tag is there
|
||||
assert.equal(await driver.find('.test-unsaved-tag').isPresent(), true);
|
||||
// check that the org name area is showing the user (not @Support).
|
||||
assert.equal(await driver.find('.test-dm-org').getText(), name);
|
||||
// check that the org name area is showing one of the last visited sites. this is
|
||||
// an imprecise check; doing an assert.equal instead is possible, but would require
|
||||
// changing this test significantly.
|
||||
assert.include(visitedSites, await driver.find('.test-dm-org').getText());
|
||||
if (content === 'imported') {
|
||||
assert.equal(await gu.getCell({rowNum: 1, col: 0}).getText(), '999');
|
||||
} else {
|
||||
@@ -331,13 +333,13 @@ describe("Fork", function() {
|
||||
// Check others without view access to trunk cannot see fork
|
||||
await team.user('user2').login();
|
||||
await driver.get(forkUrl);
|
||||
assert.equal(await driver.findWait('.test-dm-logo', 2000).isDisplayed(), true);
|
||||
assert.match(await driver.find('.test-error-header').getText(), /Access denied/);
|
||||
assert.match(await driver.findWait('.test-error-header', 2000).getText(), /Access denied/);
|
||||
assert.equal(await driver.find('.test-dm-logo').isDisplayed(), true);
|
||||
|
||||
await server.removeLogin();
|
||||
await driver.get(forkUrl);
|
||||
assert.equal(await driver.findWait('.test-dm-logo', 2000).isDisplayed(), true);
|
||||
assert.match(await driver.find('.test-error-header').getText(), /Access denied/);
|
||||
assert.match(await driver.findWait('.test-error-header', 2000).getText(), /Access denied/);
|
||||
assert.equal(await driver.find('.test-dm-logo').isDisplayed(), true);
|
||||
});
|
||||
|
||||
it('fails to create forks with inconsistent user id', async function() {
|
||||
@@ -364,8 +366,8 @@ describe("Fork", function() {
|
||||
// new doc user2 has no access granted via the doc, or
|
||||
// workspace, or org).
|
||||
await altSession.loadDoc(`/doc/new~${forkId}~${userId}`, false);
|
||||
assert.equal(await driver.findWait('.test-dm-logo', 2000).isDisplayed(), true);
|
||||
assert.match(await driver.find('.test-error-header').getText(), /Access denied/);
|
||||
assert.match(await driver.findWait('.test-error-header', 2000).getText(), /Access denied/);
|
||||
assert.equal(await driver.find('.test-dm-logo').isDisplayed(), true);
|
||||
|
||||
// Same, but as an anonymous user.
|
||||
const anonSession = await altSession.anon.login();
|
||||
@@ -375,8 +377,8 @@ describe("Fork", function() {
|
||||
|
||||
// A new doc cannot be created either (because of access mismatch).
|
||||
await altSession.loadDoc(`/doc/new~${forkId}~${userId}`, false);
|
||||
assert.equal(await driver.findWait('.test-dm-logo', 2000).isDisplayed(), true);
|
||||
assert.match(await driver.find('.test-error-header').getText(), /Access denied/);
|
||||
assert.match(await driver.findWait('.test-error-header', 2000).getText(), /Access denied/);
|
||||
assert.equal(await driver.find('.test-dm-logo').isDisplayed(), true);
|
||||
|
||||
// Now as a user who *is* allowed to create the fork.
|
||||
// But doc forks cannot be casually created this way anymore, so it still doesn't work.
|
||||
|
||||
@@ -10,6 +10,7 @@ import {server, setupTestSuite} from 'test/nbrowser/testUtils';
|
||||
describe('HomeIntro', function() {
|
||||
this.timeout(40000);
|
||||
setupTestSuite({samples: true});
|
||||
gu.withEnvironmentSnapshot({'GRIST_TEMPLATE_ORG': 'templates'});
|
||||
|
||||
describe("Anonymous on merged-org", function() {
|
||||
it('should show welcome for anonymous user', async function() {
|
||||
|
||||
@@ -116,9 +116,8 @@ export class HomeUtil {
|
||||
// When running against an external server, we log in through the Grist login page.
|
||||
await this.driver.get(this.server.getUrl(org, ""));
|
||||
if (!await this.isOnLoginPage()) {
|
||||
// Explicitly click sign-in link if necessary.
|
||||
await this.driver.findWait('.test-user-signin', 4000).click();
|
||||
await this.driver.findContentWait('.grist-floating-menu a', 'Sign in', 500).click();
|
||||
// Explicitly click Sign In button if necessary.
|
||||
await this.driver.findWait('.test-user-sign-in', 4000).click();
|
||||
}
|
||||
|
||||
// Fill the login form (either test or Grist).
|
||||
@@ -382,8 +381,7 @@ export class HomeUtil {
|
||||
await this.deleteCurrentUser();
|
||||
await this.removeLogin(org);
|
||||
await this.driver.get(this.server.getUrl(org, ""));
|
||||
await this.driver.findWait('.test-user-signin', 4000).click();
|
||||
await this.driver.findContentWait('.grist-floating-menu a', 'Sign in', 500).click();
|
||||
await this.driver.findWait('.test-user-sign-in', 4000).click();
|
||||
await this.checkLoginPage();
|
||||
// Fill the login form (either test or Grist).
|
||||
if (await this.isOnTestLoginPage()) {
|
||||
|
||||
Reference in New Issue
Block a user