Skip to content

Commit

Permalink
Merge pull request #12743 from yonasberhe23/jenkins_failure_fixes
Browse files Browse the repository at this point in the history
update e2e tests
  • Loading branch information
yonasberhe23 authored Dec 3, 2024
2 parents d47451e + c13d762 commit cc24870
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 156 deletions.
29 changes: 0 additions & 29 deletions cypress/e2e/tests/navigation/side-nav/main-side-menu.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { CURRENT_RANCHER_VERSION } from '@shell/config/version.js';
import HomePagePo from '@/cypress/e2e/po/pages/home.po';
import BurgerMenuPo from '@/cypress/e2e/po/side-bars/burger-side-menu.po';
import PagePo from '@/cypress/e2e/po/pages/page.po';
import ProductNavPo from '@/cypress/e2e/po/side-bars/product-side-nav.po';
import ClusterManagerListPagePo from '@/cypress/e2e/po/pages/cluster-manager/cluster-manager-list.po';
import { generateFakeClusterDataAndIntercepts } from '@/cypress/e2e/blueprints/nav/fake-cluster';
import { RANCHER_PAGE_EXCEPTIONS, catchTargetPageException } from '@/cypress/support/utils/exception-utils';

const longClusterDescription = 'this-is-some-really-really-really-really-really-really-long-decription';
const fakeProvClusterId = 'some-fake-cluster-id';
Expand Down Expand Up @@ -47,32 +44,6 @@ describe('Side Menu: main', () => {
cy.url().should('include', '/projectsnamespaces');
});

// testing https://github.com/rancher/dashboard/issues/10192
it('"documentation" link in editing a cluster should open in a new tab', { tags: ['@navigation', '@adminUser'] }, () => {
catchTargetPageException(RANCHER_PAGE_EXCEPTIONS);

const page = new PagePo('');
const clusterList = new ClusterManagerListPagePo('_');

page.navToMenuEntry('Cluster Management');
clusterList.waitForPage();

clusterList.list().actionMenu(fakeProvClusterId).getMenuItem('Edit Config').click();

// since in Cypress we cannot assert directly a link on a new tab
// next best thing is to assert that the link has _blank
// change it to _seft, then assert the link of the new page
cy.get('[data-testid="edit-cluster-reprovisioning-documentation"] a').should('be.visible')
.then(($a) => {
expect($a).to.have.attr('target', '_blank');
// update attr to open in same tab
$a.attr('target', '_self');
})
.click();

cy.url().should('include', `https://ranchermanager.docs.rancher.com/v${ CURRENT_RANCHER_VERSION }/how-to-guides/new-user-guides/launch-kubernetes-with-rancher/rke1-vs-rke2-differences#cluster-api`);
});

