Skip to content

Commit adc32cc

Browse files
committed
Changed dashboard navigation to actual GitRepo page
1 parent 4eecac5 commit adc32cc

File tree

3 files changed

+59
-23
lines changed

3 files changed

+59
-23
lines changed

tests/cypress/e2e/unit_tests/rbac_fleet.spec.ts

Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,16 @@ describe('Test Fleet access with RBAC with custom roles using Standard User', {
307307
cy.login(stduser, uiPassword);
308308

309309
// CAN go to Continuous Delivery Dashboard and "list" gitrepos
310-
cy.accesMenuSelection('Continuous Delivery', 'Dashboard');
311-
cy.get('div.fleet-dashboard-data').should('contain', repoName).and('contain', repoNameDefault);
310+
cy.continuousDeliveryMenuSelection();
311+
cy.verifyTableRow(0, 'Active', repoNameDefault);
312+
313+
cy.fleetNamespaceToggle('fleet-local');
314+
cy.verifyTableRow(0, 'Active', repoName);
312315

313316
// CHECKS IN FLEET-DEFAULT
314317
// Can't "Create", "Edit" nor "Delete"
315318
cy.continuousDeliveryMenuSelection();
316-
cy.get('.btn.role-primary').contains('Create App Bundle').should('not.exist');
319+
cy.checkAccessToCreateGitRepoPage();
317320
// Note: listing is checked implictly here
318321
cy.open3dotsMenu(repoNameDefault, 'Edit Config', true);
319322
cy.open3dotsMenu(repoNameDefault, 'Delete', true);
@@ -353,8 +356,11 @@ describe('Test Fleet access with RBAC with custom roles using Standard User', {
353356
cy.login(stduser, uiPassword);
354357

355358
// CAN go to Continuous Delivery Dashboard and "list" gitrepos
356-
cy.accesMenuSelection('Continuous Delivery', 'Dashboard');
357-
cy.get('div.fleet-dashboard-data').should('contain', repoName).and('contain', repoNameDefault);
359+
cy.continuousDeliveryMenuSelection();
360+
cy.verifyTableRow(0, 'Active', repoNameDefault);
361+
362+
cy.fleetNamespaceToggle('fleet-local');
363+
cy.verifyTableRow(0, 'Active', repoName);
358364

359365
// CHECKS IN FLEET-DEFAULT
360366
// CAN "Create" repos
@@ -404,8 +410,11 @@ describe('Test Fleet access with RBAC with custom roles using Standard User', {
404410
cy.login(stduser, uiPassword);
405411

406412
// CAN go to Continuous Delivery Dashboard and "list" gitrepos
407-
cy.accesMenuSelection('Continuous Delivery', 'Dashboard');
408-
cy.get('div.fleet-dashboard-data').should('contain', repoName).and('contain', repoNameDefault);
413+
cy.continuousDeliveryMenuSelection();
414+
cy.verifyTableRow(0, 'Active', repoNameDefault);
415+
416+
cy.fleetNamespaceToggle('fleet-local');
417+
cy.verifyTableRow(0, 'Active', repoName);
409418

410419
// CHECKS IN FLEET-DEFAULT
411420
// CAN "Create" and "Edit"
@@ -458,13 +467,16 @@ describe('Test Fleet access with RBAC with custom roles using Standard User', {
458467
cy.login(stduser, uiPassword);
459468

460469
// CAN go to Continuous Delivery Dashboard and "list" gitrepos
461-
cy.accesMenuSelection('Continuous Delivery', 'Dashboard');
462-
cy.get('div.fleet-dashboard-data').should('contain', repoName).and('contain', repoNameDefault);
470+
cy.continuousDeliveryMenuSelection();
471+
cy.verifyTableRow(0, 'Active', repoNameDefault);
472+
473+
cy.fleetNamespaceToggle('fleet-local');
474+
cy.verifyTableRow(0, 'Active', repoName);
463475

464476
// CHECKS IN FLEET-DEFAULT
465477
cy.continuousDeliveryMenuSelection();
466478
// Can't "Create" repos
467-
cy.get('.btn.role-primary').contains('Create App Bundle').should('not.exist');
479+
cy.checkAccessToCreateGitRepoPage();
468480
// Cant't "Edit"
469481
cy.open3dotsMenu(repoNameDefault, 'Edit Config', true);
470482
// CAN "Delete"
@@ -528,19 +540,25 @@ describe('Test Fleet access with RBAC with "CUSTOM ROLES" and "GITREPOS" using "
528540
cypressLib.logout();
529541
cy.login(baseUser, uiPassword);
530542

531-
// CAN go to Continuous Delivery Dashboard and "list" gitrepos
532-
cy.accesMenuSelection('Continuous Delivery', 'Dashboard');
533-
cy.get('div.fleet-dashboard-data').should('contain', repoName).and('contain', repoNameDefault);
534-
543+
// CAN go to Continuous Delivery Dashboard/App Bundles page and "list" gitrepos
544+
// cy.accesMenuSelection('Continuous Delivery', 'Dashboard');
545+
// cy.get('div.fleet-dashboard-data').should('contain', repoName).and('contain', repoNameDefault);
546+
cy.continuousDeliveryMenuSelection();
547+
cy.verifyTableRow(0, 'Active', repoNameDefault);
548+
549+
cy.fleetNamespaceToggle('fleet-local');
550+
cy.verifyTableRow(0, 'Active', repoName);
551+
535552
// CHECKS IN FLEET-DEFAULT
536553
// Can't "Create", "Edit" nor "Delete"
537554
cy.continuousDeliveryMenuSelection();
538-
cy.get('.btn.role-primary').contains('Create App Bundle').should('not.exist');
555+
cy.checkAccessToCreateGitRepoPage();
556+
539557
// Note: listing is checked implictly here
540558
cy.open3dotsMenu(repoNameDefault, 'Edit Config', true);
541559
cy.open3dotsMenu(repoNameDefault, 'Delete', true);
542560

543-
// CHECKS IN FLEET-DEFAULT
561+
// CHECKS IN FLEET-LOCAL
544562
// Can't "Create", "Edit" nor "Delete"
545563
cy.fleetNamespaceToggle('fleet-local');
546564
cy.open3dotsMenu(repoName, 'Edit Config', true);
@@ -575,8 +593,11 @@ describe('Test Fleet access with RBAC with "CUSTOM ROLES" and "GITREPOS" using "
575593
cy.login(baseUser, uiPassword);
576594

577595
// CAN go to Continuous Delivery Dashboard and "list" gitrepos
578-
cy.accesMenuSelection('Continuous Delivery', 'Dashboard');
579-
cy.get('div.fleet-dashboard-data').should('contain', repoName).and('contain', repoNameDefault);
596+
cy.continuousDeliveryMenuSelection();
597+
cy.verifyTableRow(0, 'Active', repoNameDefault);
598+
599+
cy.fleetNamespaceToggle('fleet-local');
600+
cy.verifyTableRow(0, 'Active', repoName);
580601

581602
// CHECKS IN FLEET-DEFAULT
582603
// CAN "Create" repos
@@ -626,8 +647,11 @@ describe('Test Fleet access with RBAC with "CUSTOM ROLES" and "GITREPOS" using "
626647
cy.login(baseUser, uiPassword);
627648

628649
// CAN go to Continuous Delivery Dashboard and "list" gitrepos
629-
cy.accesMenuSelection('Continuous Delivery', 'Dashboard');
630-
cy.get('div.fleet-dashboard-data').should('contain', repoName).and('contain', repoNameDefault);
650+
cy.continuousDeliveryMenuSelection();
651+
cy.verifyTableRow(0, 'Active', repoNameDefault);
652+
653+
cy.fleetNamespaceToggle('fleet-local');
654+
cy.verifyTableRow(0, 'Active', repoName);
631655

632656
// CHECKS IN FLEET-DEFAULT
633657
// CAN "Create" and "Edit"
@@ -680,13 +704,16 @@ describe('Test Fleet access with RBAC with "CUSTOM ROLES" and "GITREPOS" using "
680704
cy.login(baseUser, uiPassword);
681705

682706
// CAN go to Continuous Delivery Dashboard and "list" gitrepos
683-
cy.accesMenuSelection('Continuous Delivery', 'Dashboard');
684-
cy.get('div.fleet-dashboard-data').should('contain', repoName).and('contain', repoNameDefault);
707+
cy.continuousDeliveryMenuSelection();
708+
cy.verifyTableRow(0, 'Active', repoNameDefault);
709+
710+
cy.fleetNamespaceToggle('fleet-local');
711+
cy.verifyTableRow(0, 'Active', repoName);
685712

686713
// CHECKS IN FLEET-DEFAULT
687714
cy.continuousDeliveryMenuSelection();
688715
// Can't "Create" repos
689-
cy.get('.btn.role-primary').contains('Create App Bundle').should('not.exist');
716+
cy.checkAccessToCreateGitRepoPage();
690717
// Cant't "Edit"
691718
cy.open3dotsMenu(repoNameDefault, 'Edit Config', true);
692719
// CAN "Delete"

tests/cypress/support/commands.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,3 +1068,11 @@ Cypress.Commands.add('k8sUpgradeInRancher', (clusterName) => {
10681068
cy.verifyTableRow(0, 'Upgrading');
10691069
cy.verifyTableRow(0, 'Active', k8s_version_for_upgrade_ds_cluster, timeout);
10701070
})
1071+
1072+
// Below function will ensure that there is no Access to the Create GitRepos. Used in RBAC tests only.
1073+
Cypress.Commands.add('checkAccessToCreateGitRepoPage', () => {
1074+
cy.clickButton('Create App Bundle');
1075+
cy.get('[data-testid="subtype-banner-item-fleet.cattle.io.gitrepo"]').should('be.visible').trigger('mouseenter', { force: true });
1076+
cy.contains('You have no permissions to create Git Repos').should('be.visible');
1077+
cy.clickButton('Cancel');
1078+
});

tests/cypress/support/e2e.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ declare global {
7171
continuousDeliveryMenuSelection(appBundles?: boolean): Chainable<Element>;
7272
continuousDeliveryWorkspacesMenu(): Chainable<Element>;
7373
continuousDeliveryBundlesMenu(): Chainable<Element>;
74+
checkAccessToCreateGitRepoPage(): Chainable<Element>;
7475
}
7576
}
7677
}

0 commit comments

Comments
 (0)