diff --git a/examples/for-tests/src/App.js b/examples/for-tests/src/App.js index 4496d10a2..0b3c1db7e 100644 --- a/examples/for-tests/src/App.js +++ b/examples/for-tests/src/App.js @@ -669,7 +669,7 @@ function getEmailVerificationConfigs({ disableDefaultUI }) { function getFormFields() { if (localStorage.getItem("SHOW_INCORRECT_FIELDS") === "YES") { return incorrectFormFields; - } else if (localStorage.getItem("SHOW_DEFAULT_FIELDS") === "YES") { + } else if (localStorage.getItem("SHOW_CUSTOM_FIELDS_WITH_DEFAULT_VALUES") === "YES") { return formFieldsWithDefault; } else if (localStorage.getItem("SHOW_CUSTOM_FIELDS") === "YES") { return customFields; diff --git a/test/end-to-end/signup.test.js b/test/end-to-end/signup.test.js index f835217ec..bb2cc2d01 100644 --- a/test/end-to-end/signup.test.js +++ b/test/end-to-end/signup.test.js @@ -444,7 +444,7 @@ describe("SuperTokens SignUp", function () { describe("Signup default value for fields test", function () { beforeEach(async function () { // set cookie and reload which loads the form fields with default values - await page.evaluate(() => window.localStorage.setItem("SHOW_DEFAULT_FIELDS", "YES")); + await page.evaluate(() => window.localStorage.setItem("SHOW_CUSTOM_FIELDS_WITH_DEFAULT_VALUES", "YES")); await page.reload({ waitUntil: "domcontentloaded", @@ -480,14 +480,35 @@ describe("SuperTokens SignUp", function () { // input field default value const countryInput = await getInputField(page, "country"); - const defaultCountry = await countryInput.evaluate((f) => f.value); - assert.strictEqual(defaultCountry, updatedFields["country"]); + const updatedCountry = await countryInput.evaluate((f) => f.value); + assert.strictEqual(updatedCountry, updatedFields["country"]); // dropdown default value is also getting set correctly const ratingsDropdown = await waitForSTElement(page, "select"); - const defaultRating = await ratingsDropdown.evaluate((f) => f.value); - assert.strictEqual(defaultRating, updatedFields["ratings"]); + const updatedRating = await ratingsDropdown.evaluate((f) => f.value); + assert.strictEqual(updatedRating, updatedFields["ratings"]); }); + + // TODO + // it("Check if default values are getting sent in signup-payload", async function () { + // const updatedFields = { + // country: "USA", + // ratings: "good", + // }; + + // await setInputValues(page, [{ name: "country", value: updatedFields["country"] }]); + // await setSelectDropdownValue(page, 'select[name="ratings"]', updatedFields["ratings"]); + + // // input field default value + // const countryInput = await getInputField(page, "country"); + // const updatedCountry = await countryInput.evaluate((f) => f.value); + // assert.strictEqual(updatedCountry, updatedFields["country"]); + + // // dropdown default value is also getting set correctly + // const ratingsDropdown = await waitForSTElement(page, "select"); + // const updatedRating = await ratingsDropdown.evaluate((f) => f.value); + // assert.strictEqual(updatedRating, updatedFields["ratings"]); + // }); }); }); diff --git a/test/with-typescript/src/App.tsx b/test/with-typescript/src/App.tsx index a053d3303..fe7d38c44 100644 --- a/test/with-typescript/src/App.tsx +++ b/test/with-typescript/src/App.tsx @@ -326,97 +326,6 @@ function getRecipeList() { ]; } -const formFieldsForSignUp = [ - { - id: "email", - label: "Your Email", - placeholder: "Your work email", - }, - { - id: "name", - label: "Full name", - placeholder: "First name and last name", - }, - { - id: "age", - label: "Your age", - placeholder: "How old are you?", - validate: async (value) => { - if (parseInt(value) > 18) { - return undefined; - } - - return "You must be over 18 to register"; - }, - }, - { - id: "country", - label: "Your Country", - placeholder: "Where do you live?", - optional: true, - }, -]; - -const customFormFieldsWithDefault = [ - { - id: "terms", - label: "", - optional: false, - inputComponent: (inputProps) => ( -