Skip to content

Commit

Permalink
Add host checks selection tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arbulu89 committed Jun 27, 2024
1 parent 0aa4e07 commit 94b1965
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/e2e/cypress/e2e/host_details.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {
saptuneDetailsDataUnsupportedVersion,
} from '../fixtures/saptune-details/saptune_details_data';

import { createUserRequestFactory } from '@lib/test-utils/factories';

context('Host Details', () => {
before(() => {
cy.loadScenario('healthy-27-node-SAP-cluster');
Expand Down Expand Up @@ -471,4 +473,42 @@ context('Host Details', () => {
});
});
});

describe('Forbidden actions', () => {
const password = 'password';

beforeEach(() => {
cy.deleteAllUsers();
cy.logout();
const user = createUserRequestFactory.build({
password,
password_confirmation: password,
});
cy.wrap(user).as('user');
});

describe('Check Selection', () => {
it('should forbid check selection saving', () => {
cy.get('@user').then((user) => {
cy.createUserWithAbilities(user, []);
cy.login(user.username, password);
});
cy.visit(`/hosts/${selectedHost.agentId}/settings`);

cy.contains('button', 'Save Checks Selection').should('be.disabled');
});

it('should allow check selection saving', () => {
cy.get('@user').then((user) => {
cy.createUserWithAbilities(user, [
{ name: 'all', resource: 'host_checks_selection' },
]);
cy.login(user.username, password);
});
cy.visit(`/hosts/${selectedHost.agentId}/settings`);

cy.contains('button', 'Save Checks Selection').should('be.enabled');
});
});
});
});

0 comments on commit 94b1965

Please sign in to comment.