Skip to content

Commit c1cd094

Browse files
author
Zhaoxinxin
committed
Feat add dark module (#448)
Signed-off-by: zhaoxinxin <1186037180@qq.com>
1 parent 0ab1a91 commit c1cd094

File tree

340 files changed

+7733
-5158
lines changed

Some content is hidden

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

340 files changed

+7733
-5158
lines changed

cypress/e2e/clusters/cluster.cy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ describe('Cluster', () => {
214214
// Click the copy scheduler cluster id icon.
215215
cy.get('#copy-scheduler-cluster-id').click();
216216
cy.get('#schedulerClusterIDCopyIcon').should('exist');
217-
cy.get('#schedulerClusterIDTooltip').should('exist');
217+
cy.get('#schedulerClusterIDTooltip').should('not.exist');
218218
cy.wait(1000);
219219

220220
// Display successful copy icon.
221-
cy.get('#schedulerClusterIDCopyIcon').should('not.exist');
221+
cy.get('#schedulerClusterIDCopyIcon').should('exist');
222222
cy.get('#schedulerClusterIDTooltip').should('not.exist');
223223

224224
// Let's check the copied text.
@@ -230,11 +230,11 @@ describe('Cluster', () => {
230230
// Click the copy seed peer cluster id icon.
231231
cy.get('#copy-seed-peer-cluster-id').click();
232232
cy.get('#seedPeerClusterIDCopyIcon').should('exist');
233-
cy.get('#seedPeerClusterIDTooltip').should('exist');
233+
cy.get('#seedPeerClusterIDTooltip').should('not.exist');
234234
cy.wait(1000);
235235

236236
// Display successful copy icon.
237-
cy.get('#seedPeerClusterIDCopyIcon').should('not.exist');
237+
cy.get('#seedPeerClusterIDCopyIcon').should('exist');
238238
cy.get('#seedPeerClusterIDTooltip').should('not.exist');
239239

240240
// Let's check the copied text.

cypress/e2e/clusters/clusters.cy.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('Clusters', () => {
4343
);
4444

4545
cy.visit('/clusters');
46-
cy.viewport(1440, 1080);
46+
cy.viewport(1440, 1480);
4747
});
4848

4949
describe('when data is loaded', () => {
@@ -86,7 +86,7 @@ describe('Clusters', () => {
8686
cy.get('#default-cluster-1')
8787
.should('be.visible')
8888
.and('contain', 'Default')
89-
.and('have.css', 'background-color', 'rgb(46, 143, 121)');
89+
.and('have.css', 'background-color', 'rgb(31, 125, 83)');
9090

9191
// Show cluster name.
9292
cy.get('#cluster-name-1').should('be.visible').and('contain', 'cluster-1');
@@ -108,7 +108,7 @@ describe('Clusters', () => {
108108
cy.get('#default-cluster-2')
109109
.should('be.visible')
110110
.and('contain', 'Non-Default')
111-
.and('have.css', 'background-color', 'rgb(28, 41, 58)');
111+
.and('have.css', 'background-color', 'rgb(24, 35, 15)');
112112
});
113113
});
114114

@@ -183,8 +183,6 @@ describe('Clusters', () => {
183183

184184
describe('pagination', () => {
185185
it('pagination updates results and page number', () => {
186-
cy.get('.Mui-selected').invoke('text').should('eq', 'Cluster1');
187-
188186
// Check number of pagination.
189187
cy.get('#clusterPagination > .MuiPagination-ul').children().should('have.length', 7);
190188

@@ -193,8 +191,6 @@ describe('Clusters', () => {
193191
});
194192

195193
it('when pagination changes, different page results are rendered', () => {
196-
cy.get('.Mui-selected').invoke('text').should('eq', 'Cluster1');
197-
198194
// Go to last page.
199195
cy.get('.MuiPagination-ul > :nth-child(3) > .MuiButtonBase-root').click();
200196

@@ -205,7 +201,7 @@ describe('Clusters', () => {
205201
cy.get('#default-cluster-8')
206202
.should('be.visible')
207203
.and('contain', 'Non-Default')
208-
.and('have.css', 'background-color', 'rgb(28, 41, 58)');
204+
.and('have.css', 'background-color', 'rgb(24, 35, 15)');
209205

210206
cy.get('#cluster-name-8').should('be.visible').and('contain', 'cluster-8');
211207

@@ -268,7 +264,7 @@ describe('Clusters', () => {
268264

269265
cy.get('#clusterPagination > .MuiPagination-ul .Mui-selected').should('have.text', '5');
270266

271-
cy.get('#clusters').children().should('have.length', 1);
267+
cy.get('#clustersCard').children().should('have.length', 1);
272268

273269
cy.get('#cluster-name-37').should('have.text', 'cluster-37');
274270

@@ -384,7 +380,7 @@ describe('Clusters', () => {
384380
cy.get('#free-solo-demo').type('cluster-47');
385381

386382
// No clusters card.
387-
cy.get('#clusters').should('not.exist');
383+
cy.get('#clustersCard').should('not.exist');
388384

389385
// Pagination has been hidden.
390386
cy.get('#clusterPagination > .MuiPagination-ul').should('not.exist');

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ describe('Create cluster', () => {
192192
// Show error message.
193193
cy.get('.MuiAlert-message').should('be.visible').and('contain', 'Conflict');
194194
cy.get('.MuiAlert-action > .MuiButtonBase-root').click();
195-
cy.get('.MuiPaper-root').should('not.exist');
195+
cy.get('.MuiPaper-message').should('not.exist');
196196
});
197197

198198
it('click the `CANCEL button', () => {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('Create token', () => {
2727
cy.visit('/developer/personal-access-tokens');
2828

2929
// Click the `ADD PERSONAL ACCESS TOKENS` button.
30-
cy.get('.css-1qdyvok > .MuiButtonBase-root').click();
30+
cy.get('#new-tokens-button').click();
3131

3232
// Then I see that the current page is the developer/personal-access-tokens/new!
3333
cy.url().should('include', '/developer/personal-access-tokens/new');
@@ -140,7 +140,7 @@ describe('Create token', () => {
140140
// Show error message.
141141
cy.get('.MuiAlert-message').should('be.visible').and('contain', 'Conflict');
142142
cy.get('.MuiAlert-action > .MuiButtonBase-root').click();
143-
cy.get('.MuiPaper-root').should('not.exist');
143+
cy.get('.MuiAlert-message').should('not.exist');
144144
});
145145

146146
it('click the `CANCEL button', () => {

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ describe('Tokens', () => {
2525

2626
it('when data is loaded', () => {
2727
cy.get('[data-testid="isloading"]').should('be.exist');
28-
cy.get('.css-1qdyvok > .MuiTypography-root').should('have.text', 'Personal access tokens');
29-
30-
cy.get('.MuiList-root > :nth-child(2) > .MuiButtonBase-root > .MuiTypography-root').click();
31-
32-
// Whether the style selected by menu is Personal access tokens.
33-
cy.get('.MuiCollapse-wrapperInner > .MuiList-root > .MuiButtonBase-root').should('have.class', 'Mui-selected');
28+
cy.get('#token-title').should('have.text', 'Personal access tokens');
3429

3530
// Show token name.
3631
cy.get('#root-11').should('be.visible').and('have.text', 'root-11');
@@ -69,7 +64,7 @@ describe('Tokens', () => {
6964
},
7065
);
7166

72-
cy.get('.MuiPaper-root').should('be.visible').and('have.text', `You don't have any tokens.`);
67+
cy.get('#no-tokens').should('be.visible').and('have.text', `You don't have any tokens.`);
7368
});
7469

7570
it('should handle API error response', () => {
@@ -97,7 +92,7 @@ describe('Tokens', () => {
9792
cy.get('#tokens-list').should('not.exist');
9893

9994
// Show You don't have any preheat tokens.
100-
cy.get('.MuiPaper-root').should('be.visible').and('have.text', `You don't have any tokens.`);
95+
cy.get('#no-tokens').should('be.visible').and('have.text', `You don't have any tokens.`);
10196
});
10297

10398
describe('pagination', () => {
@@ -120,9 +115,9 @@ describe('Tokens', () => {
120115
cy.get('#tokens-pagination > .MuiPagination-ul .Mui-selected').should('have.text', '2');
121116

122117
// Show token name.
123-
cy.get('.MuiTypography-inherit').should('be.visible').and('have.text', 'root-1');
118+
cy.get('#root-1').should('be.visible').and('have.text', 'root-1');
124119

125-
cy.get('span.css-189ppmh-MuiTypography-root').should('be.visible').and('have.text', 'Thu, Dec 1 2033.');
120+
cy.get('#expired-at-1').should('be.visible').and('have.text', 'Thu, Dec 1 2033.');
126121
});
127122

128123
it('when you click refresh, the paginated results and page numbers remain unchanged.', () => {

cypress/e2e/job/preheats/create-preheat.cy.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('Create preheat', () => {
4646

4747
it('can create preheat', () => {
4848
cy.visit('/jobs/preheats');
49-
cy.get('.css-1g5t85q > .MuiButtonBase-root').click();
49+
cy.get('#new-preheat').click();
5050

5151
cy.url().should('include', '/jobs/preheats/new');
5252

@@ -321,7 +321,6 @@ describe('Create preheat', () => {
321321
it('try to verify header', () => {
322322
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
323323
const key = _.times(101, () => _.sample(characters)).join('');
324-
const value = _.times(1001, () => _.sample(characters)).join('');
325324

326325
// Select a cluster.
327326
cy.get('#select-cluster').click();
@@ -344,13 +343,11 @@ describe('Create preheat', () => {
344343
// Show header value verification error message.
345344
cy.get('.new_headersValueInput__zn-9E > .MuiFormHelperText-root')
346345
.should('be.visible')
347-
.and('have.text', 'Fill in the characters, the length is 1-1000.');
346+
.and('have.text', 'Fill in the characters, the length is 1-10000.');
348347

349348
// Verification passed.
350349
cy.get('.new_headersKeyInput__aZcds > .MuiInputBase-root > .MuiInputBase-input').type('key');
351350
cy.get('.new_headersKeyInput__aZcds > .MuiFormHelperText-root').should('not.exist');
352-
cy.get('.new_headersValueInput__zn-9E > .MuiInputBase-root').type('value');
353-
cy.get('.new_headersValueInput__zn-9E > .MuiFormHelperText-root').should('not.exist');
354351

355352
// Incorrect header key entered.
356353
cy.get('.new_headersKeyInput__aZcds > .MuiInputBase-root > .MuiInputBase-input').clear();
@@ -371,19 +368,6 @@ describe('Create preheat', () => {
371368
cy.get('.new_headersKeyInput__aZcds > .MuiInputBase-root > .MuiInputBase-input').type('key');
372369
cy.get('.new_headersKeyInput__aZcds > .MuiFormHelperText-root').should('not.exist');
373370

374-
// Incorrect header value entered.
375-
cy.get('.new_headersValueInput__zn-9E > .MuiInputBase-root').type(value);
376-
377-
// Show header value verification error message.
378-
cy.get('.new_headersValueInput__zn-9E > .MuiFormHelperText-root')
379-
.should('be.visible')
380-
.and('have.text', 'Fill in the characters, the length is 1-1000.');
381-
382-
// Show header value verification error message.
383-
cy.get('.new_headersValueInput__zn-9E > .MuiFormHelperText-root')
384-
.should('be.visible')
385-
.and('have.text', 'Fill in the characters, the length is 1-1000.');
386-
387371
cy.get('#save').click();
388372

389373
// Preheat creation failed, the page is still in preheat/new!

cypress/e2e/job/preheats/preheat.cy.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ describe('Preheat', () => {
4444
it('click the breadcrumb', () => {
4545
cy.get('[data-testid="isloading"]').should('be.exist');
4646

47-
cy.get(':nth-child(6) > .css-1mlhis1 > .css-1ozvesn > .MuiTypography-root > .MuiBox-root').click();
47+
cy.get('#preheat-6').click();
4848

4949
cy.url().should('include', '/jobs/preheats/6');
5050

5151
// Check for breadcrumb.
52-
cy.get('.MuiBreadcrumbs-ol > :nth-child(3) > .MuiTypography-root').should('exist').and('contain', 'preheats');
52+
cy.get(':nth-child(3) > .MuiTypography-root').should('exist').and('contain', 'Preheat');
5353

54-
cy.get('.MuiBreadcrumbs-ol > :nth-child(3) > .MuiTypography-root').click();
54+
cy.get(':nth-child(3) > .MuiTypography-root').click();
5555

5656
cy.get('[data-testid="isloading"]').should('not.exist');
5757

@@ -244,7 +244,7 @@ describe('Preheat', () => {
244244
});
245245

246246
it('unable to display breadcrumb', () => {
247-
cy.get('.MuiBreadcrumbs-ol').should('be.visible').and('contain', 'preheats');
247+
cy.get('.MuiBreadcrumbs-ol').should('be.visible').and('contain', 'Preheat');
248248

249249
cy.get('.MuiBreadcrumbs-ol > :nth-child(5) > .MuiTypography-root').should('have.text', '-');
250250
});
@@ -303,7 +303,7 @@ describe('Preheat', () => {
303303
});
304304

305305
it('unable to display breadcrumb', () => {
306-
cy.get('.MuiBreadcrumbs-ol').should('be.visible').and('contain', 'preheats');
306+
cy.get('.MuiBreadcrumbs-ol').should('be.visible').and('contain', 'Preheat');
307307

308308
cy.get('.MuiBreadcrumbs-ol > :nth-child(5) > .MuiTypography-root').should('have.text', '-');
309309
});

cypress/e2e/job/preheats/preheats.cy.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,30 +67,32 @@ describe('Preheats', () => {
6767
).as('preheats');
6868
cy.get('[data-testid="isloading"]').should('be.exist');
6969
cy.wait(120000);
70+
7071
// Executed every 3 seconds, it should be executed 2 times after 6 seconds.
7172
cy.get('@preheats').then(() => {
7273
expect(interceptCount).to.be.greaterThan(0);
7374
expect(interceptCount).to.be.closeTo(2, 1);
7475
});
76+
7577
cy.get('[data-testid="isloading"]').should('not.exist');
7678
cy.get('.MuiList-root > :nth-child(3) > .MuiButtonBase-root').click();
77-
// Whether the style selected by menu is Preheat.
78-
cy.get(
79-
':nth-child(3) > .MuiCollapse-root > .MuiCollapse-wrapper > .MuiCollapse-wrapperInner > .MuiList-root > .MuiButtonBase-root',
80-
).should('have.class', 'Mui-selected');
81-
cy.get('.css-1g5t85q > .MuiTypography-root').should('be.visible').and('have.text', 'Preheats');
79+
8280
// The preheating status is displayed as PENDING.
8381
cy.get('#PENDING-11').should('exist');
8482
cy.get('#id-11').should('have.text', 11);
83+
8584
// cy.get('#created_at-11').should('have.text', '2023-03-23 16:29:18');
8685
cy.get('#description-11').should('have.text', 'This is a preheat task with status pending');
86+
8787
// The preheating status is displayed as FAILURE.
8888
cy.get('#FAILURE-10').should('exist');
8989
cy.get('#description-10').should('have.text', 'This is a preheat task with status failure');
90+
9091
// The preheating status is displayed as SUCCESS.
9192
cy.get('#list-8 > .css-1mlhis1').should('exist').find('#SUCCESS-8').should('exist');
9293
cy.get('#description-8').should('have.text', 'This is a preheat task with status success');
9394
});
95+
9496
it('should display preheat success list', () => {
9597
cy.intercept(
9698
{
@@ -113,6 +115,7 @@ describe('Preheats', () => {
113115
cy.get('#preheats-list').children().should('have.length', 6);
114116
cy.get('#preheat-pagination').should('not.exist');
115117
});
118+
116119
it('should display preheat failure list', () => {
117120
cy.intercept(
118121
{
@@ -134,6 +137,7 @@ describe('Preheats', () => {
134137
// Check how many preheat tasks are in success failure.
135138
cy.get('#preheats-list').children().should('have.length', 4);
136139
});
140+
137141
it('should display preheat pending list', () => {
138142
let interceptCount = 0;
139143
cy.intercept(
@@ -288,7 +292,7 @@ describe('Preheats', () => {
288292
cy.get('#list-1').should('exist').find('#SUCCESS-1').should('exist');
289293

290294
// Go to show preheat page.
291-
cy.get('#preheat-1 > .MuiBox-root').click();
295+
cy.get('#preheat-1').click();
292296

293297
// Then I see that the current page is the show update personal-access-tokens.
294298
cy.url().should('include', '/jobs/preheats/1');

cypress/e2e/job/task/clear.cy.ts

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ describe('Clear', () => {
1616
it('when no data is loaded', () => {
1717
cy.get('#no-task').should('not.exist');
1818

19+
cy.get('#light').should('exist');
20+
cy.get('#no-task-image').should('exist');
21+
22+
cy.get('#dark').click();
23+
// Dark mode should show a different no-task-image.
24+
25+
cy.get('.Mui-selected').invoke('text').should('contain', 'Dark');
26+
27+
cy.get('.Mui-selected').invoke('text').should('not.contain', 'Light');
28+
29+
cy.get('#no-task-image').should('not.exist');
30+
31+
cy.get('#dark-no-task-image').should('exist');
32+
1933
cy.intercept(
2034
{
2135
method: 'post',
@@ -299,6 +313,12 @@ describe('Clear', () => {
299313
expect(interceptCount).to.be.closeTo(2, 1);
300314
});
301315

316+
// Executed every 1 minute and once after 1 minute.
317+
cy.get('@cache').then(() => {
318+
expect(interceptCount).to.be.greaterThan(0);
319+
expect(interceptCount).to.be.closeTo(2, 1);
320+
});
321+
302322
cy.intercept(
303323
{
304324
method: 'GET',
@@ -314,13 +334,6 @@ describe('Clear', () => {
314334

315335
// Preheat API error response after three seconds.
316336
cy.wait(60000);
317-
318-
// Show error message.
319-
cy.get('.MuiAlert-message').should('be.visible').and('contain', 'Unauthorized');
320-
321-
// Close error message.
322-
cy.get('.MuiAlert-action > .MuiButtonBase-root').click();
323-
cy.get('.MuiAlert-message').should('not.exist');
324337
});
325338

326339
it('Delete cache API error response', () => {

cypress/e2e/job/task/execution.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ describe('Executions', () => {
4343
// Show isloading.
4444
cy.get('[data-testid="isloading"]').should('be.exist');
4545

46-
cy.get('#execution-9 > .MuiBox-root').click();
46+
cy.get('#execution-9').click();
4747

4848
cy.url().should('include', '/jobs/task/executions/9');
4949

5050
// Check for breadcrumb.
51-
cy.get('.MuiBreadcrumbs-ol').should('exist').and('contain', 'executions').and('contain', '9');
51+
cy.get('.MuiBreadcrumbs-ol').should('exist').and('contain', 'Executions').and('contain', '9');
5252

5353
cy.get('.MuiBreadcrumbs-ol > :nth-child(5) > .MuiTypography-root').click();
5454

0 commit comments

Comments
 (0)