Skip to content

Commit 21db335

Browse files
authored
feat: console v2.2.0 (#427)
Signed-off-by: zhaoxinxin <[email protected]>
1 parent eb41763 commit 21db335

File tree

168 files changed

+24690
-7300
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+24690
-7300
lines changed

cypress/e2e/clusters/cluster.cy.ts

Lines changed: 109 additions & 337 deletions
Large diffs are not rendered by default.

cypress/e2e/clusters/clusters.cy.ts

Lines changed: 118 additions & 142 deletions
Large diffs are not rendered by default.

cypress/e2e/clusters/create-cluster.cy.ts

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import clusters from '../../fixtures/clusters/clusters.json';
22
import seedPeers from '../../fixtures/seed-peers/seed-peers.json';
33
import schedulers from '../../fixtures/schedulers/schedulers.json';
4+
import createClusters from '../../fixtures/clusters/create-clusters.json';
45
import createCluster from '../../fixtures/clusters/create-cluster.json';
56
import _ from 'lodash';
67

@@ -52,18 +53,10 @@ describe('Create cluster', () => {
5253
cy.visit('/clusters');
5354

5455
// Show number of cluster.
55-
cy.get(
56-
':nth-child(1) > .css-q5fqw0 > .clusters_clusterContentContainer__ZxKuh > .css-zm3ms > .css-70qvj9 > .MuiTypography-root',
57-
)
58-
.should('be.visible')
59-
.and('contain', '16');
56+
cy.get('#total-clusters').should('be.visible').and('contain', '37');
6057

6158
// Show number of cluster default.
62-
cy.get(
63-
':nth-child(1) > .css-q5fqw0 > .clusters_clusterContentContainer__ZxKuh > .css-zm3ms > .MuiGrid-root > .clusters_clusterBottomContentContainer__KII0M > .clusters_clusterBottomContent__k3P4u',
64-
)
65-
.should('be.visible')
66-
.and('contain', '7');
59+
cy.get('#default-clusters').should('be.visible').and('contain', '13');
6760

6861
// Click the `ADD CLUSTER` button.
6962
cy.get('.clusters_clusterTitle__5Lhnw > .MuiButtonBase-root').click();
@@ -101,7 +94,7 @@ describe('Create cluster', () => {
10194
req.body = '';
10295
req.reply({
10396
statusCode: 200,
104-
body: [],
97+
body: createCluster,
10598
});
10699
},
107100
);
@@ -110,6 +103,19 @@ describe('Create cluster', () => {
110103
method: 'GET',
111104
url: '/api/v1/clusters?page=1&per_page=10000000',
112105
},
106+
(req) => {
107+
req.reply({
108+
statusCode: 200,
109+
body: createClusters,
110+
});
111+
},
112+
);
113+
114+
cy.intercept(
115+
{
116+
method: 'GET',
117+
url: '/api/v1/clusters/38',
118+
},
113119
(req) => {
114120
req.reply({
115121
statusCode: 200,
@@ -122,26 +128,29 @@ describe('Create cluster', () => {
122128
cy.get('#save').click();
123129

124130
// Then I see that the current page is the clusters.
125-
cy.url().should('include', '/clusters');
131+
cy.url().should('include', '/clusters/38');
132+
133+
cy.get('.information_classNameWrapper__Ey-oo > div.MuiBox-root > #name').should('have.text', 'cluster-38');
134+
135+
cy.get('#description').should('have.text', 'Add new cluster case');
136+
137+
// Show Scopes.
138+
cy.get('#location').should('have.text', 'China|Hang|Zhou');
139+
140+
cy.get('#idc-1').should('have.text', 'hz');
141+
cy.get('#idc-2').should('have.text', 'sh');
142+
143+
cy.get('#cidrs-1').should('have.text', '10.0.0.0/8');
144+
cy.get('#cidrs-2').should('have.text', '172.16.0.0/12');
145+
cy.get('#cidrs-3').should('have.text', '192.168.0.0/16');
126146

127-
// Displays successfully added clusters.
128-
cy.get(':nth-child(8) > .MuiPaper-root > .clusters_clusterListContent__UwWjF > .MuiTypography-h6')
129-
.should('be.visible')
130-
.and('contain', 'cluster-17');
147+
cy.get('.MuiBreadcrumbs-ol > :nth-child(1) > .MuiTypography-root').click();
131148

132149
// The number of clusters has been increased.
133-
cy.get(
134-
':nth-child(1) > .css-q5fqw0 > .clusters_clusterContentContainer__ZxKuh > .css-zm3ms > .css-70qvj9 > .MuiTypography-root',
135-
)
136-
.should('be.visible')
137-
.and('contain', '17');
150+
cy.get('#total-clusters').should('be.visible').and('contain', '38');
138151

139152
// The default number of clusters has been increased.
140-
cy.get(
141-
':nth-child(1) > .css-q5fqw0 > .clusters_clusterContentContainer__ZxKuh > .css-zm3ms > .MuiGrid-root > .clusters_clusterBottomContentContainer__KII0M > .clusters_clusterBottomContent__k3P4u',
142-
)
143-
.should('be.visible')
144-
.and('contain', '8');
153+
cy.get('#default-clusters').should('be.visible').and('contain', '14');
145154
});
146155

147156
it('cannot create cluster with existing cluster', () => {

cypress/e2e/clusters/update-cluster.cy.ts

Lines changed: 15 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,14 @@ describe('Update cluster', () => {
1818
});
1919
},
2020
);
21-
cy.intercept(
22-
{
23-
method: 'GET',
24-
url: '/api/v1/seed-peers?page=1&per_page=10000000&seed_peer_cluster_id=1',
25-
},
26-
(req) => {
27-
req.reply({
28-
statusCode: 200,
29-
body: [],
30-
});
31-
},
32-
);
33-
cy.intercept(
34-
{
35-
method: 'GET',
36-
url: '/api/v1/schedulers?page=1&per_page=10000000&scheduler_cluster_id=1',
37-
},
38-
(req) => {
39-
req.reply({
40-
statusCode: 200,
41-
body: [],
42-
});
43-
},
44-
);
4521

4622
cy.visit('/clusters/1/edit');
4723
cy.viewport(1440, 1080);
4824
});
4925

5026
it('when data is loaded', () => {
5127
// Show cluster information.
52-
cy.get('.MuiPaper-root > .css-0 > :nth-child(2)').should('contain', 'cluster-1');
28+
cy.get('#name').should('contain', 'cluster-1');
5329

5430
cy.get('.PrivateSwitchBase-input').should('be.checked').check({ force: true });
5531

@@ -121,9 +97,9 @@ describe('Update cluster', () => {
12197

12298
// Show cluster information.
12399

124-
cy.get('.MuiPaper-outlined > .css-0 > :nth-child(1)').should('contain', '0');
100+
cy.get('#id').should('contain', '0');
125101

126-
cy.get('.MuiPaper-root > .css-0 > :nth-child(2)').should('contain', '');
102+
cy.get('#name').should('contain', '');
127103

128104
cy.get('.PrivateSwitchBase-input').should('not.be.checked').check({ force: false });
129105

@@ -151,7 +127,7 @@ describe('Update cluster', () => {
151127
cy.get('#peerLoadLimit').should('have.value', 0);
152128
cy.get('#candidateParentLimit').should('have.value', 0);
153129
cy.get('#filterParentLimit').should('have.value', 0);
154-
cy.get('#jobRateLimit').should('have.value', 10);
130+
cy.get('#jobRateLimit').should('have.value', 0);
155131
});
156132

157133
it('can update cluster', () => {
@@ -165,10 +141,10 @@ describe('Update cluster', () => {
165141
cy.visit('/clusters/1');
166142

167143
// Click update cluster button.
168-
cy.get('.css-bbra84-MuiButtonBase-root-MuiButton-root').click();
144+
cy.get('#update').click();
169145

170146
// Show cluster name.
171-
cy.get('.MuiPaper-root > .css-0 > :nth-child(2)').should('be.visible').and('contain', 'cluster-1');
147+
cy.get('#name').should('be.visible').and('contain', 'cluster-1');
172148

173149
cy.get('.PrivateSwitchBase-input').click();
174150

@@ -223,32 +199,28 @@ describe('Update cluster', () => {
223199
// Then I see that the current page is the clusters/1!
224200
cy.url().should('include', '/clusters/1');
225201

226-
cy.get('.show_container__osP4U > .MuiTypography-root').scrollIntoView();
227-
228202
// Check whether the cluster information is updated successfully.
229-
cy.get('.information_clusterContainer__l8H8p > :nth-child(3) > .MuiTypography-subtitle1')
230-
.should('be.visible')
231-
.and('contain', 'update cluster-1');
203+
cy.get('#description').should('be.visible').and('contain', 'update cluster-1');
232204

233-
cy.get('.information_clusterContainer__l8H8p > :nth-child(5) > .MuiTypography-subtitle1')
234-
.should('be.visible')
235-
.and('contain', 'No');
205+
cy.get('#default').should('be.visible').and('contain', 'No');
236206

237207
cy.get('#cidrs').click();
238208

239209
cy.get('.MuiDialogContent-root > :nth-child(4)').should('be.visible').and('contain', '192.168.20.2');
240210

241211
cy.get('body').click('topLeft');
242212

243-
cy.get('.MuiPaper-root > :nth-child(1) > .MuiTypography-body1')
244-
.scrollIntoView()
245-
.should('be.visible')
246-
.and('contain', '400');
213+
cy.get('#seed-peer-load-limit').scrollIntoView().should('be.visible').and('contain', '400');
247214

248-
cy.get('#filter-parent-limit').should('be.visible').and('contain', '20');
215+
cy.get('#job-rate-limit').should('be.visible').and('contain', '20');
249216
});
250217

251218
it('click the `CANCEL button', () => {
219+
cy.url().should('include', '/clusters/1/edit');
220+
cy.get('[data-testid="isloading"]').should('be.exist');
221+
222+
cy.wait(1000);
223+
252224
cy.get('#cancel').click();
253225

254226
// Then I see that the current page is the clusters/1!

cypress/e2e/developer/tokens/create-token.cy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ describe('Create token', () => {
8282
cy.url().should('include', '/developer/personal-access-tokens');
8383

8484
// After creation is completed, the copyable token will be displayed.
85-
cy.get('.css-1s0a73l').should('exist');
85+
cy.get('#copy-column').should('exist');
8686

8787
// Click the Copy icon button.
88-
cy.get('.css-1s0a73l > .MuiButtonBase-root').click();
88+
cy.get('#copy-button').click();
8989

9090
// The copy icon is no longer displayed.
9191
cy.get('#copy').should('not.exist');
@@ -113,11 +113,11 @@ describe('Create token', () => {
113113

114114
// Refresh page.
115115
cy.reload().then(() => {
116-
cy.wait(2000);
116+
cy.wait(1000);
117117
});
118118

119119
// When you click refresh, the replication token will not be displayed again for your security.
120-
cy.get('.css-1s0a73l').should('not.exist');
120+
cy.get('#copy-column').should('not.exist');
121121
});
122122

123123
it('cannot create token with existing token', () => {

cypress/e2e/developer/tokens/tokens.cy.ts

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,38 +36,23 @@ describe('Tokens', () => {
3636
cy.get('#root-11').should('be.visible').and('have.text', 'root-11');
3737

3838
// Show user name.
39-
cy.get(':nth-child(1) > .css-fyy1jt > :nth-child(1) > .MuiBox-root > .MuiTypography-body2').should(
40-
'contain',
41-
'root',
42-
);
39+
cy.get('#user-name-11').should('contain', 'root');
4340

4441
// Show Expiration.
45-
cy.get(':nth-child(1) > .css-fyy1jt > :nth-child(1) > .css-70qvj9 > .css-189ppmh-MuiTypography-root')
46-
.should('be.visible')
47-
.and('have.text', 'Mon, Dec 11 2023.');
42+
cy.get('#expired-at-11').should('be.visible').and('have.text', 'Mon, Dec 11 2023.');
4843

4944
// Show token information.
5045
cy.get('#root-9').should('be.visible').and('have.text', 'root-9');
5146

52-
cy.get(':nth-child(3) > .css-fyy1jt > :nth-child(1) > .css-fu0n4a > .MuiTypography-body2').should(
53-
'contain',
54-
'jack',
55-
);
47+
cy.get('#user-name-9').should('contain', 'jack');
5648

57-
cy.get(':nth-child(3) > .css-fyy1jt > :nth-child(1) > .css-70qvj9 > .css-189ppmh-MuiTypography-root')
58-
.should('be.visible')
59-
.and('have.text', 'Thu, Dec 1 2033.');
49+
cy.get('#expired-at-9').should('be.visible').and('have.text', 'Thu, Dec 1 2033.');
6050

6151
cy.get('#root-4').should('be.visible').and('have.text', 'root-4');
6252

63-
cy.get(':nth-child(8) > .css-fyy1jt > :nth-child(1) > .css-fu0n4a > .MuiTypography-body2').should(
64-
'contain',
65-
'lucy',
66-
);
53+
cy.get('#user-name-3').should('contain', 'lucy');
6754

68-
cy.get(':nth-child(8) > .css-fyy1jt > :nth-child(1) > .css-70qvj9 > .css-189ppmh-MuiTypography-root')
69-
.should('be.visible')
70-
.and('have.text', 'Sun, Feb 11 2024.');
55+
cy.get('#expired-at-4').should('be.visible').and('have.text', 'Sun, Feb 11 2024.');
7156
});
7257

7358
it('when no data is loaded', () => {
@@ -190,11 +175,11 @@ describe('Tokens', () => {
190175
cy.get('#root-1').should('be.visible').and('have.text', 'root-1');
191176

192177
// Click DELETE button.
193-
cy.get('.css-fyy1jt > :nth-child(2) > .MuiButtonBase-root').click();
178+
cy.get('#delete-token-1').click();
194179

195180
// Click cancel button.
196181
cy.get('#cancel').click();
197-
cy.get('.css-fyy1jt > :nth-child(2) > .MuiButtonBase-root').click();
182+
cy.get('#delete-token-1').click();
198183

199184
cy.intercept(
200185
{
@@ -248,7 +233,7 @@ describe('Tokens', () => {
248233
// Displays the name of the token that needs to be deleted.
249234
cy.get('#root-11').should('be.visible').and('have.text', 'root-11');
250235

251-
cy.get(':nth-child(1) > .css-fyy1jt > :nth-child(2) > #delete-token').click();
236+
cy.get('#delete-token-11').click();
252237

253238
cy.intercept(
254239
{
@@ -290,7 +275,7 @@ describe('Tokens', () => {
290275
it('try to delete token using guest user', () => {
291276
cy.guestSignin();
292277

293-
cy.get(':nth-child(1) > .css-fyy1jt > :nth-child(2) > #delete-token').click();
278+
cy.get('#delete-token-11').click();
294279

295280
cy.intercept(
296281
{
@@ -314,7 +299,7 @@ describe('Tokens', () => {
314299
it('try to delete token using guest user', () => {
315300
cy.guestSignin();
316301

317-
cy.get(':nth-child(1) > .css-fyy1jt > :nth-child(2) > #delete-token').click();
302+
cy.get('#delete-token-11').click();
318303

319304
cy.intercept(
320305
{

cypress/e2e/developer/tokens/update-token.cy.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,16 @@ describe('Update token', () => {
177177
cy.get('#save').click();
178178

179179
// Check for updated expiration date.
180-
cy.get(':nth-child(1) > .css-fyy1jt > :nth-child(1) > .css-70qvj9 > .css-189ppmh-MuiTypography-root')
181-
.should('be.visible')
182-
.and('have.text', 'Sat, Dec 3 2033.');
180+
cy.get('#expired-at-11').should('be.visible').and('have.text', 'Sat, Dec 3 2033.');
183181

184182
// Then I see that the current page is the developer/personal-access-tokens!
185183
cy.url().should('include', '/developer/personal-access-tokens');
186184

187185
// After update is completed, the copyable token will be displayed.
188-
cy.get('.css-1s0a73l').should('exist');
186+
cy.get('#copy-column').should('exist');
189187

190188
// Click the Copy icon button.
191-
cy.get('.css-1s0a73l > .MuiButtonBase-root').click();
189+
cy.get('#copy-button').click();
192190

193191
// Let's check the copied text.
194192
cy.window()

0 commit comments

Comments
 (0)