diff --git a/cypress/e2e/po/pages/explorer/cluster-dashboard.po.ts b/cypress/e2e/po/pages/explorer/cluster-dashboard.po.ts index abb5f94d310..3f1daaf5eaf 100644 --- a/cypress/e2e/po/pages/explorer/cluster-dashboard.po.ts +++ b/cypress/e2e/po/pages/explorer/cluster-dashboard.po.ts @@ -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)); } diff --git a/cypress/e2e/tests/pages/explorer/dashboard/cluster-dashboard.spec.ts b/cypress/e2e/tests/pages/explorer/dashboard/cluster-dashboard.spec.ts index c1f9ef6a7e1..739bb22bffa 100644 --- a/cypress/e2e/tests/pages/explorer/dashboard/cluster-dashboard.spec.ts +++ b/cypress/e2e/tests/pages/explorer/dashboard/cluster-dashboard.spec.ts @@ -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 @@ -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'); @@ -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); diff --git a/cypress/e2e/tests/pages/explorer2/workloads/pods.spec.ts b/cypress/e2e/tests/pages/explorer2/workloads/pods.spec.ts index 505038e8e81..12e3b0ce024 100644 --- a/cypress/e2e/tests/pages/explorer2/workloads/pods.spec.ts +++ b/cypress/e2e/tests/pages/explorer2/workloads/pods.spec.ts @@ -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(); @@ -55,13 +61,20 @@ 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 @@ -178,7 +191,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(); @@ -195,7 +208,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); @@ -289,14 +302,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); diff --git a/cypress/e2e/tests/pages/extensions/extensions.spec.ts b/cypress/e2e/tests/pages/extensions/extensions.spec.ts index 21e089876fa..c328313600d 100644 --- a/cypress/e2e/tests/pages/extensions/extensions.spec.ts +++ b/cypress/e2e/tests/pages/extensions/extensions.spec.ts @@ -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'; @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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();