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' ;
33import BurgerMenuPo from '@/cypress/e2e/po/side-bars/burger-side-menu.po' ;
44import 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}
0 commit comments