|
| 1 | +const testTaskScript = `// mode=local,language=javascript,parameters=[greetee] |
| 2 | +"Hello " + greetee` |
| 3 | + |
| 4 | +const updatedScript = `// mode=local,language=javascript,parameters=[greetee] |
| 5 | +"Good morning " + greetee` |
| 6 | + |
| 7 | +describe('Tasks', () => { |
| 8 | + beforeEach(() => { |
| 9 | + cy.login(Cypress.env('username'), Cypress.env('password')); |
| 10 | + }); |
| 11 | + |
| 12 | + it('successfully navigates through tasks', () => { |
| 13 | + cy.get('a[aria-label="nav-item-Tasks"]').click(); |
| 14 | + cy.contains('hello'); |
| 15 | + }); |
| 16 | + |
| 17 | + it('successfully creates tasks', () => { |
| 18 | + cy.get('a[aria-label="nav-item-Tasks"]').click(); |
| 19 | + cy.get('button[aria-label="create-task-button"]').click(); |
| 20 | + cy.get('#task-name').click().type('testTask'); |
| 21 | + cy.get('.pf-c-code-editor').click().type(testTaskScript) |
| 22 | + cy.get('[data-cy="add-task-button"]').click(); |
| 23 | + cy.contains('Task testTask has been created'); |
| 24 | + cy.get('.pf-c-alert__action > .pf-c-button').click(); //Closing alert popup. |
| 25 | + cy.contains('testTask'); |
| 26 | + }); |
| 27 | + |
| 28 | + it('successfully execute a task', () => { |
| 29 | + cy.get('a[aria-label="nav-item-Tasks"]').click(); |
| 30 | + cy.contains('testTask').click(); |
| 31 | + cy.get('button[aria-label="expand-task-testTask"]').click({ force: true }); |
| 32 | + cy.get('button[aria-label="execute-button-testTask"]').click(); |
| 33 | + cy.get('input[aria-label="input-parameter"]').click().type('world'); |
| 34 | + cy.get('button[aria-label="Confirm"]').click(); |
| 35 | + cy.contains('The script has been successfully executed'); |
| 36 | + cy.get('.pf-c-alert__action > .pf-c-button').click(); //Closing alert popup. |
| 37 | + }) |
| 38 | + |
| 39 | + it('successfully update a task', () => { |
| 40 | + cy.get('a[aria-label="nav-item-Tasks"]').click(); |
| 41 | + cy.contains('testTask').click(); |
| 42 | + cy.get('button[aria-label="expand-task-testTask"]').click({ force: true }); |
| 43 | + cy.get('button[aria-label="edit-button-testTask"]').click(); |
| 44 | + cy.get('[data-cy=taskEditArea]').type('{selectall}', { timeout: 10000 }); |
| 45 | + cy.get('[data-cy="taskEditArea"]').click().type(updatedScript); |
| 46 | + cy.get('button[aria-label="edit-button-testTask"]').click(); |
| 47 | + cy.contains('Task testTask has been updated'); |
| 48 | + cy.get('.pf-c-alert__action > .pf-c-button').click(); //Closing alert popup. |
| 49 | + cy.contains('testTask'); |
| 50 | + cy.contains('"Good morning " + greetee'); |
| 51 | + }) |
| 52 | +}); |
0 commit comments