From 6815742e1b21ab476c64667fb8cad4fc93b7f070 Mon Sep 17 00:00:00 2001 From: trendschau Date: Fri, 8 Jan 2021 10:10:47 +0100 Subject: [PATCH] Version 1.4.3: Updated Cypress Tests --- cypress/test02-initial-frontend.spec.js | 12 +-- cypress/test05-blox-editor.spec.js | 102 +++++++++++++++++++++++- 2 files changed, 107 insertions(+), 7 deletions(-) diff --git a/cypress/test02-initial-frontend.spec.js b/cypress/test02-initial-frontend.spec.js index 534b959..89a328b 100644 --- a/cypress/test02-initial-frontend.spec.js +++ b/cypress/test02-initial-frontend.spec.js @@ -9,7 +9,7 @@ describe('Typemill Initial Frontend', function() cy.get('h1').contains("Typemill") /* has start and setup button */ - cy.get('.cy-nav').find('a').should(($a) => { + cy.get('nav').find('a').should(($a) => { expect($a).to.have.length(10) expect($a[0].href).to.match(/welcome/) expect($a[1].href).to.match(/welcome\/setup/) @@ -81,11 +81,11 @@ describe('Typemill Initial Frontend', function() /* check if toc exists */ cy.get('.TOC').within(($toc) =>{ /* check if a certain link in toc exists */ - cy.get('a').eq(2).should('have.attr', 'href', '/typemillTest/welcome/markdown-test#headlines') + cy.get('a').eq(2).should('have.attr', 'href', '#h-headlines') }) /* check if corresponding anchor exists */ - cy.get('#headlines').should('exist') + cy.get('#h-headlines').should('exist') /* soft linebreaks */ cy.get('br').should('exist') @@ -106,7 +106,7 @@ describe('Typemill Initial Frontend', function() /* images */ cy.get('img').eq(0).should('have.attr', 'alt', 'alt') - cy.get('img').eq(0).should('have.attr', 'src', 'media/files/markdown.png') + cy.get('img').eq(0).should('have.attr', 'src').should('include','media/files/markdown.png') cy.get('figure').eq(2).should('have.id', 'myid') .and('have.class', 'otherclass') cy.get('img').eq(2).should('have.attr', 'alt', 'alt-text') @@ -124,7 +124,7 @@ describe('Typemill Initial Frontend', function() /* footnote */ cy.get('sup').eq(0).should('have.id', 'fnref1:1') cy.get('sup').eq(0).within(($sup) =>{ - cy.get('a').eq(0).should('have.attr', 'href', '/typemillTest/welcome/markdown-test#fn%3A1') + cy.get('a').eq(0).should('have.attr', 'href', '#fn%3A1') .and('have.class', 'footnote-ref') }) @@ -148,7 +148,7 @@ describe('Typemill Initial Frontend', function() cy.get('.footnotes').within(($footnotes) => { cy.get('li').eq(0).should('have.id', 'fn:1') cy.get('a').eq(0).should('have.class', 'footnote-backref') - .and('have.attr', 'href', '/typemillTest/welcome/markdown-test#fnref1%3A1') + .and('have.attr', 'href', '#fnref1%3A1') .and('have.attr', 'rev', 'footnote') }) }) diff --git a/cypress/test05-blox-editor.spec.js b/cypress/test05-blox-editor.spec.js index 6c41a69..05879d6 100644 --- a/cypress/test05-blox-editor.spec.js +++ b/cypress/test05-blox-editor.spec.js @@ -77,6 +77,106 @@ describe('Blox Editor', function() }) }) + it('edits paragraph', function() + { + cy.get('#blox').within(($blox) => { + /* Get Format Bar */ + cy.get('.format-bar').within(($formats) => { + + /* Edit Table */ + cy.get("button").eq(0).click() + cy.get("textarea") + .type("This is a second paragraph.") + + /* save table */ + cy.get(".edit").click() + cy.get(".cancel").click() + + }) + + cy.get('#blox-2').should("contain", "second paragraph") + }) + }) + + it('edits headline', function() + { + cy.get('#blox').within(($blox) => { + /* Get Format Bar */ + cy.get('.format-bar').within(($formats) => { + + /* Edit Table */ + cy.get("button").eq(1).click() + cy.get("input") + .type("Second Level Headline") + + /* save block */ + cy.get(".edit").click() + + /* close new standard textarea */ + cy.get(".cancel").click() + + }) + + cy.get('#blox-3').should("contain", "Second Level Headline") + }) + }) + + it('edits unordered list', function() + { + cy.get('#blox').within(($blox) => { + /* Get Format Bar */ + cy.get('.format-bar').within(($formats) => { + + /* Edit Table */ + cy.get("button").eq(2).click() + cy.get("textarea") + .type("first list item{enter}second list item") + + /* save block */ + cy.get(".edit").click() + + /* close new standard textarea */ + cy.get(".cancel").click() + + }) + + cy.get('#blox-4').within(($block) => { + cy.get("li").should(($lis) => { + expect($lis).to.have.length(2) + expect($lis.eq(0)).to.contain('first list item') + }) + }) + }) + }) + + it('edits ordered list', function() + { + cy.get('#blox').within(($blox) => { + /* Get Format Bar */ + cy.get('.format-bar').within(($formats) => { + + /* Edit Table */ + cy.get("button").eq(3).click() + cy.get("textarea") + .type("first ordered item{enter}second ordered item") + + /* save block */ + cy.get(".edit").click() + + /* close new standard textarea */ + cy.get(".cancel").click() + + }) + + cy.get('#blox-5').within(($block) => { + cy.get("li").should(($lis) => { + expect($lis).to.have.length(2) + expect($lis.eq(0)).to.contain('first ordered item') + }) + }) + }) + }) + it('edits table', function() { cy.get('#blox').within(($blox) => { @@ -153,7 +253,7 @@ describe('Blox Editor', function() }) - cy.get('#blox-2').should("contain", "Beautiful").click() + cy.get('#blox-6').should("contain", "Beautiful").click() cy.get('.editactive').within(($activeblock) => { cy.get('.component').should("contain", "Beautiful")