Skip to content

Commit 687f89d

Browse files
namsnathdeepjyoti30-st
authored andcommitted
test: only run few tests
1 parent d25c6ed commit 687f89d

File tree

1 file changed

+38
-8
lines changed

1 file changed

+38
-8
lines changed

test/end-to-end/emailverification.test.js

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,44 @@ describe("SuperTokens Email Verification", function () {
114114
}
115115
});
116116

117-
describe("Email verification screen", function () {
118-
beforeEach(async function () {
119-
page = await browser.newPage();
120-
consoleLogs = [];
121-
page.on("console", (consoleObj) => {
122-
const log = consoleObj.text();
123-
if (log.startsWith("ST_LOGS")) {
124-
consoleLogs.push(log);
117+
after(async function () {
118+
await browser?.close();
119+
await backendHook("after");
120+
});
121+
122+
describe("Core", function () {
123+
describe.only("Email verification screen", function () {
124+
it("Should redirect to auth from email verification protected page if the user is deleted", async function () {
125+
await toggleSignInSignUp(page);
126+
127+
const email = await getTestEmail();
128+
const { fieldValues, postValues } = getDefaultSignUpFieldValues({ email });
129+
await signUp(page, fieldValues, postValues, "emailpassword");
130+
131+
await waitForSTElement(page, "[data-supertokens~='sendVerifyEmailIcon']");
132+
133+
await fetch(`${TEST_APPLICATION_SERVER_BASE_URL}/deleteUser`, {
134+
method: "POST",
135+
headers: [["content-type", "application/json"]],
136+
body: JSON.stringify({
137+
email,
138+
rid: "emailpassword",
139+
}),
140+
});
141+
await new Promise((r) => setTimeout(r, 11000));
142+
consoleLogs = [];
143+
await Promise.all([
144+
page.goto(`${TEST_CLIENT_BASE_URL}/dashboard`),
145+
page.waitForNavigation({ waitUntil: "networkidle0" }),
146+
]);
147+
148+
// In strict mode useEffects may be called twice in development mode,
149+
// but sometimes the second call is aborted by the navigation in the first
150+
if (
151+
consoleLogs[consoleLogs.length - 1] === "ST_LOGS SUPERTOKENS GET_REDIRECTION_URL TO_AUTH" &&
152+
consoleLogs[consoleLogs.length - 2] === "ST_LOGS SUPERTOKENS GET_REDIRECTION_URL TO_AUTH"
153+
) {
154+
consoleLogs.pop();
125155
}
126156
});
127157
consoleLogs = await clearBrowserCookiesWithoutAffectingConsole(page, consoleLogs);

0 commit comments

Comments
 (0)