(core) Fix staging test and tweak template line height

Summary:
Staging tests were using an organization named Test Grist,
while local was using one named test-grist. Both are now
named Test Grist, which should help keep things more consistent
between local and deployment test runs.

The inherited line height of template docs in icon view was
different on Windows, cutting off part of the last line of the
description. The description line height should now be fixed
to a reasonable value.

Test Plan: Manually tested CSS fix on a Windows machine.

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D2948
This commit is contained in:
George Gevoian 2021-07-28 21:24:00 -07:00
parent 24fc3a2d00
commit 37eed2d3c2
3 changed files with 26 additions and 22 deletions

View File

@ -245,6 +245,7 @@ const cssPinnedDocDesc = styled(cssPinnedDocTimestamp, `
margin: 8px 16px 16px 16px; margin: 8px 16px 16px 16px;
color: ${colors.slate}; color: ${colors.slate};
height: 48px; height: 48px;
line-height: 16px;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 3; -webkit-line-clamp: 3;

View File

@ -1213,34 +1213,36 @@ export function translateUser(userName: TestUser): {email: string, name: string}
*/ */
export class Session { export class Session {
// private constructor - access sessions via session() or Session.default // private constructor - access sessions via session() or Session.default
private constructor(public settings: { email: string, org: string, private constructor(public settings: { email: string, orgDomain: string,
name: string, workspace: string }) { orgName: string, name: string,
workspace: string }) {
} }
// Get a session configured for the personal site of a default user. // Get a session configured for the personal site of a default user.
public static get default() { public static get default() {
// Start with an empty session, then fill in the personal site (typically docs, or docs-s // Start with an empty session, then fill in the personal site (typically docs, or docs-s
// in staging), and then fill in a default user (currently gristoid+chimpy@gmail.com). // in staging), and then fill in a default user (currently gristoid+chimpy@gmail.com).
return new Session({name: '', email: '', org: '', workspace: 'Home'}).personalSite.user(); return new Session({name: '', email: '', orgDomain: '', orgName: '', workspace: 'Home'}).personalSite.user();
} }
// Return a session configured for the personal site of the current session's user. // Return a session configured for the personal site of the current session's user.
public get personalSite() { public get personalSite() {
return this.customTeamSite('docs'); const orgName = this.settings.name ? `@${this.settings.name}` : '';
return this.customTeamSite('docs', orgName);
} }
// Return a session configured for a default team site and the current session's user. // Return a session configured for a default team site and the current session's user.
public get teamSite() { public get teamSite() {
return this.customTeamSite('test-grist'); return this.customTeamSite('test-grist', 'Test Grist');
} }
// Return a session configured for a particular team site and the current session's user. // Return a session configured for a particular team site and the current session's user.
public customTeamSite(org: string = 'test-grist') { public customTeamSite(orgDomain: string = 'test-grist', orgName = 'Test Grist') {
const deployment = process.env.GRIST_ID_PREFIX; const deployment = process.env.GRIST_ID_PREFIX;
if (deployment) { if (deployment) {
org = `${org}-${deployment}`; orgDomain = `${orgDomain}-${deployment}`;
} }
return new Session({...this.settings, org}); return new Session({...this.settings, orgDomain, orgName});
} }
// Return a session configured to create and import docs in the given workspace. // Return a session configured to create and import docs in the given workspace.
@ -1250,7 +1252,7 @@ export class Session {
// Wipe the current site. The current user ends up being its only owner and manager. // Wipe the current site. The current user ends up being its only owner and manager.
public async resetSite() { public async resetSite() {
return resetOrg(this.createHomeApi(), this.settings.org); return resetOrg(this.createHomeApi(), this.settings.orgDomain);
} }
// Return a session configured for the current session's site but a different user. // Return a session configured for the current session's site but a different user.
@ -1279,7 +1281,7 @@ export class Session {
await removeLogin(); await removeLogin();
if (this.settings.email === 'anon@getgrist.com') { return this; } if (this.settings.email === 'anon@getgrist.com') { return this; }
} }
await server.simulateLogin(this.settings.name, this.settings.email, this.settings.org, await server.simulateLogin(this.settings.name, this.settings.email, this.settings.orgDomain,
{isFirstLogin: false, cacheCredentials: true, ...options}); {isFirstLogin: false, cacheCredentials: true, ...options});
return this; return this;
} }
@ -1299,9 +1301,9 @@ export class Session {
// ok, we may not be in a page associated with a user. // ok, we may not be in a page associated with a user.
} }
return currentUser && currentUser.email === this.settings.email && return currentUser && currentUser.email === this.settings.email &&
currentOrg && (currentOrg.name === this.settings.org || currentOrg && (currentOrg.name === this.settings.orgName ||
// This is an imprecise check for personal sites, but adequate for tests. // This is an imprecise check for personal sites, but adequate for tests.
(currentOrg.owner && (this.settings.org.startsWith('docs')))); (currentOrg.owner && (this.settings.orgDomain.startsWith('docs'))));
} }
// Load a document on a site. // Load a document on a site.
@ -1319,17 +1321,17 @@ export class Session {
public async loadRelPath(relPath: string) { public async loadRelPath(relPath: string) {
const part = relPath.match(/^\/o\/([^/]*)(\/.*)/); const part = relPath.match(/^\/o\/([^/]*)(\/.*)/);
if (part) { if (part) {
if (part[1] !== this.settings.org) { if (part[1] !== this.settings.orgDomain) {
throw new Error(`org mismatch: ${this.settings.org} vs ${part[1]}`); throw new Error(`org mismatch: ${this.settings.orgDomain} vs ${part[1]}`);
} }
relPath = part[2]; relPath = part[2];
} }
await driver.get(server.getUrl(this.settings.org, relPath)); await driver.get(server.getUrl(this.settings.orgDomain, relPath));
} }
// Import a file into the current site + workspace. // Import a file into the current site + workspace.
public async importFixturesDoc(fileName: string, options: ImportOpts = {load: true}) { public async importFixturesDoc(fileName: string, options: ImportOpts = {load: true}) {
return importFixturesDoc(this.settings.name, this.settings.org, this.settings.workspace, fileName, return importFixturesDoc(this.settings.name, this.settings.orgDomain, this.settings.workspace, fileName,
{email: this.settings.email, ...options}); {email: this.settings.email, ...options});
} }
@ -1362,8 +1364,8 @@ export class Session {
} }
public async tempNewDoc(cleanup: Cleanup, docName: string, {load} = {load: true}) { public async tempNewDoc(cleanup: Cleanup, docName: string, {load} = {load: true}) {
const docId = await createNewDoc(this.settings.name, this.settings.org, this.settings.workspace, docName, const docId = await createNewDoc(this.settings.name, this.settings.orgDomain, this.settings.workspace,
{email: this.settings.email}); docName, {email: this.settings.email});
if (load) { if (load) {
await this.loadDoc(`/doc/${docId}`); await this.loadDoc(`/doc/${docId}`);
} }
@ -1389,9 +1391,9 @@ export class Session {
// Get an appropriate home api object. // Get an appropriate home api object.
public createHomeApi() { public createHomeApi() {
if (this.settings.email === 'anon@getgrist.com') { if (this.settings.email === 'anon@getgrist.com') {
return createHomeApi(null, this.settings.org); return createHomeApi(null, this.settings.orgDomain);
} }
return createHomeApi(this.settings.name, this.settings.org, this.settings.email); return createHomeApi(this.settings.name, this.settings.orgDomain, this.settings.email);
} }
// Get the id of this user. // Get the id of this user.
@ -1404,7 +1406,8 @@ export class Session {
public get email() { return this.settings.email; } public get email() { return this.settings.email; }
public get name() { return this.settings.name; } public get name() { return this.settings.name; }
public get org() { return this.settings.org; } public get orgDomain() { return this.settings.orgDomain; }
public get orgName() { return this.settings.orgName; }
public get workspace() { return this.settings.workspace; } public get workspace() { return this.settings.workspace; }
public async downloadDoc(fname: string, urlId?: string) { public async downloadDoc(fname: string, urlId?: string) {

View File

@ -224,7 +224,7 @@ export function setupRequirement(options: TestSuiteOptions) {
if (deployment) { orgName = `${orgName}-${deployment}`; } if (deployment) { orgName = `${orgName}-${deployment}`; }
let isNew: boolean = false; let isNew: boolean = false;
try { try {
await api.newOrg({name: orgName, domain: orgName}); await api.newOrg({name: 'Test Grist', domain: orgName});
isNew = true; isNew = true;
} catch (e) { } catch (e) {
// Assume the org already exists. // Assume the org already exists.