diff --git a/client/cypress/e2e/frontend/rooms/add-room.cy.ts b/client/cypress/e2e/frontend/rooms/add-room.cy.ts new file mode 100644 index 00000000..894cd88e --- /dev/null +++ b/client/cypress/e2e/frontend/rooms/add-room.cy.ts @@ -0,0 +1,56 @@ +import { getMinimalMe } from '../../../support/helpers'; + +describe('Add Room Page', () => { + const MeQuery = getMinimalMe(); + const operations = { + MeQuery, + AddRoomEntry: { + addRoomEntry: { + roomEntry: {}, + }, + }, + RoomEntriesQuery: { + room: { + roomEntries: { + edges: [ + { + node: { + id: 1, + slug: 'hello', + title: 'A Room Entry', + comments: [], + author: { + id: MeQuery.me.id, + }, + }, + }, + ], + }, + }, + }, + }; + + beforeEach(() => { + cy.setup(); + cy.mockGraphqlOps({ + operations, + }); + }); + + it('visits the page and fills out the form', () => { + // go to /room/some-room/add + cy.visit('/room/some-room/add'); + + // element with data-cy 'content-form-section-title' should have the text 'Titel (Pflichtfeld)' + // focus the input with data-cy 'input-with-label-input' and type 'Raumtitel' + cy.getByDataCy('content-form-section-title').should('have.text', 'Titel (Pflichtfeld)'); + cy.getByDataCy('input-with-label-input').type('Raumtitel'); + + // click on first element with data-cy 'add-content-link' + cy.getByDataCy('add-content-link').click(); + cy.getByDataCy('choose-text-widget').click(); + cy.get('.tip-tap__editor').type('Hello'); + + cy.getByDataCy('save-button').click(); + }); +}); diff --git a/client/cypress/e2e/frontend/rooms/room-page.spec.js b/client/cypress/e2e/frontend/rooms/room-page.spec.js index 54ecd1fc..7f422769 100644 --- a/client/cypress/e2e/frontend/rooms/room-page.spec.js +++ b/client/cypress/e2e/frontend/rooms/room-page.spec.js @@ -40,7 +40,7 @@ describe('The Room Page (Teacher)', () => { author: { firstName: 'Rachel', lastName: 'Green', - id: btoa('PublicUserNode:rachels-id'), + id: window.btoa('PublicUserNode:rachels-id'), }, }, errors: [], diff --git a/client/package-lock.json b/client/package-lock.json index fcd90f40..e02528b9 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -44,7 +44,7 @@ "css-loader": "^3.6.0", "css-minimizer-webpack-plugin": "^3.4.1", "cy2": "^1.2.1", - "cypress": "^10", + "cypress": "^12.6.0", "dayjs": "^1.10.7", "eslint": "^7.32.0", "eslint-config-prettier": "^8.6.0", @@ -6447,9 +6447,9 @@ } }, "node_modules/cypress": { - "version": "10.11.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-10.11.0.tgz", - "integrity": "sha512-lsaE7dprw5DoXM00skni6W5ElVVLGAdRUUdZjX2dYsGjbY/QnpzWZ95Zom1mkGg0hAaO/QVTZoFVS7Jgr/GUPA==", + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.6.0.tgz", + "integrity": "sha512-WdHSVaS1lumSd5XpVTslZd8ui9GIGphrzvXq9+3DtVhqjRZC5M70gu5SW/Y/SLPq3D1wiXGZoHC6HJ7ESVE2lw==", "hasInstallScript": true, "dependencies": { "@cypress/request": "^2.88.10", @@ -6469,7 +6469,7 @@ "commander": "^5.1.0", "common-tags": "^1.8.0", "dayjs": "^1.10.4", - "debug": "^4.3.2", + "debug": "^4.3.4", "enquirer": "^2.3.6", "eventemitter2": "6.4.7", "execa": "4.1.0", @@ -6499,7 +6499,7 @@ "cypress": "bin/cypress" }, "engines": { - "node": ">=12.0.0" + "node": "^14.0.0 || ^16.0.0 || >=18.0.0" } }, "node_modules/cypress/node_modules/@types/node": { @@ -22860,9 +22860,9 @@ } }, "cypress": { - "version": "10.11.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-10.11.0.tgz", - "integrity": "sha512-lsaE7dprw5DoXM00skni6W5ElVVLGAdRUUdZjX2dYsGjbY/QnpzWZ95Zom1mkGg0hAaO/QVTZoFVS7Jgr/GUPA==", + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.6.0.tgz", + "integrity": "sha512-WdHSVaS1lumSd5XpVTslZd8ui9GIGphrzvXq9+3DtVhqjRZC5M70gu5SW/Y/SLPq3D1wiXGZoHC6HJ7ESVE2lw==", "requires": { "@cypress/request": "^2.88.10", "@cypress/xvfb": "^1.2.4", @@ -22881,7 +22881,7 @@ "commander": "^5.1.0", "common-tags": "^1.8.0", "dayjs": "^1.10.4", - "debug": "^4.3.2", + "debug": "^4.3.4", "enquirer": "^2.3.6", "eventemitter2": "6.4.7", "execa": "4.1.0", diff --git a/client/package.json b/client/package.json index 450fadf4..f322cb22 100644 --- a/client/package.json +++ b/client/package.json @@ -67,7 +67,7 @@ "css-loader": "^3.6.0", "css-minimizer-webpack-plugin": "^3.4.1", "cy2": "^1.2.1", - "cypress": "^10", + "cypress": "^12.6.0", "dayjs": "^1.10.7", "eslint": "^7.32.0", "eslint-config-prettier": "^8.6.0",