forked from rancher/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.spec.ts
More file actions
845 lines (651 loc) · 27.8 KB
/
Copy pathshell.spec.ts
File metadata and controls
845 lines (651 loc) · 27.8 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
import { LoginPagePo } from '@/cypress/e2e/po/pages/login-page.po';
import HomePagePo from '@/cypress/e2e/po/pages/home.po';
import AboutPagePo from '@/cypress/e2e/po/pages/about.po';
import PreferencesPagePo from '@/cypress/e2e/po/pages/preferences.po';
import UserMenuPo from '@/cypress/e2e/po/side-bars/user-menu.po';
import AccountPagePo from '@/cypress/e2e/po/pages/account-api-keys.po';
import CreateKeyPagePo from '@/cypress/e2e/po/pages/account-api-keys-create_key.po';
import BurgerMenuPo from '@/cypress/e2e/po/side-bars/burger-side-menu.po';
import ClusterDashboardPagePo from '@/cypress/e2e/po/pages/explorer/cluster-dashboard.po';
import CardPo from '@/cypress/e2e/po/components/card.po';
import ProductNavPo from '@/cypress/e2e/po/side-bars/product-side-nav.po';
import ClusterManagerCreatePagePo from '@/cypress/e2e/po/edit/provisioning.cattle.io.cluster/create/cluster-create.po';
import LoadingPo from '@/cypress/e2e/po/components/loading.po';
import { WorkloadsDeploymentsListPagePo } from '@/cypress/e2e/po/pages/explorer/workloads/workloads-deployments.po';
import { ChartsPage } from '@/cypress/e2e/po/pages/explorer/charts/charts.po';
import ExtensionsPagePo from '@/cypress/e2e/po/pages/extensions.po';
import { SettingsPagePo } from '@/cypress/e2e/po/pages/global-settings/settings.po';
import PodSecurityAdmissionsPagePo from '@/cypress/e2e/po/pages/cluster-manager/pod-security-admissions.po';
import BannersPo from '@/cypress/e2e/po/components/banners.po';
import { HomeLinksPagePo } from '@/cypress/e2e/po/pages/global-settings/home-links.po';
import ChartRepositoriesPagePo from '@/cypress/e2e/po/pages/chart-repositories.po';
import { EventsCreateEditPo, EventsPageListPo } from '@/cypress/e2e/po/pages/explorer/events.po';
import { HeaderPo } from '@/cypress/e2e/po/components/header.po';
import { ProjectsNamespacesListPagePo, NamespaceCreateEditPagePo, ProjectCreateEditPagePo } from '@/cypress/e2e/po/pages/explorer/projects-namespaces.po';
import PromptRemove from '@/cypress/e2e/po/prompts/promptRemove.po';
import { dialogModal, promptModal } from '@/cypress/e2e/po/prompts/shared/modalInstances.po';
import ClusterToolsPagePo from '@/cypress/e2e/po/pages/explorer/cluster-tools.po';
import { WorkLoadsDaemonsetsCreatePagePo, WorkloadsDaemonsetsListPagePo } from '@/cypress/e2e/po/pages/explorer/workloads-daemonsets.po';
import { ChartPage } from '@/cypress/e2e/po/pages/explorer/charts/chart.po';
import { MEDIUM_TIMEOUT_OPT } from '@/cypress/support/utils/timeouts';
import { SecretsCreateEditPo, SecretsListPagePo } from '@/cypress/e2e/po/pages/explorer/secrets.po';
import SlideInPo from '@/cypress/e2e/po/side-bars/slide-in.po';
import ClusterManagerListPagePo from '@/cypress/e2e/po/pages/cluster-manager/cluster-manager-list.po';
import DigitalOceanCloudCredentialsCreateEditPo from '@/cypress/e2e/po/edit/cloud-credentials-digitalocean.po';
import KontainerDriversPagePo from '@/cypress/e2e/po/pages/cluster-manager/kontainer-drivers.po';
import UsersPo from '@/cypress/e2e/po/pages/users-and-auth/users.po';
import UserRetentionPo from '@/cypress/e2e/po/pages/users-and-auth/user.retention.po';
import ResourceSearchDialog from '@/cypress/e2e/po/prompts/ResourceSearchDialog.po';
import { StorageClassesPagePo } from '@/cypress/e2e/po/pages/explorer/storage-classes.po';
import { BrandingPagePo } from '@/cypress/e2e/po/pages/global-settings/branding.po';
import { BannersPagePo } from '@/cypress/e2e/po/pages/global-settings/banners.po';
import { USERS_BASE_URL } from '@/cypress/support/utils/api-endpoints';
import { FleetApplicationCreatePo, FleetGitRepoCreateEditPo } from '@/cypress/e2e/po/pages/fleet/fleet.cattle.io.application.po';
describe('Shell a11y testing', { tags: ['@adminUser', '@accessibility'] }, () => {
describe('Login page', () => {
it('login page', () => {
const loginPage = new LoginPagePo();
loginPage.goTo();
loginPage.waitForPage();
cy.injectAxe();
loginPage.username().set('test user');
cy.checkPageAccessibility();
});
it('locale selector', () => {
const loginPage = new LoginPagePo();
loginPage.goTo();
loginPage.waitForPage();
cy.injectAxe();
loginPage.localSelector().click();
cy.checkPageAccessibility();
});
});
describe('Logged in', { testIsolation: 'off' }, () => {
const aboutPage = new AboutPagePo();
const prefPage = new PreferencesPagePo();
const userMenu = new UserMenuPo();
before(() => {
cy.login();
cy.updateNamespaceFilter('local', 'none', '{"local":[]}');
});
it('Home page', () => {
HomePagePo.goToAndWaitForGet();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('About page', () => {
AboutPagePo.navTo();
aboutPage.waitForPage();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Preferences page', () => {
userMenu.clickMenuItem('Preferences');
userMenu.isClosed();
prefPage.waitForPage();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Fleet GitRepo - Add Repository page', () => {
const appBundleCreatePage = new FleetApplicationCreatePo();
const gitRepoCreatePage = new FleetGitRepoCreateEditPo();
appBundleCreatePage.goTo();
appBundleCreatePage.waitForPage();
appBundleCreatePage.createGitRepo();
gitRepoCreatePage.waitForPage();
gitRepoCreatePage.resourceDetail().createEditView().nameNsDescription()
.name()
.checkVisible();
cy.injectAxe();
cy.checkPageAccessibility();
});
describe('Account and API Keys', () => {
const accountPage = new AccountPagePo();
const createKeyPage = new CreateKeyPagePo();
it('Account and API Keys Page', () => {
accountPage.goTo();
accountPage.waitForPage();
accountPage.title();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Change Password dialog', () => {
accountPage.changePassword();
accountPage.currentPassword().checkVisible();
cy.injectAxe();
accountPage.changePasswordModal().then((el) => {
cy.checkElementAccessibility(el);
});
promptModal().clickActionButton('Cancel');
});
it('API Key - Create', () => {
accountPage.create();
createKeyPage.waitForPage();
createKeyPage.mastheadTitle().then((title) => {
expect(title.replace(/\s+/g, ' ')).to.contain('API Key: Create');
});
cy.injectAxe();
cy.checkPageAccessibility();
createKeyPage.cancel();
accountPage.waitForPage();
});
it('API Key - Delete', () => {
accountPage.title();
accountPage.list().resourceTable().sortableTable().selectAllCheckbox()
.set();
accountPage.list().resourceTable().sortableTable().deleteButton()
.click();
cy.injectAxe();
cy.checkPageAccessibility();
});
});
describe('Explorer', () => {
describe('Cluster', () => {
const clusterDashboard = new ClusterDashboardPagePo('local');
it('Cluster Dashboard page', () => {
clusterDashboard.goTo();
clusterDashboard.waitForPage();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Cluster Appearance Modal', () => {
clusterDashboard.customizeAppearanceButton().click();
const customClusterCard = new CardPo();
customClusterCard.getTitle().contains('Cluster Appearance');
cy.injectAxe();
customClusterCard.self().then((el: any) => {
cy.checkElementAccessibility(el);
});
promptModal().clickActionButton('Cancel');
});
describe('Projects-Namespaces', () => {
const projectsNamespacesPage = new ProjectsNamespacesListPagePo();
const createProjectPage = new ProjectCreateEditPagePo();
const createNamespacePage = new NamespaceCreateEditPagePo();
it('Projects-Namespaces - Move dialog', () => {
ProjectsNamespacesListPagePo.navTo();
projectsNamespacesPage.waitForPage();
projectsNamespacesPage.list().resourceTable().sortableTable().rowActionMenuOpen('cattle-fleet-system')
.getMenuItem('Move')
.click();
cy.injectAxe();
promptModal().self().then((el) => {
cy.checkElementAccessibility(el);
});
promptModal().clickActionButton('Cancel');
});
it('Projects-Namespaces - Delete Project dialog', () => {
projectsNamespacesPage.waitForPage();
projectsNamespacesPage.list().resourceTable().sortableTable().groupByButtons(1)
.click();
projectsNamespacesPage.list().resourceTable().sortableTable().rowActionMenuOpen('Project: Default')
.getMenuItem('Delete')
.click();
const promptRemove = new PromptRemove();
cy.injectAxe();
promptRemove.self().then((el) => {
cy.checkElementAccessibility(el);
});
promptRemove.cancel();
});
it('Projects-Namespaces - Create Project', () => {
projectsNamespacesPage.waitForPage();
projectsNamespacesPage.baseResourceList().masthead().create();
projectsNamespacesPage.mastheadTitle().then((title) => {
expect(title.replace(/\s+/g, ' ')).to.contain('Project: Create');
});
createProjectPage.waitForPage(null, 'members');
createProjectPage.resourceDetail().createEditView()
.nameNsDescription()
.name()
.checkVisible();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Projects-Namespaces - Add Project Member', () => {
createProjectPage.goTo();
createProjectPage.waitForPage();
createProjectPage.addProjectMemberButton().should('be.visible');
createProjectPage.addProjectMemberButton().click();
promptModal().getBody().should('be.visible');
cy.injectAxe();
promptModal().self().then((el) => {
cy.checkElementAccessibility(el);
});
promptModal().clickActionButton('Cancel');
createProjectPage.resourceDetail().cruResource()
.cancel()
.click();
});
it('Projects-Namespaces - Create Namespace', () => {
projectsNamespacesPage.waitForPage();
projectsNamespacesPage.list().resourceTable().sortableTable().groupByButtons(0)
.click();
projectsNamespacesPage.createNamespaceButton().should('be.visible').click();
projectsNamespacesPage.mastheadTitle().then((title) => {
expect(title.replace(/\s+/g, ' ')).to.contain('Namespace: Create');
});
createNamespacePage.waitForPage('flatView=true', 'container-resource-limit');
createNamespacePage.resourceDetail().createEditView()
.nameNsDescription()
.name()
.checkVisible();
cy.injectAxe();
cy.checkPageAccessibility();
createNamespacePage.resourceDetail().cruResource()
.cancel()
.click();
});
it('Projects-Namespaces Page', () => {
projectsNamespacesPage.waitForPage();
projectsNamespacesPage.list().masthead().title().should('contain', 'Projects/Namespaces');
cy.injectAxe();
cy.checkPageAccessibility();
});
});
describe('Tools', () => {
it('Cluster Tools Page', () => {
const clusterTools = new ClusterToolsPagePo('local');
ClusterToolsPagePo.navTo();
clusterTools.waitForPage();
clusterTools.featureChartCards().should('be.visible');
cy.injectAxe();
cy.checkPageAccessibility();
});
});
describe('Events', () => {
const events = new EventsPageListPo('local');
it('Cluster events page', () => {
EventsPageListPo.navTo();
events.waitForPage();
events.list().resourceTable().sortableTable().checkLoadingIndicatorNotVisible();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Create event from YAML', () => {
const createEventPage = new EventsCreateEditPo();
EventsPageListPo.navTo();
events.waitForPage();
events.baseResourceList().masthead().createYaml();
createEventPage.waitForPage('as=yaml');
events.mastheadTitle().then((title) => {
expect(title.replace(/\s+/g, ' ')).to.contain('Event: Create');
});
createEventPage.resourceDetail().resourceYaml()
.codeMirror()
.checkExists();
cy.injectAxe();
cy.checkPageAccessibility();
createEventPage.resourceDetail().resourceYaml()
.cancel();
});
});
});
describe('Workloads', () => {
it('Deployments page', () => {
const deploymentsListPage = new WorkloadsDeploymentsListPagePo();
deploymentsListPage.goTo();
deploymentsListPage.waitForPage();
deploymentsListPage.sortableTable().checkLoadingIndicatorNotVisible();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('DeamonSets - Create', () => {
const daemonsetsListPage = new WorkloadsDaemonsetsListPagePo();
const daemonsetsCreatePage = new WorkLoadsDaemonsetsCreatePagePo('local');
daemonsetsListPage.goTo();
daemonsetsListPage.waitForPage();
daemonsetsListPage.baseResourceList().masthead().create();
daemonsetsCreatePage.waitForPage();
daemonsetsCreatePage.resourceDetail().createEditView().nameNsDescription()
.name()
.checkVisible();
cy.injectAxe();
cy.checkPageAccessibility();
daemonsetsCreatePage.resourceDetail().cruResource()
.cancel()
.click();
});
});
describe('Storage', () => {
it('Secret - Create page', () => {
const secretsListPage = new SecretsListPagePo('local');
const secretsCreatePage = new SecretsCreateEditPo('local');
SecretsListPagePo.navTo();
secretsListPage.waitForPage();
secretsListPage.createButton().click();
secretsCreatePage.waitForPage();
secretsCreatePage.mastheadTitle().then((title) => {
expect(title.replace(/\s+/g, ' ')).to.contain('Secret: Create');
});
secretsCreatePage.resourceDetail().cruResource().findSubTypeByName('custom')
.should('be.visible');
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Secret - Describe Resource', () => {
const header = new HeaderPo();
const slideIn = new SlideInPo();
header.kubectlExplain().click();
slideIn.checkVisible();
slideIn.waitforContent();
cy.injectAxe();
cy.checkPageAccessibility();
slideIn.closeButton().click();
slideIn.checkNotVisible();
});
it('Storage Class - Create', () => {
const storageClasses = new StorageClassesPagePo();
storageClasses.goTo();
storageClasses.waitForPage();
storageClasses.clickCreate();
storageClasses.createStorageClassesForm().waitForPage(null, 'parameters');
storageClasses.mastheadTitle().then((title) => {
expect(title.replace(/\s+/g, ' ')).to.contain('StorageClass: Create');
});
cy.injectAxe();
cy.checkPageAccessibility();
});
});
describe('Header', () => {
const header = new HeaderPo();
it('Import YAML', () => {
const clusterDashboard = new ClusterDashboardPagePo('local');
ClusterDashboardPagePo.navTo();
clusterDashboard.waitForPage();
header.importYamlHeaderAction().click();
header.importYaml().checkVisible();
cy.injectAxe();
header.importYaml().self().then((el: any) => {
cy.checkElementAccessibility(el);
});
header.importYaml().importYamlCancelClick();
header.importYaml().checkNotExists();
});
it('Kubectl Shell', () => {
header.kubectlShell().openTerminal();
header.kubectlShell().waitForTerminalToBeVisible();
cy.injectAxe();
header.kubectlShell().self().then((el: any) => {
cy.checkElementAccessibility(el);
});
header.kubectlShell().closeTerminal();
});
it('Resource Search', () => {
const dialog = new ResourceSearchDialog();
header.resourceSearchButton().click();
dialog.searchBox().should('be.visible');
cy.injectAxe();
dialog.self().then((el: any) => {
cy.checkElementAccessibility(el);
});
dialog.close();
dialog.checkNotExists();
});
});
});
describe('Cluster Management', () => {
const createClusterPage = new ClusterManagerCreatePagePo();
const loadingPo = new LoadingPo('.loading-indicator');
it('Clusters - Create page', () => {
createClusterPage.goTo();
createClusterPage.waitForPage();
loadingPo.checkNotExists();
cy.injectAxe();
cy.checkPageAccessibility();
cy.injectAxe();
});
it('Cluster - Create Digital Ocean Cloud Credential', () => {
const clusterList = new ClusterManagerListPagePo();
ClusterManagerListPagePo.navTo();
clusterList.waitForPage();
clusterList.createCluster();
createClusterPage.selectCreate(2);
loadingPo.checkNotExists();
createClusterPage.rke2PageTitle().should('include', 'Create DigitalOcean');
createClusterPage.waitForPage('type=digitalocean&rkeType=rke2');
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Cluster - Create Digital Ocean', () => {
const cloudCredForm = new DigitalOceanCloudCredentialsCreateEditPo();
// fake cloud credential authentication
cy.intercept('GET', '/meta/proxy/api.digitalocean.com/v2/regions?per_page=1000', (req) => {
req.reply({ statusCode: 200 });
}).as('doCloudCred');
// create fake cloud credential
cloudCredForm.credentialName().set('doCloudCredName');
cloudCredForm.accessToken().set('fakeToken');
cloudCredForm.saveCreateForm().cruResource().saveOrCreate().click();
cy.wait('@doCloudCred');
createClusterPage.waitForPage('type=digitalocean&rkeType=rke2', 'basic');
createClusterPage.rke2PageTitle().should('include', 'Create DigitalOcean');
cy.injectAxe();
cy.checkPageAccessibility();
// delete digital ocean cloud credential
cy.getRancherResource('v3', 'cloudcredentials', null, null).then((resp: Cypress.Response<any>) => {
const body = resp.body;
if (body.pagination['total'] > 0) {
body.data.forEach((item: any) => {
if (item.digitaloceancredentialConfig) {
const id = item.id;
cy.deleteRancherResource('v3', 'cloudcredentials', id);
}
});
}
});
});
it('Cluster drivers page', () => {
const driversPage = new KontainerDriversPagePo();
KontainerDriversPagePo.navTo();
driversPage.waitForPage();
driversPage.list().masthead().title().should('contain', 'Cluster Drivers');
driversPage.list().resourceTable().sortableTable().checkVisible();
driversPage.list().resourceTable().sortableTable().checkLoadingIndicatorNotVisible();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Pod Security Admissions - Create page', () => {
const podSecurityAdmissionsPage = new PodSecurityAdmissionsPagePo();
PodSecurityAdmissionsPagePo.navTo();
podSecurityAdmissionsPage.waitForPage();
podSecurityAdmissionsPage.create();
podSecurityAdmissionsPage.createPodSecurityAdmissionForm().waitForPage();
// trigger error banner with invalid resource name `AAA`
podSecurityAdmissionsPage.createPodSecurityAdmissionForm().nameNsDescription().name().set('AAA');
podSecurityAdmissionsPage.createPodSecurityAdmissionForm().resourceDetail().cruResource().saveOrCreate()
.click();
const banner = new BannersPo('[data-testid="error-banner0"]');
banner.checkVisible();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Repositories - Create page', () => {
const repositoriesPage = new ChartRepositoriesPagePo(undefined, 'manager');
ChartRepositoriesPagePo.navTo();
repositoriesPage.waitForPage();
repositoriesPage.create();
repositoriesPage.createEditRepositories().waitForPage();
repositoriesPage.createEditRepositories().lablesAnnotationsKeyValue().addButton('Add Label').click();
// Adding Annotations doesn't work via test automation
// See https://github.com/rancher/dashboard/issues/13191
// repositoriesPage.createEditRepositories().lablesAnnotationsKeyValue().addButton('Add Annotation').click();
cy.injectAxe();
cy.checkPageAccessibility();
});
});
describe('Users', () => {
const usersPo = new UsersPo('_');
it('Users page', () => {
cy.intercept('GET', `${ USERS_BASE_URL }?*`).as('getUsers');
usersPo.goTo();
usersPo.waitForPage();
usersPo.list().masthead().title().should('contain', 'Users');
cy.wait('@getUsers');
usersPo.list().resourceTable().sortableTable().checkLoadingIndicatorNotVisible();
usersPo.list().refreshGroupMembership().checkVisible();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Users - Create page', () => {
const userCreate = usersPo.createEdit();
usersPo.list().masthead().create();
userCreate.waitForPage();
userCreate.mastheadTitle().then((title) => {
expect(title.replace(/\s+/g, ' ')).to.contain('User: Create');
});
userCreate.username().checkVisible();
cy.injectAxe();
cy.checkPageAccessibility();
userCreate.resourceDetail().cruResource().cancel()
.click();
usersPo.waitForPage();
});
it('User Retention Settings', () => {
const userRetentionPo = new UserRetentionPo();
usersPo.userRetentionLink().click();
userRetentionPo.waitForPage();
userRetentionPo.disableAfterPeriodCheckbox().checkVisible();
cy.injectAxe();
cy.checkPageAccessibility();
});
});
describe('Charts', () => {
it('Charts page', () => {
const chartsPage = new ChartsPage();
ChartsPage.navTo();
chartsPage.waitForPage();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Chart Detail Page - Kubecost', () => {
const chartPage = new ChartPage();
ChartPage.navTo(null, 'Kubecost');
chartPage.waitForChartPage('rancher-partner-charts', 'cost-analyzer');
chartPage.waitForChartHeader('Kubecost', MEDIUM_TIMEOUT_OPT);
cy.injectAxe();
cy.checkPageAccessibility();
});
});
describe('Extensions', () => {
const extensionsPo = new ExtensionsPagePo();
it('Extensions page', () => {
// Set the preference
cy.setUserPreference({ 'plugin-developer': true });
extensionsPo.goTo();
extensionsPo.waitForPage(undefined, 'available');
extensionsPo.loading().should('not.exist');
extensionsPo.extensionTabBuiltinClick();
extensionsPo.waitForPage(undefined, 'builtin');
extensionsPo.extensionCard('AKS Provisioning').checkVisible();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Add Rancher Repositories Modal', () => {
extensionsPo.extensionMenuToggle();
extensionsPo.addRepositoriesClick();
dialogModal().checkVisible();
cy.injectAxe();
dialogModal().self().then((el) => {
cy.checkElementAccessibility(el);
});
dialogModal().clickActionButton('Cancel');
});
it('Import Extension Catalog Modal', () => {
extensionsPo.extensionMenuToggle();
extensionsPo.manageExtensionCatalogsClick();
extensionsPo.catalogsList().sortableTable()
.bulkActionButton('Import Extension Catalog')
.click();
dialogModal().checkVisible();
cy.injectAxe();
dialogModal().self().then((el) => {
cy.checkElementAccessibility(el);
});
dialogModal().clickActionButton('Cancel');
});
});
describe('Global Settings', () => {
it('Settings page', () => {
const settingsPage = new SettingsPagePo('local');
SettingsPagePo.navTo();
settingsPage.waitForPage();
cy.injectAxe();
cy.checkPageAccessibility();
// expand menu
settingsPage.actionButtonByLabel('agent-tls-mode').click();
settingsPage.editSettingsButton().should('be.visible');
cy.injectAxe();
settingsPage.editSettingsButton().then((el) => {
cy.checkElementAccessibility(el);
});
});
it('Home Links page', () => {
const homeLinksPage = new HomeLinksPagePo();
HomeLinksPagePo.navTo();
homeLinksPage.addLinkButton().click();
homeLinksPage.displayTextInput().checkVisible();
homeLinksPage.urlInput().checkVisible();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Branding page', () => {
const brandingPage = new BrandingPagePo();
BrandingPagePo.navTo();
brandingPage.privateLabel().checkVisible();
cy.injectAxe();
cy.checkPageAccessibility();
});
it('Banners page', () => {
const bannersPage = new BannersPagePo();
BannersPagePo.navTo();
bannersPage.headerBannerCheckbox().checkVisible();
cy.injectAxe();
cy.checkPageAccessibility();
});
});
describe('Menus', () => {
const burgerMenu = new BurgerMenuPo();
it('User Menu', () => {
const userMenu = new UserMenuPo();
userMenu.ensureOpen();
cy.injectAxe();
userMenu.userMenuContainer().then((el: any) => {
cy.checkElementAccessibility(el);
});
});
it('Burger Menu', () => {
// HomePagePo.navTo();
// homePage.waitForPage();
burgerMenu.checkVisible();
BurgerMenuPo.toggle();
cy.injectAxe();
burgerMenu.self().then((el: any) => {
cy.checkElementAccessibility(el);
});
burgerMenu.brandLogoImage().then((el: any) => {
cy.checkElementAccessibility(el);
});
});
it('Product Side navigation', () => {
const clusterDashboard = new ClusterDashboardPagePo('local');
clusterDashboard.goTo();
clusterDashboard.waitForPage();
cy.injectAxe();
const sideNav = new ProductNavPo();
const sideNavOptions = ['Cluster', 'Workloads', 'Apps', 'Service Discovery', 'Storage', 'Policy', 'More Resources'];
// expand each side nav option and check accessibility
sideNavOptions.forEach((option) => {
sideNav.navToSideMenuGroupByLabel(option);
sideNav.self().then((el: any) => {
cy.checkElementAccessibility(el);
});
});
});
});
});
after(() => {
cy.updateNamespaceFilter('local', 'none', '{"local":["all://user"]}');
cy.setUserPreference({ 'plugin-developer': false });
});
});