Răsfoiți Sursa

Merge pull request #16995 from overleaf/jpa-fix-server-ce-e2e

[server-ce] fix e2e tests

GitOrigin-RevId: 95a9edd44a50254ac9f680368cf8e10bbf827d69
Jakob Ackermann 2 ani în urmă
părinte
comite
1b0c4215b8

+ 6 - 1
server-ce/test/Makefile

@@ -5,4 +5,9 @@ test-e2e:
 	docker compose -f docker-compose.yml run --rm e2e
 	docker compose down -v -t 0
 
-.PHONY: test-e2e
+test-e2e-open:
+	docker compose down -v -t 0
+	docker compose -f docker-compose.yml run --rm e2e-open
+	docker compose down -v -t 0
+
+.PHONY: test-e2e test-e2e-open

+ 3 - 5
server-ce/test/create-and-compile-project.spec.ts

@@ -63,7 +63,7 @@ describe('Project creation and compilation', function () {
       cy.findByText('Create').click()
     })
     // FIXME: should be aria-labeled or data-test-id
-    cy.get('.file-tree').within(() => {
+    cy.get('.file-tree').first().within(() => {
       cy.findByText('frog.jpg').click()
     })
     cy.findByText('Another project')
@@ -100,9 +100,7 @@ describe('Project creation and compilation', function () {
     cy.findByText('Share').click()
     cy.findByRole('dialog').within(() => {
       cy.get('input').type('collaborator@example.com,')
-      // FIXME: Open an issue for this.
-      cy.get('button[type="submit"]').click({ force: true })
-      cy.get('button[type="submit"]').click({ force: true })
+      cy.findByText('Share').click({ force: true })
     })
 
     cy.visit('/project')
@@ -123,7 +121,7 @@ describe('Project creation and compilation', function () {
       cy.url().should('include', targetProjectId)
     })
 
-    cy.get('.file-tree').within(() => {
+    cy.get('.file-tree').first().within(() => {
       cy.findByText('frog.jpg').click()
     })
     cy.findByText('Another project')

+ 21 - 2
server-ce/test/docker-compose.yml

@@ -9,7 +9,7 @@ services:
       redis:
         condition: service_started
     ports:
-      - 80:80
+      - 127.0.0.2:80:80
     links:
       - mongo
       - redis
@@ -50,7 +50,7 @@ services:
       - 6379
 
   e2e:
-    image: cypress/included:13.3.0
+    image: cypress/included:13.3.3
     links:
       - sharelatex
     working_dir: /e2e
@@ -62,3 +62,22 @@ services:
     depends_on:
       sharelatex:
         condition: service_healthy
+
+  e2e-open:
+    image: cypress/included:13.3.3
+    entrypoint: npm
+    command: run cypress:open
+    links:
+      - sharelatex
+    working_dir: /e2e
+    volumes:
+      - ./:/e2e
+      - /tmp/.X11-unix:/tmp/.X11-unix
+    user: "${DOCKER_USER:-1000:1000}"
+    environment:
+      CYPRESS_BASE_URL: http://sharelatex
+      SPEC_PATTERN: '**/*.spec.{js,jsx,ts,tsx}'
+      DISPLAY: ${DISPLAY:-:0}
+    depends_on:
+      sharelatex:
+        condition: service_healthy

+ 4 - 4
server-ce/test/package-lock.json

@@ -7,7 +7,7 @@
       "name": "@overleaf/server-ce/test",
       "dependencies": {
         "@testing-library/cypress": "^10.0.1",
-        "cypress": "13.3.0",
+        "cypress": "13.3.3",
         "typescript": "^5.0.4"
       }
     },
@@ -713,9 +713,9 @@
       }
     },
     "node_modules/cypress": {
-      "version": "13.3.0",
-      "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.3.0.tgz",
-      "integrity": "sha512-mpI8qcTwLGiA4zEQvTC/U1xGUezVV4V8HQCOYjlEOrVmU1etVvxOjkCXHGwrlYdZU/EPmUiWfsO3yt1o+Q2bgw==",
+      "version": "13.3.3",
+      "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.3.3.tgz",
+      "integrity": "sha512-mbdkojHhKB1xbrj7CrKWHi22uFx9P9vQFiR0sYDZZoK99OMp9/ZYN55TO5pjbXmV7xvCJ4JwBoADXjOJK8aCJw==",
       "hasInstallScript": true,
       "dependencies": {
         "@cypress/request": "^3.0.0",

+ 1 - 1
server-ce/test/package.json

@@ -10,7 +10,7 @@
   },
   "dependencies": {
     "@testing-library/cypress": "^10.0.1",
-    "cypress": "13.3.0",
+    "cypress": "13.3.3",
     "typescript": "^5.0.4"
   }
 }