overleaf/server-ce/test/helpers/project.ts
Mathias Jakobsen 732cbf0c26 Merge pull request #15547 from overleaf/mj-community-edition-tests
[server-ce] Add e2e test for CE

GitOrigin-RevId: f76ee4d19680c57a3a0854bc89175b3fb352ca41
2023-11-24 09:04:18 +00:00

19 lines
629 B
TypeScript

export function createProject(
name: string,
{
type = 'Blank Project',
}: { type?: 'Blank Project' | 'Example Project' } = {}
): 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()
// FIXME: This should only look in the left menu
cy.findAllByText(type).first().click()
cy.findByRole('dialog').within(() => {
cy.get('input').type(name)
cy.findByText('Create').click()
})
return cy
.url()
.should('match', /\/project\/[a-fA-F0-9]{24}/)
.then(url => url.split('/').pop())
}