Skip to content

Commit

Permalink
Revert to beforeeach and aftereach
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 ce64989 commit ce4cad7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ let externalDataSourceUrl;
let localDataSourceUrl;

describe('Multi-datasources enabled', () => {
before(() => {
beforeEach(() => {
deleteAllDataSources();
localStorage.setItem('opendistro::security::tenant::saved', '""');
localStorage.setItem('home:newThemeModal:show', 'false');
Expand All @@ -82,18 +82,17 @@ describe('Multi-datasources enabled', () => {
});
});

after(() => {
afterEach(() => {
cy.clearCookies();
cy.clearAllLocalStorage();
cy.clearAllSessionStorage();
deleteAllDataSources();
});

it('Checks Get Started Tab', () => {
// Remote cluster purge cache
cy.visit(
`http://localhost:5601/app/security-dashboards-plugin${externalDataSourceUrl}#/getstarted`,
{
failOnStatusCode: false,
}
`http://localhost:5601/app/security-dashboards-plugin${externalDataSourceUrl}#/getstarted`
);

cy.contains('h1', 'Get started');
Expand All @@ -109,9 +108,7 @@ describe('Multi-datasources enabled', () => {
});

it('Checks Auth Tab', () => {
cy.visit(`http://localhost:5601/app/security-dashboards-plugin${externalDataSourceUrl}#/auth`, {
failOnStatusCode: false,
});
cy.visit(`http://localhost:5601/app/security-dashboards-plugin${externalDataSourceUrl}#/auth`);

cy.get('.panel-header-count').first().invoke('text').should('contain', '(2)');
});
Expand All @@ -130,10 +127,7 @@ describe('Multi-datasources enabled', () => {
},
}).then(() => {
cy.visit(
`http://localhost:5601/app/security-dashboards-plugin${externalDataSourceUrl}#/users`,
{
failOnStatusCode: false,
}
`http://localhost:5601/app/security-dashboards-plugin${externalDataSourceUrl}#/users`
);

cy.get('[data-test-subj="tableHeaderCell_username_0"]').click();
Expand All @@ -153,10 +147,7 @@ describe('Multi-datasources enabled', () => {
},
}).then(() => {
cy.visit(
`http://localhost:5601/app/security-dashboards-plugin${externalDataSourceUrl}#/permissions`,
{
failOnStatusCode: false,
}
`http://localhost:5601/app/security-dashboards-plugin${externalDataSourceUrl}#/permissions`
);

// Permission exists on the remote data source
Expand Down
3 changes: 3 additions & 0 deletions test/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +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',
};
}
orig(url, options);
});
Expand Down

0 comments on commit ce4cad7

Please sign in to comment.