it('Local cluster should show a name and description on the side menu and display a tooltip when hovering it show the full name and description', { tags: ['@navigation', '@adminUser'] }, () => {
BurgerMenuPo.toggle();

Expand Down
5 changes: 5 additions & 0 deletions cypress/e2e/tests/pages/explorer2/workloads/jobs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ describe('Cluster Explorer', { tags: ['@explorer2', '@adminUser'] }, () => {
});

it('Creating a job while creating a new namespace should succeed', () => {
cy.intercept('POST', 'v1/namespaces').as('createNamespace');
cy.intercept('POST', 'v1/batch.jobs').as('createJob');

// list view jobs
const workloadsJobsListPage = new WorkloadsJobsListPagePo('local');

Expand All @@ -31,6 +34,8 @@ describe('Cluster Explorer', { tags: ['@explorer2', '@adminUser'] }, () => {
workloadsJobDetailsPage.name().set(jobName);
workloadsJobDetailsPage.containerImage().set(containerImageName);
workloadsJobDetailsPage.saveCreateForm().click();
cy.wait('@createNamespace').its('response.statusCode').should('eq', 201);
cy.wait('@createJob').its('response.statusCode').should('eq', 201);

workloadsJobsListPage.listElementWithName(jobName).should('exist');

Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/tests/pages/global-settings/feature-flags.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ describe('Feature Flags', { testIsolation: 'off' }, () => {
featureFlagsPage.list().details('unsupported-storage-drivers', 0).should('include.text', 'Disabled');

// Activate
featureFlagsPage.list().elementWithName('unsupported-storage-drivers').scrollIntoView().should('be.visible');
featureFlagsPage.list().clickRowActionMenuItem('unsupported-storage-drivers', 'Activate');
featureFlagsPage.clickCardActionButtonAndWait('Activate', 'unsupported-storage-drivers', true);

Expand All @@ -142,6 +143,7 @@ describe('Feature Flags', { testIsolation: 'off' }, () => {
// Deactivate
FeatureFlagsPagePo.navTo();

featureFlagsPage.list().elementWithName('unsupported-storage-drivers').scrollIntoView().should('be.visible');
featureFlagsPage.list().clickRowActionMenuItem('unsupported-storage-drivers', 'Deactivate');
featureFlagsPage.clickCardActionButtonAndWait('Deactivate', 'unsupported-storage-drivers', false);

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/tests/pages/global-settings/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PagePo from '@/cypress/e2e/po/pages/page.po';

describe('Global Settings Index', { testIsolation: 'off', tags: ['@explorer', '@adminUser'] }, () => {
describe('Global Settings Index', { testIsolation: 'off', tags: ['@globalSettings', '@adminUser'] }, () => {
before(() => {
cy.login();
});
Expand Down
31 changes: 31 additions & 0 deletions cypress/e2e/tests/pages/manager/edit-fake-cluster.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import ClusterManagerListPagePo from '@/cypress/e2e/po/pages/cluster-manager/clu
import ClusterManagerEditGenericPagePo from '@/cypress/e2e/po/edit/provisioning.cattle.io.cluster/edit/cluster-edit-generic.po';
import BurgerMenuPo from '@/cypress/e2e/po/side-bars/burger-side-menu.po';
import HomePagePo from '@/cypress/e2e/po/pages/home.po';
import { RANCHER_PAGE_EXCEPTIONS, catchTargetPageException } from '@/cypress/support/utils/exception-utils';
import { CURRENT_RANCHER_VERSION } from '@shell/config/version.js';
import PagePo from '@/cypress/e2e/po/pages/page.po';

import { generateFakeClusterDataAndIntercepts } from '@/cypress/e2e/blueprints/nav/fake-cluster';
const fakeProvClusterId = 'some-fake-cluster-id';
Expand Down Expand Up @@ -38,5 +41,33 @@ describe('Cluster Edit', { tags: ['@manager', '@adminUser'] }, () => {
// secrets need to be populated also, check fake-cluster -> INTERCEPT -> cy.intercept('GET', `/v1/secrets?*` ....)
editCluster.registryAuthenticationField().checkOptionSelected('registryconfig-auth-reg2 (HTTP Basic Auth: aaa)');
});

// testing https://github.com/rancher/dashboard/issues/10192
it('"documentation" link in editing a cluster should open in a new tab', () => {
HomePagePo.goTo();

catchTargetPageException(RANCHER_PAGE_EXCEPTIONS);

const page = new PagePo('');
const clusterList = new ClusterManagerListPagePo('_');

page.navToMenuEntry('Cluster Management');
clusterList.waitForPage();

clusterList.list().actionMenu(fakeProvClusterId).getMenuItem('Edit Config').click();

// since in Cypress we cannot assert directly a link on a new tab
// next best thing is to assert that the link has _blank
// change it to _seft, then assert the link of the new page
cy.get('[data-testid="edit-cluster-reprovisioning-documentation"] a').should('be.visible')
.then(($a) => {
expect($a).to.have.attr('target', '_blank');
// update attr to open in same tab
$a.attr('target', '_self');
})
.click();

cy.url().should('include', `https://ranchermanager.docs.rancher.com/v${ CURRENT_RANCHER_VERSION }/how-to-guides/new-user-guides/launch-kubernetes-with-rancher/rke1-vs-rke2-differences#cluster-api`);
});
});
});
11 changes: 3 additions & 8 deletions cypress/e2e/tests/pages/manager/jwt-authentication.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,12 @@ describe('JWT Authentication', { testIsolation: 'off', tags: ['@manager', '@admi
after('clean up', () => {
if (removeCluster0) {
// delete cluster
cy.get<string>('@rke2Ec2ClusterName0').then((name) => {
cy.deleteRancherResource('v1', `provisioning.cattle.io.clusters/${ namespace }`, name);
removeCluster0 = false;
});
cy.deleteRancherResource('v1', `provisioning.cattle.io.clusters/${ namespace }`, instance0);
}

if (removeCluster1) {
// delete cluster
cy.get<string>('@rke2Ec2ClusterName1').then((name) => {
cy.deleteRancherResource('v1', `provisioning.cattle.io.clusters/${ namespace }`, name);
removeCluster1 = false;
});
cy.deleteRancherResource('v1', `provisioning.cattle.io.clusters/${ namespace }`, instance1);
}
});
});
Expand Down
Loading

0 comments on commit cc24870

Please sign in to comment.