Skip to content

Commit

Permalink
Merge branch 'master' into IOBP-489-fe-rimozione-riferimenti-a-bonus-…
Browse files Browse the repository at this point in the history
…cashback-da-flussi-in-app
  • Loading branch information
forrest57 authored Jan 24, 2024
2 parents 8ab4941 + d34be63 commit bc2e7bc
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 21 deletions.
7 changes: 4 additions & 3 deletions ts/__e2e__/payment.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import I18n from "../i18n";
import { formatNumberCentsToAmount } from "../utils/stringBuilder";
import { e2eWaitRenderTimeout } from "./config";
import { ensureLoggedIn } from "./utils";
import { closeKeyboard, ensureLoggedIn } from "./utils";

describe("Payment", () => {
beforeEach(async () => {
await device.reloadReactNative();
await device.launchApp({ newInstance: true });
await ensureLoggedIn();
});

Expand Down Expand Up @@ -106,8 +106,9 @@ describe("Payment", () => {

await element(matchNoticeCodeInput).typeText("123123123123123123");
await element(by.id("EntityCodeInputMask")).typeText("12345678901");

// Close the keyboard
await element(by.label("Fine")).atIndex(0).tap();
await closeKeyboard();

await element(by.text(I18n.t("global.buttons.continue"))).tap();

Expand Down
10 changes: 10 additions & 0 deletions ts/__e2e__/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,13 @@ export const ensureLoggedIn = async () => {
await loginWithSPID();
}
};

export const closeKeyboard = async () => {
// Sometimes the device ignores the locale set by the detox setup
// In such case we can try to close the keyboard using the english translation
try {
await element(by.label("Fine")).atIndex(0).tap();
} catch (e) {
await element(by.label("Done")).atIndex(0).tap();
}
};
1 change: 1 addition & 0 deletions ts/components/wallet/WalletHomeHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const useWalletHomeHeaderBottomSheet = (): IOBottomSheetModal => {
const navigationListItems: ReadonlyArray<NavigationListItem> = [
{
title: I18n.t("wallet.paymentMethod"),
testId: "wallet.paymentMethod",
subtitle: I18n.t("wallet.paymentMethodDesc"),
onPress: () =>
navigateToWalletAddPaymentMethod({
Expand Down
2 changes: 1 addition & 1 deletion ts/features/bonus/cgn/__e2e__/cgn.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const activateBonusSuccess = async () => {

describe("CGN", () => {
beforeEach(async () => {
await device.reloadReactNative();
await device.launchApp({ newInstance: true });
await ensureLoggedIn();
});

Expand Down
7 changes: 1 addition & 6 deletions ts/features/bonus/cgn/components/detail/CgnUnsubscribe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { isError, isReady } from "../../../../../common/model/RemoteValue";
import { navigateBack } from "../../../../../store/actions/navigation";
import { cgnDetails } from "../../store/actions/details";
import { IOToast } from "../../../../../components/Toast";
import { skipToastShowingDueToE2ECrash } from "./ToastPatch";

const CgnUnsubscribe = () => {
const dispatch = useIODispatch();
Expand Down Expand Up @@ -39,11 +38,7 @@ const CgnUnsubscribe = () => {
if (isReady(unsubscriptionStatus)) {
navigateBack();
dispatch(cgnDetails.request());
// This is needed to prevent a crash while running E2E tests. Showing
// the toast causes random crashes upon calling device.reloadReactNative
if (!skipToastShowingDueToE2ECrash) {
IOToast.success(I18n.t("bonus.cgn.activation.deactivate.toast"));
}
IOToast.success(I18n.t("bonus.cgn.activation.deactivate.toast"));
}
if (isError(unsubscriptionStatus) && !isFirstRender.current) {
IOToast.error(I18n.t("global.genericError"));
Expand Down
1 change: 0 additions & 1 deletion ts/features/bonus/cgn/components/detail/ToastPatch.e2e.ts

This file was deleted.

1 change: 0 additions & 1 deletion ts/features/bonus/cgn/components/detail/ToastPatch.ts

This file was deleted.

2 changes: 1 addition & 1 deletion ts/features/euCovidCert/__e2e__/euCovidCertExpired.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const learnMoreLinkTestId = "euCovidCertLearnMoreLink";

describe("EuCovidCert Expired", () => {
beforeAll(async () => {
await device.reloadReactNative();
await device.launchApp({ newInstance: true });
await ensureLoggedIn();
});

Expand Down
2 changes: 1 addition & 1 deletion ts/features/euCovidCert/__e2e__/euCovidCertRevoked.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const learnMoreLinkTestId = "euCovidCertLearnMoreLink";

describe("EuCovidCert Revoked", () => {
beforeAll(async () => {
await device.reloadReactNative();
await device.launchApp({ newInstance: true });
await ensureLoggedIn();
});

Expand Down
2 changes: 1 addition & 1 deletion ts/features/euCovidCert/__e2e__/euCovidCertValid.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const fullScreenQrCodeTestId = "fullScreenQRCode";

describe("EuCovidCert Valid", () => {
beforeAll(async () => {
await device.reloadReactNative();
await device.launchApp({ newInstance: true });
await ensureLoggedIn();
});

Expand Down
2 changes: 1 addition & 1 deletion ts/features/messages/__e2e__/messages.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ensureLoggedIn } from "../../../__e2e__/utils";

describe("Messages Screen", () => {
beforeEach(async () => {
await device.reloadReactNative();
await device.launchApp({ newInstance: true });
await ensureLoggedIn();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { e2eWaitRenderTimeout } from "../../../../__e2e__/config";
import { ensureLoggedIn } from "../../../../__e2e__/utils";
import { closeKeyboard, ensureLoggedIn } from "../../../../__e2e__/utils";
import I18n from "../../../../i18n";

describe("Credit Card onboarding", () => {
beforeEach(async () => {
await device.reloadReactNative();
await device.launchApp({ newInstance: true });
await ensureLoggedIn();
});

Expand All @@ -24,12 +24,12 @@ describe("Credit Card onboarding", () => {
// Button "+ Add"
await element(by.id("walletAddNewPaymentMethodTestId")).tap();

await waitFor(element(by.text(I18n.t("wallet.paymentMethod"))))
await waitFor(element(by.id("wallet.paymentMethod")))
.toBeVisible()
.withTimeout(e2eWaitRenderTimeout);

// Add payment method listItem in bottomSheet
await element(by.text(I18n.t("wallet.paymentMethod"))).tap();
await element(by.id("wallet.paymentMethod")).tap();

await waitFor(element(by.text(I18n.t("wallet.methods.card.name"))))
.toBeVisible()
Expand All @@ -51,7 +51,7 @@ describe("Credit Card onboarding", () => {
await element(by.id("securityCodeInputMask")).typeText("123");

// Close the keyboard
await element(by.label("Fine")).atIndex(0).tap();
await closeKeyboard();
await element(by.text(I18n.t("global.buttons.continue"))).tap();

await waitFor(element(by.id("saveOrContinueButton")))
Expand Down

0 comments on commit bc2e7bc

Please sign in to comment.