forked from rancher/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcluster-dashboard.po.ts
More file actions
141 lines (113 loc) · 3.7 KB
/
cluster-dashboard.po.ts
File metadata and controls
141 lines (113 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import PagePo from '@/cypress/e2e/po/pages/page.po';
import BurgerMenuPo from '@/cypress/e2e/po/side-bars/burger-side-menu.po';
import CustomBadgeDialogPo from '@/cypress/e2e/po/components/custom-badge-dialog.po';
import TabbedPo from '@/cypress/e2e/po/components/tabbed.po';
import CertificatesPo from '@/cypress/e2e/po/components/certificates.po';
import { HeaderPo } from '@/cypress/e2e/po/components/header.po';
import { NamespaceFilterPo } from '@/cypress/e2e/po/components/namespace-filter.po';
import ResourceTablePo from '~/cypress/e2e/po/components/resource-table.po';
import ActionMenuPo from '@/cypress/e2e/po/components/action-menu-shell.po';
import { MEDIUM_TIMEOUT_OPT } from '@/cypress/support/utils/timeouts';
export default class ClusterDashboardPagePo extends PagePo {
private static createPath(clusterId: string) {
return `/c/${ clusterId }/explorer`;
}
static goTo(clusterId: string): Cypress.Chainable<Cypress.AUTWindow> {
return super.goTo(ClusterDashboardPagePo.createPath(clusterId));
}
urlPath(clusterId = 'local') {
return ClusterDashboardPagePo.createPath(clusterId);
}
constructor(clusterId: string) {
super(ClusterDashboardPagePo.createPath(clusterId));
}
static navTo(clusterId = 'local') {
const burgerMenu = new BurgerMenuPo();
burgerMenu.goToCluster(clusterId);
}
customizeAppearanceButton() {
return cy.getId('add-custom-cluster-badge');
}
customBadge(): CustomBadgeDialogPo {
return new CustomBadgeDialogPo();
}
certificates(): CertificatesPo {
return new CertificatesPo();
}
clickCertificatesTab() {
this.tabs().self().scrollIntoView();
return this.tabs().clickNthTab(2);
}
eventsRowCountMenuToggle() {
return cy.get('[data-testid="events-list-row-count-menu-toggle"]').click();
}
eventsRowCountMenu() {
return new ActionMenuPo();
}
tabs() {
return new TabbedPo('[data-testid="tabbed"]');
}
fullEventsLink() {
return cy.get('[data-testid="events-link"]').contains('Full events list');
}
fullSecretsList() {
return cy.get('.cert-table-link').contains('Full secrets list');
}
eventsList() {
return new ResourceTablePo('#cluster-events [data-testid="sortable-table-list-container"]');
}
certificatesList() {
return new ResourceTablePo('#cluster-certs [data-testid="sortable-table-list-container"]');
}
clusterActionsHeader() {
return new HeaderPo();
}
fleetStatus() {
return cy.get('[data-testid="k8s-service-fleet"]');
}
etcdStatus() {
return cy.get('[data-testid="k8s-service-etcd"]');
}
schedulerStatus() {
return cy.get('[data-testid="k8s-service-scheduler"]');
}
controllerManagerStatus() {
return cy.get('[data-testid="k8s-service-controller-manager"]');
}
/**
* Confirm that the ns filter is set correctly before navigating to a page that will use it
* 1. nav to cluster dashboard
* 2. check ns filter values
*/
static goToAndConfirmNsValues(cluster: string, {
nsProject,
all
}: {
nsProject?: {
values: string[]
},
all?: {
is: boolean,
}
}) {
const instance = new ClusterDashboardPagePo(cluster);
const nsfilter = new NamespaceFilterPo();
instance.goTo();
instance.waitForPage();
nsfilter.checkVisible(MEDIUM_TIMEOUT_OPT);
if (nsProject) {
for (let i = 0; i < nsProject.values.length; i++) {
nsfilter.selectedValues().contains(nsProject.values[i]);
}
} else if (all) {
nsfilter.allSelected();
} else {
throw new Error('Bad Config');
}
}
static goToAndWait(cluster: string) {
const instance = new ClusterDashboardPagePo(cluster);
instance.goTo();
instance.clusterActionsHeader().checkVisible();
}
}