diff --git a/.github/workflows/windows-zip.yml b/.github/workflows/windows-zip.yml index 6e5f80bd4..42a99a191 100644 --- a/.github/workflows/windows-zip.yml +++ b/.github/workflows/windows-zip.yml @@ -65,11 +65,13 @@ jobs: - name: Extract Etherpad run: 7z x etherpad-lite-win.zip -oetherpad - - name: list - run: dir etherpad + - name: Install Cypress + run: npm install cypress -g - name: Run Etherpad run: | cd etherpad node node_modules\ep_etherpad-lite\node\server.js & curl --connect-timeout 10 --max-time 20 --retry 5 --retry-delay 10 --retry-max-time 60 --retry-connrefused http://127.0.0.1:9001/p/test + cd src\tests\frontend + cypress run --spec cypress\integration\test.js --config-file cypress\cypress.json diff --git a/src/tests/frontend/cypress/.gitignore b/src/tests/frontend/cypress/.gitignore new file mode 100644 index 000000000..b3bf4d3e2 --- /dev/null +++ b/src/tests/frontend/cypress/.gitignore @@ -0,0 +1,5 @@ +fixtures/* +plugins/* +support/* +videos/* +screenshots/* diff --git a/src/tests/frontend/cypress/README.md b/src/tests/frontend/cypress/README.md new file mode 100644 index 000000000..4cc3f8121 --- /dev/null +++ b/src/tests/frontend/cypress/README.md @@ -0,0 +1,10 @@ +# Cypress Etherpad guide +We don't install Etherpad as a dev dep or dep within Etherpad because it's not +our core Frontend testing tool + +## Quick start +``` +npm i -g cypress +cd src/tests/frontend/cypress/ +cypress open +``` diff --git a/src/tests/frontend/cypress/cypress.json b/src/tests/frontend/cypress/cypress.json new file mode 100644 index 000000000..780d73fae --- /dev/null +++ b/src/tests/frontend/cypress/cypress.json @@ -0,0 +1,3 @@ +{ + "baseUrl": "http://127.0.0.1:9001" +} diff --git a/src/tests/frontend/cypress/integration/test.js b/src/tests/frontend/cypress/integration/test.js new file mode 100644 index 000000000..300a555d5 --- /dev/null +++ b/src/tests/frontend/cypress/integration/test.js @@ -0,0 +1,22 @@ +'use strict'; + +Cypress.Commands.add('iframe', {prevSubject: 'element'}, + ($iframe) => new Cypress.Promise((resolve) => { + $iframe.ready(() => { + resolve($iframe.contents().find('body')); + }); + })); + +describe(__filename, () => { + it('Pad content exists', async () => { + cy.visit('http://127.0.0.1:9001/p/test'); + cy.get('iframe[name="ace_outer"]', {timeout: 10000}).iframe() + .find('.line-number:first') + .should('have.text', '1'); + cy.get('iframe[name="ace_outer"]').iframe() + .find('iframe[name="ace_inner"]').iframe() + .find('.ace-line:first') + .should('be.visible') + .should('have.text', 'Welcome to Etherpad!'); + }); +});