diff --git a/ghost/portal/src/components/pages/AccountPlanPage.test.js b/ghost/portal/src/components/pages/AccountPlanPage.test.js index d8f178d9e8..96127e01a1 100644 --- a/ghost/portal/src/components/pages/AccountPlanPage.test.js +++ b/ghost/portal/src/components/pages/AccountPlanPage.test.js @@ -46,23 +46,25 @@ const customSetup = (overrides) => { describe('Account Plan Page', () => { test('renders', () => { - const {monthlyCheckboxEl, yearlyCheckboxEl, chooseBtns} = setup(); - + const {monthlyCheckboxEl, yearlyCheckboxEl, queryAllByRole} = setup(); + const continueBtn = queryAllByRole('button', {name: 'Continue'}); expect(monthlyCheckboxEl).toBeInTheDocument(); expect(yearlyCheckboxEl).toBeInTheDocument(); - expect(chooseBtns).toHaveLength(1); + expect(continueBtn).toHaveLength(1); }); test('can choose plan and continue', async () => { const siteData = getSiteData({ products: getProductsData({numOfProducts: 1}) }); - const {mockOnActionFn, monthlyCheckboxEl, yearlyCheckboxEl, chooseBtns} = setup({site: siteData}); + const {mockOnActionFn, monthlyCheckboxEl, yearlyCheckboxEl, queryAllByRole} = setup({site: siteData}); + const continueBtn = queryAllByRole('button', {name: 'Continue'}); + fireEvent.click(monthlyCheckboxEl); expect(monthlyCheckboxEl.className).toEqual('gh-portal-btn active'); fireEvent.click(yearlyCheckboxEl); expect(yearlyCheckboxEl.className).toEqual('gh-portal-btn active'); - fireEvent.click(chooseBtns[0]); + fireEvent.click(continueBtn[0]); expect(mockOnActionFn).toHaveBeenCalledWith('checkoutPlan', {plan: siteData.products[0].yearlyPrice.id}); }); diff --git a/ghost/portal/src/tests/UpgradeFlow.test.js b/ghost/portal/src/tests/UpgradeFlow.test.js index c9842cbb6b..d6af1c9189 100644 --- a/ghost/portal/src/tests/UpgradeFlow.test.js +++ b/ghost/portal/src/tests/UpgradeFlow.test.js @@ -207,7 +207,7 @@ describe('Logged-in free member', () => { // added fake timeout for react state delay in setting plan await new Promise(r => setTimeout(r, 10)); - const submitButton = within(popupIframeDocument).queryByRole('button', {name: 'Choose'}); + const submitButton = within(popupIframeDocument).queryByRole('button', {name: 'Continue'}); fireEvent.click(submitButton); expect(ghostApi.member.checkoutPlan).toHaveBeenLastCalledWith({ @@ -244,7 +244,7 @@ describe('Logged-in free member', () => { // added fake timeout for react state delay in setting plan await new Promise(r => setTimeout(r, 10)); - const submitButton = within(popupIframeDocument).queryByRole('button', {name: 'Choose'}); + const submitButton = within(popupIframeDocument).queryByRole('button', {name: 'Continue'}); fireEvent.click(submitButton); expect(ghostApi.member.checkoutPlan).toHaveBeenLastCalledWith({