From 8d754127fa589c10dbb118281f781e3337ab5066 Mon Sep 17 00:00:00 2001 From: lauramekaj1 Date: Mon, 5 Aug 2024 17:09:13 +0200 Subject: [PATCH 01/14] validate data in list and excerpt view in forms page --- .../e2e/Forms/formListDataValidation.cy.js | 147 ++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 tests/cypress/e2e/Forms/formListDataValidation.cy.js diff --git a/tests/cypress/e2e/Forms/formListDataValidation.cy.js b/tests/cypress/e2e/Forms/formListDataValidation.cy.js new file mode 100644 index 0000000000..b56ab9aa0b --- /dev/null +++ b/tests/cypress/e2e/Forms/formListDataValidation.cy.js @@ -0,0 +1,147 @@ +describe("Forms page", () => { + const formidableFormsUrl = 'https://formidableforms.com/lite-upgrade/?utm_source=WordPress&utm_medium=top-bar&utm_campaign=liteplugin'; + const origin = Cypress.config('baseUrl'); + const formTitle = "Test Form"; + + beforeEach(() => { + cy.login(); + cy.visit('/wp-admin/admin.php?page=formidable'); + cy.createNewForm(formTitle); + cy.viewport(1280, 720); + }); + + it("should validate all data in list view", () => { + + cy.log("Validate all header data"); + cy.log("Validate the upgrade link"); + cy.get('.frm-upgrade-bar > a') + .should('have.text', 'upgrading to Pro') + .and('have.attr', 'href', formidableFormsUrl) + .then(link => { + cy.wrap(link).invoke('removeAttr', 'target').click(); + + cy.origin('https://formidableforms.com', { args: { formidableFormsUrl } }, ({ formidableFormsUrl }) => { + cy.location('href').should('eq', formidableFormsUrl); + }); + + cy.log("Navigate back to the original page"); + cy.visit('/wp-admin/admin.php?page=formidable'); + }); + + cy.log("Validate the header logo link"); + cy.get('a.frm-header-logo') + .should('have.attr', 'href', origin + "/wp-admin/admin.php?page=formidable") + .click(); + + cy.log("Validate the URL after clicking the header logo"); + cy.url().should('eq', origin + "/wp-admin/admin.php?page=formidable"); + + cy.log("Validate other header elements"); + cy.get('h1').should("contain", "Forms"); + cy.get('#frm-publishing > .frm-button-secondary').should("contain", "Import"); + cy.get('#frm-publishing > .button-primary').should("contain", "Add New"); + + cy.log("Validate all other elements shown in forms page"); + cy.get('.published > .current').should("contain", "My Forms"); + cy.get('.subsubsub > .trash > a').should("contain", "Trash"); + cy.get('#entry-search-input').should('exist'); + cy.get('#search-submit').should("contain", "Search"); + cy.get('#bulk-action-selector-top').should("contain", "Bulk Actions"); + cy.get('#doaction').should("contain", "Apply"); + + cy.log("Verify that table view in forms page is in list mode"); + cy.get('#view-switch-list').should("exist").click(); + + cy.log("Verify existence of the select all checkbox"); + cy.get('#cb-select-all-1').should("exist"); + + cy.log("Verify column names in the forms page"); + cy.get('#name > a').should("contain", "Form Title"); + cy.get('#entries').should("contain", "Entries"); + cy.get('#id > a > :nth-child(1)').should("contain", "ID"); + cy.get('#form_key > a > :nth-child(1)').should("contain", "Key"); + cy.get('#shortcode').should("contain", "Actions"); + cy.get('#created_at > a > :nth-child(1)').should("contain", "Date"); + + cy.log("Verify existence of a single row select checkbox"); + cy.get('[id^="cb-item-action-"]').should("exist"); + + cy.log("Verify list view data of the created form"); + cy.get('.id').should("exist"); + cy.get(`[id^="item-action-"] > .name > strong > .row-title:contains("${formTitle}")`) + .parents('[id^="item-action-"]') + .within(() => { + cy.get('.entries > a').should("contain", "0"); + cy.get('.name > strong > .row-title').should("contain", formTitle); + cy.get('.form_key').should("contain", "test-form"); + cy.get('.shortcode > div').should("exist"); + + const currentDate = new Date(); + const formattedDate = currentDate.toISOString().split('T')[0].replace(/-/g, '/'); + + cy.log("Find the element that displays the date and get its text content"); + cy.get('.created_at > abbr') + .invoke('text') + .then((dateText) => { + const dateMatch = dateText.match(/\d{4}\/\d{2}\/\d{2}/); + const displayedDate = dateMatch ? dateMatch[0] : ''; + expect(displayedDate).to.equal(formattedDate); + }); + }); + }); + + it("should validate all data in excerpt view", () => { + + cy.log("Verify that table view in forms page is in excerpt mode"); + cy.get('#view-switch-excerpt').should("exist").click(); + + cy.log("Verify existence of the select all checkbox"); + cy.get('#cb-select-all-1').should("exist"); + + cy.log("Verify column names in the forms page"); + cy.get('#name > a').should("contain", "Form Title"); + cy.get('#entries').should("contain", "Entries"); + cy.get('#id > a > :nth-child(1)').should("contain", "ID"); + cy.get('#form_key > a > :nth-child(1)').should("contain", "Key"); + cy.get('#shortcode').should("contain", "Actions"); + cy.get('#created_at > a > :nth-child(1)').should("contain", "Date"); + + cy.log("Verify existence of a single row select checkbox"); + cy.get('[id^="cb-item-action-"]').should("exist"); + + cy.log("Verify excerpt view data of the created form"); + cy.get('.id').should("exist"); + + cy.get(`[id^="item-action-"] > .name > strong > .row-title:contains("${formTitle}")`) + .parents('[id^="item-action-"]') + .within(() => { + cy.get('.name > strong > .row-title').should("contain", formTitle); + cy.get('.entries > a').should("contain", "0"); + cy.get('.form_key').should("contain", "test-form"); + cy.get('.shortcode > div').should("exist"); + + const currentDate = new Date(); + const formattedDate = currentDate.toISOString().split('T')[0].replace(/-/g, '/'); + + cy.log("Find the element that displays the date and get its title content"); + cy.get('.created_at > abbr') + .invoke('attr', 'title') + .then((dateTime) => { + const datePart = dateTime.split(' ')[0]; + expect(datePart).to.equal(formattedDate); + }); + + cy.log("Check that time exists in the
element"); + cy.get('.created_at > abbr') + .invoke('html') + .then((html) => { + const timePart = html.split('
')[1].trim(); + expect(timePart).to.not.be.empty; + }); + }); + }); + + afterEach(() => { + cy.deleteForm(); + }); +}); \ No newline at end of file From 6ba13d6282345aa59f6626c5fe8747a46b2756d7 Mon Sep 17 00:00:00 2001 From: lauramekaj1 Date: Mon, 5 Aug 2024 17:19:58 +0200 Subject: [PATCH 02/14] update file title and fix assertion --- ...ormListDataValidation.cy.js => formPageDataValidation.cy.js} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename tests/cypress/e2e/Forms/{formListDataValidation.cy.js => formPageDataValidation.cy.js} (99%) diff --git a/tests/cypress/e2e/Forms/formListDataValidation.cy.js b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js similarity index 99% rename from tests/cypress/e2e/Forms/formListDataValidation.cy.js rename to tests/cypress/e2e/Forms/formPageDataValidation.cy.js index b56ab9aa0b..33516d17dd 100644 --- a/tests/cypress/e2e/Forms/formListDataValidation.cy.js +++ b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js @@ -15,7 +15,7 @@ describe("Forms page", () => { cy.log("Validate all header data"); cy.log("Validate the upgrade link"); cy.get('.frm-upgrade-bar > a') - .should('have.text', 'upgrading to Pro') + .should('have.text', 'upgrading to PRO') .and('have.attr', 'href', formidableFormsUrl) .then(link => { cy.wrap(link).invoke('removeAttr', 'target').click(); From c47802e71ba02bff937b58e7b037b9732b4a588b Mon Sep 17 00:00:00 2001 From: lauramekaj1 Date: Mon, 5 Aug 2024 17:46:01 +0200 Subject: [PATCH 03/14] update tests per eslint error --- tests/cypress/e2e/Forms/formPageDataValidation.cy.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js index 33516d17dd..ffaf84eaa8 100644 --- a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js +++ b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js @@ -14,8 +14,8 @@ describe("Forms page", () => { cy.log("Validate all header data"); cy.log("Validate the upgrade link"); - cy.get('.frm-upgrade-bar > a') - .should('have.text', 'upgrading to PRO') + cy.get('.frm-upgrade-bar > a',{timeout:5000}) + .should('contain', 'upgrading to PRO') .and('have.attr', 'href', formidableFormsUrl) .then(link => { cy.wrap(link).invoke('removeAttr', 'target').click(); @@ -144,4 +144,4 @@ describe("Forms page", () => { afterEach(() => { cy.deleteForm(); }); -}); \ No newline at end of file +}); From ac91e69be6a2b69b93e34ed4d615c9e75e0ff0fe Mon Sep 17 00:00:00 2001 From: lauramekaj1 Date: Mon, 5 Aug 2024 18:00:43 +0200 Subject: [PATCH 04/14] update test --- tests/cypress/e2e/Forms/formPageDataValidation.cy.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js index ffaf84eaa8..b41f4e3bd1 100644 --- a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js +++ b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js @@ -11,11 +11,10 @@ describe("Forms page", () => { }); it("should validate all data in list view", () => { - cy.log("Validate all header data"); cy.log("Validate the upgrade link"); - cy.get('.frm-upgrade-bar > a',{timeout:5000}) - .should('contain', 'upgrading to PRO') + cy.get('.frm-upgrade-bar > a') + .should('have.text', 'upgrading to PRO') .and('have.attr', 'href', formidableFormsUrl) .then(link => { cy.wrap(link).invoke('removeAttr', 'target').click(); @@ -91,7 +90,6 @@ describe("Forms page", () => { }); it("should validate all data in excerpt view", () => { - cy.log("Verify that table view in forms page is in excerpt mode"); cy.get('#view-switch-excerpt').should("exist").click(); From 84759a7bde371aa60e9353866c8267a47aa0a8b3 Mon Sep 17 00:00:00 2001 From: lauramekaj1 Date: Mon, 5 Aug 2024 18:29:38 +0200 Subject: [PATCH 05/14] update test to fix eslint error --- tests/cypress/e2e/Forms/formPageDataValidation.cy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js index b41f4e3bd1..357b20734f 100644 --- a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js +++ b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js @@ -133,8 +133,8 @@ describe("Forms page", () => { cy.get('.created_at > abbr') .invoke('html') .then((html) => { - const timePart = html.split('
')[1].trim(); - expect(timePart).to.not.be.empty; + expect(html.split('
')[1].trim()).to.not.be.empty; + }); }); }); From 547cb0ac02cc1d5a4b5c67411e4c9a660a98c789 Mon Sep 17 00:00:00 2001 From: lauramekaj1 Date: Mon, 5 Aug 2024 18:55:49 +0200 Subject: [PATCH 06/14] update the formidableFormsUpgradeUrl --- tests/cypress/e2e/Forms/formPageDataValidation.cy.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js index 357b20734f..63204437dc 100644 --- a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js +++ b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js @@ -1,5 +1,5 @@ describe("Forms page", () => { - const formidableFormsUrl = 'https://formidableforms.com/lite-upgrade/?utm_source=WordPress&utm_medium=top-bar&utm_campaign=liteplugin'; + const formidableFormsUpgradeUrl = 'https://formidableforms.com/lite-upgrade/?utm_source=WordPress&utm_medium=settings-license&utm_campaign=liteplugin'; const origin = Cypress.config('baseUrl'); const formTitle = "Test Form"; @@ -15,12 +15,12 @@ describe("Forms page", () => { cy.log("Validate the upgrade link"); cy.get('.frm-upgrade-bar > a') .should('have.text', 'upgrading to PRO') - .and('have.attr', 'href', formidableFormsUrl) + .and('have.attr', 'href', formidableFormsUpgradeUrl) .then(link => { cy.wrap(link).invoke('removeAttr', 'target').click(); - cy.origin('https://formidableforms.com', { args: { formidableFormsUrl } }, ({ formidableFormsUrl }) => { - cy.location('href').should('eq', formidableFormsUrl); + cy.origin('https://formidableforms.com', { args: { formidableFormsUpgradeUrl } }, ({ formidableFormsUpgradeUrl }) => { + cy.location('href').should('eq', formidableFormsUpgradeUrl); }); cy.log("Navigate back to the original page"); From 0e0f264e6b7505437c493190ecdcf99343126cce Mon Sep 17 00:00:00 2001 From: lauramekaj1 Date: Mon, 5 Aug 2024 19:23:35 +0200 Subject: [PATCH 07/14] disable rule no-unused-expressions --- .eslintrc.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.json b/.eslintrc.json index 3584b5c464..7948cc0681 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -46,6 +46,7 @@ "camelcase": ["error", { "properties": "never" }], "lines-around-comment": "off", "react/display-name": "off", + "no-unused-expressions": "off", "react/jsx-curly-spacing": [ "error", { From 1f7e9895f2c03c7f6741e7943941e75a75ea477f Mon Sep 17 00:00:00 2001 From: lauramekaj1 Date: Tue, 6 Aug 2024 22:13:43 +0200 Subject: [PATCH 08/14] add getFormattedCurrentDate function --- .../e2e/Forms/formPageDataValidation.cy.js | 8 +++----- tests/cypress/support/commands.js | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js index 63204437dc..c943b1331b 100644 --- a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js +++ b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js @@ -74,9 +74,8 @@ describe("Forms page", () => { cy.get('.name > strong > .row-title').should("contain", formTitle); cy.get('.form_key').should("contain", "test-form"); cy.get('.shortcode > div').should("exist"); - - const currentDate = new Date(); - const formattedDate = currentDate.toISOString().split('T')[0].replace(/-/g, '/'); + + cy.getFormattedCurrentDate(); cy.log("Find the element that displays the date and get its text content"); cy.get('.created_at > abbr') @@ -118,8 +117,7 @@ describe("Forms page", () => { cy.get('.form_key').should("contain", "test-form"); cy.get('.shortcode > div').should("exist"); - const currentDate = new Date(); - const formattedDate = currentDate.toISOString().split('T')[0].replace(/-/g, '/'); + cy.getFormattedCurrentDate(); cy.log("Find the element that displays the date and get its title content"); cy.get('.created_at > abbr') diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 94e09f2123..227d038f7f 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -65,6 +65,22 @@ Cypress.Commands.add("openForm", () => { cy.get('.frm_field_list > #frm-nav-tabs > .frm-tabs > #frm_insert_fields_tab').should("contain", "Add Fields"); }); +Cypress.Commands.add("validateFormData", () => { + cy.get('.id').should("exist"); + cy.get(`[id^="item-action-"] > .name > strong > .row-title:contains("${formTitle}")`) + .parents('[id^="item-action-"]') + .within(() => { + cy.get('.name > strong > .row-title').should("contain", formTitle); + cy.get('.entries > a').should("contain", "0"); + cy.get('.form_key').should("contain", "test-form"); + cy.get('.shortcode > div').should("exist"); + const currentDate = new Date(); + const formattedDate = currentDate.toISOString().split('T')[0].replace(/-/g, '/'); + }); + }); - +Cypress.Commands.add("getFormattedCurrentDate", () => { + const currentDate = new Date(); + const formattedDate = currentDate.toISOString().split('T')[0].replace(/-/g, '/'); +}); \ No newline at end of file From 949b48eeb844991a58708d500a06616479f9e96d Mon Sep 17 00:00:00 2001 From: lauramekaj1 Date: Tue, 6 Aug 2024 23:17:33 +0200 Subject: [PATCH 09/14] fix tests to handle new added function --- .../e2e/Forms/formPageDataValidation.cy.js | 54 ++++++++++--------- tests/cypress/support/commands.js | 40 ++++++-------- 2 files changed, 44 insertions(+), 50 deletions(-) diff --git a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js index c943b1331b..7d36ee6780 100644 --- a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js +++ b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js @@ -74,17 +74,19 @@ describe("Forms page", () => { cy.get('.name > strong > .row-title').should("contain", formTitle); cy.get('.form_key').should("contain", "test-form"); cy.get('.shortcode > div').should("exist"); - - cy.getFormattedCurrentDate(); - - cy.log("Find the element that displays the date and get its text content"); - cy.get('.created_at > abbr') - .invoke('text') - .then((dateText) => { - const dateMatch = dateText.match(/\d{4}\/\d{2}\/\d{2}/); - const displayedDate = dateMatch ? dateMatch[0] : ''; - expect(displayedDate).to.equal(formattedDate); - }); + + cy.getCurrentFormattedDate().then((formattedDate) => { + cy.log('Formatted Date: ', formattedDate); + + cy.log("Find the element that displays the date and get its text content"); + cy.get('.created_at > abbr') + .invoke('text') + .then((dateText) => { + const dateMatch = dateText.match(/\d{4}\/\d{2}\/\d{2}/); + const displayedDate = dateMatch ? dateMatch[0] : ''; + expect(displayedDate).to.equal(formattedDate); + }); + }); }); }); @@ -117,23 +119,25 @@ describe("Forms page", () => { cy.get('.form_key').should("contain", "test-form"); cy.get('.shortcode > div').should("exist"); - cy.getFormattedCurrentDate(); + cy.getCurrentFormattedDate().then((formattedDate) => { + cy.log('Formatted Date: ', formattedDate); - cy.log("Find the element that displays the date and get its title content"); - cy.get('.created_at > abbr') - .invoke('attr', 'title') - .then((dateTime) => { - const datePart = dateTime.split(' ')[0]; - expect(datePart).to.equal(formattedDate); - }); + cy.log("Find the element that displays the date and get its title content"); + cy.get('.created_at > abbr') + .invoke('attr', 'title') + .then((dateTime) => { + const datePart = dateTime.split(' ')[0]; + expect(datePart).to.equal(formattedDate); + }); - cy.log("Check that time exists in the
element"); - cy.get('.created_at > abbr') - .invoke('html') - .then((html) => { - expect(html.split('
')[1].trim()).to.not.be.empty; + cy.log("Check that time exists in the
element"); + cy.get('.created_at > abbr') + .invoke('html') + .then((html) => { + expect(html.split('
')[1].trim()).to.not.be.empty; - }); + }); + }); }); }); diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 227d038f7f..75a5cb914f 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -35,19 +35,23 @@ Cypress.Commands.add("createNewForm", () => { cy.get("#frm-save-form-name-button").should("contain", "Save").click(); cy.get("a[aria-label='Close']", { timeout: 7000 }).click(); }) - Cypress.Commands.add("deleteForm", () => { cy.log("Delete Form"); cy.contains('#the-list tr', 'Test Form').trigger('mouseover').then(($row) => { console.log('Hovered Row:', $row); - // Find the visible element with class "trash" within the hovered row and click it - cy.wrap($row).within(() => { - cy.get('.row-actions .trash .frm-trash-link').should('be.visible').click({ force: true }); + cy.wrap($row).within(() => { + cy.get('.row-actions .trash .frm-trash-link').should('be.visible').click({ force: true }); }); - cy.get("div[role='dialog']").should("contain", "Do you want to move this form to the trash?"); - cy.xpath("//a[@id='frm-confirmed-click']").should("contain", "Confirm").click({ force: true }); - }) -}) + cy.get("body").then(($body) => { + if ($body.find("div[role='dialog']").length) { + cy.get("div[role='dialog']").should("be.visible").and("contain.text", "Do you want to move this form to the trash?"); + cy.xpath("//a[@id='frm-confirmed-click']").should("contain.text", "Confirm").click({ force: true }); + } else { + cy.log("Dialog not found"); + } + }); + }); +}); Cypress.Commands.add("openForm", () => { cy.log("Click on the created form"); @@ -65,22 +69,8 @@ Cypress.Commands.add("openForm", () => { cy.get('.frm_field_list > #frm-nav-tabs > .frm-tabs > #frm_insert_fields_tab').should("contain", "Add Fields"); }); -Cypress.Commands.add("validateFormData", () => { - cy.get('.id').should("exist"); - cy.get(`[id^="item-action-"] > .name > strong > .row-title:contains("${formTitle}")`) - .parents('[id^="item-action-"]') - .within(() => { - cy.get('.name > strong > .row-title').should("contain", formTitle); - cy.get('.entries > a').should("contain", "0"); - cy.get('.form_key').should("contain", "test-form"); - cy.get('.shortcode > div').should("exist"); - - const currentDate = new Date(); - const formattedDate = currentDate.toISOString().split('T')[0].replace(/-/g, '/'); - }); - }); - -Cypress.Commands.add("getFormattedCurrentDate", () => { +Cypress.Commands.add("getCurrentFormattedDate", () => { const currentDate = new Date(); const formattedDate = currentDate.toISOString().split('T')[0].replace(/-/g, '/'); -}); \ No newline at end of file + return formattedDate; +}); \ No newline at end of file From ecc3546b365c8abb56e0cf92b3eecd40430bc078 Mon Sep 17 00:00:00 2001 From: lauramekaj1 Date: Tue, 6 Aug 2024 23:24:09 +0200 Subject: [PATCH 10/14] revert eslint added rule --- .eslintrc.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 7948cc0681..3584b5c464 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -46,7 +46,6 @@ "camelcase": ["error", { "properties": "never" }], "lines-around-comment": "off", "react/display-name": "off", - "no-unused-expressions": "off", "react/jsx-curly-spacing": [ "error", { From 8671c7fcc2a4e84e19776099a0da92bfed6ee43e Mon Sep 17 00:00:00 2001 From: lauramekaj1 Date: Tue, 6 Aug 2024 23:47:02 +0200 Subject: [PATCH 11/14] fix eslint error --- tests/cypress/e2e/Forms/formPageDataValidation.cy.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js index 7d36ee6780..5a39ea9288 100644 --- a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js +++ b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js @@ -128,7 +128,7 @@ describe("Forms page", () => { .then((dateTime) => { const datePart = dateTime.split(' ')[0]; expect(datePart).to.equal(formattedDate); - }); + cy.log("Check that time exists in the
element"); cy.get('.created_at > abbr') @@ -137,6 +137,7 @@ describe("Forms page", () => { expect(html.split('
')[1].trim()).to.not.be.empty; }); + }); }); }); }); From 15aae0fe4aaf9b0cef35f420542cb0722453f9e0 Mon Sep 17 00:00:00 2001 From: lauramekaj1 Date: Wed, 7 Aug 2024 14:19:36 +0200 Subject: [PATCH 12/14] adjust code to remove unused expression --- tests/cypress/e2e/Forms/formPageDataValidation.cy.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js index 5a39ea9288..6bcfa7fd11 100644 --- a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js +++ b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js @@ -134,8 +134,7 @@ describe("Forms page", () => { cy.get('.created_at > abbr') .invoke('html') .then((html) => { - expect(html.split('
')[1].trim()).to.not.be.empty; - + expect(html).to.not.be.empty; }); }); }); From 9a2fbcba730441c007a60e6855b224744e115695 Mon Sep 17 00:00:00 2001 From: lauramekaj1 Date: Wed, 7 Aug 2024 15:12:34 +0200 Subject: [PATCH 13/14] another try to fix the eslint error --- tests/cypress/e2e/Forms/formPageDataValidation.cy.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js index 6bcfa7fd11..dd414e0fca 100644 --- a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js +++ b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js @@ -134,7 +134,8 @@ describe("Forms page", () => { cy.get('.created_at > abbr') .invoke('html') .then((html) => { - expect(html).to.not.be.empty; + expect(html.split('
')[1]).to.exist.and.not.be.empty; + }); }); }); From 28fbca85a8c3caef01acd17ef615be3494d9c83c Mon Sep 17 00:00:00 2001 From: lauramekaj1 Date: Wed, 7 Aug 2024 15:19:43 +0200 Subject: [PATCH 14/14] add eslint-enable no-unused-expressions --- tests/cypress/e2e/Forms/formPageDataValidation.cy.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js index dd414e0fca..064e5e6a95 100644 --- a/tests/cypress/e2e/Forms/formPageDataValidation.cy.js +++ b/tests/cypress/e2e/Forms/formPageDataValidation.cy.js @@ -131,11 +131,12 @@ describe("Forms page", () => { cy.log("Check that time exists in the
element"); + /* eslint-disable no-unused-expressions */ cy.get('.created_at > abbr') .invoke('html') .then((html) => { expect(html.split('
')[1]).to.exist.and.not.be.empty; - + /* eslint-enable no-unused-expressions */ }); }); });