Skip to content

Commit 2fd1617

Browse files
committed
Cypress test for Tasks
1 parent 39dcef7 commit 2fd1617

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

cypress/e2e/task-create.cy.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const testTaskScript = `// mode=local,language=javascript,parameters=[greetee]
2+
"Hello " + greetee`
3+
4+
describe('Tasks', () => {
5+
beforeEach(() => {
6+
cy.login(Cypress.env('username'), Cypress.env('password'));
7+
});
8+
9+
it('successfully navigates through tasks', () => {
10+
cy.get('a[aria-label="nav-item-Tasks"]').click();
11+
cy.contains('hello');
12+
});
13+
14+
it('successfully creates tasks', () => {
15+
cy.get('a[aria-label="nav-item-Tasks"]').click();
16+
cy.get('button[aria-label="create-task-button"]').click();
17+
cy.get('#task-name').click().type('testTask');
18+
cy.get('.pf-c-code-editor').click().type(testTaskScript)
19+
cy.get('[data-cy="add-task-button"]').click();
20+
cy.contains('Task testTask has been created');
21+
cy.get('.pf-c-alert__action > .pf-c-button').click(); //Closing alert popup.
22+
cy.contains('testTask');
23+
});
24+
25+
it('successfully execute a task', () => {
26+
cy.get('a[aria-label="nav-item-Tasks"]').click();
27+
cy.contains('testTask').click();
28+
cy.get('button[aria-label="expand-task-testTask"]').click({ force: true });
29+
cy.get('button[aria-label="execute-button-testTask"]').click();
30+
cy.get('input[aria-label="input-parameter"]').click().type('world');
31+
cy.get('button[aria-label="Confirm"]').click();
32+
cy.contains('The script has been successfully executed');
33+
cy.get('.pf-c-alert__action > .pf-c-button').click(); //Closing alert popup.
34+
})
35+
});

0 commit comments

Comments
 (0)