(core) port some more test/browser tests to newer selenium

Summary:
Ports more test/browser tests from *.test.js (run using an old selenium setup) to *.ntest.js (run using newer setup).

Weird test failures happened due to a change in timing. Eventually tracked in down to billing changes in one test suite resulting in reloads in another test suite, since it turns out redis pub/sub channels are not scoped to the redis database specified in REDIS_URL, but are global:
  https://redis.io/docs/manual/pubsub/#database--scoping.

Test Plan: Ported tests should run and pass

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3844
This commit is contained in:
Paul Fitzpatrick
2023-04-12 12:18:48 -04:00
parent 900859854c
commit cc0e1154d0
5 changed files with 44 additions and 6 deletions

View File

@@ -60,6 +60,7 @@ export const isOnLoginPage = homeUtil.isOnLoginPage.bind(homeUtil);
export const isOnGristLoginPage = homeUtil.isOnLoginPage.bind(homeUtil);
export const checkLoginPage = homeUtil.checkLoginPage.bind(homeUtil);
export const checkGristLoginPage = homeUtil.checkGristLoginPage.bind(homeUtil);
export const copyDoc = homeUtil.copyDoc.bind(homeUtil);
export const fixturesRoot: string = testUtils.fixturesRoot;
@@ -758,10 +759,14 @@ export async function waitForDocMenuToLoad(): Promise<void> {
export async function waitToPass(check: () => Promise<void>, timeMs: number = 4000) {
try {
let delay: number = 10;
await driver.wait(async () => {
try {
await check();
} catch (e) {
// Throttle operations a little bit.
await driver.sleep(delay);
if (delay < 50) { delay += 10; }
return false;
}
return true;
@@ -1714,6 +1719,7 @@ export async function openDocDropdown(docNameOrRow: string|WebElement): Promise<
export async function openAccessRulesDropdown(): Promise<void> {
await driver.find('.test-tools-access-rules').mouseMove();
await driver.find('.test-tools-access-rules-trigger').mouseMove().click();
await driver.findWait('.grist-floating-menu', 1000);
}
export async function editOrgAcls(): Promise<void> {
@@ -1884,6 +1890,7 @@ export enum TestUserEnum {
user2 = 'charon',
user3 = 'kiwi',
user4 = 'ham',
userz = 'userz', // a user for old tests, that doesn't overlap with others.
owner = 'chimpy',
anon = 'anon',
support = 'support',