Skip to content

Commit 67dd8f0

Browse files
committed
Integration test fix
1 parent fcd907c commit 67dd8f0

File tree

3 files changed

+55
-7
lines changed

3 files changed

+55
-7
lines changed

frontend/packages/integration-tests-cypress/tests/app/start-job-from-cronjob.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe('Start a Job from a CronJob', () => {
6868
cy.visit(`/k8s/ns/${testName}/cronjobs`);
6969
listPage.rows.shouldBeLoaded();
7070
cy.visit(`/k8s/ns/${testName}/cronjobs/${CRONJOB_NAME}/jobs`);
71-
listPage.rows.countShouldBe(2);
71+
listPage.dvRows.countShouldBe(2);
7272
});
7373

7474
it('verify the number of events in CronJob > Events tab list page', () => {

frontend/packages/integration-tests-cypress/tests/crud/resource-crud.cy.ts

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ describe('Kubernetes resource CRUD operations', () => {
106106
'BuildConfig',
107107
]);
108108

109+
const dataViewResources = new Set([
110+
'HorizontalPodAutoscaler',
111+
'Job',
112+
'Pod',
113+
'ReplicaSet',
114+
'ReplicationController',
115+
'StatefulSet',
116+
]);
117+
109118
testObjs.forEach((testObj, resource) => {
110119
const {
111120
kind,
@@ -120,6 +129,7 @@ describe('Kubernetes resource CRUD operations', () => {
120129
}
121130
describe(kind, () => {
122131
const name = `${testName}-${_.kebabCase(kind)}`;
132+
const isDataViewResource = dataViewResources.has(kind);
123133

124134
it(`creates the resource instance`, () => {
125135
cy.visit(
@@ -189,6 +199,8 @@ describe('Kubernetes resource CRUD operations', () => {
189199
cy.byTestID('yaml-error').should('not.exist');
190200
});
191201
});
202+
detailsPage.isLoaded();
203+
detailsPage.titleShouldContain(name);
192204
});
193205

194206
it('displays detail view for newly created resource instance', () => {
@@ -215,7 +227,11 @@ describe('Kubernetes resource CRUD operations', () => {
215227
// should not have a namespace dropdown for non-namespaced objects');
216228
projectDropdown.shouldNotExist();
217229
}
218-
listPage.rows.shouldBeLoaded();
230+
if (isDataViewResource) {
231+
listPage.dvRows.shouldBeLoaded();
232+
} else {
233+
listPage.rows.shouldBeLoaded();
234+
}
219235
cy.testA11y(`List page for ${kind}: ${name}`);
220236
cy.testI18n([ListPageSelector.tableColumnHeaders], ['item-create']);
221237
});
@@ -227,7 +243,11 @@ describe('Kubernetes resource CRUD operations', () => {
227243
}?kind=${kind}&q=${testLabel}%3d${testName}&name=${name}`,
228244
);
229245

230-
listPage.rows.shouldExist(name);
246+
if (isDataViewResource) {
247+
listPage.dvRows.shouldExist(name);
248+
} else {
249+
listPage.rows.shouldExist(name);
250+
}
231251
cy.testA11y(`Search page for ${kind}: ${name}`);
232252

233253
// link to to details page
@@ -242,7 +262,11 @@ describe('Kubernetes resource CRUD operations', () => {
242262
namespaced ? `ns/${testName}` : 'all-namespaces'
243263
}?kind=${kind}&q=${testLabel}%3d${testName}&name=${name}`,
244264
);
245-
listPage.rows.clickKebabAction(name, editKind(kind, humanizeKind));
265+
if (isDataViewResource) {
266+
listPage.dvRows.clickKebabAction(name, editKind(kind, humanizeKind));
267+
} else {
268+
listPage.rows.clickKebabAction(name, editKind(kind, humanizeKind));
269+
}
246270
if (!skipYamlReloadTest) {
247271
yamlEditor.isLoaded();
248272
yamlEditor.clickReloadButton();
@@ -254,9 +278,15 @@ describe('Kubernetes resource CRUD operations', () => {
254278

255279
it(`deletes the resource instance`, () => {
256280
cy.visit(`${namespaced ? `/k8s/ns/${testName}` : '/k8s/cluster'}/${resource}`);
257-
listPage.filter.byName(name);
258-
listPage.rows.countShouldBe(1);
259-
listPage.rows.clickKebabAction(name, deleteKind(kind, humanizeKind));
281+
if (isDataViewResource) {
282+
listPage.dvFilter.byName(name);
283+
listPage.dvRows.countShouldBe(1);
284+
listPage.dvRows.clickKebabAction(name, deleteKind(kind, humanizeKind));
285+
} else {
286+
listPage.filter.byName(name);
287+
listPage.rows.countShouldBe(1);
288+
listPage.rows.clickKebabAction(name, deleteKind(kind, humanizeKind));
289+
}
260290
modal.shouldBeOpened();
261291
modal.submit();
262292
modal.shouldBeClosed();

frontend/packages/integration-tests-cypress/views/list-page.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ export const listPage = {
5656
cy.get('@filterDropdownToggleButton').click();
5757
},
5858
},
59+
dvFilter: {
60+
byName: (name: string) => {
61+
// these are not great selectors, but we're limited by data view toolbar
62+
cy.get('[data-ouia-component-id="DataViewToolbar"').within(() =>
63+
cy.get('.pf-v6-c-menu-toggle').first().click(),
64+
);
65+
cy.get('.pf-v6-c-menu__list-item').contains('Name').click();
66+
cy.get('[aria-label="Name filter"]').clear().type(name);
67+
},
68+
},
5969
rows: {
6070
getFirstElementName: () => cy.get('[data-test-rows="resource-row"] a').first(),
6171
shouldBeLoaded: () => {
@@ -113,6 +123,14 @@ export const listPage = {
113123
});
114124
cy.byTestActionID(actionName).click();
115125
},
126+
shouldExist: (resourceName: string) => {
127+
cy.get(`[data-test="data-view-cell-${resourceName}-name"]`)
128+
.contains(resourceName)
129+
.should('exist');
130+
},
131+
countShouldBe: (count: number) => {
132+
cy.get(`[data-test^="data-view-cell-"]`).should('have.length', count);
133+
},
116134
},
117135
};
118136

0 commit comments

Comments
 (0)