From f03987c634d696dd772aab58163b89bcc31be1cc Mon Sep 17 00:00:00 2001 From: Cody Jackson Date: Thu, 7 Nov 2024 16:08:41 -0700 Subject: [PATCH] Moving the location of the data-testid on labeled input It looks like some of our POs previously assumed that the data-testid would be placed on the parent instead of on the input. --- .../components/agent-configuration-rke2.po.ts | 2 +- cypress/e2e/po/components/unit-input.po.ts | 2 +- .../pages/explorer2/workloads/pods.spec.ts | 44 ++++++------------- 3 files changed, 16 insertions(+), 32 deletions(-) diff --git a/cypress/e2e/po/components/agent-configuration-rke2.po.ts b/cypress/e2e/po/components/agent-configuration-rke2.po.ts index 481932367cb..f441358f3ca 100644 --- a/cypress/e2e/po/components/agent-configuration-rke2.po.ts +++ b/cypress/e2e/po/components/agent-configuration-rke2.po.ts @@ -221,7 +221,7 @@ export default class AgentConfigurationRke2 extends ComponentPo { // seconds if (dataPoint.seconds) { - this.self().find(`#${ areaId } [data-testid="toleration-seconds-index${ index }"] input`).type(dataPoint.seconds); + this.self().find(`#${ areaId } input[data-testid="toleration-seconds-index${ index }"]`).type(dataPoint.seconds); } }); } else { diff --git a/cypress/e2e/po/components/unit-input.po.ts b/cypress/e2e/po/components/unit-input.po.ts index ad383387f37..fe559e039ed 100644 --- a/cypress/e2e/po/components/unit-input.po.ts +++ b/cypress/e2e/po/components/unit-input.po.ts @@ -3,6 +3,6 @@ import LabeledInputPo from '@/cypress/e2e/po/components/labeled-input.po'; export default class UnitInputPo extends ComponentPo { setValue(value: string): Cypress.Chainable { - return new LabeledInputPo(this.self().find('input')).set(value); + return new LabeledInputPo(this.self()).set(value); } } diff --git a/cypress/e2e/tests/pages/explorer2/workloads/pods.spec.ts b/cypress/e2e/tests/pages/explorer2/workloads/pods.spec.ts index 4c3631594bc..dbf755b368c 100644 --- a/cypress/e2e/tests/pages/explorer2/workloads/pods.spec.ts +++ b/cypress/e2e/tests/pages/explorer2/workloads/pods.spec.ts @@ -1,7 +1,6 @@ import { WorkloadsPodsListPagePo, WorkLoadsPodDetailsPagePo, WorkloadsPodsCreatePagePo } from '@/cypress/e2e/po/pages/explorer/workloads-pods.po'; import { createPodBlueprint, clonePodBlueprint } from '@/cypress/e2e/blueprints/explorer/workload-pods'; import PodPo from '@/cypress/e2e/po/components/workloads/pod.po'; -import PromptRemove from '@/cypress/e2e/po/prompts/promptRemove.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'; @@ -281,56 +280,41 @@ describe('Pods', { testIsolation: 'off', tags: ['@explorer2', '@adminUser'] }, ( }); describe('should delete pod', () => { - const podName = `pod-${ Date.now() }`; + const deleteNamespace = 'delete-namespace'; beforeEach(() => { workloadsPodPage.goTo(); }); it('dialog should open/close as expected', () => { + const podName = `pod-${ Date.now() }`; const podCreatePage = new WorkloadsPodsCreatePagePo('local'); podCreatePage.goTo(); - podCreatePage.createWithUI(podName, 'nginx', 'default'); + podCreatePage.createWithUI(podName, 'nginx', deleteNamespace); // Should be on the list view const podsListPage = new WorkloadsPodsListPagePo('local'); // Filter the list to just show the newly created pod podsListPage.list().resourceTable().sortableTable().filter(podName); - podsListPage.list().resourceTable().sortableTable().checkRowCount(false, 1); - - // Open action menu and delete for the first item - podsListPage.list().resourceTable().sortableTable().rowActionMenuOpen(podName) - .getMenuItem('Delete') - .click(); - - let dialog = new PromptRemove(); - - dialog.checkExists(); - dialog.checkVisible(); - - dialog.cancel(); - dialog.checkNotExists(); - - podsListPage.list().resourceTable().sortableTable().checkRowCount(false, 1); - - // Open action menu and delete for the first item - podsListPage.list().resourceTable().sortableTable().rowActionMenuOpen(podName) - .getMenuItem('Delete') - .click(); + podsListPage.list().resourceTable().sortableTable().rowWithName(podName) + .checkExists(); - dialog = new PromptRemove(); + podsListPage.list().resourceTable().sortableTable().deleteItemWithUI(podName); - dialog.checkExists(); - dialog.checkVisible(); - dialog.remove(); - dialog.checkNotExists(); + podsListPage.list().resourceTable().sortableTable().rowWithName(podName) + .checkNotExists(); + }); - podsListPage.list().resourceTable().sortableTable().checkRowCount(true, 1, true); + after('clean up', () => { + const podsListPage = new WorkloadsPodsListPagePo('local'); podsListPage.list().resourceTable().sortableTable().resetFilter(); + + // Delete orphaned pods if there was an intermittent issue above + cy.deleteRancherResource('v1', 'namespaces', deleteNamespace); }); }); });