Skip to content

Commit

Permalink
e2e fixes / debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-cox committed Dec 9, 2024
1 parent 28135a1 commit 8130cca
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 18 deletions.
4 changes: 4 additions & 0 deletions cypress/e2e/po/pages/explorer/cluster-dashboard.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export default class ClusterDashboardPagePo extends PagePo {
return super.goTo(ClusterDashboardPagePo.createPath(clusterId));
}

urlPath(clusterId = 'local') {
return ClusterDashboardPagePo.createPath(clusterId);
}

constructor(clusterId: string) {
super(ClusterDashboardPagePo.createPath(clusterId));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { NodesPagePo } from '@/cypress/e2e/po/pages/explorer/nodes.po';
import { EventsPagePo } from '@/cypress/e2e/po/pages/explorer/events.po';
import * as path from 'path';
import { eventsNoDataset } from '@/cypress/e2e/blueprints/explorer/cluster/events';
import HomePagePo from '@/cypress/e2e/po/pages/home.po';

const configMapYaml = `apiVersion: v1
kind: ConfigMap
Expand Down Expand Up @@ -258,12 +257,19 @@ describe('Cluster Dashboard', { testIsolation: 'off', tags: ['@explorer', '@admi
});

it('can view events table empty if no events', { tags: ['@vai', '@adminUser'] }, () => {
const events = new EventsPagePo('local');

HomePagePo.goTo();
cy.visit(clusterDashboard.urlPath(), {
onBeforeLoad(win) {
cy.stub(win.console, 'error').as('consoleError');
cy.stub(win.console, 'warn').as('consoleWarn');
},
});

eventsNoDataset();
ClusterDashboardPagePo.navTo();
clusterDashboard.goTo();

cy.get('@consoleError').should('not.be.called'); // See error lot
cy.get('@consoleWarn').should('not.be.called'); // See warning log (there will be some....)

cy.wait('@eventsNoData');
clusterDashboard.waitForPage(undefined, 'cluster-events');

Expand All @@ -279,6 +285,8 @@ describe('Cluster Dashboard', { testIsolation: 'off', tags: ['@explorer', '@admi

clusterDashboard.fullEventsLink().click();
cy.wait('@eventsNoData');
const events = new EventsPagePo('local');

events.waitForPage();

events.eventslist().resourceTable().sortableTable().checkRowCount(true, 1);
Expand Down
26 changes: 19 additions & 7 deletions cypress/e2e/tests/pages/explorer2/workloads/pods.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ import PodPo from '@/cypress/e2e/po/components/workloads/pod.po';
import HomePagePo from '@/cypress/e2e/po/pages/home.po';
import { generatePodsDataSmall } from '@/cypress/e2e/blueprints/explorer/workloads/pods/pods-get';
import SortableTablePo from '@/cypress/e2e/po/components/sortable-table.po';
import { NamespaceFilterPo } from '@/cypress/e2e/po/components/namespace-filter.po';
import ClusterDashboardPagePo from '@/cypress/e2e/po/pages/explorer/cluster-dashboard.po';

const cluster = 'local';

describe('Pods', { testIsolation: 'off', tags: ['@explorer2', '@adminUser'] }, () => {
const workloadsPodPage = new WorkloadsPodsListPagePo('local');
const workloadsPodPage = new WorkloadsPodsListPagePo(cluster);
const clusterDashboard = new ClusterDashboardPagePo(cluster);
const nsFilter = new NamespaceFilterPo();

before(() => {
cy.login();
Expand Down Expand Up @@ -55,13 +61,19 @@ describe('Pods', { testIsolation: 'off', tags: ['@explorer2', '@adminUser'] }, (
uniquePod = resp.body.metadata.name;
});

cy.tableRowsPerPageAndNamespaceFilter(10, 'local', 'none', `{\"local\":[\"ns://${ nsName1 }\",\"ns://${ nsName2 }\"]}`);
cy.tableRowsPerPageAndNamespaceFilter(10, cluster, 'none', `{\"local\":[\"ns://${ nsName1 }\",\"ns://${ nsName2 }\"]}`);
});
});
});

