Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tasks #313

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Tasks #313

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions cypress/e2e/task-create.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const testTaskScript = `// mode=local,language=javascript,parameters=[greetee]
"Hello " + greetee`

const updatedScript = `// mode=local,language=javascript,parameters=[greetee]
"Good morning " + greetee`

describe('Tasks', () => {
beforeEach(() => {
cy.login(Cypress.env('username'), Cypress.env('password'));
});

it('successfully navigates through tasks', () => {
cy.get('a[aria-label="nav-item-Tasks"]').click();
cy.contains('hello');
});

it('successfully creates tasks', () => {
cy.get('a[aria-label="nav-item-Tasks"]').click();
cy.get('button[aria-label="create-task-button"]').click();
cy.get('#task-name').click().type('testTask');
cy.get('.pf-c-code-editor').click().type(testTaskScript)
cy.get('[data-cy="add-task-button"]').click();
cy.contains('Task testTask has been created');
cy.get('.pf-c-alert__action > .pf-c-button').click(); //Closing alert popup.
cy.contains('testTask');
});

it('successfully execute a task', () => {
cy.get('a[aria-label="nav-item-Tasks"]').click();
cy.contains('testTask').click();
cy.get('button[aria-label="expand-task-testTask"]').click({ force: true });
cy.get('button[aria-label="execute-button-testTask"]').click();
cy.get('input[aria-label="input-parameter"]').click().type('world');
cy.get('button[aria-label="Confirm"]').click();
cy.contains('The script has been successfully executed');
cy.get('.pf-c-alert__action > .pf-c-button').click(); //Closing alert popup.
})

it('successfully update a task', () => {
cy.get('a[aria-label="nav-item-Tasks"]').click();
cy.contains('testTask').click();
cy.get('button[aria-label="expand-task-testTask"]').click({ force: true });
cy.get('button[aria-label="edit-button-testTask"]').click();
cy.get('.pf-c-code-editor').type('{selectall}', { timeout: 10000 });
cy.get('.pf-c-code-editor').click().type(updatedScript);
cy.get('button[aria-label="edit-button-testTask"]').click();
cy.contains('Task testTask has been updated');
cy.get('.pf-c-alert__action > .pf-c-button').click(); //Closing alert popup.
cy.contains('testTask');
cy.contains('"Good morning " + greetee');
})
});
2 changes: 1 addition & 1 deletion src/app/CacheManagers/CacheManagers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const CacheManagers = () => {
{ name: t('cache-managers.counters-tab'), count: countersCount, key: '1' }
];

if (ConsoleServices.security().hasConsoleACL(ConsoleACL.BULK_READ, connectedUser)) {
if (ConsoleServices.security().hasConsoleACL(ConsoleACL.EXEC, connectedUser)) {
tabs.push({ name: t('cache-managers.tasks-tab'), count: tasksCount, key: '2' });
}

Expand Down
Loading