From 73d66530e5b41c2221b35c3cde98a00cc99bd38c Mon Sep 17 00:00:00 2001 From: Fabio Bombardi <16268789+shadowsheep1@users.noreply.github.com> Date: Fri, 14 Jul 2023 10:16:02 +0200 Subject: [PATCH] Fix E2E setup (#4772) ## Short description This PR forces the `it_IT` language and locale to the current running application, to avoid language misconfiguration during tests. ## List of changes proposed in this pull request See commit list ## How to test E2E test should run fine ([GA action success run here](https://github.com/pagopa/io-app/actions/runs/5523172958)). Try run E2E tests on your machine. All tests must succeed. --------- Co-authored-by: SabPicariello <114305019+SabPicariello@users.noreply.github.com> --- e2e/globalSetup.js | 6 ++++-- ts/__e2e__/config.ts | 4 +++- ts/__e2e__/payment.e2e.ts | 2 +- .../wallet/onboarding/__e2e__/creditCardOnboarding.e2e.ts | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/e2e/globalSetup.js b/e2e/globalSetup.js index ff824b1e902..e37ff98baa3 100644 --- a/e2e/globalSetup.js +++ b/e2e/globalSetup.js @@ -1,8 +1,10 @@ -const { setLocale } = require("../ts/i18n"); -const { launchAppConfig } = require("../ts/__e2e__/config"); +/* eslint-disable no-undef */ +import { setLocale } from "../ts/i18n"; +import { launchAppConfig } from "../ts/__e2e__/config"; beforeAll(async () => { // custom setup + // eslint-disable-next-line no-console console.log("Initializing Detox"); await device.launchApp(launchAppConfig); // enforce IT locale because that's how the API are configured diff --git a/ts/__e2e__/config.ts b/ts/__e2e__/config.ts index df5105bc989..ecee6c278de 100644 --- a/ts/__e2e__/config.ts +++ b/ts/__e2e__/config.ts @@ -15,5 +15,7 @@ export const e2ePinChar6 = "6"; type DetoxLaunchAppConfig = Parameters[0]; export const launchAppConfig: DetoxLaunchAppConfig = { - permissions: { notifications: "YES", camera: "YES", photos: "YES" } + permissions: { notifications: "YES", camera: "YES", photos: "YES" }, + // enforce IT locale because that's how the API are configured + languageAndLocale: { language: "it_IT", locale: "it_IT" } }; diff --git a/ts/__e2e__/payment.e2e.ts b/ts/__e2e__/payment.e2e.ts index 8f40038316a..2586a887670 100644 --- a/ts/__e2e__/payment.e2e.ts +++ b/ts/__e2e__/payment.e2e.ts @@ -107,7 +107,7 @@ describe("Payment", () => { await element(matchNoticeCodeInput).typeText("123123123123123123"); await element(by.id("EntityCodeInputMask")).typeText("12345678901"); // Close the keyboard - await element(by.label("Done")).atIndex(0).tap(); + await element(by.label("Fine")).atIndex(0).tap(); await element(by.text(I18n.t("global.buttons.continue"))).tap(); diff --git a/ts/features/wallet/onboarding/__e2e__/creditCardOnboarding.e2e.ts b/ts/features/wallet/onboarding/__e2e__/creditCardOnboarding.e2e.ts index 75ff136ed60..27ec8188c1f 100644 --- a/ts/features/wallet/onboarding/__e2e__/creditCardOnboarding.e2e.ts +++ b/ts/features/wallet/onboarding/__e2e__/creditCardOnboarding.e2e.ts @@ -55,7 +55,7 @@ describe("Credit Card onboarding", () => { await element(by.id("securityCodeInputMask")).typeText("123"); // Close the keyboard - await element(by.label("Done")).atIndex(0).tap(); + await element(by.label("Fine")).atIndex(0).tap(); await element(by.text(I18n.t("global.buttons.continue"))).tap(); await waitFor(element(by.id("saveOrContinueButton")))