it('pagination is visible and user is able to navigate through pods data', () => {
WorkloadsPodsListPagePo.goTo('local');
// Confirm that the ns filter is set correctly before navigating to a page that will use it
clusterDashboard.goTo();
clusterDashboard.waitForPage();
nsFilter.selectedValues().contains(nsName1);
nsFilter.selectedValues().contains(nsName2);

WorkloadsPodsListPagePo.navTo();
workloadsPodPage.waitForPage();

// check pods count
Expand Down Expand Up @@ -178,7 +190,7 @@ describe('Pods', { testIsolation: 'off', tags: ['@explorer2', '@adminUser'] }, (
});

it('pagination is hidden', () => {
cy.tableRowsPerPageAndNamespaceFilter(10, 'local', 'none', '{"local":[]}');
cy.tableRowsPerPageAndNamespaceFilter(10, cluster, 'none', '{"local":[]}');

// generate small set of pods data
generatePodsDataSmall();
Expand All @@ -195,7 +207,7 @@ describe('Pods', { testIsolation: 'off', tags: ['@explorer2', '@adminUser'] }, (

after('clean up', () => {
// Ensure the default rows per page value is set after running the tests
cy.tableRowsPerPageAndNamespaceFilter(100, 'local', 'none', '{"local":["all://user"]}');
cy.tableRowsPerPageAndNamespaceFilter(100, cluster, 'none', '{"local":["all://user"]}');

// delete namespace (this will also delete all pods in it)
cy.deleteRancherResource('v1', 'namespaces', nsName1);
Expand Down Expand Up @@ -289,14 +301,14 @@ describe('Pods', { testIsolation: 'off', tags: ['@explorer2', '@adminUser'] }, (
// });

// it('dialog should open/close as expected', () => {
// const podCreatePage = new WorkloadsPodsCreatePagePo('local');
// const podCreatePage = new WorkloadsPodsCreatePagePo(cluster);

// podCreatePage.goTo();

// podCreatePage.createWithUI(podName, 'nginx', 'default');

// // Should be on the list view
// const podsListPage = new WorkloadsPodsListPagePo('local');
// const podsListPage = new WorkloadsPodsListPagePo(cluster);

// // Filter the list to just show the newly created pod
// podsListPage.list().resourceTable().sortableTable().filter(podName);
Expand Down
13 changes: 7 additions & 6 deletions cypress/e2e/tests/pages/extensions/extensions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import UiPluginsPagePo from '@/cypress/e2e/po/pages/explorer/uiplugins.po';
import { NamespaceFilterPo } from '@/cypress/e2e/po/components/namespace-filter.po';

const namespaceFilter = new NamespaceFilterPo();
const cluster = 'local';

const DISABLED_CACHE_EXTENSION_NAME = 'large-extension';
// const DISABLED_CACHE_EXTENSION_MENU_LABEL = 'Large-extension';
Expand Down Expand Up @@ -150,7 +151,7 @@ describe('Extensions page', { tags: ['@extensions', '@adminUser'] }, () => {
BurgerMenuPo.checkIfMenuItemLinkIsHighlighted('Extensions');

// catching regression https://github.com/rancher/dashboard/issues/10576
BurgerMenuPo.checkIfClusterMenuLinkIsHighlighted('local', false);
BurgerMenuPo.checkIfClusterMenuLinkIsHighlighted(cluster, false);

// go to "add rancher repositories"
extensionsPo.extensionMenuToggle();
Expand All @@ -161,7 +162,7 @@ describe('Extensions page', { tags: ['@extensions', '@adminUser'] }, () => {
extensionsPo.addReposModal().should('not.exist');

// go to repos list page
const appRepoList = new RepositoriesPagePo('local', 'apps');
const appRepoList = new RepositoriesPagePo(cluster, 'apps');

appRepoList.goTo();
appRepoList.waitForPage();
Expand All @@ -185,7 +186,7 @@ describe('Extensions page', { tags: ['@extensions', '@adminUser'] }, () => {
}
});

const appRepoList = new RepositoriesPagePo('local', 'apps');
const appRepoList = new RepositoriesPagePo(cluster, 'apps');

// Ensure that the banner should be shown (by confirming that a required repo isn't there)
appRepoList.goTo();
Expand Down Expand Up @@ -344,7 +345,7 @@ describe('Extensions page', { tags: ['@extensions', '@adminUser'] }, () => {
});

// ui-plugin-operator updated cache disabled threshold to 30mb as per https://github.com/rancher/rancher/pull/47565
it('An extension larger than 30mb, which will trigger chacheState disabled, should install and work fine', () => {
it('An extension larger than 30mb, which will trigger cacheState disabled, should install and work fine', () => {
const extensionsPo = new ExtensionsPagePo();

extensionsPo.goTo();
Expand Down Expand Up @@ -378,7 +379,7 @@ describe('Extensions page', { tags: ['@extensions', '@adminUser'] }, () => {
// cy.get('h1').should('have.text', DISABLED_CACHE_EXTENSION_TITLE);

// check if cache state is disabled
const uiPluginsPo = new UiPluginsPagePo('local');
const uiPluginsPo = new UiPluginsPagePo(cluster);

uiPluginsPo.goTo();
uiPluginsPo.waitForPage();
Expand Down Expand Up @@ -460,7 +461,7 @@ describe('Extensions page', { tags: ['@extensions', '@adminUser'] }, () => {
extensionsPo.extensionDetailsTitle().should('contain', EXTENSION_NAME);
});

it('Should uninstall unathenticated extensions', () => {
it('Should uninstall unauthenticated extensions', () => {
// Because we logged out in the previous test this one will also have to use an uncached login
cy.login(undefined, undefined, false);
const extensionsPo = new ExtensionsPagePo();
Expand Down

0 comments on commit 8130cca

Please sign in to comment.