Skip to content

Commit 21c3f5c

Browse files
committed
fix configmap test and refactor
1 parent 137adbe commit 21c3f5c

File tree

5 files changed

+122
-130
lines changed

5 files changed

+122
-130
lines changed

cypress/e2e/po/components/create-edit-view.po.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import AsyncButtonPo from '@/cypress/e2e/po/components/async-button.po';
33
import NameNsDescription from '@/cypress/e2e/po/components/name-ns-description.po';
44

55
export default class CreateEditViewPo extends ComponentPo {
6+
errorBanner() {
7+
return this.self().find('#cru-errors');
8+
}
9+
610
nameNsDescription() {
711
return new NameNsDescription(this.self());
812
}

cypress/e2e/po/components/storage/config-map.po.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
import PagePo from '@/cypress/e2e/po/pages/page.po';
2-
import BaseResourceList from '@/cypress/e2e/po/lists/base-resource-list.po';
1+
import { BaseListPagePo } from '@/cypress/e2e/po/pages/base/base-list-page.po';
2+
import { BaseDetailPagePo } from '@/cypress/e2e/po/pages/base/base-detail-page.po';
33
import BurgerMenuPo from '@/cypress/e2e/po/side-bars/burger-side-menu.po';
44
import ProductNavPo from '@/cypress/e2e/po/side-bars/product-side-nav.po';
5-
6-
export class ConfigMapPagePo extends PagePo {
5+
import InputPo from '@/cypress/e2e/po/components/input.po';
6+
import CodeMirrorPo from '@/cypress/e2e/po/components/code-mirror.po';
7+
export class ConfigMapListPagePo extends BaseListPagePo {
78
private static createPath(clusterId: string) {
89
return `/c/${ clusterId }/explorer/configmap`;
910
}
1011

1112
static goTo(clusterId: string): Cypress.Chainable<Cypress.AUTWindow> {
12-
return super.goTo(ConfigMapPagePo.createPath(clusterId));
13+
return super.goTo(ConfigMapListPagePo.createPath(clusterId));
1314
}
1415

1516
static navTo(clusterId = 'local') {
@@ -22,28 +23,36 @@ export class ConfigMapPagePo extends PagePo {
2223
}
2324

2425
constructor(clusterId = 'local') {
25-
super(ConfigMapPagePo.createPath(clusterId));
26+
super(ConfigMapListPagePo.createPath(clusterId));
2627
}
2728

28-
list() {
29-
return new BaseResourceList(this.self());
29+
searchForConfigMap(name: string) {
30+
this.list().resourceTable().sortableTable().filter(name);
31+
32+
return cy.url().should('include', `q=${ name }`);
3033
}
34+
}
3135

32-
clickCreate() {
33-
return this.list().masthead().create();
36+
export class ConfigMapCreateEditPagePo extends BaseDetailPagePo {
37+
private static createPath(clusterId: string, namespace?: string, id?: string ) {
38+
const root = `/c/${ clusterId }/explorer/configmap`;
39+
40+
return id ? `${ root }/${ namespace }/${ id }` : `${ root }/create`;
3441
}
3542

36-
listElementWithName(name:string) {
37-
return this.list().resourceTable().sortableTable().rowElementWithName(name);
43+
static goTo(path: string): Cypress.Chainable<Cypress.AUTWindow> {
44+
throw new Error('invalid');
3845
}
3946

40-
searchForConfigMap(name: string) {
41-
this.list().resourceTable().sortableTable().filter(name);
47+
constructor(clusterId = 'local', namespace?: string, id?: string) {
48+
super(ConfigMapCreateEditPagePo.createPath(clusterId, namespace, id));
49+
}
4250

43-
return cy.url().should('include', `q=${ name }`);
51+
keyInput() {
52+
return InputPo.bySelector(this.self(), '[data-testid="input-kv-item-key-0"]');
4453
}
4554

46-
title() {
47-
return this.self().get('.title h1').invoke('text');
55+
valueInput() {
56+
return CodeMirrorPo.bySelector(this.self(), '[data-testid="code-mirror-multiline-field"]');
4857
}
4958
}

cypress/e2e/tests/pages/explorer2/resource-search.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import HomePagePo from '@/cypress/e2e/po/pages/home.po';
22
import ClusterDashboardPagePo from '@/cypress/e2e/po/pages/explorer/cluster-dashboard.po';
33
import ResourceSearchDialog from '@/cypress/e2e/po/prompts/ResourceSearchDialog.po';
44
import { NamespaceFilterPo } from '@/cypress/e2e/po/components/namespace-filter.po';
5-
import { ConfigMapPagePo } from '@/cypress/e2e/po/pages/explorer/config-map.po';
5+
import { ConfigMapListPagePo } from '@/cypress/e2e/po/pages/explorer/config-map.po';
66

77
const clusterDashboard = new ClusterDashboardPagePo('local');
88

@@ -77,7 +77,7 @@ describe('Cluster Dashboard', { testIsolation: 'off', tags: ['@explorer2', '@adm
7777

7878
dialog.results().first().click();
7979

80-
const configMapPage = new ConfigMapPagePo('local');
80+
const configMapPage = new ConfigMapListPagePo('local');
8181

8282
configMapPage.waitForPage();
8383

0 commit comments

Comments
 (0)