diff --git a/cypress.config.js b/cypress.config.js new file mode 100644 index 00000000..05791abb --- /dev/null +++ b/cypress.config.js @@ -0,0 +1,24 @@ +const { defineConfig } = require("cypress"); + +module.exports = defineConfig({ + viewportWidth: 1280, + defaultCommandTimeout: 8888, + chromeWebSecurity: false, + reporter: "junit", + video: true, + retries: { + runMode: 8, + openMode: 0, + }, + reporterOptions: { + mochaFile: "cypress/reports/cypress-[hash].xml", + jenkinsMode: true, + toConsole: true, + }, + e2e: { + setupNodeEvents(on, config) { + // e2e testing node events setup code + }, + baseUrl: "http://localhost:3000", + }, +}); diff --git a/cypress.json b/cypress.json deleted file mode 100644 index 736deddf..00000000 --- a/cypress.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "baseUrl": "http://localhost:3000", - "viewportWidth": 1280, - "defaultCommandTimeout": 8888, - "chromeWebSecurity": false, - "reporter": "junit", - "video": true, - "retries": { - "runMode": 8, - "openMode": 0 - }, - "reporterOptions": { - "mochaFile": "cypress/reports/cypress-[hash].xml", - "jenkinsMode": true, - "toConsole": true - } -} diff --git a/cypress/e2e/block-basics.cy.js b/cypress/e2e/block-basics.cy.js new file mode 100644 index 00000000..23d4a6b8 --- /dev/null +++ b/cypress/e2e/block-basics.cy.js @@ -0,0 +1,44 @@ +import { setupBeforeEach, tearDownAfterEach } from "../support/e2e"; + +describe("Blocks Tests", () => { + beforeEach(setupBeforeEach); + afterEach(tearDownAfterEach); + + it("Add Block: Empty", () => { + // without this the clear command below does nothing sometimes + cy.wait(500); + + // Change page title + cy.get("[contenteditable=true]").first().clear(); + + cy.get("[contenteditable=true]").first().type("My Add-on Page"); + + cy.get(".documentFirstHeading").contains("My Add-on Page"); + + cy.get("[contenteditable=true]").first().type("{enter}"); + + // Add block + cy.get(".ui.basic.icon.button.block-add-button").first().click(); + cy.get(".blocks-chooser .title").contains("Common").click(); + cy.get(".content.active.common .button.listing") + .contains("Listing") + .click(); + + // Select Custom summary Variation + cy.get("#field-variation").click().contains("Cards gallery").click(); + cy.get(".query-widget #field-query-0-querystring").click(); + cy.get(".react-select__menu").contains("Creator").first().click(); + cy.get(".field.query-sort-on-widget #select-listingblock-sort-on").click(); + cy.get(".react-select__menu").contains("Creator").click(); + + // Test for switches + cy.contains("Gallery").click(); + + // Save + cy.get("#toolbar-save").click(); + cy.url().should("eq", Cypress.config().baseUrl + "/cypress/my-page"); + + // then the page view should contain our changes + cy.contains("My Add-on Page"); + }); +}); diff --git a/cypress/integration/block-basics.js b/cypress/integration/block-basics.js deleted file mode 100644 index 0708d4c7..00000000 --- a/cypress/integration/block-basics.js +++ /dev/null @@ -1,44 +0,0 @@ -import { setupBeforeEach, tearDownAfterEach } from '../support'; - -describe('Blocks Tests', () => { - beforeEach(setupBeforeEach); - afterEach(tearDownAfterEach); - - it('Add Block: Empty', () => { - // without this the clear command below does nothing sometimes - cy.wait(500); - - // Change page title - cy.get('[contenteditable=true]').first().clear(); - - cy.get('[contenteditable=true]').first().type('My Add-on Page'); - - cy.get('.documentFirstHeading').contains('My Add-on Page'); - - cy.get('[contenteditable=true]').first().type('{enter}'); - - // Add block - cy.get('.ui.basic.icon.button.block-add-button').first().click(); - cy.get('.blocks-chooser .title').contains('Common').click(); - cy.get('.content.active.common .button.listing') - .contains('Listing') - .click(); - - // Select Custom summary Variation - cy.get('#field-variation').click().contains('Cards gallery').click(); - cy.get('.query-widget #field-query-0-querystring').click(); - cy.get('.react-select__menu').contains('Creator').first().click(); - cy.get('.field.query-sort-on-widget #select-listingblock-sort-on').click(); - cy.get('.react-select__menu').contains('Creator').click(); - - // Test for switches - cy.contains('Gallery').click(); - - // Save - cy.get('#toolbar-save').click(); - cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page'); - - // then the page view should contain our changes - cy.contains('My Add-on Page'); - }); -}); diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js deleted file mode 100644 index 27a31a54..00000000 --- a/cypress/plugins/index.js +++ /dev/null @@ -1,26 +0,0 @@ -/// -// *********************************************************** -// This example plugins/index.js can be used to load plugins -// -// You can change the location of this file or turn off loading -// the plugins file with the 'pluginsFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/plugins-guide -// *********************************************************** - -// This function is called when a project is opened or re-opened (e.g. due to -// the project's config changing) - -/** - * @type {Cypress.PluginConfig} - */ -module.exports = (on, config) => { - // `on` is used to hook into various events Cypress emits - // `config` is the resolved Cypress config - /* coverage-start - require('@cypress/code-coverage/task')(on, config) - on('file:preprocessor', require('@cypress/code-coverage/use-babelrc')) - return config - coverage-end */ -}; diff --git a/cypress/support/index.js b/cypress/support/e2e.js similarity index 100% rename from cypress/support/index.js rename to cypress/support/e2e.js