Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

enhancement: increase e2e tests stability (#443)

Guilherme Oenning1b4cdcb2b501
diff --git a/tests/lib/browser.ts b/tests/lib/browser.ts
index 029998c42..2874bd354 100644
--- a/tests/lib/browser.ts
+++ b/tests/lib/browser.ts
@@ -18,7 +18,6 @@ export class Browser {
public async newTab(baseUrl: string): Promise<BrowserTab> {
const page = await this.browser.newPage();
- await page.bringToFront();
return new BrowserTab(page, baseUrl);
}
diff --git a/tests/lib/mailgun.ts b/tests/lib/mailgun.ts
index 6d693d7db..0c82052ba 100644
--- a/tests/lib/mailgun.ts
+++ b/tests/lib/mailgun.ts
@@ -23,7 +23,7 @@ const httpGet = (endpoint: string): Promise<any> => {
};
export const mailgun = {
- getLinkFromLastEmailTo: async (tenant: string, to: string): Promise<string> => {
+ getLinkFromLastEmailTo: async (tenant: string, subject: string, to: string): Promise<string> => {
let messageUrl = "";
let count = 0;
@@ -32,8 +32,8 @@ export const mailgun = {
let url = `https://api.mailgun.net/v3/${
process.env.EMAIL_MAILGUN_DOMAIN
- }/events?to=${to}&event=accepted&limit=1&ascending=no`;
- if (tenant) {
+ }/events?to=${to}&subject=${subject}&event=accepted&limit=1&ascending=no`;
+ if (tenant !== "login") {
url += `&tags=tenant:${tenant}`;
}
diff --git a/tests/scenarios/email-signup.ts b/tests/scenarios/email-signup.ts
index fa7d86c26..e151c3eec 100644
--- a/tests/scenarios/email-signup.ts
+++ b/tests/scenarios/email-signup.ts
@@ -22,7 +22,11 @@ describe("E2E: Sign up with e-mail", () => {
await tab.pages.signup.signInWithEmail(`Darth Vader ${now}`, `[email protected]`);
await tab.pages.signup.signUpAs(`Selenium ${now}`, `selenium${now}`);
- const link = await mailgun.getLinkFromLastEmailTo(`selenium${now}`, `[email protected]`);
+ const link = await mailgun.getLinkFromLastEmailTo(
+ `selenium${now}`,
+ `Confirm your new Fider instance`,
+ );
await tab.pages.goTo(link);
await tab.wait(pageHasLoaded(HomePage));
diff --git a/tests/scenarios/feedback-loop.ts b/tests/scenarios/feedback-loop.ts
index 6fcb178e8..299836bbd 100644
--- a/tests/scenarios/feedback-loop.ts
+++ b/tests/scenarios/feedback-loop.ts
@@ -10,6 +10,7 @@ import {
} from "../lib";
import { HomePage, ShowIdeaPage } from "../pages";
import { ctx } from ".";
+import { O_NOCTTY } from "constants";
it("Tab1: User is authenticated after sign up", async () => {
// Action
@@ -138,7 +139,11 @@ it("Tab2: Logout and sign in with email", async () => {
// Action
await ctx.tab2.pages.home.navigate();
await ctx.tab2.pages.home.signInWithEmail("[email protected]");
- const link = await mailgun.getLinkFromLastEmailTo(ctx.tenantSubdomain, `[email protected]`);
+ const link = await mailgun.getLinkFromLastEmailTo(
+ ctx.tenantSubdomain,
+ `Sign in to ${ctx.tenantName}`,
+ );
await ctx.tab2.navigate(link);
await ctx.tab2.pages.home.completeSignIn("Darth Vader");