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

[server-ce] Fix cypress e2e tests

GitOrigin-RevId: ffb802d15491cd5fdb96486629da675d90cce18e
This commit is contained in:
Miguel Serrano 2024-01-16 10:40:22 +01:00 committed by Copybot
parent a68b0b2793
commit 6703ed7e27
2 changed files with 13 additions and 4 deletions

View file

@ -5,7 +5,8 @@ describe('Project creation and compilation', function () {
it('users can create project and compile it', function () { it('users can create project and compile it', function () {
login('user@example.com') login('user@example.com')
cy.visit('/project') 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.url().should('match', /\/project\/[a-fA-F0-9]{24}/)
cy.findByText('\\maketitle') cy.findByText('\\maketitle')
.parent() .parent()

View file

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