Skip to content

Commit

Permalink
ci: debugging tests on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Sep 21, 2023
1 parent c4772af commit 09251d8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
4 changes: 2 additions & 2 deletions test/end-to-end/accountlinking.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import { TEST_CLIENT_BASE_URL, TEST_SERVER_BASE_URL, SIGN_IN_UP_API, RESET_PASSW
/*
* Tests.
*/
describe("SuperTokens Account linking", function () {
describe.only("SuperTokens Account linking", function () {
let browser;
let page;
let consoleLogs;
Expand Down Expand Up @@ -532,7 +532,7 @@ describe("SuperTokens Account linking", function () {
assert.strictEqual(new URL(page.url()).pathname, "/auth/reset-password");
});

it("should allow sign in w/ a verified emailpassword user in case of conflict", async function () {
it.only("should allow sign in w/ a verified emailpassword user in case of conflict", async function () {
const email = `test-user+${Date.now()}@supertokens.com`;
await page.evaluate(() => window.localStorage.setItem("mode", "REQUIRED"));

Expand Down
2 changes: 1 addition & 1 deletion test/end-to-end/multitenancy.dynamic_login_methods.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ let connectionURI;
/*
* Tests.
*/
describe("SuperTokens Multitenancy dynamic login methods", function () {
describe.only("SuperTokens Multitenancy dynamic login methods", function () {
let browser;
let page;
let pageCrashed;
Expand Down
2 changes: 1 addition & 1 deletion test/end-to-end/multitenancy.tenant_interactions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import {
/*
* Tests.
*/
describe("SuperTokens Multitenancy tenant interactions", function () {
describe.only("SuperTokens Multitenancy tenant interactions", function () {
let browser;
let page;
let pageCrashed;
Expand Down
24 changes: 22 additions & 2 deletions test/end-to-end/thirdpartypasswordless.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("SuperTokens Third Party Passwordless", function () {
}
});

describe("Recipe combination tests", () => {
describe.only("Recipe combination tests", () => {
before(async function () {
await fetch(`${TEST_SERVER_BASE_URL}/beforeeach`, {
method: "POST",
Expand All @@ -77,7 +77,7 @@ describe("SuperTokens Third Party Passwordless", function () {

browser = await puppeteer.launch({
args: ["--no-sandbox", "--disable-setuid-sandbox"],
headless: true,
headless: false,
});
page = await browser.newPage();
page.on("console", (consoleObj) => {
Expand Down Expand Up @@ -117,42 +117,62 @@ describe("SuperTokens Third Party Passwordless", function () {

it("No account consolidation", async function () {
// 1. Sign up with credentials
console.log("a");
await setPasswordlessFlowType("EMAIL_OR_PHONE", "USER_INPUT_CODE");
console.log("b");
await page.evaluate(() => localStorage.removeItem("supertokens-passwordless-loginAttemptInfo"));
console.log("c");
await Promise.all([
page.goto(`${TEST_CLIENT_BASE_URL}/auth`),
page.waitForNavigation({ waitUntil: "networkidle0" }),
]);
console.log("d");

await setInputValues(page, [{ name: "emailOrPhone", value: email }]);
console.log("e");
await submitForm(page);
console.log("f");

await waitForSTElement(page, "[data-supertokens~=input][name=userInputCode]");
console.log("g");

const loginAttemptInfo = JSON.parse(
await page.evaluate(() => localStorage.getItem("supertokens-passwordless-loginAttemptInfo"))
);
console.log("h");
const device = await getPasswordlessDevice(loginAttemptInfo);
console.log("i");
await setInputValues(page, [{ name: "userInputCode", value: device.codes[0].userInputCode }]);
console.log("j");
await submitForm(page);
console.log("k");

await Promise.all([page.waitForSelector(".sessionInfo-user-id"), page.waitForNetworkIdle()]);
console.log("l");
const passwordlessUserId = await getUserIdWithFetch(page);

// 2. Log out
console.log("m");
const logoutButton = await getLogoutButton(page);
console.log("n");
await Promise.all([await logoutButton.click(), page.waitForNavigation({ waitUntil: "networkidle0" })]);

console.log("o");
await waitForSTElement(page, `input[name=emailOrPhone]`);

// 3. Sign in with auth0 with same address.
console.log("p");
await clickOnProviderButton(page, "Auth0");
console.log("q");
await Promise.all([
loginWithAuth0(page),
page.waitForResponse((response) => response.url() === SIGN_IN_UP_API && response.status() === 200),
]);
console.log("r");
await Promise.all([page.waitForSelector(".sessionInfo-user-id"), page.waitForNetworkIdle()]);
console.log("s");
const thirdPartyUserId = await getUserIdWithFetch(page);
console.log(thirdPartyUserId, passwordlessUserId);

// 4. Compare userIds
assert.notDeepStrictEqual(thirdPartyUserId, passwordlessUserId);
Expand Down

0 comments on commit 09251d8

Please sign in to comment.