Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add onboarding tests #230

Merged
merged 14 commits into from
Jun 30, 2023
3 changes: 2 additions & 1 deletion clients/onboarding/src/components/CountryPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ export function OnboardingCountryPicker<T extends CountryCCA3>({
return (
<LakeLabel
label={label}
render={() => (
render={id => (
<CountryPicker
id={id}
countries={countries}
value={value}
hideErrors={hideError}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,10 @@ export const OnboardingCompanyOrganisation1 = ({
{({ value, valid, error, onChange }) => (
<LakeLabel
label={t("company.step.organisation1.organisationLabel")}
render={() =>
render={id =>
country === "FRA" ? (
<LakeCompanyInput
id={id}
value={value}
placeholder={t("company.step.organisation1.organisationPlaceholder")}
error={error}
Expand All @@ -366,6 +367,7 @@ export const OnboardingCompanyOrganisation1 = ({
/>
) : (
<LakeTextInput
id={id}
value={value}
placeholder={t("company.step.organisation1.organisationPlaceholder")}
valid={valid}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ export const OnboardingCompanyOrganisation2 = ({
{({ value, error, onChange }) => (
<LakeLabel
label={t("company.step.organisation2.activityLabel")}
render={() => (
render={id => (
<LakeSelect
id={id}
placeholder={t("company.step.organisation2.activityPlaceholder")}
value={emptyToUndefined(value)}
items={businessActivitiesItems}
Expand Down Expand Up @@ -233,8 +234,9 @@ export const OnboardingCompanyOrganisation2 = ({
{({ value, onChange }) => (
<LakeLabel
label={t("company.step.organisation2.monthlyPaymentLabel")}
render={() => (
render={id => (
<LakeSelect
id={id}
value={value}
items={monthlyPaymentVolumeItems}
onValueChange={onChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export const OnboardingCompanyOwnership = ({
const [showConfirmNoUboModal, setShowConfirmNoUboModal] = useBoolean(false);
const beneficiaryFormRef = useRef<BeneficiaryFormRef>();

const withAddressPart = accountCountry === "DEU";
const withAddressPart = accountCountry === "DEU" || accountCountry === "ESP";

useEffect(() => {
if (shakeError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ export const OnboardingCompanyRegistration = ({
<Field name="tcuAccepted">
{({ value, error, onChange }) => (
<Pressable
role="checkbox"
aria-checked={value}
onPress={() => onChange(!value)}
style={styles.tcuCheckbox}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export const OnboardingIndividualDetails = ({

{canSetTaxIdentification && (
<>
<Space height={12} />
<Space height={32} />

<Field name="taxIdentificationNumber">
{({ value, valid, error, onChange, onBlur }) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export const OnboardingIndividualEmail = ({
<Field name="tcuAccepted">
{({ value, error, onChange }) => (
<Pressable
role="checkbox"
aria-checked={value}
onPress={() => onChange(!value)}
style={styles.tcuCheckbox}
Expand Down
2 changes: 1 addition & 1 deletion scripts/twilio/getLastMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getLastMessages } from "../../tests/utils/twilio";
const startDate = new Date();
startDate.setMinutes(startDate.getMinutes() - 15);

getLastMessages({ startDate })
getLastMessages(startDate)
.then(messages => console.log(messages.join(EOL)))
.catch(error => {
console.error(error);
Expand Down
103 changes: 103 additions & 0 deletions tests/0-individual-onboarding.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { expect, test } from "@playwright/test";
import { env } from "./utils/env";
import { sca } from "./utils/sca";
import { getSession } from "./utils/session";

test("French individual onboarding", async ({ browser, page }) => {
const { benady } = await getSession();

await page.goto(`${env.ONBOARDING_URL}/onboarding/individual/start?accountCountry=FRA`);
await page.getByRole("button", { name: "Next" }).click();

await page.getByLabel("What's your email?").fill(benady.email);

await page.getByRole("button", { name: "Next" }).click();

await page.getByRole("button", { name: "Enter manually" }).click();
await page.getByLabel("Type your personal home address").fill("95 Av. du Président Wilson");
await page.getByLabel("City").fill("Montreuil");
await page.getByLabel("Postcode").fill("93100");

await page.getByRole("button", { name: "Next" }).click();

await page.getByLabel("What's your current occupation?").click();
await page.getByRole("option", { name: "Entrepreneur" }).click();
await page.getByText("Between €3000 and €4500").click();

await page.getByRole("button", { name: "Next" }).click();

const startDate = new Date();
await page.getByRole("button", { name: "Finalize" }).click();
await sca.consent(browser, startDate);

await expect(page).toHaveURL(new RegExp("^" + env.BANKING_URL));
});

test("German individual onboarding", async ({ browser, page }) => {
const { benady } = await getSession();

await page.goto(`${env.ONBOARDING_URL}/onboarding/individual/start?accountCountry=DEU`);
await page.getByRole("button", { name: "Next" }).click();

await page.getByLabel("What's your email?").fill(benady.email);
await page.getByRole("checkbox").check();

await page.getByRole("button", { name: "Next" }).click();

await page.waitForLoadState("networkidle");
await page.getByLabel("Type your personal home address").fill("Pariser Platz 5 Berlin");
await page.getByText("Pariser Platz 5").click();

expect(await page.getByLabel("City").inputValue()).toBe("Berlin");
expect(await page.getByLabel("Postcode").inputValue()).toBe("10117");

await page.getByRole("button", { name: "Next" }).click();

await page.getByLabel("What's your current occupation?").click();
await page.getByRole("option", { name: "Entrepreneur" }).click();
await page.getByText("Between €3000 and €4500").click();
await page.getByLabel("Tax identification number").fill("00000000000");

await page.getByRole("button", { name: "Next" }).click();

const startDate = new Date();
await page.getByRole("button", { name: "Finalize" }).click();
await sca.consent(browser, startDate);

await expect(page).toHaveURL(new RegExp("^" + env.BANKING_URL));
});

test("Spanish individual onboarding", async ({ browser, page }) => {
const { benady } = await getSession();

await page.goto(`${env.ONBOARDING_URL}/onboarding/individual/start?accountCountry=ESP`);
await page.getByRole("button", { name: "Next" }).click();

await page.getByLabel("What's your email?").fill(benady.email);

await page.getByRole("button", { name: "Next" }).click();

await page.getByRole("button", { name: "Enter manually" }).click();

await page
.getByLabel("Type your personal home address")
.fill("Carrer de la Riera de Sant Miquel");

await page.getByLabel("City").fill("Barcelona");
await page.getByLabel("Postcode").fill("08006");

await page.getByRole("button", { name: "Next" }).click();

await page.getByLabel("What's your current occupation?").click();
await page.getByRole("option", { name: "Entrepreneur" }).click();
await page.getByText("Between €3000 and €4500").click();
await page.getByLabel("Tax identification number").fill("xxxxxxxxx");

await page.getByRole("button", { name: "Next" }).click();

const startDate = new Date();
await page.getByRole("button", { name: "Finalize" }).click();
await sca.consent(browser, startDate);

await expect(page).toHaveURL(new RegExp("^" + env.BANKING_URL));
});
7 changes: 0 additions & 7 deletions tests/0-onboarding.spec.ts

This file was deleted.

Loading