From 5baa099f337d38347305dc48f5660f575ee2e800 Mon Sep 17 00:00:00 2001 From: ludwiczakpawel Date: Mon, 14 Feb 2022 13:17:14 +0100 Subject: [PATCH] Spec fix (#16431) --- app/views/admin/pages/_form.html.erb | 1 - .../adminFlows/pages/landingPage.spec.js | 30 ++++++++++++++----- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/app/views/admin/pages/_form.html.erb b/app/views/admin/pages/_form.html.erb index 3b451fb40..22d977d68 100644 --- a/app/views/admin/pages/_form.html.erb +++ b/app/views/admin/pages/_form.html.erb @@ -67,7 +67,6 @@
<%= form.check_box :landing_page, class: "crayons-checkbox", "aria-describedby": "lock-screen-description", data: { - testid: "private-checkbox", "landing-page-modal-target": "landingPageCheckbox", action: (@landing_page.present? ? "landing-page-modal#openModal" : "") } %> diff --git a/cypress/integration/seededFlows/adminFlows/pages/landingPage.spec.js b/cypress/integration/seededFlows/adminFlows/pages/landingPage.spec.js index 80d6a2eeb..7bf702b1b 100644 --- a/cypress/integration/seededFlows/adminFlows/pages/landingPage.spec.js +++ b/cypress/integration/seededFlows/adminFlows/pages/landingPage.spec.js @@ -28,7 +28,9 @@ describe('Set a landing page from the admin portal', () => { it('should set a landing page when no other landing page exists', () => { cy.findAllByRole('link', { name: 'Edit' }).first().click(); - cy.findByTestId('private-checkbox').check(); + cy.findByRole('checkbox', { + name: "Use as 'Locked Screen' Determines if this page will be used as a landing page for anonymous viewers.", + }).check(); cy.findByRole('button', { name: 'Update Page' }).click(); // Verify that the form has submitted and the page has changed to the confirmation page @@ -41,10 +43,14 @@ describe('Set a landing page from the admin portal', () => { it('should overwrite the landing page when choosing to set a new landing page', () => { cy.findAllByRole('link', { name: 'Edit' }).first().click(); - cy.findByTestId('private-checkbox'); + cy.findByRole('checkbox', { + name: "Use as 'Locked Screen' Determines if this page will be used as a landing page for anonymous viewers.", + }); // Set landing page cy.findByRole('main').within(() => { - cy.findByTestId('private-checkbox').check(); + cy.findByRole('checkbox', { + name: "Use as 'Locked Screen' Determines if this page will be used as a landing page for anonymous viewers.", + }).check(); cy.findByRole('button', { name: 'Update Page' }).click(); }); @@ -65,10 +71,14 @@ describe('Set a landing page from the admin portal', () => { cy.findAllByRole('link', { name: 'Edit' }).eq(1).click(); }); - cy.findByTestId('private-checkbox'); + cy.findByRole('checkbox', { + name: "Use as 'Locked Screen' Determines if this page will be used as a landing page for anonymous viewers.", + }); // Change landing page cy.findByRole('main').within(() => { - cy.findByTestId('private-checkbox').check(); + cy.findByRole('checkbox', { + name: "Use as 'Locked Screen' Determines if this page will be used as a landing page for anonymous viewers.", + }).check(); cy.findAllByRole('button', { name: 'Overwrite current locked screen', @@ -100,7 +110,10 @@ describe('Set a landing page from the admin portal', () => { // Set landing page cy.findByRole('main').within(() => { - cy.findAllByTestId('private-checkbox').first().check(); + cy.findByRole('checkbox', { + name: "Use as 'Locked Screen' Determines if this page will be used as a landing page for anonymous viewers.", + }) + .check(); cy.findAllByRole('button', { name: 'Update Page' }).first().click(); }); @@ -124,7 +137,10 @@ describe('Set a landing page from the admin portal', () => { // Change landing page but then Cancel cy.findByRole('main').within(() => { - cy.findAllByTestId('private-checkbox').first().check(); + cy.findByRole('checkbox', { + name: "Use as 'Locked Screen' Determines if this page will be used as a landing page for anonymous viewers.", + }) + .check(); cy.findAllByRole('button', { name: 'Cancel' }).first().click();