diff --git a/ui/cypress/e2e/tasks.test.ts b/ui/cypress/e2e/tasks.test.ts index 4c627cc0f9e..8121291d560 100644 --- a/ui/cypress/e2e/tasks.test.ts +++ b/ui/cypress/e2e/tasks.test.ts @@ -85,46 +85,42 @@ from(bucket: "${name}") }) }) - it('can disable a task', () => { - cy.get('@org').then(({id}: Organization) => { - cy.get('@token').then(token => { - cy.createTask(token, id) + describe('When tasks already exsist', () => { + beforeEach(() => { + cy.get('@org').then(({id}: Organization) => { + cy.get('@token').then(token => { + cy.createTask(token, id) + }) }) }) - cy.getByTestID('task-card--slide-toggle').should('have.class', 'active') - - cy.getByTestID('task-card--slide-toggle').click() + it('can edit a task', () => { + // Disabling the test + cy.getByTestID('task-card--slide-toggle').should('have.class', 'active') - cy.getByTestID('task-card--slide-toggle').should('not.have.class', 'active') - }) + cy.getByTestID('task-card--slide-toggle').click() - it('can edit a tasks name', () => { - cy.get('@org').then(({id}: Organization) => { - cy.get('@token').then(token => { - cy.createTask(token, id) - }) - }) - - const newName = 'Task' + cy.getByTestID('task-card--slide-toggle').should( + 'not.have.class', + 'active' + ) - cy.getByTestID('task-card').within(() => { - cy.getByTestID('task-card--name').trigger('mouseover') + // Editing a name + const newName = 'Task' - cy.getByTestID('task-card--name-button').click() + cy.getByTestID('task-card').within(() => { + cy.getByTestID('task-card--name').trigger('mouseover') - cy.get('.cf-input-field') - .type(newName) - .type('{enter}') - }) + cy.getByTestID('task-card--name-button').click() - cy.fixture('routes').then(({orgs}) => { - cy.get('@org').then(({id}: Organization) => { - cy.visit(`${orgs}/${id}/tasks`) + cy.get('.cf-input-field') + .type(newName) + .type('{enter}') }) - }) - cy.getByTestID('task-card').should('contain', newName) + cy.getByTestID('notification-success').should('exist') + cy.getByTestID('task-card').should('contain', newName) + }) }) describe('labeling', () => {