project.ts 629 B

12345678910111213141516171819
  1. export function createProject(
  2. name: string,
  3. {
  4. type = 'Blank Project',
  5. }: { type?: 'Blank Project' | 'Example Project' } = {}
  6. ): Cypress.Chainable<string> {
  7. // FIXME: This should be be a data-test-id shared between the welcome page and project list
  8. cy.get('.new-project-button').first().click()
  9. // FIXME: This should only look in the left menu
  10. cy.findAllByText(type).first().click()
  11. cy.findByRole('dialog').within(() => {
  12. cy.get('input').type(name)
  13. cy.findByText('Create').click()
  14. })
  15. return cy
  16. .url()
  17. .should('match', /\/project\/[a-fA-F0-9]{24}/)
  18. .then(url => url.split('/').pop())
  19. }