gristlabs_grist-core/test/nbrowser/Smoke.ts
Paul Fitzpatrick 9f234b758d (core) freshen grist-core build
Summary:
 * adds a smoke test to grist-core
 * fixes a problem with highlight.js failing to load correctly
 * skips survey for default user
 * freshens docker build

Utility files in test/nbrowser are moved to core/test/nbrowser, so that gristUtils are available there. This increased the apparent size of the diff as "./" import paths needed replacing with "test/nbrowser/" paths. The utility files are untouched, except for the code to start a server - it now has a small grist-core specific conditional in it.

Test Plan: adds test

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2768
2021-04-03 09:41:06 -04:00

47 lines
1.4 KiB
TypeScript

/**
*
* This is a minimal test to make sure documents can be created, edited, and
* reopened. Grist has a very extensive test set that has not yet been ported
* to the grist-core.
*
*/
import { assert, driver } from 'mocha-webdriver';
import { server, setupTestSuite } from 'test/nbrowser/testUtils';
import * as gu from 'test/nbrowser/gristUtils';
async function openMainPage() {
await driver.get(`${server.getHost()}`);
while (true) { // eslint-disable-line no-constant-condition
try {
const url = await driver.getCurrentUrl();
if (url.match(/welcome\//)) {
await driver.findContent('button', /Continue/).click();
}
if (await driver.findContent('button', /Create Empty Document/).isPresent()) {
return;
}
} catch (e) {
// don't worry about transients.
}
await driver.sleep(10);
}
}
describe("Smoke", function() {
this.timeout(20000);
setupTestSuite();
it('can create, edit, and reopen a document', async function() {
this.timeout(20000);
await openMainPage();
await driver.findContent('button', /Create Empty Document/).click();
await gu.waitForDocToLoad(20000);
await gu.getCell('A', 1).click();
await gu.enterCell('123');
await driver.navigate().refresh();
await gu.waitForDocToLoad();
assert.equal(await gu.getCell('A', 1).getText(), '123');
});
});