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

Allow URL params for Security plugin intercept calls #1276

Merged
merged 15 commits into from
May 16, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ if (Cypress.env('SECURITY_ENABLED')) {

before(() => {
cy.server();
localStorage.setItem('home:welcome:show', false);
SuZhou-Joe marked this conversation as resolved.
Show resolved Hide resolved
});
it('Checks that the tenant switcher can switch tenants despite a different tenant being present in the tenant query parameter.', function () {
CURRENT_TENANT.newTenant = tenantName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ if (Cypress.env('SECURITY_ENABLED')) {
`"${TEST_CONFIG.tenant.name}"`
);
window.localStorage.setItem('home:newThemeModal:show', false);
window.localStorage.setItem('home:welcome:show', false);
},
});
cy.waitForLoader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if (Cypress.env('SECURITY_ENABLED')) {
// Navigate to Security/Internal User Database section

cy.visit(`${BASE_PATH}/app/security-dashboards-plugin#/users`);
cy.intercept(SEC_API_INTERNAL_USERS_PATH, {
cy.intercept(`${SEC_API_INTERNAL_USERS_PATH}*`, {
fixture:
SEC_INTERNALUSERS_FIXTURES_PATH + '/internalusers_info_response.json',
}).as('listUserResponse');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export function switchTenantTo(newTenant) {
cy.getElementByTestId('account-popover').click();
cy.intercept({
method: 'GET',
url: '/api/v1/auth/dashboardsinfo',
url: '/api/v1/auth/dashboardsinfo*',
}).as('waitForDashboardsInfo');

cy.intercept({
method: 'GET',
url: '/api/v1/configuration/account',
url: '/api/v1/configuration/account*',
}).as('waitForAccountInfo');

cy.getElementByTestId('switch-tenants').click();
Expand All @@ -37,7 +37,7 @@ export function switchTenantTo(newTenant) {

cy.intercept({
method: 'POST',
url: '/api/v1/multitenancy/tenant',
url: '/api/v1/multitenancy/tenant*',
}).as('waitForUpdatingTenants');
cy.getElementByTestId('tenant-switch-modal')
.find('[data-test-subj="confirm"]')
Expand Down
16 changes: 8 additions & 8 deletions cypress/utils/plugins/security/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
Cypress.Commands.add(
'mockAuthAction',
function (fixtureFileName, funcMockedOn) {
cy.intercept(SEC_API_CONFIG_PATH, {
cy.intercept(`${SEC_API_CONFIG_PATH}*`, {
fixture: fixtureFileName,
}).as('getAuthDetails');

Expand All @@ -35,7 +35,7 @@ Cypress.Commands.add(
Cypress.Commands.add(
'mockRolesAction',
function (fixtureFileName, funcMockedOn) {
cy.intercept(SEC_API_ROLES_PATH, {
cy.intercept(`${SEC_API_ROLES_PATH}*`, {
fixture: fixtureFileName,
}).as('getRoleDetails');

Expand All @@ -48,7 +48,7 @@ Cypress.Commands.add(
Cypress.Commands.add(
'mockInternalUsersAction',
function (fixtureFileName, funcMockedOn) {
cy.intercept(SEC_API_INTERNAL_ACCOUNTS_PATH, {
cy.intercept(`${SEC_API_INTERNAL_ACCOUNTS_PATH}*`, {
fixture: fixtureFileName,
}).as('getInternalUsersDetails');

Expand All @@ -61,7 +61,7 @@ Cypress.Commands.add(
Cypress.Commands.add(
'mockPermissionsAction',
function (fixtureFileName, funcMockedOn) {
cy.intercept(SEC_API_ACTIONGROUPS_PATH, {
cy.intercept(`${SEC_API_ACTIONGROUPS_PATH}*`, {
fixture: fixtureFileName,
}).as('getPermissions');

Expand All @@ -74,7 +74,7 @@ Cypress.Commands.add(
Cypress.Commands.add(
'mockTenantsAction',
function (fixtureFileName, funcMockedOn) {
cy.intercept(SEC_API_TENANTS_PATH, {
cy.intercept(`${SEC_API_TENANTS_PATH}*`, {
fixture: fixtureFileName,
}).as('getTenants');

Expand All @@ -87,7 +87,7 @@ Cypress.Commands.add(
Cypress.Commands.add(
'mockAuditLogsAction',
function (fixtureFileName, funcMockedOn) {
cy.intercept(SEC_API_AUDIT_PATH, {
cy.intercept(`${SEC_API_AUDIT_PATH}*`, {
fixture: fixtureFileName,
}).as('getAuditInfo');

Expand All @@ -101,7 +101,7 @@ Cypress.Commands.add(
'mockAuditConfigUpdateAction',
function (fixtureFileName, funcMockedOn) {
cy.intercept(
{ method: 'POST', url: SEC_API_AUDIT_CONFIG_PATH },
{ method: 'POST', url: `${SEC_API_AUDIT_CONFIG_PATH}*` },
{
fixture: fixtureFileName,
}
Expand All @@ -117,7 +117,7 @@ Cypress.Commands.add(
'mockCachePurgeAction',
function (fixtureFileName, funcMockedOn) {
cy.intercept(
{ method: 'DELETE', url: SEC_API_CACHE_PURGE_PATH },
{ method: 'DELETE', url: `${SEC_API_CACHE_PURGE_PATH}*` },
{
fixture: fixtureFileName,
}
Expand Down
Loading