gristlabs_grist-core/test/init-mocha-webdriver.js
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
2.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Settings that affect tests using mocha-webdriver. This module is imported by any run of mocha,
* by being listed in test/mocha.opts. (Keep in mind that it's imported by non-browser tests, such
* as test/common, as well.)
*/
// This determines when a failed assertion shows a diff with details or
// "expected [ Array(3) ] to deeply equal [ Array(3) ]".
// Increase the threshhold since the default (of 40 characters) is often too low.
// You can override it using CHAI_TRUNCATE_THRESHOLD env var; 0 disables it.
require('chai').config.truncateThreshold = process.env.CHAI_TRUNCATE_THRESHOLD ?
parseFloat(process.env.CHAI_TRUNCATE_THRESHOLD) : 200;
// Set an explicit window size (if not set by an external variable), to ensure that manully-run
// and Jenkins-run tests, headless or not, use a consistent size. (Not that height is still not
// identical between regular and headless browsers.)
//
// The size is picked to be on the small size, to ensure we test issues caused by constrained
// space (e.g. scrolling when needed). 1024x640 is a slight increase over 900x600 we used before.
// Note that https://www.hobo-web.co.uk/best-screen-size/ lists 1366×768 as most common desktop
// size, so it's reasonable to assume a browser that takes up most but not all of such a screen.
if (!process.env.MOCHA_WEBDRIVER_WINSIZE) {
process.env.MOCHA_WEBDRIVER_WINSIZE = "1024x640";
}
// Enable enhanced stacktraces by default. Disable by running with MOCHA_WEBDRIVER_STACKTRACES="".
if (process.env.MOCHA_WEBDRIVER_STACKTRACES === undefined) {
process.env.MOCHA_WEBDRIVER_STACKTRACES = "1";
}
// Default to chrome for mocha-webdriver testing. Override by setting SELENIUM_BROWSER, as usual.
if (!process.env.SELENIUM_BROWSER) {
process.env.SELENIUM_BROWSER = "chrome";
}
// Don't fail on mismatched Chrome versions. Disable with MOCHA_WEBDRIVER_IGNORE_CHROME_VERSION="".
if (process.env.MOCHA_WEBDRIVER_IGNORE_CHROME_VERSION === undefined) {
process.env.MOCHA_WEBDRIVER_IGNORE_CHROME_VERSION = "1";
}
// don't show "Chrome is controlled by..." banner since at time of writing it can
// swallow early clicks on page reload.
if (process.env.MOCHA_WEBDRIVER_NO_CONTROL_BANNER === undefined) {
process.env.MOCHA_WEBDRIVER_NO_CONTROL_BANNER = "1";
}