mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-26 22:03:19 +00:00
6703ed7e27
[server-ce] Fix cypress e2e tests GitOrigin-RevId: ffb802d15491cd5fdb96486629da675d90cce18e
27 lines
777 B
TypeScript
27 lines
777 B
TypeScript
export function createProject(
|
|
name: string,
|
|
{
|
|
type = 'Blank Project',
|
|
isFirstProject,
|
|
}: {
|
|
type?: 'Blank Project' | 'Example Project'
|
|
isFirstProject?: boolean
|
|
} = {}
|
|
): Cypress.Chainable<string> {
|
|
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(() => {
|
|
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())
|
|
}
|