(core) Update failing HomeIntro core test

Summary:
Core doesn't redirect to Cognito or our own sign-up page
when clicking 'sign up' on the welcome screen. Instead, it
redirects to the test login page.

Test Plan: N/A (fixing test)

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D3298
This commit is contained in:
George Gevoian 2022-02-28 11:43:51 -08:00
parent c91593e312
commit 83ba2957bf
2 changed files with 23 additions and 3 deletions

View File

@ -915,7 +915,7 @@ export class FlexServer implements GristServer {
res.send(`<!doctype html> res.send(`<!doctype html>
<html><body> <html><body>
<div class="modal-content-desktop"> <div class="modal-content-desktop">
<h1>A Very Creduluous Login Page</h1> <h1>A Very Credulous Login Page</h1>
<p> <p>
A minimal login screen to facilitate testing. A minimal login screen to facilitate testing.
I'll believe anything you tell me. I'll believe anything you tell me.

View File

@ -266,6 +266,13 @@ export class HomeUtil {
return /^https:\/\/login(-s)?\.getgrist\.com/.test(await this.driver.getCurrentUrl()); return /^https:\/\/login(-s)?\.getgrist\.com/.test(await this.driver.getCurrentUrl());
} }
/**
* Returns whether we are currently on the test login page.
*/
public async isOnTestLoginPage() {
return await this.driver.findContent('h1', 'A Very Credulous Login Page');
}
/** /**
* Waits for browser to navigate to Cognito login page. * Waits for browser to navigate to Cognito login page.
*/ */
@ -281,11 +288,24 @@ export class HomeUtil {
} }
/** /**
* Waits for browser to navigate to either the Cognito or Grist login page. * Waits for browser to navigate to test login page.
*/
public async checkTestLoginPage(waitMs: number = 2000) {
await this.driver.wait(this.isOnTestLoginPage.bind(this), waitMs);
}
/**
* Waits for browser to navigate to any login page (e.g. Cognito, Grist, test).
*/ */
public async checkSigninPage(waitMs: number = 4000) { public async checkSigninPage(waitMs: number = 4000) {
await this.driver.wait( await this.driver.wait(
async () => await this.isOnLoginPage() || await this.isOnGristLoginPage(), async () => {
return (
await this.isOnLoginPage() ||
await this.isOnGristLoginPage() ||
await this.isOnTestLoginPage()
);
},
waitMs waitMs
); );
} }