diff --git a/test/nbrowser/gristUtils.ts b/test/nbrowser/gristUtils.ts index 2e2d7d06..8089e0e8 100644 --- a/test/nbrowser/gristUtils.ts +++ b/test/nbrowser/gristUtils.ts @@ -42,6 +42,7 @@ export const removeLogin = homeUtil.removeLogin.bind(homeUtil); export const setValue = homeUtil.setValue.bind(homeUtil); export const isOnLoginPage = homeUtil.isOnLoginPage.bind(homeUtil); export const checkLoginPage = homeUtil.checkLoginPage.bind(homeUtil); +export const checkGristLoginPage = homeUtil.checkGristLoginPage.bind(homeUtil); export const fixturesRoot: string = testUtils.fixturesRoot; diff --git a/test/nbrowser/homeUtil.ts b/test/nbrowser/homeUtil.ts index 89346224..35ef9d89 100644 --- a/test/nbrowser/homeUtil.ts +++ b/test/nbrowser/homeUtil.ts @@ -78,7 +78,7 @@ export class HomeUtil { // When running against an external server, we log in through Cognito. await this.driver.get(this.server.getUrl(org, "")); // Check if we got redirected to the Grist sign-up page. - if (await this.isOnSignupPage()) { + if (await this.isOnGristLoginPage()) { await this.driver.findWait('a[href*="login?"]', 4000).click(); } else if (!(await this.isOnLoginPage())) { // Explicitly click sign-in link if necessary. @@ -86,7 +86,7 @@ export class HomeUtil { await this.driver.findContentWait('.grist-floating-menu a', 'Sign in', 500).click(); } // Check if we need to switch to Cognito login from the Grist sign-up page. - if (await this.isOnSignupPage()) { + if (await this.isOnGristLoginPage()) { await this.driver.findWait('a[href*="login?"]', 4000).click(); } await this.checkLoginPage(); @@ -263,10 +263,10 @@ export class HomeUtil { } /** - * Returns whether we are currently on the Grist sign-up page. + * Returns whether we are currently on a Grist login page. */ - public async isOnSignupPage() { - return /login(-s)?\.getgrist\.com\/signup/.test(await this.driver.getCurrentUrl()); + public async isOnGristLoginPage() { + return /login(-s)?\.getgrist\.com/.test(await this.driver.getCurrentUrl()); } /** @@ -276,6 +276,13 @@ export class HomeUtil { await this.driver.wait(this.isOnLoginPage.bind(this), waitMs); } + /** + * Waits for browser to navigate to Grist login page. + */ + public async checkGristLoginPage(waitMs: number = 2000) { + await this.driver.wait(this.isOnGristLoginPage.bind(this), waitMs); + } + /** * Delete and recreate the user, via the specified org. The specified user must be * currently logged in!