High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.
JavaScript campaigncampaign-managementemail-marketingemail-subscriptionlistmonkmailing-listnewsletternewsletter-managementnewsletter-softwareself-hostedsms-gatewaysmtptransactional-emails
Refactor template tests.
Kailash Nadhf26f7c60af24
diff --git a/frontend/cypress/integration/templates.js b/frontend/cypress/integration/templates.jsindex 8ad8ba06..07d4a517 100644--- a/frontend/cypress/integration/templates.js+++ b/frontend/cypress/integration/templates.js@@ -6,18 +6,27 @@ describe('Templates', () => {it('Counts default templates', () => {- cy.get('tbody td[data-label=Name]').should('have.length', 1);+ cy.get('tbody td[data-label=Name]').should('have.length', 2);});- it('Clones template', () => {- // Clone the campaign.+ it('Clones campaign template', () => {cy.get('[data-cy=btn-clone]').first().click();cy.get('.modal input').clear().type('cloned').click();cy.get('.modal button.is-primary').click();cy.wait(250);// Verify the newly created row.- cy.get('tbody td[data-label="Name"]').eq(1).contains('cloned');+ cy.get('tbody td[data-label="Name"]').eq(2).contains('cloned');+ });++ it('Clones tx template', () => {+ cy.get('tbody tr:nth-child(2) [data-cy=btn-clone]').click();+ cy.get('.modal input').clear().type('cloned').click();+ cy.get('.modal button.is-primary').click();+ cy.wait(250);++ // Verify the newly created row.+ cy.get('tbody td[data-label="Name"]').eq(3).contains('cloned');});it('Edits template', () => {@@ -43,7 +52,7 @@ describe('Templates', () => {cy.get('.modal-card-foot button').click();// Cloned one should have the full template.- cy.get('tbody [data-cy=btn-preview').eq(1).click();+ cy.get('tbody [data-cy=btn-preview').eq(2).click();cy.wait(500);cy.get('.modal-card-body iframe').iframe(() => {cy.get('.wrap p').first().contains('Hi there');@@ -53,7 +62,7 @@ describe('Templates', () => {});it('Sets default', () => {- cy.get('tbody td.actions').eq(1).find('[data-cy=btn-set-default]').click();+ cy.get('tbody td.actions').eq(2).find('[data-cy=btn-set-default]').click();cy.get('.modal button.is-primary').click();// The original default shouldn't have default and the new one should have.@@ -61,7 +70,7 @@ describe('Templates', () => {cy.wrap(el).find('[data-cy=btn-delete]').should('exist');cy.wrap(el).find('[data-cy=btn-set-default]').should('exist');});- cy.get('tbody td.actions').eq(1).then((el) => {+ cy.get('tbody td.actions').eq(2).then((el) => {cy.wrap(el).find('[data-cy=btn-delete]').should('not.exist');cy.wrap(el).find('[data-cy=btn-set-default]').should('not.exist');});@@ -70,9 +79,13 @@ describe('Templates', () => {it('Deletes template', () => {cy.wait(250);- cy.get('tbody td.actions [data-cy=btn-delete]').first().click();- cy.get('.modal button.is-primary').click();- cy.wait(250);++ [1, 1, 2].forEach((n) => {+ cy.get(`tbody tr:nth-child(${n}) td.actions [data-cy=btn-delete]`).click();+ cy.get('.modal button.is-primary').click();+ cy.wait(250);+ })+cy.get('tbody td.actions').should('have.length', 1);});});