Skip to content

Commit

Permalink
Fix E2E setup (#4772)
Browse files Browse the repository at this point in the history
## 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 <[email protected]>
  • Loading branch information
shadowsheep1 and sabontech authored Jul 14, 2023
1 parent cdf050f commit 73d6653
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions e2e/globalSetup.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion ts/__e2e__/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ export const e2ePinChar6 = "6";
type DetoxLaunchAppConfig = Parameters<typeof device.launchApp>[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" }
};
2 changes: 1 addition & 1 deletion ts/__e2e__/payment.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")))
Expand Down

0 comments on commit 73d6653

Please sign in to comment.