This commit is contained in:
ludwiczakpawel 2022-02-14 13:17:14 +01:00 committed by GitHub
parent 29b17e4bf9
commit 5baa099f33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 8 deletions

View file

@ -67,7 +67,6 @@
<div class="crayons-field crayons-field--checkbox">
<%= 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" : "")
} %>

View file

@ -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();