Skip to content
Draft
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
1 change: 1 addition & 0 deletions web/cypress/e2e/perses/04.coo_import_perses_admin.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe(

beforeEach(() => {
nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
cy.wait(2000);
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
cy.wait(5000);
cy.changeNamespace('All Projects');
Expand Down
27 changes: 7 additions & 20 deletions web/cypress/e2e/perses/99.coo_rbac_perses_user1.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,17 @@ const MP = {
operatorName: 'Cluster Monitoring Operator',
};

//TODO: change tag to @smoke, @dashboards, @perses when customizable-dashboards gets merged
describe(
'RBAC User1: COO - Dashboards (Perses) - Administrator perspective',
{ tags: ['@perses', '@perses-dev'] },
() => {
before(() => {
//TODO: https://issues.redhat.com/browse/OCPBUGS-58468 - when it gets fixed, installation can be don using non-admin user
// Step 1: Grant temporary cluster-admin role to dev user for COO/Perses installation
// cy.log('Granting temporary cluster-admin role to dev user for setup');
// cy.adminCLI(
// `oc adm policy add-cluster-role-to-user cluster-admin ${Cypress.env('LOGIN_USERNAME')}`,
// );

// Step 2: Setup COO and Perses dashboards (requires admin privileges)
// Setup COO and Perses dashboards (requires admin privileges)
cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false });
cy.cleanupPersesTestDashboardsBeforeTests();
cy.setupPersesRBACandExtraDashboards();

//TODO: https://issues.redhat.com/browse/OCPBUGS-58468 - when it gets fixed, installation can be don using non-admin user
// Step 3: Remove cluster-admin role - dev user now has limited permissions
// cy.log('Removing cluster-admin role from dev user');
// cy.adminCLI(
// `oc adm policy remove-cluster-role-from-user cluster-admin ` +
// `${Cypress.env('LOGIN_USERNAME')}`,
// );

// Step 4: Clear Cypress session cache and logout
// Clear Cypress session cache and logout
// This is critical because beforeBlockCOO uses cy.session() which caches the login state
cy.log('Clearing Cypress session cache to ensure fresh login');
cy.then(() => {
Expand All @@ -54,7 +39,7 @@ describe(
cy.clearAllLocalStorage();
cy.clearAllSessionStorage();

// Step 5: Re-login as dev user (now without cluster-admin role)
// Re-login as dev user (now without cluster-admin role)
// Using cy.relogin() because it doesn't require oauthurl and handles the login page directly
cy.log('Re-logging in as dev user with limited permissions');
cy.relogin(
Expand All @@ -67,7 +52,9 @@ describe(
});

beforeEach(() => {
cy.switchPerspective('Core platform');
nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
cy.wait(2000);
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
});

Expand All @@ -77,7 +64,7 @@ describe(

//TODO: rename after customizable-dashboards gets merged
runCOORBACPersesTestsDevUser1({
name: 'Administrator',
name: 'Core platform',
});
},
);
6 changes: 5 additions & 1 deletion web/cypress/e2e/perses/99.coo_rbac_perses_user2.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe(

// Step 2: Setup COO and Perses dashboards (requires admin privileges)
cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false });
cy.cleanupPersesTestDashboardsBeforeTests();
cy.setupPersesRBACandExtraDashboards();

//TODO: https://issues.redhat.com/browse/OCPBUGS-58468 - when it gets fixed, installation can be don using non-admin user
Expand Down Expand Up @@ -67,8 +68,11 @@ describe(
});

beforeEach(() => {
cy.switchPerspective('Core platform');
nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
cy.wait(2000);
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
cy.wait(2000);
cy.changeNamespace('All Projects');
});

Expand All @@ -78,7 +82,7 @@ describe(

//TODO: rename after customizable-dashboards gets merged
runCOORBACPersesTestsDevUser2({
name: 'Administrator',
name: 'Core platform',
});
},
);
7 changes: 6 additions & 1 deletion web/cypress/e2e/perses/99.coo_rbac_perses_user3.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe(

// Step 2: Setup COO and Perses dashboards (requires admin privileges)
cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false });
cy.cleanupPersesTestDashboardsBeforeTests();
cy.setupPersesRBACandExtraDashboards();

//TODO: https://issues.redhat.com/browse/OCPBUGS-58468 - when it gets fixed, installation can be don using non-admin user
Expand Down Expand Up @@ -67,8 +68,12 @@ describe(
});

beforeEach(() => {
cy.switchPerspective('Core platform');
nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
cy.wait(2000);
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
cy.wait(2000);
cy.changeNamespace('All Projects');
});

after(() => {
Expand All @@ -77,7 +82,7 @@ describe(

//TODO: rename after customizable-dashboards gets merged
runCOORBACPersesTestsDevUser3({
name: 'Administrator',
name: 'Core platform',
});
},
);
7 changes: 6 additions & 1 deletion web/cypress/e2e/perses/99.coo_rbac_perses_user4.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe(

// Step 2: Setup COO and Perses dashboards (requires admin privileges)
cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false });
cy.cleanupPersesTestDashboardsBeforeTests();
cy.setupPersesRBACandExtraDashboards();

//TODO: https://issues.redhat.com/browse/OCPBUGS-58468 - when it gets fixed, installation can be don using non-admin user
Expand Down Expand Up @@ -67,8 +68,12 @@ describe(
});

beforeEach(() => {
cy.switchPerspective('Core platform');
nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
cy.wait(2000);
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
cy.wait(2000);
cy.changeNamespace('All Projects');
});

after(() => {
Expand All @@ -77,7 +82,7 @@ describe(

//TODO: rename after customizable-dashboards gets merged
runCOORBACPersesTestsDevUser4({
name: 'Administrator',
name: 'Core platform',
});
},
);
7 changes: 6 additions & 1 deletion web/cypress/e2e/perses/99.coo_rbac_perses_user5.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe(

// Step 2: Setup COO and Perses dashboards (requires admin privileges)
cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false });
cy.cleanupPersesTestDashboardsBeforeTests();
cy.setupPersesRBACandExtraDashboards();

//TODO: https://issues.redhat.com/browse/OCPBUGS-58468 - when it gets fixed, installation can be don using non-admin user
Expand Down Expand Up @@ -67,8 +68,12 @@ describe(
});

