mirror of https://github.com/rancher/dashboard.git
Merge pull request #12743 from yonasberhe23/jenkins_failure_fixes
update e2e tests
This commit is contained in:
commit
cc2487030f
|
|
@ -1,11 +1,8 @@
|
||||||
import { CURRENT_RANCHER_VERSION } from '@shell/config/version.js';
|
|
||||||
import HomePagePo from '@/cypress/e2e/po/pages/home.po';
|
import HomePagePo from '@/cypress/e2e/po/pages/home.po';
|
||||||
import BurgerMenuPo from '@/cypress/e2e/po/side-bars/burger-side-menu.po';
|
import BurgerMenuPo from '@/cypress/e2e/po/side-bars/burger-side-menu.po';
|
||||||
import PagePo from '@/cypress/e2e/po/pages/page.po';
|
import PagePo from '@/cypress/e2e/po/pages/page.po';
|
||||||
import ProductNavPo from '@/cypress/e2e/po/side-bars/product-side-nav.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 { 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 longClusterDescription = 'this-is-some-really-really-really-really-really-really-long-decription';
|
||||||
const fakeProvClusterId = 'some-fake-cluster-id';
|
const fakeProvClusterId = 'some-fake-cluster-id';
|
||||||
|
|
@ -47,32 +44,6 @@ describe('Side Menu: main', () => {
|
||||||
cy.url().should('include', '/projectsnamespaces');
|
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'] }, () => {
|
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();
|
BurgerMenuPo.toggle();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,9 @@ describe('Cluster Explorer', { tags: ['@explorer2', '@adminUser'] }, () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Creating a job while creating a new namespace should succeed', () => {
|
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
|
// list view jobs
|
||||||
const workloadsJobsListPage = new WorkloadsJobsListPagePo('local');
|
const workloadsJobsListPage = new WorkloadsJobsListPagePo('local');
|
||||||
|
|
||||||
|
|
@ -31,6 +34,8 @@ describe('Cluster Explorer', { tags: ['@explorer2', '@adminUser'] }, () => {
|
||||||
workloadsJobDetailsPage.name().set(jobName);
|
workloadsJobDetailsPage.name().set(jobName);
|
||||||
workloadsJobDetailsPage.containerImage().set(containerImageName);
|
workloadsJobDetailsPage.containerImage().set(containerImageName);
|
||||||
workloadsJobDetailsPage.saveCreateForm().click();
|
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');
|
workloadsJobsListPage.listElementWithName(jobName).should('exist');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,7 @@ describe('Feature Flags', { testIsolation: 'off' }, () => {
|
||||||
featureFlagsPage.list().details('unsupported-storage-drivers', 0).should('include.text', 'Disabled');
|
featureFlagsPage.list().details('unsupported-storage-drivers', 0).should('include.text', 'Disabled');
|
||||||
|
|
||||||
// Activate
|
// Activate
|
||||||
|
featureFlagsPage.list().elementWithName('unsupported-storage-drivers').scrollIntoView().should('be.visible');
|
||||||
featureFlagsPage.list().clickRowActionMenuItem('unsupported-storage-drivers', 'Activate');
|
featureFlagsPage.list().clickRowActionMenuItem('unsupported-storage-drivers', 'Activate');
|
||||||
featureFlagsPage.clickCardActionButtonAndWait('Activate', 'unsupported-storage-drivers', true);
|
featureFlagsPage.clickCardActionButtonAndWait('Activate', 'unsupported-storage-drivers', true);
|
||||||
|
|
||||||
|
|
@ -142,6 +143,7 @@ describe('Feature Flags', { testIsolation: 'off' }, () => {
|
||||||
// Deactivate
|
// Deactivate
|
||||||
FeatureFlagsPagePo.navTo();
|
FeatureFlagsPagePo.navTo();
|
||||||
|
|
||||||
|
featureFlagsPage.list().elementWithName('unsupported-storage-drivers').scrollIntoView().should('be.visible');
|
||||||
featureFlagsPage.list().clickRowActionMenuItem('unsupported-storage-drivers', 'Deactivate');
|
featureFlagsPage.list().clickRowActionMenuItem('unsupported-storage-drivers', 'Deactivate');
|
||||||
featureFlagsPage.clickCardActionButtonAndWait('Deactivate', 'unsupported-storage-drivers', false);
|
featureFlagsPage.clickCardActionButtonAndWait('Deactivate', 'unsupported-storage-drivers', false);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import PagePo from '@/cypress/e2e/po/pages/page.po';
|
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(() => {
|
before(() => {
|
||||||
cy.login();
|
cy.login();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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 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 BurgerMenuPo from '@/cypress/e2e/po/side-bars/burger-side-menu.po';
|
||||||
import HomePagePo from '@/cypress/e2e/po/pages/home.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';
|
import { generateFakeClusterDataAndIntercepts } from '@/cypress/e2e/blueprints/nav/fake-cluster';
|
||||||
const fakeProvClusterId = 'some-fake-cluster-id';
|
const fakeProvClusterId = 'some-fake-cluster-id';
|
||||||
|
|
@ -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?*` ....)
|
// 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)');
|
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`);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -140,17 +140,12 @@ describe('JWT Authentication', { testIsolation: 'off', tags: ['@manager', '@admi
|
||||||
after('clean up', () => {
|
after('clean up', () => {
|
||||||
if (removeCluster0) {
|
if (removeCluster0) {
|
||||||
// delete cluster
|
// delete cluster
|
||||||
cy.get<string>('@rke2Ec2ClusterName0').then((name) => {
|
cy.deleteRancherResource('v1', `provisioning.cattle.io.clusters/${ namespace }`, instance0);
|
||||||
cy.deleteRancherResource('v1', `provisioning.cattle.io.clusters/${ namespace }`, name);
|
|
||||||
removeCluster0 = false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (removeCluster1) {
|
if (removeCluster1) {
|
||||||
// delete cluster
|
// delete cluster
|
||||||
cy.get<string>('@rke2Ec2ClusterName1').then((name) => {
|
cy.deleteRancherResource('v1', `provisioning.cattle.io.clusters/${ namespace }`, instance1);
|
||||||
cy.deleteRancherResource('v1', `provisioning.cattle.io.clusters/${ namespace }`, name);
|
|
||||||
removeCluster1 = false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -12,17 +12,16 @@ function updateUserRetentionSetting(settingId, newValue) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('Auth Index', { testIsolation: 'off', tags: ['@explorer', '@adminUser'] }, () => {
|
describe('Auth Index', { testIsolation: 'off' }, () => {
|
||||||
const runTimestamp = +new Date();
|
const runTimestamp = +new Date();
|
||||||
const usernameBlock = `user_to_block_${ runTimestamp }`;
|
const usernameBlock = `user_to_block_${ runTimestamp }`;
|
||||||
const usernameRetention = `user_retention_access_${ runTimestamp }`;
|
|
||||||
const userIdsList = [];
|
const userIdsList = [];
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.login();
|
cy.login();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can redirect', () => {
|
it('can redirect', { tags: ['@usersAndAuths', '@adminUser'] }, () => {
|
||||||
const page = new PagePo('/c/local/auth');
|
const page = new PagePo('/c/local/auth');
|
||||||
|
|
||||||
page.goTo();
|
page.goTo();
|
||||||
|
|
@ -30,6 +29,7 @@ describe('Auth Index', { testIsolation: 'off', tags: ['@explorer', '@adminUser']
|
||||||
cy.url().should('includes', `${ Cypress.config().baseUrl }/c/local/auth/management.cattle.io.user`);
|
cy.url().should('includes', `${ Cypress.config().baseUrl }/c/local/auth/management.cattle.io.user`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('User retention: admin user', { tags: ['@usersAndAuths', '@adminUser'] }, () => {
|
||||||
it('can navigate to user retention settings', () => {
|
it('can navigate to user retention settings', () => {
|
||||||
const page = new PagePo('/c/local/auth');
|
const page = new PagePo('/c/local/auth');
|
||||||
|
|
||||||
|
|
@ -155,35 +155,28 @@ describe('Auth Index', { testIsolation: 'off', tags: ['@explorer', '@adminUser']
|
||||||
.should('not.eq', '-');
|
.should('not.eq', '-');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
after(() => {
|
||||||
|
// reset user retention settings
|
||||||
|
updateUserRetentionSetting('disable-inactive-user-after', null);
|
||||||
|
|
||||||
|
updateUserRetentionSetting('user-retention-cron', null);
|
||||||
|
|
||||||
|
updateUserRetentionSetting('delete-inactive-user-after', null);
|
||||||
|
|
||||||
|
// delete users
|
||||||
|
userIdsList.forEach((r) => cy.deleteRancherResource('v3', 'Users', r, false));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('User retention: standard user', { tags: ['@usersAndAuths', '@standardUser'] }, () => {
|
||||||
it('standard user should not have access to user retention page', () => {
|
it('standard user should not have access to user retention page', () => {
|
||||||
const usersPo = new UsersPo();
|
const usersPo = new UsersPo();
|
||||||
|
|
||||||
cy.createUser({
|
// login as standard user
|
||||||
username: usernameRetention,
|
cy.login();
|
||||||
globalRole: { role: 'user' },
|
|
||||||
projectRole: {
|
|
||||||
clusterId: 'local',
|
|
||||||
projectName: 'Default',
|
|
||||||
role: 'project-member',
|
|
||||||
}
|
|
||||||
}).then((resp: Cypress.Response<any>) => {
|
|
||||||
const userId = resp.body.id;
|
|
||||||
|
|
||||||
userIdsList.push(userId);
|
|
||||||
});
|
|
||||||
// logout from admin
|
|
||||||
cy.logout();
|
|
||||||
|
|
||||||
cy.url().should('includes', `${ Cypress.config().baseUrl }/auth/login`);
|
|
||||||
|
|
||||||
// login as test user
|
|
||||||
cy.login(usernameRetention, Cypress.env('password'));
|
|
||||||
usersPo.goTo();
|
usersPo.goTo();
|
||||||
usersPo.waitForPage();
|
usersPo.waitForPage();
|
||||||
usersPo.userRetentionLink().checkNotExists();
|
usersPo.userRetentionLink().checkNotExists();
|
||||||
});
|
});
|
||||||
|
|
||||||
after(() => {
|
|
||||||
userIdsList.forEach((r) => cy.deleteRancherResource('v3', 'Users', r, false));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -213,8 +213,7 @@ fi
|
||||||
|
|
||||||
echo "Rancher type: ${RANCHER_TYPE}"
|
echo "Rancher type: ${RANCHER_TYPE}"
|
||||||
|
|
||||||
override_node=$(semver lt "${RANCHER_VERSION}" "2.9.99")
|
if semver lt "${RANCHER_VERSION}" "2.9.99" && [[ "${RANCHER_IMAGE_TAG}" != "head" ]]; then NODEJS_VERSION="16.20.2"; fi
|
||||||
if [[ ${override_node} -eq 0 && "${RANCHER_IMAGE_TAG}" != "head" ]]; then NODEJS_VERSION="16.20.2"; fi
|
|
||||||
|
|
||||||
corral config vars set rancher_type "${RANCHER_TYPE}"
|
corral config vars set rancher_type "${RANCHER_TYPE}"
|
||||||
corral config vars set nodejs_version "${NODEJS_VERSION}"
|
corral config vars set nodejs_version "${NODEJS_VERSION}"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue