Skip to content

Commit

Permalink
test: fix mfa tests (#805)
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Mar 16, 2024
1 parent 9e0916d commit f28cd4c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
5 changes: 3 additions & 2 deletions test/end-to-end/mfa.chooserscreen.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ describe("SuperTokens SignIn w/ MFA", function () {
});

after(async function () {
if (!skipped) {
await browser.close();
if (skipped) {
return;
}
await browser.close();

await fetch(`${TEST_SERVER_BASE_URL}/after`, {
method: "POST",
Expand Down
3 changes: 3 additions & 0 deletions test/end-to-end/mfa.factorscreen.otp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ describe("SuperTokens SignIn w/ MFA", function () {
});

after(async function () {
if (skipped) {
return;
}
await browser.close();

await fetch(`${TEST_SERVER_BASE_URL}/after`, {
Expand Down
3 changes: 2 additions & 1 deletion test/end-to-end/mfa.factorscreen.totp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ describe("SuperTokens SignIn w/ MFA", function () {

after(async function () {
if (skipped) {
await browser.close();
return;
}
await browser.close();

await fetch(`${TEST_SERVER_BASE_URL}/after`, {
method: "POST",
Expand Down
10 changes: 10 additions & 0 deletions test/end-to-end/mfa.requirement_handling.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
waitFor,
getFactorChooserOptions,
setAccountLinkingConfig,
isMFASupported,
} from "../helpers";
import fetch from "isomorphic-fetch";
import { CREATE_CODE_API, CREATE_TOTP_DEVICE_API, MFA_INFO_API } from "../constants";
Expand Down Expand Up @@ -64,8 +65,14 @@ describe("SuperTokens SignIn w/ MFA", function () {
let browser;
let page;
let consoleLogs = [];
let skipped;

before(async function () {
if (!(await isMFASupported())) {
skipped = true;
this.skip();
return;
}
await backendBeforeEach();

await fetch(`${TEST_SERVER_BASE_URL}/startst`, {
Expand All @@ -79,6 +86,9 @@ describe("SuperTokens SignIn w/ MFA", function () {
});

after(async function () {
if (skipped) {
return;
}
await browser.close();

await fetch(`${TEST_SERVER_BASE_URL}/after`, {
Expand Down
6 changes: 3 additions & 3 deletions test/server/package-lock.json

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

0 comments on commit f28cd4c

Please sign in to comment.