From d6abe6a7375c76e55953caef1780747a03e4192e Mon Sep 17 00:00:00 2001 From: Paul Fitzpatrick Date: Tue, 25 Apr 2023 13:10:07 -0400 Subject: [PATCH] (core) finish porting test/browser/*.test.js tests Summary: This finishes porting the bulk of tests relying on the old selenium pseudo-promise manager. Here the remaining ones that I know of: * There are some tests written in typescript at test/browser/*.test.ts (I've olny been looking at the older *.test.js ones so far) * There are some tests in test/home that run a slightly different way First version of this diff just had renames, so for reviewing it is likely easiest to switch to a comparison of that version with the final version. I switched from using test.(describe/it/...) to straight mocha since the indirection was confusing mocha-webdriver's debug functions (e.g. it was misnaming screenshots). That resulted in a lot of noise in the diff, sorry! Some tests fail in headless operation in modern chrome for what looks to be the same reason as https://github.com/gristlabs/grist-core/pull/490 (some copy/paste nuance or change). Test Plan: test porting Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3862 --- test/nbrowser/DocTutorial.ts | 2 +- test/nbrowser/gristUtils.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/nbrowser/DocTutorial.ts b/test/nbrowser/DocTutorial.ts index 198d0a94..ebdbadfc 100644 --- a/test/nbrowser/DocTutorial.ts +++ b/test/nbrowser/DocTutorial.ts @@ -12,7 +12,7 @@ describe('DocTutorial', function () { let api: UserAPI; let session: gu.Session; - const cleanup = setupTestSuite(); + const cleanup = setupTestSuite({team: true}); before(async () => { session = await gu.session().teamSite.user('support').login(); diff --git a/test/nbrowser/gristUtils.ts b/test/nbrowser/gristUtils.ts index 784e0444..a9babd48 100644 --- a/test/nbrowser/gristUtils.ts +++ b/test/nbrowser/gristUtils.ts @@ -543,10 +543,11 @@ export async function rightClick(cell: WebElement) { * section. RowNum is a 1-based number as in the row headers, and col is a 0-based index for * grid view or field name for detail view. */ -export async function getCursorPosition(section?: WebElement) { +export async function getCursorPosition(section?: WebElement|string) { return await retryOnStale(async () => { + if (typeof section === 'string') { section = await getSection(section); } section = section ?? await driver.findWait('.active_section', 4000); - const cursor = await section.findWait('.active_cursor', 1000); + const cursor = await section.findWait('.selected_cursor', 1000); // Query assuming the cursor is in a GridView and a DetailView, then use whichever query data // works out. const [colIndex, rowIndex, rowNum, colName] = await Promise.all([