Skip to content

Commit 801b835

Browse files
committed
Integration test fix
1 parent 29cf902 commit 801b835

File tree

3 files changed

+47
-7
lines changed

3 files changed

+47
-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: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ describe('Kubernetes resource CRUD operations', () => {
106106
'BuildConfig',
107107
]);
108108

109+
const dataViewResources = new Set([
110+
'Job',
111+
'ReplicaSet',
112+
'HorizontalPodAutoscaler',
113+
'StatefulSet',
114+
'ReplicationController',
115+
]);
116+
109117
testObjs.forEach((testObj, resource) => {
110118
const {
111119
kind,
@@ -120,6 +128,7 @@ describe('Kubernetes resource CRUD operations', () => {
120128
}
121129
describe(kind, () => {
122130
const name = `${testName}-${_.kebabCase(kind)}`;
131+
const isDataViewResource = dataViewResources.has(kind);
123132

124133
it(`creates the resource instance`, () => {
125134
cy.visit(
@@ -215,7 +224,11 @@ describe('Kubernetes resource CRUD operations', () => {
215224
// should not have a namespace dropdown for non-namespaced objects');
216225
projectDropdown.shouldNotExist();
217226
}
218-
listPage.rows.shouldBeLoaded();
227+
if (isDataViewResource) {
228+
listPage.dvRows.shouldBeLoaded();
229+
} else {
230+
listPage.rows.shouldBeLoaded();
231+
}
219232
cy.testA11y(`List page for ${kind}: ${name}`);
220233
cy.testI18n([ListPageSelector.tableColumnHeaders], ['item-create']);
221234
});
@@ -227,7 +240,11 @@ describe('Kubernetes resource CRUD operations', () => {
227240
}?kind=${kind}&q=${testLabel}%3d${testName}&name=${name}`,
228241
);
229242

230-
listPage.rows.shouldExist(name);
243+
if (isDataViewResource) {
244+
listPage.dvRows.shouldExist(name);
245+
} else {
246+
listPage.rows.shouldExist(name);
247+
}
231248
cy.testA11y(`Search page for ${kind}: ${name}`);
232249

233250
// link to to details page
@@ -242,7 +259,11 @@ describe('Kubernetes resource CRUD operations', () => {
242259
namespaced ? `ns/${testName}` : 'all-namespaces'
243260
}?kind=${kind}&q=${testLabel}%3d${testName}&name=${name}`,
244261
);
245-
listPage.rows.clickKebabAction(name, editKind(kind, humanizeKind));
262+
if (isDataViewResource) {
263+
listPage.dvRows.clickKebabAction(name, editKind(kind, humanizeKind));
264+
} else {
265+
listPage.rows.clickKebabAction(name, editKind(kind, humanizeKind));
266+
}
246267
if (!skipYamlReloadTest) {
247268
yamlEditor.isLoaded();
248269
yamlEditor.clickReloadButton();
@@ -254,9 +275,15 @@ describe('Kubernetes resource CRUD operations', () => {
254275

255276
it(`deletes the resource instance`, () => {
256277
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));
278+
if (isDataViewResource) {
279+
listPage.dvFilter.byName(name);
280+
listPage.dvRows.countShouldBe(1);
281+
listPage.dvRows.clickKebabAction(name, deleteKind(kind, humanizeKind));
282+
} else {
283+
listPage.filter.byName(name);
284+
listPage.rows.countShouldBe(1);
285+
listPage.rows.clickKebabAction(name, deleteKind(kind, humanizeKind));
286+
}
260287
modal.shouldBeOpened();
261288
modal.submit();
262289
modal.shouldBeClosed();

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ export const listPage = {
5656
cy.get('@filterDropdownToggleButton').click();
5757
},
5858
},
59+
dvFilter: {
60+
byName: (name: string) => {
61+
cy.get('[aria-label="Name filter"]').clear().type(name); // this is not a great selector, but we're limited by data view
62+
},
63+
},
5964
rows: {
6065
getFirstElementName: () => cy.get('[data-test-rows="resource-row"] a').first(),
6166
shouldBeLoaded: () => {
@@ -113,6 +118,14 @@ export const listPage = {
113118
});
114119
cy.byTestActionID(actionName).click();
115120
},
121+
shouldExist: (resourceName: string) => {
122+
cy.get(`[data-test="data-view-cell-${resourceName}-name"]`)
123+
.contains(resourceName)
124+
.should('exist');
125+
},
126+
countShouldBe: (count: number) => {
127+
cy.get(`[data-test^="data-view-cell-"]`).should('have.length', count);
128+
},
116129
},
117130
};
118131

0 commit comments

Comments
 (0)