Skip to content

Commit

Permalink
Fix roles and enable
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Ho <[email protected]>
  • Loading branch information
derek-ho committed Apr 22, 2024
1 parent 22fa5e6 commit cda06ff
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,29 +215,31 @@ describe('Multi-datasources enabled', () => {
});
});

it.skip('Checks Roles Tab', () => {
Cypress.on('uncaught:exception', (err) => !err.message.includes('ResizeObserver'));
// select remote data source
cy.visit(`http://localhost:5601/app/security-dashboards-plugin${externalDataSourceUrl}#/roles`);

// create a role on remote data source
cy.get('[data-test-subj="create-role"]').click();
cy.contains('h1', 'Create Role');
cy.get('[data-test-subj="name-text"]').focus().type('9202-role');
cy.get('[data-test-subj="create-or-update-role"]').click();

cy.get('[class="euiToast euiToast--success euiGlobalToastListItem"]')
.get('.euiToastHeader__title')
.should('contain', 'Role "9202-role" successfully created');
it('Checks Roles Tab', () => {
cy.request({
method: 'POST',
url: `http://localhost:5601/api/v1/configuration/roles/9202-role?dataSourceId=${externalDataSourceId}`,
headers: {
'osd-xsrf': true,
},
body: {
cluster_permissions: [],
index_permissions: [],
tenant_permissions: [],
},
}).then(() => {
cy.visit(
`http://localhost:5601/app/security-dashboards-plugin${externalDataSourceUrl}#/roles`
);

// role exists on the remote
cy.visit(`http://localhost:5601/app/security-dashboards-plugin${externalDataSourceUrl}#/roles`);
cy.get('[data-test-subj="dataSourceSelectableContextMenuHeaderLink"]').should(
'contain',
'9202'
);
cy.get('[data-test-subj="tableHeaderCell_roleName_0"]').click();
cy.get('[data-test-subj="checkboxSelectRow-9202-role"]').should('exist');

cy.get('[data-test-subj="dataSourceSelectableContextMenuHeaderLink"]').should(
'contain',
'9202'
);
cy.get('[data-test-subj="tableHeaderCell_roleName_0"]').click();
cy.get('[data-test-subj="checkboxSelectRow-9202-role"]').should('exist');
// role exists on the remote
});
});
});
6 changes: 3 additions & 3 deletions test/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ if (Cypress.env('LOGIN_AS_ADMIN')) {
if (Cypress.env('LOGIN_AS_ADMIN')) {
options.auth = ADMIN_AUTH;
options.failOnStatusCode = false;
// options.qs = {
// security_tenant: 'private',
// };
options.qs = {
security_tenant: 'private',
};
}
orig(url, options);
});
Expand Down

0 comments on commit cda06ff

Please sign in to comment.