Skip to content

Commit

Permalink
docs: fix examples/tests
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed May 29, 2024
1 parent 73eac66 commit dd6e928
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 22 deletions.
2 changes: 1 addition & 1 deletion examples/with-account-linking/frontend/src/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const SuperTokensConfig = {
},
}),
Passwordless.init({
contactMethod: "PHONE",
contactMethod: "EMAIL_OR_PHONE",
}),
Session.init(),
],
Expand Down
12 changes: 9 additions & 3 deletions examples/with-account-linking/test/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,17 @@ describe("SuperTokens Example Basic tests", function () {
await page.evaluate(() => __supertokensSessionRecipe.signOut({}));
await new Promise((res) => setTimeout(res, 200));

await page.goto(`${websiteDomain}/auth?rid=passwordless`);
await page.goto(`${websiteDomain}/auth?show=signup`);

await setInputValues(page, [{ name: "emailOrPhone", value: email }]);
await submitForm(page);
const contWithPwless = await waitForSTElement(
page,
"[data-supertokens~=continueWithPasswordlessButtonWrapper]"
);
await contWithPwless.click();

await setInputValues(page, [{ name: "email", value: email }]);

await submitForm(page);
await waitForSTElement(page, "[name=userInputCode]");

const loginAttemptInfo = JSON.parse(
Expand Down
15 changes: 1 addition & 14 deletions examples/with-i18next/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ i18next.init({
AUTH_PAGE_FOOTER_PP: "Privacy Policy",
AUTH_PAGE_FOOTER_END: "",

DIVIDER_OR: "or",
DIVIDER_OR: "or translation",

THIRD_PARTY_PROVIDER_DEFAULT_BTN_START: "Continue with ",
THIRD_PARTY_PROVIDER_DEFAULT_BTN_END: "",
Expand Down Expand Up @@ -73,23 +73,10 @@ i18next.init({
EMAIL_PASSWORD_PASSWORD_LABEL: "Password",
EMAIL_PASSWORD_PASSWORD_PLACEHOLDER: "Password",

EMAIL_PASSWORD_SIGN_IN_HEADER_TITLE: "Sign In",
EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_START: "Not registered yet?",
EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_SIGN_UP_LINK: "Sign Up",
EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_END: "",
EMAIL_PASSWORD_SIGN_IN_FORGOT_PW_LINK: "Forgot password?",
EMAIL_PASSWORD_SIGN_IN_SUBMIT_BTN: "SIGN IN",
EMAIL_PASSWORD_SIGN_IN_WRONG_CREDENTIALS_ERROR: "Incorrect email and password combination",

EMAIL_PASSWORD_SIGN_UP_HEADER_TITLE: "Sign Up",
EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_START: "Already have an account?",
EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_SIGN_IN_LINK: "Sign In",
EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_END: "",
EMAIL_PASSWORD_SIGN_UP_FOOTER_START: "By continuing, you agree to our ",
AUTH_PAGE_FOOTER_TOS: "Terms of Service",
EMAIL_PASSWORD_SIGN_UP_FOOTER_AND: " and ",
EMAIL_PASSWORD_SIGN_UP_FOOTER_PP: "Privacy Policy",
EMAIL_PASSWORD_SIGN_UP_FOOTER_END: "",
EMAIL_PASSWORD_SIGN_UP_SUBMIT_BTN: "SIGN UP",

EMAIL_PASSWORD_EMAIL_ALREADY_EXISTS: "This email already exists. Please sign in instead",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe("SuperTokens Example Basic tests", function () {
before(async function () {
browser = await puppeteer.launch({
args: ["--no-sandbox", "--disable-setuid-sandbox"],
headless: false,
headless: true,
});
page = await browser.newPage();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ describe("SuperTokens Example Basic tests", function () {

// redirected to /auth
await waitForSTElement(page);
assert.strictEqual(page.url(), websiteDomain + "/auth/?redirectToPath=");
assert.strictEqual(page.url(), websiteDomain + "/signin?redirectToPath=");

// Go to separate sign up page
const link = await waitForSTElement(page, "#signupLink");
await Promise.all([link.click(), page.waitForNavigation({ waitUntil: "networkidle0" })]);
assert.strictEqual(page.url(), websiteDomain + "/signup?show=signup");
assert.strictEqual(page.url(), websiteDomain + "/signup");

await setInputValues(page, [
{ name: "email", value: email },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ describe("SuperTokens Example Basic tests", function () {
it("Successful signup with credentials", async function () {
await Promise.all([page.goto(websiteDomain), page.waitForNavigation({ waitUntil: "networkidle0" })]);

const pwlessBtn = await waitForSTElement(page, "#passwordlessLoginBtn");
await toggleSignInSignUp(page);

const pwlessBtn = await waitForSTElement(page, "[data-supertokens~=continueWithPasswordlessButtonWrapper]");
await pwlessBtn.click();

// redirected to /auth
Expand Down

0 comments on commit dd6e928

Please sign in to comment.