mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Fix failing login tests
Summary: The rollout of the new sign-up page on prod caused a few tests that previously expected to be on the Cognito sign-up page to fail. Test Plan: N/A (fixing failing tests). Reviewers: alexmojaki Reviewed By: alexmojaki Subscribers: alexmojaki Differential Revision: https://phab.getgrist.com/D3279
This commit is contained in:
parent
be8c053922
commit
481122b4d3
@ -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;
|
||||
|
||||
|
@ -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!
|
||||
|
Loading…
Reference in New Issue
Block a user