Przeglądaj źródła

Merge pull request #16508 from overleaf/msm-fix-ce-test

[server-ce] Fix cypress e2e tests

GitOrigin-RevId: ffb802d15491cd5fdb96486629da675d90cce18e
Miguel Serrano 2 lat temu
rodzic
commit
6703ed7e27

+ 2 - 1
server-ce/test/create-and-compile-project.spec.ts

@@ -5,7 +5,8 @@ describe('Project creation and compilation', function () {
   it('users can create project and compile it', function () {
     login('user@example.com')
     cy.visit('/project')
-    createProject('test-project')
+    // this is the first project created, the welcome screen is displayed instead of the project list
+    createProject('test-project', { isFirstProject: true })
     cy.url().should('match', /\/project\/[a-fA-F0-9]{24}/)
     cy.findByText('\\maketitle')
       .parent()

+ 11 - 3
server-ce/test/helpers/project.ts

@@ -2,10 +2,18 @@ export function createProject(
   name: string,
   {
     type = 'Blank Project',
-  }: { type?: 'Blank Project' | 'Example Project' } = {}
+    isFirstProject,
+  }: {
+    type?: 'Blank Project' | 'Example Project'
+    isFirstProject?: boolean
+  } = {}
 ): Cypress.Chainable<string> {
-  // FIXME: This should be be a data-test-id shared between the welcome page and project list
-  cy.get('.new-project-button').first().click()
+  if (isFirstProject) {
+    cy.findByText('Create a new project').click()
+  } else {
+    // FIXME: This should be be a data-test-id shared between the welcome page and project list
+    cy.get('.new-project-button').first().click()
+  }
   // FIXME: This should only look in the left menu
   cy.findAllByText(type).first().click()
   cy.findByRole('dialog').within(() => {