From 02c1408f5c70c76a7b9660af208ae8a51ed1bf9e Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Thu, 9 Dec 2021 20:47:52 +0530 Subject: [PATCH] Fix broken Cypress UI tests. --- frontend/cypress.json | 4 +++- frontend/cypress/integration/campaigns.js | 6 ++++++ frontend/cypress/integration/dashboard.js | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/cypress.json b/frontend/cypress.json index c17cea67b..f27017689 100644 --- a/frontend/cypress.json +++ b/frontend/cypress.json @@ -5,5 +5,7 @@ "serverInitCmd": "pkill -9 listmonk | cd ../ && ./listmonk --install --yes && ./listmonk > /dev/null 2>/dev/null &", "username": "listmonk", "password": "listmonk" - } + }, + "viewportWidth": 1300, + "viewportHeight": 950 } diff --git a/frontend/cypress/integration/campaigns.js b/frontend/cypress/integration/campaigns.js index da26a9411..28af8c8b3 100644 --- a/frontend/cypress/integration/campaigns.js +++ b/frontend/cypress/integration/campaigns.js @@ -108,6 +108,9 @@ describe('Campaigns', () => { cy.get('button[data-cy=btn-preview]').click(); cy.wait(200); cy.get("#iframe").then(($f) => { + if (c === 'plain') { + return; + } const doc = $f.contents(); expect(doc.find('.wrap').text().trim().replace(/(\s|\n)+/, ' ')).equal(plainBody); }); @@ -216,6 +219,9 @@ describe('Campaigns', () => { cy.get('button[data-cy=btn-preview]').click(); cy.wait(200); cy.get("#iframe").then(($f) => { + if (c === 'plain') { + return; + } const doc = $f.contents(); expect(doc.find('.wrap').text().trim()).equal(plainBody); }); diff --git a/frontend/cypress/integration/dashboard.js b/frontend/cypress/integration/dashboard.js index 4a32da905..5d79d21fa 100644 --- a/frontend/cypress/integration/dashboard.js +++ b/frontend/cypress/integration/dashboard.js @@ -13,7 +13,7 @@ describe('Dashboard', () => { // Campaign counts. cy.get('[data-cy=campaigns] .title').contains('1'); - cy.get('[data-cy=campaigns]').contains('1 draft'); + cy.get('[data-cy=campaigns-draft]').contains('1'); // Subscriber counts. cy.get('[data-cy=subscribers] .title').contains('2');