Skip to content

Commit

Permalink
test: fix ci failures by making tests more stable (#821)
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus authored May 24, 2024
1 parent 440512b commit d4b792d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions test/end-to-end/signin-rrdv5.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ describe("SuperTokens SignIn with react router dom v5", function () {
submitFormReturnRequestAndResponse(page, SIGN_IN_API),
page.waitForNavigation({ waitUntil: "networkidle0" }),
]);
await page.waitForSelector(".sessionInfo-user-id");
const pathname = await page.evaluate(() => window.location.pathname);
assert.deepStrictEqual(pathname, "/redirect-to-this-custom-path");
assert.deepStrictEqual(consoleLogs, [
Expand Down Expand Up @@ -611,6 +612,7 @@ describe("SuperTokens SignIn with react router dom v5", function () {
submitFormReturnRequestAndResponse(page, SIGN_IN_API),
page.waitForNavigation({ waitUntil: "networkidle0" }),
]);
await page.waitForSelector(".sessionInfo-user-id");
const pathname = await page.evaluate(() => window.location.pathname);
assert.deepStrictEqual(pathname, "/CasE/Case-SensItive1-PAth");
assert.deepStrictEqual(consoleLogs, [
Expand Down
2 changes: 2 additions & 0 deletions test/end-to-end/signin-rrdv6.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ describe("SuperTokens SignIn with react router dom v6", function () {
submitFormReturnRequestAndResponse(page, SIGN_IN_API),
page.waitForNavigation({ waitUntil: "networkidle0" }),
]);
await page.waitForSelector(".sessionInfo-user-id");
const pathname = await page.evaluate(() => window.location.pathname);
assert.deepStrictEqual(pathname, "/redirect-to-this-custom-path");
assert.deepStrictEqual(consoleLogs, [
Expand Down Expand Up @@ -760,6 +761,7 @@ describe("SuperTokens SignIn with react router dom v6", function () {
submitFormReturnRequestAndResponse(page, SIGN_IN_API),
page.waitForNavigation({ waitUntil: "networkidle0" }),
]);
await page.waitForSelector(".sessionInfo-user-id");
const pathname = await page.evaluate(() => window.location.pathname);
assert.deepStrictEqual(pathname, "/CasE/Case-SensItive1-PAth");
assert.deepStrictEqual(consoleLogs, [
Expand Down
3 changes: 3 additions & 0 deletions test/end-to-end/signin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ describe("SuperTokens SignIn", function () {
page = await browser.newPage();
page.on("console", (consoleObj) => {
const log = consoleObj.text();
// console.log(log);
if (log.startsWith("ST_LOGS")) {
consoleLogs.push(log);
}
Expand Down Expand Up @@ -660,6 +661,7 @@ describe("SuperTokens SignIn", function () {
submitFormReturnRequestAndResponse(page, SIGN_IN_API),
page.waitForNavigation({ waitUntil: "networkidle0" }),
]);
await page.waitForSelector(".sessionInfo-user-id");
const pathname = await page.evaluate(() => window.location.pathname);
assert.deepStrictEqual(pathname, "/redirect-to-this-custom-path");
assert.deepStrictEqual(consoleLogs, [
Expand Down Expand Up @@ -700,6 +702,7 @@ describe("SuperTokens SignIn", function () {
submitFormReturnRequestAndResponse(page, SIGN_IN_API),
page.waitForNavigation({ waitUntil: "networkidle0" }),
]);
await page.waitForSelector(".sessionInfo-user-id");
const pathname = await page.evaluate(() => window.location.pathname);
assert.deepStrictEqual(pathname, "/CasE/Case-SensItive1-PAth");
assert.deepStrictEqual(consoleLogs, [
Expand Down
2 changes: 2 additions & 0 deletions test/end-to-end/thirdparty.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export function getThirdPartyTestCases({ authRecipe, rid, signInUpPageLoadLogs,
loginWithAuth0(page),
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
]);
await page.waitForSelector(".sessionInfo-user-id");
const pathname = await page.evaluate(() => window.location.pathname);
assert.deepStrictEqual(pathname, "/dashboard");
assert.deepStrictEqual(consoleLogs, [
Expand Down Expand Up @@ -213,6 +214,7 @@ export function getThirdPartyTestCases({ authRecipe, rid, signInUpPageLoadLogs,
loginWithAuth0(page),
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
]);
await page.waitForSelector(".sessionInfo-user-id");
const pathname = await page.evaluate(() => window.location.pathname);
assert.deepStrictEqual(pathname, "/dashboard");
assert.deepStrictEqual(consoleLogs, [
Expand Down
1 change: 1 addition & 0 deletions test/end-to-end/thirdpartyemailpassword.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ describe("SuperTokens Third Party Email Password", function () {
loginWithAuth0(page),
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
]);
await page.waitForSelector(".sessionInfo-user-id");
const pathname = await page.evaluate(() => window.location.pathname);
assert.deepStrictEqual(pathname, "/dashboard");
assert.deepStrictEqual(consoleLogs, [
Expand Down

0 comments on commit d4b792d

Please sign in to comment.