mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
bcbf57d590
Summary: This uses a newer version of mocha in grist-core so that tests can be run in parallel. That allows more tests to be moved without slowing things down overall. Tests moved are venerable browser tests; only the ones that "just work" or worked without too much trouble to are moved, in order to keep the diff from growing too large. Will wrestle with more in follow up. Parallelism is at the file level, rather than the individual test. The newer version of mocha isn't needed for grist-saas repo; tests are parallelized in our internal CI by other means. I've chosen to allocate files to workers in a cruder way than our internal CI, based on initial characters rather than an automated process. The automated process would need some reworking to be compatible with mocha running in parallel mode. Test Plan: this diff was tested first on grist-core, then ported to grist-saas so saas repo history will correctly track history of moved files. Reviewers: jarek Reviewed By: jarek Subscribers: jarek Differential Revision: https://phab.getgrist.com/D3927
62 lines
2.1 KiB
JavaScript
62 lines
2.1 KiB
JavaScript
/* global window */
|
|
|
|
import { assert, driver } from 'mocha-webdriver';
|
|
import { $, gu, test } from 'test/nbrowser/gristUtil-nbrowser';
|
|
|
|
describe('CodeEditor.ntest', function() {
|
|
const cleanup = test.setupTestSuite(this);
|
|
|
|
before(async function() {
|
|
await gu.supportOldTimeyTestCode();
|
|
await gu.useFixtureDoc(cleanup, '../uploads/CodeEditor.test.csv', true);
|
|
});
|
|
|
|
afterEach(function() {
|
|
return gu.checkForErrors();
|
|
});
|
|
|
|
it('Should activate on click of `Code View` button', async function() {
|
|
await gu.openSidePane('code');
|
|
assert.match(await $('.g-code-viewer').wait().getText(),
|
|
/class CodeEditor_test:[^]*A = grist.Text\(\)[^]*B = grist.Numeric\(\)/);
|
|
});
|
|
|
|
it('Should update to reflect changes in schema', async function() {
|
|
await gu.actions.selectTabView('CodeEditor.test');
|
|
// open the side menu
|
|
await gu.openSidePane('field');
|
|
|
|
await gu.getCellRC(0, 0).click();
|
|
await $(".test-field-label").wait(assert.isDisplayed);
|
|
await $(".test-field-label").sendNewText('foo');
|
|
await gu.waitForServer();
|
|
|
|
await gu.getCellRC(0, 1).click();
|
|
await $(".test-field-label").sendNewText('bar');
|
|
await gu.waitForServer(); // Must wait for colId change to finish
|
|
|
|
await gu.setType('Reference');
|
|
await gu.applyTypeConversion();
|
|
await gu.setVisibleCol('foo');
|
|
await gu.waitForServer();
|
|
|
|
// Check that type conversion worked correctly.
|
|
assert.equal(await gu.getCellRC(1, 1).text(), 'Bob');
|
|
|
|
await gu.openSidePane('code');
|
|
assert.match(await $('.g-code-viewer').wait().getText(),
|
|
/foo = grist.Text\(\)[^]*bar = grist.Reference\('CodeEditor_test'\)/);
|
|
});
|
|
|
|
it('should filter out helper columns', async function() {
|
|
assert.notInclude(await $('.g-code-viewer').wait().getText(), 'gristHelper');
|
|
});
|
|
|
|
it('should allow text selection', async function() {
|
|
const textElem = $('.hljs-title:contains(CodeEditor)');
|
|
await textElem.click();
|
|
await driver.withActions(a => a.doubleClick(textElem.elem()));
|
|
assert.equal(await driver.executeScript(() => window.getSelection().toString()), 'CodeEditor_test');
|
|
});
|
|
});
|