From 99aa596b400d369173c07b440b9de78119a7bcc0 Mon Sep 17 00:00:00 2001 From: Andrew Snaith Date: Mon, 31 Jan 2022 15:32:16 -0800 Subject: [PATCH 1/9] add new ui tests for annual and monthly billing options --- .../modals/billing/planDetailsModal.ts | 1 + .../cypress/tests/subscription-plan-spec.ts | 63 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/packages/files-ui/cypress/support/page-objects/modals/billing/planDetailsModal.ts b/packages/files-ui/cypress/support/page-objects/modals/billing/planDetailsModal.ts index 0168e4a545..072a0c7706 100644 --- a/packages/files-ui/cypress/support/page-objects/modals/billing/planDetailsModal.ts +++ b/packages/files-ui/cypress/support/page-objects/modals/billing/planDetailsModal.ts @@ -6,6 +6,7 @@ export const planDetailsModal = { storageDetailsLabel: () => cy.get("[data-cy=label-storage-details]"), billingLabel: () => cy.get("[data-cy=label-billing]"), billingStartDate: () => cy.get("[data-cy=label-billing-start-date]"), + annualBillingLabel: () => cy.get("[data-cy=label-annual-billing]"), durationToggleSwitch: () => cy.get("[data-testid=toggle-switch-duration]"), totalCostLabel: () => cy.get("[data-cy=label-total-cost]"), selectThisPlanButton: () => cy.get("[data-testid=button-select-this-plan]"), diff --git a/packages/files-ui/cypress/tests/subscription-plan-spec.ts b/packages/files-ui/cypress/tests/subscription-plan-spec.ts index daa3854905..024f741185 100644 --- a/packages/files-ui/cypress/tests/subscription-plan-spec.ts +++ b/packages/files-ui/cypress/tests/subscription-plan-spec.ts @@ -205,6 +205,8 @@ describe("Subscription Plan", () => { planDetailsModal.storageDetailsLabel().should("be.visible") planDetailsModal.billingLabel().should("be.visible") planDetailsModal.billingStartDate().should("be.visible") + planDetailsModal.annualBillingLabel().should("be.visible") + planDetailsModal.durationToggleSwitch().should("be.visible") planDetailsModal.totalCostLabel().should("be.visible") planDetailsModal.selectThisPlanButton().should("be.visible") planDetailsModal.goBackButton().should("be.visible") @@ -214,6 +216,67 @@ describe("Subscription Plan", () => { selectPlanModal.body().should("be.visible") }) + it("can toggle between monthly and annual billing price", () => { + cy.web3Login({ deleteCreditCard: true, resetToFreePlan: true }) + navigationMenu.settingsNavButton().click() + settingsPage.subscriptionTabButton().click() + settingsPage.changePlanButton().click() + + selectPlanModal.planBoxContainer().contains("Standard plan") + .should("be.visible") + .as("standardPlanBox") + + cy.get("@standardPlanBox").parent().within(() => { + selectPlanModal.selectPlanButton().click() + }) + + // retrieve the monthly plan data as cypress alias for later comparison + planDetailsModal.totalCostLabel().invoke("text").as("monthlyBillingPrice") + + // toggle to enable annual billing + planDetailsModal.durationToggleSwitch().click() + planDetailsModal.totalCostLabel().invoke("text").as("yearlyBillingPrice") + + // price should update when switching to annual billing + cy.get("@monthlyBillingPrice").then(($monthlyBillingPrice) => { + cy.get("@yearlyBillingPrice").should("not.equal", $monthlyBillingPrice) + }) + }) + + it("can only choose crypto as a payment option for annual billing", () => { + cy.web3Login({ deleteCreditCard: true, resetToFreePlan: true }) + navigationMenu.settingsNavButton().click() + settingsPage.subscriptionTabButton().click() + settingsPage.changePlanButton().click() + + selectPlanModal.planBoxContainer().contains("Standard plan") + .should("be.visible") + .as("standardPlanBox") + + cy.get("@standardPlanBox").parent().within(() => { + selectPlanModal.selectPlanButton().click() + }) + + // ensure the crypto option cannot be selected for monthly billing + planDetailsModal.selectThisPlanButton().click() + selectPaymentMethodModal.cryptoRadioInput() + .should("be.visible") + .click() + selectPaymentMethodModal.selectPaymentButton().should("be.disabled") + selectPaymentMethodModal.goBackButton().click() + + // toggle to enable annual billing + planDetailsModal.durationToggleSwitch().click() + planDetailsModal.totalCostLabel().invoke("text").as("yearlyBillingPrice") + + // ensure the crypto option can be selected for annual billing + planDetailsModal.selectThisPlanButton().click() + selectPaymentMethodModal.cryptoRadioInput() + .should("be.visible") + .click() + selectPaymentMethodModal.selectPaymentButton().should("be.enabled") + }) + it("can upgrade the plan via credit card payment", () => { cy.web3Login({ deleteCreditCard: true, resetToFreePlan: true }) From 7a9e5e318e308381636b84bc92ec028faf6488cc Mon Sep 17 00:00:00 2001 From: Andrew Snaith Date: Fri, 4 Feb 2022 19:58:40 -0800 Subject: [PATCH 2/9] add new element identifiers for downgrade details modal --- .../page-objects/modals/billing/downgradeDetailsModal.ts | 9 +++++++++ .../cypress/support/page-objects/settingsPage.ts | 1 + .../SubscriptionTab/ChangePlan/DowngradeDetails.tsx | 7 +++++++ .../Modules/Settings/SubscriptionTab/CurrentPlan.tsx | 1 + 4 files changed, 18 insertions(+) create mode 100644 packages/files-ui/cypress/support/page-objects/modals/billing/downgradeDetailsModal.ts diff --git a/packages/files-ui/cypress/support/page-objects/modals/billing/downgradeDetailsModal.ts b/packages/files-ui/cypress/support/page-objects/modals/billing/downgradeDetailsModal.ts new file mode 100644 index 0000000000..f18b7146e1 --- /dev/null +++ b/packages/files-ui/cypress/support/page-objects/modals/billing/downgradeDetailsModal.ts @@ -0,0 +1,9 @@ +export const downgradeDetailsModal = { + body: () => cy.get("[data-testid=modal-container-downgradeDetails]", { timeout: 10000 }), + downgradePlanHeader: () => cy.get("[data-cy=header-downgrade-plan]"), + lostFeaturesSummaryLabel: () => cy.get("[data-cy=label-lost-features-summary]"), + downgradedStorageLabel: () => cy.get("[data-cy=label-downgraded-storage-description]"), + goBackButton: () => cy.get("[data-testid=button-go-back-to-plan-selection]"), + switchToFreePlanButton: () => cy.get("[data-testid=button-switch-to-free-plan]"), + switchPlanButton: () => cy.get("[data-testid=button-switch-plan]") +} \ No newline at end of file diff --git a/packages/files-ui/cypress/support/page-objects/settingsPage.ts b/packages/files-ui/cypress/support/page-objects/settingsPage.ts index c9ba15e3b6..8bbcb2ce2d 100644 --- a/packages/files-ui/cypress/support/page-objects/settingsPage.ts +++ b/packages/files-ui/cypress/support/page-objects/settingsPage.ts @@ -21,6 +21,7 @@ export const settingsPage = { // subscription tab subscriptionTabButton: () => cy.get("[data-testid=tab-subscription]"), + planNameLabel: () => cy.get("[data-cy=label-plan-name]"), addCardButton: () => cy.get("[data-testid=button-add-a-card]"), updateCardButton: () => cy.get("[data-testid=button-update-a-card]"), defaultCardLabel: () => cy.get("[data-cy=label-default-card]"), diff --git a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/ChangePlan/DowngradeDetails.tsx b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/ChangePlan/DowngradeDetails.tsx index 3f97cdbe6a..685760d095 100644 --- a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/ChangePlan/DowngradeDetails.tsx +++ b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/ChangePlan/DowngradeDetails.tsx @@ -124,6 +124,7 @@ const DowngradeDetails = ({ plan, goBack, goToPlanDetails, shouldCancelPlan, onC Change plan @@ -133,6 +134,7 @@ const DowngradeDetails = ({ plan, goBack, goToPlanDetails, shouldCancelPlan, onC variant="body1" component="p" className={classes.featuresTitle} + data-cy="label-lost-features-summary" > You would lose the following features: @@ -142,6 +144,7 @@ const DowngradeDetails = ({ plan, goBack, goToPlanDetails, shouldCancelPlan, onC {currentStorage ? {currentStorage} of storage @@ -154,6 +157,7 @@ const DowngradeDetails = ({ plan, goBack, goToPlanDetails, shouldCancelPlan, onC {currentSubscription?.product.description} @@ -166,6 +170,7 @@ const DowngradeDetails = ({ plan, goBack, goToPlanDetails, shouldCancelPlan, onC onClick={goBack} variant="text" disabled={isCancelingPlan} + testId="go-back-to-plan-selection" > Go back @@ -176,12 +181,14 @@ const DowngradeDetails = ({ plan, goBack, goToPlanDetails, shouldCancelPlan, onC onClick={onCancelPlan} loading={isCancelingPlan} disabled={isCancelingPlan} + testId="switch-to-free-plan" > Switch to Free plan : diff --git a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/CurrentPlan.tsx b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/CurrentPlan.tsx index 17dc9e2897..87b8ace9c7 100644 --- a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/CurrentPlan.tsx +++ b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/CurrentPlan.tsx @@ -80,6 +80,7 @@ const CurrentPlan = ({ className }: ICurrentProduct) => { variant="h4" component="h4" className={classes.heading} + data-cy="label-plan-name" > {currentSubscription?.product.name}{isPendingInvoice && ` ${t`(Awaiting payment)`}`} From 0343c336174db01b774f8633d6c97bf856617766 Mon Sep 17 00:00:00 2001 From: Andrew Snaith Date: Sun, 6 Feb 2022 19:09:52 -0800 Subject: [PATCH 3/9] add test to downgrade subscription plan --- .../cypress/tests/subscription-plan-spec.ts | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/packages/files-ui/cypress/tests/subscription-plan-spec.ts b/packages/files-ui/cypress/tests/subscription-plan-spec.ts index 024f741185..3171581a06 100644 --- a/packages/files-ui/cypress/tests/subscription-plan-spec.ts +++ b/packages/files-ui/cypress/tests/subscription-plan-spec.ts @@ -13,6 +13,7 @@ import { selectPaymentMethodModal } from "../support/page-objects/modals/billing import { planChangeConfirmationModal } from "../support/page-objects/modals/billing/planChangeConfirmationModal" import { planChangeSuccessModal } from "../support/page-objects/modals/billing/planChangeSuccessModal" import { billingHistoryPage } from "../support/page-objects/billingHistoryPage" +import { downgradeDetailsModal } from "../support/page-objects/modals/billing/downgradeDetailsModal" describe("Subscription Plan", () => { @@ -315,6 +316,8 @@ describe("Subscription Plan", () => { // for reliability wait for stripe and default card responses / requests cy.awaitStripeConfirmation() cy.awaitDefaultCardRequest() + cardAddedToast.body().should("be.visible") + cardAddedToast.closeButton().click() selectPaymentMethodModal.selectPaymentButton().click() @@ -369,5 +372,90 @@ describe("Subscription Plan", () => { }) }) }) + + it("can downgrade from premium plan to standard plan", () => { + cy.web3Login({ deleteCreditCard: true, resetToFreePlan: true }) + + // upgrade the account first + navigationMenu.settingsNavButton().click() + settingsPage.subscriptionTabButton().click() + settingsPage.changePlanButton().click() + selectPlanModal.body().should("be.visible") + selectPlanModal.planBoxContainer().should("have.length.greaterThan", 0) + selectPlanModal.planBoxContainer().contains("Premium plan") + .should("be.visible") + .as("premiumPlanBox") + selectPlanModal.planBoxContainer().contains("Standard plan") + .should("be.visible") + .as("standardPlanBox") + + cy.get("@premiumPlanBox").parent().within(() => { + selectPlanModal.selectPlanButton().click() + }) + planDetailsModal.selectThisPlanButton().click() + selectPaymentMethodModal.body().should("be.visible") + selectPaymentMethodModal.addCardTextButton() + .should("be.visible") + .click() + cy.awaitStripeElementReady() + selectPaymentMethodModal.cardNumberInput().type(visaNumber) + selectPaymentMethodModal.expiryDateInput().type(visaExpiry) + selectPaymentMethodModal.cvcNumberInput().type(visaCvc) + selectPaymentMethodModal.useThisCardButton().click() + cy.awaitStripeConfirmation() + cy.awaitDefaultCardRequest() + cardAddedToast.body().should("be.visible") + cardAddedToast.closeButton().click() + selectPaymentMethodModal.selectPaymentButton().click() + planChangeConfirmationModal.confirmPlanChangeButton().click() + planChangeSuccessModal.body().should("be.visible") + planChangeSuccessModal.closeButton() + .should("be.visible") + .safeClick() + + // store the upgraded plan name for later comparison + settingsPage.planNameLabel() + .should("be.visible") + .as("upgradedPlanName") + .invoke("text").as("upgradedPlanName") + + // initiate the downgrade process + settingsPage.changePlanButton().click() + selectPlanModal.planBoxContainer().should("have.length.greaterThan", 0) + cy.get("@standardPlanBox").parent().within(() => { + selectPlanModal.selectPlanButton().click() + }) + + // ensure the downgraded plan details are shown + downgradeDetailsModal.body().should("be.visible") + downgradeDetailsModal.downgradePlanHeader().should("be.visible") + downgradeDetailsModal.lostFeaturesSummaryLabel().should("be.visible") + downgradeDetailsModal.downgradedStorageLabel().should("be.visible") + downgradeDetailsModal.goBackButton().should("be.visible") + downgradeDetailsModal.switchToFreePlanButton().should("not.exist") + + // proceed with the switch to downgrade + downgradeDetailsModal.switchPlanButton() + .should("be.visible") + .click() + planDetailsModal.selectThisPlanButton().click() + selectPaymentMethodModal.selectPaymentButton().click() + planChangeConfirmationModal.confirmPlanChangeButton().click() + planChangeSuccessModal.body().should("be.visible") + planChangeSuccessModal.closeButton() + .should("be.visible") + .safeClick() + + // store the downgraded plan name for later comparison + settingsPage.planNameLabel() + .should("be.visible") + .as("upgradedPlanName") + .invoke("text").as("downgradedPlanName") + + // ensure the downgraded plan name is not the same as the previously upgraded plan + cy.get("@upgradedPlanName").then(($upgradedPlanName) => { + cy.get("@downgradedPlanName").should("not.equal", $upgradedPlanName) + }) + }) }) }) \ No newline at end of file From 6e533c3cb3285aef488bdf12cb00839c7ed44712 Mon Sep 17 00:00:00 2001 From: Andrew Snaith Date: Mon, 7 Feb 2022 20:03:25 -0800 Subject: [PATCH 4/9] address pr feedback --- .../modals/billing/selectPlanModal.ts | 16 ++- .../support/page-objects/settingsPage.ts | 42 ++++++- .../cypress/tests/subscription-plan-spec.ts | 103 +++++++++--------- 3 files changed, 107 insertions(+), 54 deletions(-) diff --git a/packages/files-ui/cypress/support/page-objects/modals/billing/selectPlanModal.ts b/packages/files-ui/cypress/support/page-objects/modals/billing/selectPlanModal.ts index 8d585f5c22..c933549121 100644 --- a/packages/files-ui/cypress/support/page-objects/modals/billing/selectPlanModal.ts +++ b/packages/files-ui/cypress/support/page-objects/modals/billing/selectPlanModal.ts @@ -9,5 +9,19 @@ export const selectPlanModal = { monthlyPriceLabel: () => cy.get("[data-cy=label-monthly-price]"), yearlyPriceLabel: () => cy.get("[data-cy=label-yearly-price]"), storageDescriptionLabel: () => cy.get("[data-cy=label-storage-capacity-amount]"), - storageCapacityWarningLabel: () => cy.get("[data-cy=label-storage-capacity-warning]") + storageCapacityWarningLabel: () => cy.get("[data-cy=label-storage-capacity-warning]"), + + // creates a cypress alias for each individual plan. + createPlanCypressAliases() { + this.planBoxContainer().should("have.length.greaterThan", 0) + this.planBoxContainer().contains("Free plan") + .should("be.visible") + .as("freePlanBox") + this.planBoxContainer().contains("Standard plan") + .should("be.visible") + .as("standardPlanBox") + this.planBoxContainer().contains("Premium plan") + .should("be.visible") + .as("premiumPlanBox") + } } diff --git a/packages/files-ui/cypress/support/page-objects/settingsPage.ts b/packages/files-ui/cypress/support/page-objects/settingsPage.ts index 8bbcb2ce2d..2cab1390dc 100644 --- a/packages/files-ui/cypress/support/page-objects/settingsPage.ts +++ b/packages/files-ui/cypress/support/page-objects/settingsPage.ts @@ -1,4 +1,11 @@ import { basePage } from "./basePage" +import { visaNumber, visaExpiry, visaCvc } from "../../fixtures/cardData" +import { cardAddedToast } from "../../support/page-objects/toasts/cardAddedToast" +import { selectPlanModal } from "../../support/page-objects/modals/billing/selectPlanModal" +import { planDetailsModal } from "../../support/page-objects/modals/billing/planDetailsModal" +import { selectPaymentMethodModal } from "../../support/page-objects/modals/billing/selectPaymentMethodModal" +import { planChangeConfirmationModal } from "../../support/page-objects/modals/billing/planChangeConfirmationModal" +import { planChangeSuccessModal } from "../../support/page-objects/modals/billing/planChangeSuccessModal" export const settingsPage = { ...basePage, @@ -27,5 +34,38 @@ export const settingsPage = { defaultCardLabel: () => cy.get("[data-cy=label-default-card]"), noCardLabel: () => cy.get("[data-cy=label-no-card]"), removeCardLink: () => cy.get("[data-cy=link-remove-card]"), - changePlanButton: () => cy.get("[data-cy=button-change-plan]", { timeout: 10000 }) + changePlanButton: () => cy.get("[data-cy=button-change-plan]", { timeout: 10000 }), + + // use this convenience function when an upgraded account is required as a test requisite + upgradeSubscription(plan: "standard" | "premium") { + const planContainer = plan === "standard" ? "@standardPlanBox" : "@premiumPlanBox" + + this.subscriptionTabButton().click() + this.changePlanButton().click() + selectPlanModal.body().should("be.visible") + selectPlanModal.createPlanCypressAliases() + cy.get(planContainer).parent().within(() => { + selectPlanModal.selectPlanButton().click() + }) + planDetailsModal.selectThisPlanButton().click() + selectPaymentMethodModal.body().should("be.visible") + selectPaymentMethodModal.addCardTextButton() + .should("be.visible") + .click() + cy.awaitStripeElementReady() + selectPaymentMethodModal.cardNumberInput().type(visaNumber) + selectPaymentMethodModal.expiryDateInput().type(visaExpiry) + selectPaymentMethodModal.cvcNumberInput().type(visaCvc) + selectPaymentMethodModal.useThisCardButton().click() + cy.awaitStripeConfirmation() + cy.awaitDefaultCardRequest() + cardAddedToast.body().should("be.visible") + cardAddedToast.closeButton().click() + selectPaymentMethodModal.selectPaymentButton().click() + planChangeConfirmationModal.confirmPlanChangeButton().click() + planChangeSuccessModal.body().should("be.visible") + planChangeSuccessModal.closeButton() + .should("be.visible") + .safeClick() + } } diff --git a/packages/files-ui/cypress/tests/subscription-plan-spec.ts b/packages/files-ui/cypress/tests/subscription-plan-spec.ts index 3171581a06..98a879f8ef 100644 --- a/packages/files-ui/cypress/tests/subscription-plan-spec.ts +++ b/packages/files-ui/cypress/tests/subscription-plan-spec.ts @@ -154,15 +154,7 @@ describe("Subscription Plan", () => { selectPlanModal.planBoxContainer().should("have.length.greaterThan", 0) // create cypress aliases for the plans - selectPlanModal.planBoxContainer().contains("Free plan") - .should("be.visible") - .as("freePlanBox") - selectPlanModal.planBoxContainer().contains("Standard plan") - .should("be.visible") - .as("standardPlanBox") - selectPlanModal.planBoxContainer().contains("Premium plan") - .should("be.visible") - .as("premiumPlanBox") + selectPlanModal.createPlanCypressAliases() // ensure all plan boxes contain expected elements and element state cy.get("@freePlanBox").parent().within(() => { @@ -223,9 +215,8 @@ describe("Subscription Plan", () => { settingsPage.subscriptionTabButton().click() settingsPage.changePlanButton().click() - selectPlanModal.planBoxContainer().contains("Standard plan") - .should("be.visible") - .as("standardPlanBox") + // create cypress aliases for the plans + selectPlanModal.createPlanCypressAliases() cy.get("@standardPlanBox").parent().within(() => { selectPlanModal.selectPlanButton().click() @@ -376,36 +367,35 @@ describe("Subscription Plan", () => { it("can downgrade from premium plan to standard plan", () => { cy.web3Login({ deleteCreditCard: true, resetToFreePlan: true }) - // upgrade the account first + // upgrade to a premium plan first using convenience function navigationMenu.settingsNavButton().click() - settingsPage.subscriptionTabButton().click() - settingsPage.changePlanButton().click() - selectPlanModal.body().should("be.visible") - selectPlanModal.planBoxContainer().should("have.length.greaterThan", 0) - selectPlanModal.planBoxContainer().contains("Premium plan") - .should("be.visible") - .as("premiumPlanBox") - selectPlanModal.planBoxContainer().contains("Standard plan") + settingsPage.upgradeSubscription("premium") + + // store the upgraded plan name for later comparison + settingsPage.planNameLabel() .should("be.visible") - .as("standardPlanBox") + .invoke("text").as("premiumPlanName") - cy.get("@premiumPlanBox").parent().within(() => { + // initiate the downgrade process + settingsPage.changePlanButton().click() + selectPlanModal.planBoxContainer().should("have.length.greaterThan", 0) + cy.get("@standardPlanBox").parent().within(() => { selectPlanModal.selectPlanButton().click() }) - planDetailsModal.selectThisPlanButton().click() - selectPaymentMethodModal.body().should("be.visible") - selectPaymentMethodModal.addCardTextButton() + + // ensure the downgraded plan details are shown + downgradeDetailsModal.body().should("be.visible") + downgradeDetailsModal.downgradePlanHeader().should("be.visible") + downgradeDetailsModal.lostFeaturesSummaryLabel().should("be.visible") + downgradeDetailsModal.downgradedStorageLabel().should("be.visible") + downgradeDetailsModal.goBackButton().should("be.visible") + downgradeDetailsModal.switchToFreePlanButton().should("not.exist") + + // proceed with the switch to downgrade + downgradeDetailsModal.switchPlanButton() .should("be.visible") .click() - cy.awaitStripeElementReady() - selectPaymentMethodModal.cardNumberInput().type(visaNumber) - selectPaymentMethodModal.expiryDateInput().type(visaExpiry) - selectPaymentMethodModal.cvcNumberInput().type(visaCvc) - selectPaymentMethodModal.useThisCardButton().click() - cy.awaitStripeConfirmation() - cy.awaitDefaultCardRequest() - cardAddedToast.body().should("be.visible") - cardAddedToast.closeButton().click() + planDetailsModal.selectThisPlanButton().click() selectPaymentMethodModal.selectPaymentButton().click() planChangeConfirmationModal.confirmPlanChangeButton().click() planChangeSuccessModal.body().should("be.visible") @@ -413,16 +403,33 @@ describe("Subscription Plan", () => { .should("be.visible") .safeClick() - // store the upgraded plan name for later comparison + // store the downgraded plan name for later comparison + settingsPage.planNameLabel() + .should("be.visible") + .invoke("text").as("standardPlanName") + + // ensure the downgraded plan name is not the same as the previously upgraded plan + cy.get("@premiumPlanName").then(($premiumPlanName) => { + cy.get("@standardPlanName").should("not.equal", $premiumPlanName) + }) + }) + + it("can downgrade from standard plan to free plan", () => { + cy.web3Login({ deleteCreditCard: true, resetToFreePlan: true }) + + // upgrade to a standard plan first + navigationMenu.settingsNavButton().click() + settingsPage.upgradeSubscription("standard") + + // store the standard plan name for later comparison settingsPage.planNameLabel() .should("be.visible") - .as("upgradedPlanName") - .invoke("text").as("upgradedPlanName") + .invoke("text").as("standardPlanName") // initiate the downgrade process settingsPage.changePlanButton().click() selectPlanModal.planBoxContainer().should("have.length.greaterThan", 0) - cy.get("@standardPlanBox").parent().within(() => { + cy.get("@freePlanBox").parent().within(() => { selectPlanModal.selectPlanButton().click() }) @@ -432,29 +439,21 @@ describe("Subscription Plan", () => { downgradeDetailsModal.lostFeaturesSummaryLabel().should("be.visible") downgradeDetailsModal.downgradedStorageLabel().should("be.visible") downgradeDetailsModal.goBackButton().should("be.visible") - downgradeDetailsModal.switchToFreePlanButton().should("not.exist") + downgradeDetailsModal.switchPlanButton().should("not.exist") // proceed with the switch to downgrade - downgradeDetailsModal.switchPlanButton() + downgradeDetailsModal.switchToFreePlanButton() .should("be.visible") .click() - planDetailsModal.selectThisPlanButton().click() - selectPaymentMethodModal.selectPaymentButton().click() - planChangeConfirmationModal.confirmPlanChangeButton().click() - planChangeSuccessModal.body().should("be.visible") - planChangeSuccessModal.closeButton() - .should("be.visible") - .safeClick() // store the downgraded plan name for later comparison settingsPage.planNameLabel() .should("be.visible") - .as("upgradedPlanName") - .invoke("text").as("downgradedPlanName") + .invoke("text").as("freePlanName") // ensure the downgraded plan name is not the same as the previously upgraded plan - cy.get("@upgradedPlanName").then(($upgradedPlanName) => { - cy.get("@downgradedPlanName").should("not.equal", $upgradedPlanName) + cy.get("@standardPlanName").then(($standardPlanName) => { + cy.get("@freePlanName").should("not.equal", $standardPlanName) }) }) }) From e595c1b0e3089e269d933ec9125bfa6fbd6e092f Mon Sep 17 00:00:00 2001 From: Andrew Snaith Date: Wed, 9 Feb 2022 21:41:43 -0800 Subject: [PATCH 5/9] add test for returning to pay crypto invoice --- .../page-objects/billingHistoryPage.ts | 4 +- .../modals/billing/cryptoPaymentModal.ts | 24 +++++++ .../billing/planChangeConfirmationModal.ts | 9 ++- .../support/page-objects/settingsPage.ts | 3 + .../cypress/tests/subscription-plan-spec.ts | 65 ++++++++++++++++- .../SubscriptionTab/BillingHistory.tsx | 5 +- .../SubscriptionTab/Common/ConfirmPlan.tsx | 5 +- .../SubscriptionTab/Common/CryptoPayment.tsx | 71 +++++++++++++------ .../PayInvoice/PayInvoiceModal.tsx | 2 +- 9 files changed, 158 insertions(+), 30 deletions(-) create mode 100644 packages/files-ui/cypress/support/page-objects/modals/billing/cryptoPaymentModal.ts diff --git a/packages/files-ui/cypress/support/page-objects/billingHistoryPage.ts b/packages/files-ui/cypress/support/page-objects/billingHistoryPage.ts index 54baba4cff..cc14fbddb3 100644 --- a/packages/files-ui/cypress/support/page-objects/billingHistoryPage.ts +++ b/packages/files-ui/cypress/support/page-objects/billingHistoryPage.ts @@ -3,6 +3,6 @@ import { basePage } from "./basePage" export const billingHistoryPage = { ...basePage, billingHistoryHeader: () => cy.get("[data-cy=header-billing-history]"), - downloadInvoiceButton: () => cy.get("[data-testid=button-download-invoice]"), - payInvoiceButton: () => cy.get("[data-testid=button-pay-invoice]") + viewPdfButton: () => cy.get("[data-testid=button-download-invoice]"), + payNowButton: () => cy.get("[data-testid=button-pay-invoice]") } \ No newline at end of file diff --git a/packages/files-ui/cypress/support/page-objects/modals/billing/cryptoPaymentModal.ts b/packages/files-ui/cypress/support/page-objects/modals/billing/cryptoPaymentModal.ts new file mode 100644 index 0000000000..520846dc58 --- /dev/null +++ b/packages/files-ui/cypress/support/page-objects/modals/billing/cryptoPaymentModal.ts @@ -0,0 +1,24 @@ +export const cryptoPaymentModal = { + body: () => cy.get("[data-testid=modal-container-cryptoPayment]", { timeout: 10000 }), + closeButton: () => cy.get("[data-testid=button-close-modal-cryptoPayment]"), + payWithCryptoHeader: () => cy.get("[data-cy=header-pay-with-crypto]"), + cryptoPaymentTimer: () => cy.get("[data-cy=container-crypto-time-remaining]"), + totalLabel: () => cy.get("[data-cy=label-total-crypto-title]", { timeout: 10000 }), + totalPriceLabel: () => cy.get("[data-cy=label-total-crypto-price]"), + crypoPaymentErrorLabel: () => cy.get("[data-cy=label-crypto-payment-error]"), + selectCryptocurrencyLabel: () => cy.get("[data-cy=label-select-cryptocurrency]"), + cryptoPaymentButton: () => cy.get("[data-cy=container-crypto-payment-option]"), + + // elements below only shown after crypto payment button has been clicked + receivingQrCodeContainer: () => cy.get("[data-cy=container-qr-code]"), + currencyTypeWarning: () => cy.get("[data-cy=label-currency-type-warning]"), + destinationAddressLabelTitle: () => cy.get("[data-cy=label-destination-address-title]"), + destinationAddressLabel: () => cy.get("[data-cy=label-destination-address]"), + cryptoAmountTitleLabel: () => cy.get("[data-cy=label-crypto-amount-title]"), + cryptoAmountLabel: () => cy.get("[data-cy=label-crypto-amount]"), + crypoFinalSaleWarningLabel: () => cy.get("[data-cy=label-crypto-final-sale-warning]"), + goBackButton: () => cy.get("[data-testid=button-go-back-to-crypto-selection]"), + switchNetworkButton: () => cy.get("[data-testid=button-switch-network]"), + connectWalletButton: () => cy.get("[data-testid=button-connect-wallet]") +} + diff --git a/packages/files-ui/cypress/support/page-objects/modals/billing/planChangeConfirmationModal.ts b/packages/files-ui/cypress/support/page-objects/modals/billing/planChangeConfirmationModal.ts index 087b584d5a..6ceb1d1773 100644 --- a/packages/files-ui/cypress/support/page-objects/modals/billing/planChangeConfirmationModal.ts +++ b/packages/files-ui/cypress/support/page-objects/modals/billing/planChangeConfirmationModal.ts @@ -13,7 +13,12 @@ export const planChangeConfirmationModal = { totalLabel: () => cy.get("[data-cy=label-total-title]"), totalPriceLabel: () => cy.get("[data-cy=label-total-price]"), changePlanErrorLabel: () => cy.get("[data-cy=label-change-plan-error]"), - planPaymentWarningLabel: () => cy.get("[data-cy=label-change-plan-payment-warning]"), goBackButton: () => cy.get("[data-testid=button-go-back-to-payment-method]"), - confirmPlanChangeButton: () => cy.get("[data-testid=button-confirm-plan-change]") + confirmPlanChangeButton: () => cy.get("[data-testid=button-confirm-plan-change]"), + + // elements are only displayed if the payment type is crypto + payWithCryptoLabel: () => cy.get("[data-cy=label-pay-with-crypto]"), + acceptedCurrenciesLabel: () => cy.get("[data-cy=label-accepted-currencies]"), + acceptedCryptoTypes: () => cy.get("[data-cy=label-accepted-crypto-types]"), + cryptoFinalSaleWarningLabel: () => cy.get("[data-cy=label-crypto-final-sale-warning]") } \ No newline at end of file diff --git a/packages/files-ui/cypress/support/page-objects/settingsPage.ts b/packages/files-ui/cypress/support/page-objects/settingsPage.ts index 2cab1390dc..3ef3ef642c 100644 --- a/packages/files-ui/cypress/support/page-objects/settingsPage.ts +++ b/packages/files-ui/cypress/support/page-objects/settingsPage.ts @@ -35,6 +35,9 @@ export const settingsPage = { noCardLabel: () => cy.get("[data-cy=label-no-card]"), removeCardLink: () => cy.get("[data-cy=link-remove-card]"), changePlanButton: () => cy.get("[data-cy=button-change-plan]", { timeout: 10000 }), + allInvoicesLink: () => cy.get("[data-cy=link-all-invoices]"), + viewPdfButton: () => cy.get("[data-testid=button-download-invoice]"), + payNowButton: () => cy.get("[data-testid=button-pay-invoice]"), // use this convenience function when an upgraded account is required as a test requisite upgradeSubscription(plan: "standard" | "premium") { diff --git a/packages/files-ui/cypress/tests/subscription-plan-spec.ts b/packages/files-ui/cypress/tests/subscription-plan-spec.ts index 98a879f8ef..642b7ed94f 100644 --- a/packages/files-ui/cypress/tests/subscription-plan-spec.ts +++ b/packages/files-ui/cypress/tests/subscription-plan-spec.ts @@ -14,6 +14,7 @@ import { planChangeConfirmationModal } from "../support/page-objects/modals/bill import { planChangeSuccessModal } from "../support/page-objects/modals/billing/planChangeSuccessModal" import { billingHistoryPage } from "../support/page-objects/billingHistoryPage" import { downgradeDetailsModal } from "../support/page-objects/modals/billing/downgradeDetailsModal" +import { cryptoPaymentModal } from "../support/page-objects/modals/billing/cryptoPaymentModal" describe("Subscription Plan", () => { @@ -355,7 +356,7 @@ describe("Subscription Plan", () => { expect($request).to.be.null }) - billingHistoryPage.downloadInvoiceButton().first().click() + billingHistoryPage.viewPdfButton().first().click() // ensure the download request contains pdf content cy.wait("@downloadRequest").its("response.headers").should("contain", { @@ -456,5 +457,67 @@ describe("Subscription Plan", () => { cy.get("@freePlanName").should("not.equal", $standardPlanName) }) }) + + it("can initiate and return to a crypto payment flow within 60 minutes", () => { + cy.web3Login({ deleteCreditCard: true, resetToFreePlan: true }) + navigationMenu.settingsNavButton().click() + settingsPage.subscriptionTabButton().click() + settingsPage.changePlanButton().click() + selectPlanModal.createPlanCypressAliases() + cy.get("@standardPlanBox").parent().within(() => { + selectPlanModal.selectPlanButton().click() + }) + + // choose crypto as payment type + planDetailsModal.durationToggleSwitch().click() + planDetailsModal.selectThisPlanButton().click() + selectPaymentMethodModal.cryptoRadioInput() + .should("be.visible") + .click() + selectPaymentMethodModal.selectPaymentButton().click() + + // ensure crypto payment specific elements are displayed + planChangeConfirmationModal.body().should("be.visible") + planChangeConfirmationModal.payWithCryptoLabel().should("be.visible") + planChangeConfirmationModal.acceptedCurrenciesLabel().should("be.visible") + planChangeConfirmationModal.acceptedCryptoTypes().should("be.visible") + planChangeConfirmationModal.cryptoFinalSaleWarningLabel().should("be.visible") + planChangeConfirmationModal.confirmPlanChangeButton().click() + + // ensure default crypto elements are displayed + cryptoPaymentModal.body().should("be.visible") + cryptoPaymentModal.payWithCryptoHeader().should("be.visible") + cryptoPaymentModal.totalLabel().should("be.visible") + cryptoPaymentModal.cryptoPaymentTimer().should("be.visible") + cryptoPaymentModal.totalPriceLabel().should("be.visible") + cryptoPaymentModal.selectCryptocurrencyLabel().should("be.visible") + + // choose a crypto currency + cryptoPaymentModal.cryptoPaymentButton().contains("Ethereum").click() + + // ensure additional modal elements are displayed after crypto type is selected + cryptoPaymentModal.receivingQrCodeContainer().should("be.visible") + cryptoPaymentModal.currencyTypeWarning().should("be.visible") + cryptoPaymentModal.destinationAddressLabelTitle().should("be.visible") + cryptoPaymentModal.destinationAddressLabel().should("be.visible") + cryptoPaymentModal.cryptoAmountTitleLabel().should("be.visible") + cryptoPaymentModal.cryptoAmountLabel().should("be.visible") + cryptoPaymentModal.crypoFinalSaleWarningLabel().should("be.visible") + cryptoPaymentModal.goBackButton().should("be.visible") + cryptoPaymentModal.connectWalletButton().should("be.visible") + + // close modal, ensure we can return to flow via "pay now" on settings page + cryptoPaymentModal.closeButton().click() + cryptoPaymentModal.body().should("not.exist") + settingsPage.payNowButton().click() + cryptoPaymentModal.body().should("be.visible") + + // close modal, ensure we can return to flow via "pay now" on billing history page + cryptoPaymentModal.closeButton().click() + cryptoPaymentModal.body().should("not.exist") + settingsPage.allInvoicesLink().click() + billingHistoryPage.payNowButton().click() + cryptoPaymentModal.body().should("be.visible") + }) }) }) \ No newline at end of file diff --git a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/BillingHistory.tsx b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/BillingHistory.tsx index a2f78d2f55..cda0540d37 100644 --- a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/BillingHistory.tsx +++ b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/BillingHistory.tsx @@ -48,7 +48,10 @@ const BillingHistory = () => { component="p" className={classes.link} > - + All invoices diff --git a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/ConfirmPlan.tsx b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/ConfirmPlan.tsx index c848028c4b..c16f72847b 100644 --- a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/ConfirmPlan.tsx +++ b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/ConfirmPlan.tsx @@ -226,6 +226,7 @@ const ConfirmPlan = ({ Pay with Crypto @@ -247,6 +248,7 @@ const ConfirmPlan = ({ Accepted currencies @@ -254,6 +256,7 @@ const ConfirmPlan = ({ DAI, USDC, ETH or BTC @@ -308,7 +311,7 @@ const ConfirmPlan = ({ variant="body1" component="p" className={classes.warningText} - data-cy="label-change-plan-payment-warning" + data-cy="label-crypto-final-sale-warning" > {paymentMethod === "crypto" diff --git a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx index e737eb6ff9..bb3712d548 100644 --- a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx +++ b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx @@ -368,15 +368,19 @@ const CryptoPayment = ({ planPrice }: ICryptoPayment) => { variant="h5" component="h4" className={classes.heading} + data-cy="header-pay-with-crypto" > Pay with crypto - {cryptoPayment &&
+ {cryptoPayment &&
}
@@ -388,6 +392,7 @@ const CryptoPayment = ({ planPrice }: ICryptoPayment) => { component="p" variant="body1" className={classes.error} + data-cy="label-crypto-payment-error" > Failed to create a charge @@ -395,9 +400,11 @@ const CryptoPayment = ({ planPrice }: ICryptoPayment) => { {cryptoPayment && pendingCryptoInvoice && <>
- Total + + Total +
- + {pendingCryptoInvoice.currency?.toUpperCase()} {pendingCryptoInvoice.amount}
@@ -405,8 +412,12 @@ const CryptoPayment = ({ planPrice }: ICryptoPayment) => { {!selectedCurrency && currencies && <> - Select a cryptocurrency -
+ + Select a cryptocurrency + +
{currencies.map(c => { const CurrencyIcon = iconMap[c] || null return } {selectedCurrency && selectedCurrency !== "bitcoin" && !isReady && - + } {selectedCurrency && selectedCurrency !== "bitcoin" && isReady && network !== 1 && - } {selectedCurrency && selectedCurrency !== "bitcoin" && isReady && network === 1 && - + }
diff --git a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/PayInvoice/PayInvoiceModal.tsx b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/PayInvoice/PayInvoiceModal.tsx index bf35e8bb66..5e2bb6f075 100644 --- a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/PayInvoice/PayInvoiceModal.tsx +++ b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/PayInvoice/PayInvoiceModal.tsx @@ -68,7 +68,7 @@ const PayInvoiceModal = ({ onClose, invoiceId }: IChangeProductModal) => { injectedClass={{ inner: classes.inner }} - testId="pay-invoice" + testId="cryptoPayment" onClose={onClose} > {invoiceToPay?.payment_method === "crypto" From ac8d9a74af629b184ea64808234520ae8278c5ec Mon Sep 17 00:00:00 2001 From: Andrew Snaith Date: Wed, 9 Feb 2022 21:58:25 -0800 Subject: [PATCH 6/9] fix misc mistakes --- .../billing/planChangeConfirmationModal.ts | 4 ++-- .../cypress/tests/subscription-plan-spec.ts | 3 ++- .../SubscriptionTab/Common/ConfirmPlan.tsx | 2 +- .../SubscriptionTab/Common/CryptoPayment.tsx | 16 ++++++++-------- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/packages/files-ui/cypress/support/page-objects/modals/billing/planChangeConfirmationModal.ts b/packages/files-ui/cypress/support/page-objects/modals/billing/planChangeConfirmationModal.ts index 6ceb1d1773..8024b834d0 100644 --- a/packages/files-ui/cypress/support/page-objects/modals/billing/planChangeConfirmationModal.ts +++ b/packages/files-ui/cypress/support/page-objects/modals/billing/planChangeConfirmationModal.ts @@ -15,10 +15,10 @@ export const planChangeConfirmationModal = { changePlanErrorLabel: () => cy.get("[data-cy=label-change-plan-error]"), goBackButton: () => cy.get("[data-testid=button-go-back-to-payment-method]"), confirmPlanChangeButton: () => cy.get("[data-testid=button-confirm-plan-change]"), + finalSaleWarningLabel: () => cy.get("[data-cy=label-final-sale-warning]"), // elements are only displayed if the payment type is crypto payWithCryptoLabel: () => cy.get("[data-cy=label-pay-with-crypto]"), acceptedCurrenciesLabel: () => cy.get("[data-cy=label-accepted-currencies]"), - acceptedCryptoTypes: () => cy.get("[data-cy=label-accepted-crypto-types]"), - cryptoFinalSaleWarningLabel: () => cy.get("[data-cy=label-crypto-final-sale-warning]") + acceptedCryptoTypes: () => cy.get("[data-cy=label-accepted-crypto-types]") } \ No newline at end of file diff --git a/packages/files-ui/cypress/tests/subscription-plan-spec.ts b/packages/files-ui/cypress/tests/subscription-plan-spec.ts index 642b7ed94f..7225c7a67e 100644 --- a/packages/files-ui/cypress/tests/subscription-plan-spec.ts +++ b/packages/files-ui/cypress/tests/subscription-plan-spec.ts @@ -327,6 +327,7 @@ describe("Subscription Plan", () => { planChangeConfirmationModal.billingStartDate().should("be.visible") planChangeConfirmationModal.totalLabel().should("be.visible") planChangeConfirmationModal.totalPriceLabel().should("be.visible") + planChangeConfirmationModal.finalSaleWarningLabel().should("be.visible") planChangeConfirmationModal.goBackButton().should("be.visible") planChangeConfirmationModal.confirmPlanChangeButton().should("be.visible") @@ -481,7 +482,7 @@ describe("Subscription Plan", () => { planChangeConfirmationModal.payWithCryptoLabel().should("be.visible") planChangeConfirmationModal.acceptedCurrenciesLabel().should("be.visible") planChangeConfirmationModal.acceptedCryptoTypes().should("be.visible") - planChangeConfirmationModal.cryptoFinalSaleWarningLabel().should("be.visible") + planChangeConfirmationModal.finalSaleWarningLabel().should("be.visible") planChangeConfirmationModal.confirmPlanChangeButton().click() // ensure default crypto elements are displayed diff --git a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/ConfirmPlan.tsx b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/ConfirmPlan.tsx index c16f72847b..90f893c60c 100644 --- a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/ConfirmPlan.tsx +++ b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/ConfirmPlan.tsx @@ -311,7 +311,7 @@ const ConfirmPlan = ({ variant="body1" component="p" className={classes.warningText} - data-cy="label-crypto-final-sale-warning" + data-cy="label-final-sale-warning" > {paymentMethod === "crypto" diff --git a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx index bb3712d548..59f7442646 100644 --- a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx +++ b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx @@ -530,14 +530,14 @@ const CryptoPayment = ({ planPrice }: ICryptoPayment) => { } {selectedCurrency && selectedCurrency !== "bitcoin" && isReady && network === 1 && - + }
From 5e1bf1edd6d6c260b84524a7dde4298c5f7db467 Mon Sep 17 00:00:00 2001 From: Andrew Snaith Date: Wed, 9 Feb 2022 22:06:41 -0800 Subject: [PATCH 7/9] re-add accidentally removed test steps --- .../page-objects/modals/billing/downgradeDetailsModal.ts | 1 + packages/files-ui/cypress/tests/subscription-plan-spec.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/packages/files-ui/cypress/support/page-objects/modals/billing/downgradeDetailsModal.ts b/packages/files-ui/cypress/support/page-objects/modals/billing/downgradeDetailsModal.ts index f18b7146e1..35bcf54e73 100644 --- a/packages/files-ui/cypress/support/page-objects/modals/billing/downgradeDetailsModal.ts +++ b/packages/files-ui/cypress/support/page-objects/modals/billing/downgradeDetailsModal.ts @@ -3,6 +3,7 @@ export const downgradeDetailsModal = { downgradePlanHeader: () => cy.get("[data-cy=header-downgrade-plan]"), lostFeaturesSummaryLabel: () => cy.get("[data-cy=label-lost-features-summary]"), downgradedStorageLabel: () => cy.get("[data-cy=label-downgraded-storage-description]"), + downgradePaymentWarningLabel: () => cy.get("[data-cy=label-downgrade-payment-warning]"), goBackButton: () => cy.get("[data-testid=button-go-back-to-plan-selection]"), switchToFreePlanButton: () => cy.get("[data-testid=button-switch-to-free-plan]"), switchPlanButton: () => cy.get("[data-testid=button-switch-plan]") diff --git a/packages/files-ui/cypress/tests/subscription-plan-spec.ts b/packages/files-ui/cypress/tests/subscription-plan-spec.ts index 7225c7a67e..4a35dfc872 100644 --- a/packages/files-ui/cypress/tests/subscription-plan-spec.ts +++ b/packages/files-ui/cypress/tests/subscription-plan-spec.ts @@ -390,6 +390,7 @@ describe("Subscription Plan", () => { downgradeDetailsModal.downgradePlanHeader().should("be.visible") downgradeDetailsModal.lostFeaturesSummaryLabel().should("be.visible") downgradeDetailsModal.downgradedStorageLabel().should("be.visible") + downgradeDetailsModal.downgradePaymentWarningLabel().should("be.visible") downgradeDetailsModal.goBackButton().should("be.visible") downgradeDetailsModal.switchToFreePlanButton().should("not.exist") @@ -440,6 +441,7 @@ describe("Subscription Plan", () => { downgradeDetailsModal.downgradePlanHeader().should("be.visible") downgradeDetailsModal.lostFeaturesSummaryLabel().should("be.visible") downgradeDetailsModal.downgradedStorageLabel().should("be.visible") + downgradeDetailsModal.downgradePaymentWarningLabel().should("be.visible") downgradeDetailsModal.goBackButton().should("be.visible") downgradeDetailsModal.switchPlanButton().should("not.exist") From 899ed71f6d870e50bdaeaedafb8fba0c74d264c8 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> Date: Fri, 11 Feb 2022 11:24:41 +0000 Subject: [PATCH 8/9] Apply suggestions from code review --- .../Settings/SubscriptionTab/Common/CryptoPayment.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx index 59f7442646..a02627f161 100644 --- a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx +++ b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx @@ -374,7 +374,8 @@ const CryptoPayment = ({ planPrice }: ICryptoPayment) => { {cryptoPayment &&
+ data-cy="container-crypto-time-remaining" + > { {!selectedCurrency && currencies && <> - Select a cryptocurrency + Select a cryptocurrency
Date: Fri, 11 Feb 2022 11:25:59 +0000 Subject: [PATCH 9/9] lingui extract --- packages/files-ui/src/locales/de/messages.po | 3 +++ packages/files-ui/src/locales/en/messages.po | 3 +++ packages/files-ui/src/locales/es/messages.po | 3 +++ packages/files-ui/src/locales/fr/messages.po | 3 +++ packages/files-ui/src/locales/no/messages.po | 3 +++ 5 files changed, 15 insertions(+) diff --git a/packages/files-ui/src/locales/de/messages.po b/packages/files-ui/src/locales/de/messages.po index ab58c86732..442d19bbb7 100644 --- a/packages/files-ui/src/locales/de/messages.po +++ b/packages/files-ui/src/locales/de/messages.po @@ -811,6 +811,9 @@ msgstr "Sicherheit" msgid "See payment info" msgstr "" +msgid "Select a cryptocurrency" +msgstr "" + msgid "Select a wallet" msgstr "" diff --git a/packages/files-ui/src/locales/en/messages.po b/packages/files-ui/src/locales/en/messages.po index 1fb42ef676..9c9d8d1423 100644 --- a/packages/files-ui/src/locales/en/messages.po +++ b/packages/files-ui/src/locales/en/messages.po @@ -814,6 +814,9 @@ msgstr "Security" msgid "See payment info" msgstr "See payment info" +msgid "Select a cryptocurrency" +msgstr "Select a cryptocurrency" + msgid "Select a wallet" msgstr "Select a wallet" diff --git a/packages/files-ui/src/locales/es/messages.po b/packages/files-ui/src/locales/es/messages.po index 36e19788ef..2b21593ac9 100644 --- a/packages/files-ui/src/locales/es/messages.po +++ b/packages/files-ui/src/locales/es/messages.po @@ -815,6 +815,9 @@ msgstr "Seguridad" msgid "See payment info" msgstr "" +msgid "Select a cryptocurrency" +msgstr "" + msgid "Select a wallet" msgstr "Seleccione una billetera" diff --git a/packages/files-ui/src/locales/fr/messages.po b/packages/files-ui/src/locales/fr/messages.po index f8a1b9ac77..27169a7106 100644 --- a/packages/files-ui/src/locales/fr/messages.po +++ b/packages/files-ui/src/locales/fr/messages.po @@ -815,6 +815,9 @@ msgstr "Sécurité" msgid "See payment info" msgstr "Voir les détails du paiement" +msgid "Select a cryptocurrency" +msgstr "" + msgid "Select a wallet" msgstr "Sélectionner un wallet" diff --git a/packages/files-ui/src/locales/no/messages.po b/packages/files-ui/src/locales/no/messages.po index e04458e89e..5dbd36e44d 100644 --- a/packages/files-ui/src/locales/no/messages.po +++ b/packages/files-ui/src/locales/no/messages.po @@ -811,6 +811,9 @@ msgstr "" msgid "See payment info" msgstr "" +msgid "Select a cryptocurrency" +msgstr "" + msgid "Select a wallet" msgstr ""