Skip to content
Open
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
20 changes: 12 additions & 8 deletions web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,19 @@ export function testCOORBACPersesTestsDevUser1(perspective: PerspectiveConfig) {

});

it(`4.${perspective.name} perspective - Create button validation - Disabled / Enabled`, () => {
it(`4.${perspective.name} perspective - Create button validation - Access denied / Enabled`, () => {
cy.log(`4.1. use sidebar nav to go to Observe > Dashboards (Perses)`);
listPersesDashboardsPage.shouldBeLoaded();

cy.log(`4.2 change namespace to observ-test`);
cy.changeNamespace('observ-test');

cy.log(`4.3. Verify Create button is disabled`);
listPersesDashboardsPage.assertCreateButtonIsDisabled();
cy.log(`4.3. Verify Create button is enabled and creation is denied`);
listPersesDashboardsPage.assertCreateButtonIsEnabled();
listPersesDashboardsPage.clickCreateButton();
persesCreateDashboardsPage.createDashboardShouldBeLoaded();
persesCreateDashboardsPage.assertCreateAccessDenied('observ-test');
persesCreateDashboardsPage.createDashboardDialogCancelButton();

cy.log(`4.4 change namespace to openshift-cluster-observability-operator`);
cy.changeNamespace('openshift-cluster-observability-operator');
Expand Down Expand Up @@ -294,9 +298,9 @@ export function testCOORBACPersesTestsDevUser1(perspective: PerspectiveConfig) {
cy.log(`6.2. Change namespace to observ-test`);
cy.changeNamespace('observ-test');

cy.log(`6.3. Assert Kebab icon is disabled`);
cy.log(`6.3. Assert Rename/Delete row actions are disabled`);
listPersesDashboardsPage.filter.byName(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0]);
listPersesDashboardsPage.assertKebabIconDisabled();
listPersesDashboardsPage.assertKebabRowActionsDisabled();

cy.log(`6.4. Change namespace to openshift-cluster-observability-operator`);
cy.changeNamespace('openshift-cluster-observability-operator');
Expand All @@ -317,7 +321,7 @@ export function testCOORBACPersesTestsDevUser1(perspective: PerspectiveConfig) {
listPersesDashboardsPage.filter.byName(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0]);
listPersesDashboardsPage.countDashboards('1');
listPersesDashboardsPage.clickKebabIcon();
listPersesDashboardsPage.assertKebabIconDisabled();
listPersesDashboardsPage.assertKebabRowActionsDisabled();
listPersesDashboardsPage.clearAllFilters();

cy.log(`6.4. Filter by Project and Name`);
Expand Down Expand Up @@ -408,8 +412,8 @@ export function testCOORBACPersesTestsDevUser1(perspective: PerspectiveConfig) {

cy.log(`8.5. Assert project dropdown options`);
listPersesDashboardsPage.assertDuplicateProjectDropdownOptions('openshift-cluster-observability-operator', true);
listPersesDashboardsPage.assertDuplicateProjectDropdownOptions('observ-test', false);
listPersesDashboardsPage.assertDuplicateProjectDropdownOptions('perses-dev', false);
listPersesDashboardsPage.assertDuplicateProjectDropdownOptions('observ-test', true);
listPersesDashboardsPage.assertDuplicateProjectDropdownOptions('perses-dev', true);

cy.log(`8.6. Enter new dashboard name`);
listPersesDashboardsPage.duplicateDashboardEnterName(dashboardName);
Expand Down
26 changes: 16 additions & 10 deletions web/cypress/support/perses/99.coo_rbac_perses_user2.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { persesDashboardsPage } from '../../views/perses-dashboards';
import { listPersesDashboardsPage } from '../../views/perses-dashboards-list-dashboards';
import { persesCreateDashboardsPage } from '../../views/perses-dashboards-create-dashboard';
import { persesDashboardsDashboardDropdownCOO, persesDashboardsDashboardDropdownPersesDev } from '../../fixtures/perses/constants';

export interface PerspectiveConfig {
Expand Down Expand Up @@ -72,41 +73,46 @@ export function testCOORBACPersesTestsDevUser2(perspective: PerspectiveConfig) {

});

it(`3.${perspective.name} perspective - Create button validation - Disabled`, () => {
it(`3.${perspective.name} perspective - Create button validation - Access denied`, () => {
cy.log(`3.1. use sidebar nav to go to Observe > Dashboards (Perses)`);
listPersesDashboardsPage.shouldBeLoaded();

cy.log(`3.2. Verify Create button is disabled`);
listPersesDashboardsPage.assertCreateButtonIsDisabled();
cy.log(`3.2. Verify Create button is enabled but creation is denied`);
listPersesDashboardsPage.assertCreateButtonIsEnabled();
listPersesDashboardsPage.clickCreateButton();
persesCreateDashboardsPage.createDashboardShouldBeLoaded();
persesCreateDashboardsPage.assertCreateAccessDenied('perses-dev');
persesCreateDashboardsPage.createDashboardDialogCancelButton();

cy.log(`3.3 change namespace to perses-dev`);
cy.changeNamespace('perses-dev');

cy.log(`3.4. Verify Create button is disabled`);
listPersesDashboardsPage.assertCreateButtonIsDisabled();
cy.log(`3.4. Verify Create button is enabled but creation is denied`);
listPersesDashboardsPage.assertCreateButtonIsEnabled();

});

it(`4.${perspective.name} perspective - Kebab icon - Disabled`, () => {
it(`4.${perspective.name} perspective - Kebab icon - Row actions denied`, () => {
cy.log(`4.1. use sidebar nav to go to Observe > Dashboards (Perses)`);
listPersesDashboardsPage.shouldBeLoaded();

cy.log(`4.2. Change namespace to perses-dev`);
cy.changeNamespace('perses-dev');

cy.log(`4.3. Assert Kebab icon is disabled`);
cy.log(`4.3. Assert Rename/Delete row actions are disabled`);
listPersesDashboardsPage.filter.byName(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0]);
listPersesDashboardsPage.assertKebabIconDisabled();
listPersesDashboardsPage.assertKebabRowActionsDisabled();
listPersesDashboardsPage.assertDuplicateAccessDenied('perses-dev');
listPersesDashboardsPage.clearAllFilters();

cy.log(`4.4. Change namespace to All Projects`);
cy.changeNamespace('All Projects');

cy.log(`4.5. Assert Kebab icon is disabled`);
cy.log(`4.5. Assert Rename/Delete row actions are disabled`);
listPersesDashboardsPage.filter.byProject('perses-dev');
listPersesDashboardsPage.filter.byName(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0]);
listPersesDashboardsPage.countDashboards('1');
listPersesDashboardsPage.assertKebabIconDisabled();
listPersesDashboardsPage.assertKebabRowActionsDisabled();
listPersesDashboardsPage.clearAllFilters();

});
Expand Down
19 changes: 18 additions & 1 deletion web/cypress/views/perses-dashboards-create-dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Classes, IDs } from "../../src/components/data-test";
import { Classes, IDs, persesDashboardDataTestIDs } from "../../src/components/data-test";
import { persesCreateDashboard, persesDashboardsModalTitles } from "../fixtures/perses/constants";

export const persesCreateDashboardsPage = {
Expand Down Expand Up @@ -39,6 +39,17 @@ export const persesCreateDashboardsPage = {
cy.get(Classes.PersesCreateDashboardProjectDropdown).should('be.visible').click({ force: true });
},

assertCreateAccessDenied: (project: string) => {
cy.log('persesCreateDashboardsPage.assertCreateAccessDenied');
cy.get('#' + IDs.persesDashboardCreateDashboardName)
.should('be.visible')
.clear()
.type('access-denied-check');
persesCreateDashboardsPage.selectProject(project);
cy.byTestID(persesDashboardDataTestIDs.createAccessDeniedHelperText).should('be.visible');
cy.byPFRole('dialog').find('button').contains('Create').should('be.disabled');
},

enterDashboardName: (name: string) => {
cy.log('persesCreateDashboardsPage.enterDashboardName');
cy.get('#' + IDs.persesDashboardCreateDashboardName).should('be.visible').clear().type(name);
Expand All @@ -50,6 +61,12 @@ export const persesCreateDashboardsPage = {
cy.wait(2000);
},

createDashboardDialogCancelButton: () => {
cy.log('persesCreateDashboardsPage.clickCancelButton');
cy.byPFRole('dialog').find('button').contains('Cancel').should('be.visible').click({ force: true });
cy.wait(2000);
},

assertMaxLengthValidation: () => {
cy.log('persesCreateDashboardsPage.assertMaxLengthValidation');
cy.byPFRole('dialog').find('h4').should('have.text', persesCreateDashboard.DIALOG_MAX_LENGTH_VALIDATION).should('be.visible');
Expand Down
22 changes: 21 additions & 1 deletion web/cypress/views/perses-dashboards-list-dashboards.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { commonPages } from "./common";
import { DataTestIDs, Classes, listPersesDashboardsOUIAIDs, listPersesDashboardsDataTestIDs, IDs, persesAriaLabels } from "../../src/components/data-test";
import { DataTestIDs, Classes, listPersesDashboardsOUIAIDs, listPersesDashboardsDataTestIDs, IDs, persesAriaLabels, persesDashboardDataTestIDs } from "../../src/components/data-test";
import { listPersesDashboardsEmptyState, listPersesDashboardsPageSubtitle, persesDashboardsDuplicateDashboard, persesDashboardsRenameDashboard } from "../fixtures/perses/constants";
import { MonitoringPageTitles } from "../fixtures/monitoring/constants";

Expand Down Expand Up @@ -134,6 +134,15 @@ export const listPersesDashboardsPage = {
cy.byAriaLabel(persesAriaLabels.persesDashboardKebabIcon).scrollIntoView().should('be.visible').should('have.attr', 'disabled');
},

assertKebabRowActionsDisabled: (index?: number) => {
cy.log('persesDashboardsPage.assertKebabRowActionsDisabled');
listPersesDashboardsPage.clickKebabIcon(index);
cy.byPFRole('menuitem').contains('Rename dashboard').should('have.attr', 'aria-disabled', 'true');
cy.byPFRole('menuitem').contains('Delete dashboard').should('have.attr', 'aria-disabled', 'true');
cy.byPFRole('menuitem').contains('Duplicate dashboard').should('not.have.attr', 'aria-disabled', 'true');
listPersesDashboardsPage.clickKebabIcon(index);
},

clickRenameDashboardOption: () => {
cy.log('listPersesDashboardsPage.clickRenameDashboardOption');
cy.wait(1000);
Expand Down Expand Up @@ -209,6 +218,17 @@ export const listPersesDashboardsPage = {
cy.wait(2000);
},

assertDuplicateAccessDenied: (project: string) => {
cy.log('persesDashboardsPage.assertDuplicateAccessDenied');
listPersesDashboardsPage.clickKebabIcon();
listPersesDashboardsPage.clickDuplicateOption();
listPersesDashboardsPage.duplicateDashboardEnterName('access-denied-check');
listPersesDashboardsPage.duplicateDashboardSelectProjectDropdown(project);
cy.byTestID(persesDashboardDataTestIDs.createAccessDeniedHelperText).should('be.visible');
cy.byPFRole('dialog').find('button').contains('Duplicate').should('be.disabled');
listPersesDashboardsPage.duplicateDashboardCancelButton();
},

assertDuplicateProjectDropdownOptions: (project: string, contains: boolean) => {
cy.log('listPersesDashboardsPage.assertDuplicateProjectDropdownOptions');
cy.get(Classes.PersesCreateDashboardProjectDropdown).should('be.visible').click({ force: true });
Expand Down
18 changes: 5 additions & 13 deletions web/locales/en/plugin__monitoring-plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@
"Failed to create project \"{{project}}\". Please try again.": "Failed to create project \"{{project}}\". Please try again.",
"Error creating project: {{error}}": "Error creating project: {{error}}",
"Duplicate Dashboard": "Duplicate Dashboard",
"Loading...": "Loading...",
"Failed to load project permissions. Please refresh the page and try again.": "Failed to load project permissions. Please refresh the page and try again.",
"Select namespace": "Select namespace",
"No namespace found for \"{{filter}}\"": "No namespace found for \"{{filter}}\"",
"Duplicate": "Duplicate",
Expand All @@ -187,14 +185,15 @@
"Delete": "Delete",
"Must be 75 or fewer characters long": "Must be 75 or fewer characters long",
"Dashboard name '{{dashboardName}}' already exists in '{{projectName}}' project!": "Dashboard name '{{dashboardName}}' already exists in '{{projectName}}' project!",
"Checking permissions...": "Checking permissions...",
"Create": "Create",
"Dashboard actions": "Dashboard actions",
"Import": "Import",
"To create dashboards, contact your cluster administrator for permission.": "To create dashboards, contact your cluster administrator for permission.",
"Create Dashboard": "Create Dashboard",
"my-new-dashboard": "my-new-dashboard",
"Select project": "Select project",
"You do not have permission to create dashboards in this project.": "You do not have permission to create dashboards in this project.",
"You do not have permission to edit dashboards in this project.": "You do not have permission to edit dashboards in this project.",
"You do not have permission to delete dashboards in this project.": "You do not have permission to delete dashboards in this project.",
"View and manage dashboards.": "View and manage dashboards.",
"Unable to detect dashboard format. Please provide a valid Perses or Grafana dashboard.": "Unable to detect dashboard format. Please provide a valid Perses or Grafana dashboard.",
"Invalid {{format}}: {{error}}": "Invalid {{format}}: {{error}}",
Expand All @@ -219,7 +218,7 @@
"Rename dashboard": "Rename dashboard",
"Duplicate dashboard": "Duplicate dashboard",
"Delete dashboard": "Delete dashboard",
"You don't have permissions for dashboard actions": "You don't have permissions for dashboard actions",
"Kebab toggle": "Kebab toggle",
"Dashboard": "Dashboard",
"Project": "Project",
"Created on": "Created on",
Expand All @@ -234,19 +233,12 @@
"The dashboard \"{{name}}\" was not found in project \"{{project}}\".": "The dashboard \"{{name}}\" was not found in project \"{{project}}\".",
"Empty Dashboard": "Empty Dashboard",
"To get started add something to your dashboard": "To get started add something to your dashboard",
"Loading...": "Loading...",
"Edit": "Edit",
"You don't have permission to edit this dashboard": "You don't have permission to edit this dashboard",
"No Dashboard Available in Selected Project": "No Dashboard Available in Selected Project",
"To explore data, create a dashboard for this project": "To explore data, create a dashboard for this project",
"No Perses Project Available": "No Perses Project Available",
"To explore data, create a Perses Project": "To explore data, create a Perses Project",
"Project is required for fetching project dashboards": "Project is required for fetching project dashboards",
"No projects found": "No projects found",
"No results match the filter criteria.": "No results match the filter criteria.",
"Clear filters": "Clear filters",
"Select project...": "Select project...",
"Projects": "Projects",
"All Projects": "All Projects",
"useToast must be used within ToastProvider": "useToast must be used within ToastProvider",
"Refresh off": "Refresh off",
"{{count}} second_one": "{{count}} second",
Expand Down
Loading