Skip to content

Commit

Permalink
Moving the location of the data-testid on labeled input
Browse files Browse the repository at this point in the history
It looks like some of our POs previously assumed that the data-testid would be placed on the parent instead of on the input.
  • Loading branch information
codyrancher committed Nov 11, 2024
1 parent ded06a7 commit f03987c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 32 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/po/components/agent-configuration-rke2.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/po/components/unit-input.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
44 changes: 14 additions & 30 deletions cypress/e2e/tests/pages/explorer2/workloads/pods.spec.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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);
});
});
});

0 comments on commit f03987c

Please sign in to comment.