beforeEach(() => {
cy.switchPerspective('Core platform');
nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
cy.wait(2000);
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
cy.wait(2000);
cy.changeNamespace('All Projects');
});

after(() => {
Expand All @@ -77,7 +82,7 @@ describe(

//TODO: rename after customizable-dashboards gets merged
runCOORBACPersesTestsDevUser5({
name: 'Administrator',
name: 'Core platform',
});
},
);
5 changes: 4 additions & 1 deletion web/cypress/e2e/perses/99.coo_rbac_perses_user6.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe(

// Step 2: Setup COO and Perses dashboards (requires admin privileges)
cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false });
cy.cleanupPersesTestDashboardsBeforeTests();
cy.setupPersesRBACandExtraDashboards();

//TODO: https://issues.redhat.com/browse/OCPBUGS-58468 - when it gets fixed, installation can be don using non-admin user
Expand Down Expand Up @@ -67,7 +68,9 @@ describe(
});

beforeEach(() => {
cy.switchPerspective('Core platform');
nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
cy.wait(2000);
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
});

Expand All @@ -77,7 +80,7 @@ describe(

//TODO: rename after customizable-dashboards gets merged
runCOORBACPersesTestsDevUser6({
name: 'Administrator',
name: 'Core platform',
});
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -231,31 +231,6 @@
}
]
}
},
"c03e17f849d341bcb1139c65e68dad1d": {
"kind": "Panel",
"spec": {
"display": {
"name": "status history"
},
"plugin": {
"kind": "StatusHistoryChart",
"spec": {}
},
"queries": [
{
"kind": "TimeSeriesQuery",
"spec": {
"plugin": {
"kind": "PrometheusTimeSeriesQuery",
"spec": {
"query": "vector(1)"
}
}
}
}
]
}
}
},
"layouts": [
Expand Down Expand Up @@ -317,16 +292,7 @@
{
"x": 0,
"y": 15,
"width": 12,
"height": 6,
"content": {
"$ref": "#/spec/panels/c03e17f849d341bcb1139c65e68dad1d"
}
},
{
"x": 12,
"y": 15,
"width": 12,
"width": 24,
"height": 6,
"content": {
"$ref": "#/spec/panels/31b8374866184a26beddf46ec30df0b5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,6 @@ spec:
kind: PrometheusTimeSeriesQuery
spec:
query: up
c03e17f849d341bcb1139c65e68dad1d:
kind: Panel
spec:
display:
name: status history
plugin:
kind: StatusHistoryChart
spec: {}
queries:
- kind: TimeSeriesQuery
spec:
plugin:
kind: PrometheusTimeSeriesQuery
spec:
query: vector(1)
layouts:
- kind: Grid
spec:
Expand Down Expand Up @@ -198,13 +183,7 @@ spec:
$ref: "#/spec/panels/57ce686052c9464fa9486ff49d3757cd"
- x: 0
"y": 15
width: 12
height: 6
content:
$ref: "#/spec/panels/c03e17f849d341bcb1139c65e68dad1d"
- x: 12
"y": 15
width: 12
width: 24
height: 6
content:
$ref: "#/spec/panels/31b8374866184a26beddf46ec30df0b5"
Expand Down
15 changes: 7 additions & 8 deletions web/cypress/fixtures/perses/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,11 @@ export const persesDashboardsAddPanelAddQueryType = {
};

export const persesCreateDashboard = {
DIALOG_MAX_LENGTH_VALIDATION: 'Must be 75 or fewer characters long: error status;',
DIALOG_MAX_LENGTH_VALIDATION: 'Must be 75 or fewer characters long',
DIALOG_DUPLICATED_NAME_PF_VALIDATION_PREFIX: 'Dashboard name ',
DIALOG_DUPLICATED_NAME_PF_VALIDATION_SUFFIX: ' already exists in ',
DIALOG_DUPLICATED_NAME_PF_VALIDATION_SUFFIX_PROJECT: ' project!: error status;',
DIALOG_DUPLICATED_NAME_BKD_VALIDATION:
'Danger alert:Could not create dashboard. e: document already exists',
DIALOG_CREATE_NAME_BKD_VALIDATION: 'document already exists',
};

export const persesDashboardsEmptyDashboard = {
Expand All @@ -167,7 +166,9 @@ export const persesDashboardsRenameDashboard = {
};

export const persesDashboardsDuplicateDashboard = {
DIALOG_DUPLICATED_NAME_VALIDATION: 'already exists', //use contains
DIALOG_DUPLICATED_NAME_VALIDATION: 'Could not duplicate dashboard. e: document already exists', //use contains
DIALOG_DUPLICATED_NAME_FED_VALIDATION_1: 'Dashboard name "',
DIALOG_DUPLICATED_NAME_FED_VALIDATION_2: '" already exists in this project: error status;',
};

export const persesDashboardsImportDashboard = {
Expand All @@ -179,8 +180,6 @@ export const persesDashboardsImportDashboard = {
DIALOG_GRAFANA_DASHBOARD_DETECTED:
'Grafana dashboard detected. It will be automatically migrated to Perses format. Note: migration may be partial as not all Grafana features are supported.',
DIALOG_PERSES_DASHBOARD_DETECTED: 'Perses dashboard detected.',
DIALOG_FAILED_TO_MIGRATE_GRAFANA_DASHBOARD:
'Danger alert:Error migrating dashboard: Failed to migrate dashboard: internal server error',
DIALOG_DUPLICATED_DASHBOARD_ERROR:
'Danger alert:Error importing dashboard: document already exists',
DIALOG_FAILED_TO_MIGRATE_GRAFANA_DASHBOARD: 'Failed to migrate dashboard',
DIALOG_DUPLICATED_DASHBOARD_ERROR: 'document already exists',
};
4 changes: 2 additions & 2 deletions web/cypress/support/commands/auth-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const operatorAuthUtils = {
}
cy.exec(
`oc get oauthclient openshift-browser-client -o go-template ` +
`--template="{{index .redirectURIs 0}}" --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`,
`--template="{{index .redirectURIs 0}}" --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`,
).then((result) => {
if (result.stderr === '') {
const oauth = result.stdout;
Expand Down Expand Up @@ -325,7 +325,7 @@ Cypress.Commands.add('relogin', (provider: string, username: string, password: s
// Get the OAuth URL from the cluster (same as performLoginAndAuth does)
cy.exec(
`oc get oauthclient openshift-browser-client -o go-template ` +
`--template="{{index .redirectURIs 0}}" --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`,
`--template="{{index .redirectURIs 0}}" --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`,
).then((result) => {
if (result.stderr !== '') {
throw new Error(`Failed to get OAuth URL: ${result.stderr}`);
Expand Down
Loading