@@ -32,32 +32,36 @@ describe('Menu', () => {
3232 } ) ;
3333
3434 it ( 'should navigate to the tokens page' , ( ) => {
35- cy . get ( '.MuiList-root > :nth-child(2) > .MuiButtonBase-root ' ) . click ( ) ;
36- cy . get ( '.MuiCollapse-wrapperInner > .MuiList-root > .MuiButtonBase-root ' ) . click ( ) ;
35+ cy . get ( '#developer ' ) . click ( ) ;
36+ cy . get ( '#personal-access-tokens ' ) . click ( ) ;
3737
3838 // Then I see that the current page is the tokens!
3939 cy . url ( ) . should ( 'include' , '/developer/personal-access-tokens' ) ;
4040
4141 // The selected menu is tokens.
42- cy . get ( '.MuiCollapse-wrapperInner > .MuiList-root > .MuiButtonBase-root' ) . should ( 'have.class' , 'Mui-selected' ) ;
42+ cy . get ( '#personal-access-tokens' ) . should ( 'have.class' , 'Mui-selected' ) ;
43+
44+ cy . get ( '#dragonfly' ) . click ( ) ;
45+ // Then I see that the current page is the clusters!
46+ cy . url ( ) . should ( 'include' , '/clusters' ) ;
4347 } ) ;
4448
4549 it ( 'should navigate to the preheats page and task page' , ( ) => {
46- cy . get ( '.MuiList-root > :nth-child(3) > .MuiButtonBase-root ' ) . click ( ) ;
47- cy . get ( '[href="/jobs/ preheats"] ' ) . click ( ) ;
50+ cy . get ( '#jobs ' ) . click ( ) ;
51+ cy . get ( '# preheats' ) . click ( ) ;
4852
4953 // Then I see that the current page is the preheats!
5054 cy . url ( ) . should ( 'include' , '/jobs/preheats' ) ;
5155
5256 // The selected menu is preheats.
53- cy . get ( '[href="/jobs/ preheats"] ' ) . should ( 'have.class' , 'Mui-selected' ) ;
57+ cy . get ( '# preheats' ) . should ( 'have.class' , 'Mui-selected' ) ;
5458
55- cy . get ( '[href="/jobs/ task/clear"] ' ) . click ( ) ;
59+ cy . get ( '# task' ) . click ( ) ;
5660
5761 // Then I see that the current page is the task!
5862 cy . url ( ) . should ( 'include' , '/jobs/task/clear' ) ;
5963
60- cy . get ( '[href="/jobs/ task/clear"] ' ) . should ( 'have.class' , 'Mui-selected' ) ;
64+ cy . get ( '# task' ) . should ( 'have.class' , 'Mui-selected' ) ;
6165 } ) ;
6266 } ) ;
6367
@@ -114,46 +118,42 @@ describe('Menu', () => {
114118 } ) ;
115119
116120 it ( 'should navigate to the tokens page' , ( ) => {
117- cy . get ( '.MuiList-root > :nth-child(2) > .MuiButtonBase-root ' ) . click ( ) ;
118- cy . get ( '.MuiCollapse-wrapperInner > .MuiList-root > .MuiButtonBase-root ' ) . click ( ) ;
121+ cy . get ( '#developer ' ) . click ( ) ;
122+ cy . get ( '#personal-access-tokens ' ) . click ( ) ;
119123
120124 // Then I see that the current page is the tokens!
121125 cy . url ( ) . should ( 'include' , '/developer/personal-access-tokens' ) ;
122126
123127 // The selected menu is tokens.
124- cy . get ( '.MuiCollapse-wrapperInner > .MuiList-root > .MuiButtonBase-root ' ) . should ( 'have.class' , 'Mui-selected' ) ;
128+ cy . get ( '#personal-access-tokens ' ) . should ( 'have.class' , 'Mui-selected' ) ;
125129 } ) ;
126130
127131 it ( 'should navigate to the preheats page and task page' , ( ) => {
128- cy . get ( '.MuiList-root > :nth-child(3) > .MuiButtonBase-root' ) . click ( ) ;
129- cy . get ( '[href="/jobs/preheats"]' ) . click ( ) ;
130-
131- // Show page loading.
132- cy . get ( '#page-loading' ) . should ( 'be.visible' ) ;
132+ cy . get ( '#jobs' ) . click ( ) ;
133+ cy . get ( '#preheats' ) . click ( ) ;
133134
134135 // Then I see that the current page is the preheats!
135136 cy . url ( ) . should ( 'include' , '/jobs/preheats' ) ;
136137
137138 // The selected menu is preheats.
138- cy . get ( '[href="/jobs/ preheats"] ' ) . should ( 'have.class' , 'Mui-selected' ) ;
139+ cy . get ( '# preheats' ) . should ( 'have.class' , 'Mui-selected' ) ;
139140
140- cy . get ( '[href="/jobs/ task/clear"] ' ) . click ( ) ;
141+ cy . get ( '# task' ) . click ( ) ;
141142
142143 // Then I see that the current page is the task!
143144 cy . url ( ) . should ( 'include' , '/jobs/task/clear' ) ;
144145
145- // The selected menu is task.
146- cy . get ( '[href="/jobs/task/clear"]' ) . should ( 'have.class' , 'Mui-selected' ) ;
146+ cy . get ( '#task' ) . should ( 'have.class' , 'Mui-selected' ) ;
147147 } ) ;
148148
149149 it ( 'should navigate to the users page' , ( ) => {
150- cy . get ( '[href="/ users"] ' ) . click ( ) ;
150+ cy . get ( '# users' ) . click ( ) ;
151151
152152 // Then I see that the current page is the users!
153153 cy . url ( ) . should ( 'include' , '/users' ) ;
154154
155155 // The selected menu is users.
156- cy . get ( '[href="/ users"] ' ) . should ( 'have.class' , 'Mui-selected' ) ;
156+ cy . get ( '# users' ) . should ( 'have.class' , 'Mui-selected' ) ;
157157 } ) ;
158158
159159 it ( 'should navigate to the profile page' , ( ) => {
@@ -167,6 +167,42 @@ describe('Menu', () => {
167167 cy . url ( ) . should ( 'include' , '/profile' ) ;
168168 } ) ;
169169
170+ it ( 'The menu should be smaller' , ( ) => {
171+ // The menu should be smaller.
172+ cy . get ( '#closure' ) . should ( 'exist' ) . click ( ) ;
173+ cy . get ( '#expand' ) . should ( 'exist' ) ;
174+ cy . get ( '#closure' ) . should ( 'not.exist' ) ;
175+
176+ // Go to tokens page.
177+ cy . get ( '#developer' ) . click ( ) ;
178+
179+ cy . get ( '#personal-access-tokens' ) . click ( ) ;
180+
181+ // Then I see that the current page is the tokens!
182+ cy . url ( ) . should ( 'include' , '/developer/personal-access-tokens' ) ;
183+
184+ // Go to jobs page.
185+ cy . get ( '#jobs' ) . click ( ) ;
186+ cy . get ( '#preheats' ) . click ( ) ;
187+
188+ // Then I see that the current page is the preheats!
189+ cy . url ( ) . should ( 'include' , '/jobs/preheats' ) ;
190+
191+ // Go to task page.
192+ cy . get ( '#jobs' ) . click ( ) ;
193+ cy . get ( '#task' ) . click ( ) ;
194+
195+ // Then I see that the current page is the task!
196+ cy . url ( ) . should ( 'include' , '/jobs/task/clear' ) ;
197+
198+ // Go to user page.
199+
200+ cy . get ( '#users' ) . click ( ) ;
201+
202+ // Then I see that the current page is the users!
203+ cy . url ( ) . should ( 'include' , '/users' ) ;
204+ } ) ;
205+
170206 it ( 'can logout' , ( ) => {
171207 cy . intercept (
172208 {
@@ -217,5 +253,9 @@ describe('Menu', () => {
217253 cy . get ( '.MuiAlert-action > .MuiButtonBase-root' ) . click ( ) ;
218254 cy . get ( '.MuiAlert-message' ) . should ( 'not.exist' ) ;
219255 } ) ;
256+
257+ it ( 'should jump to GitHub' , ( ) => {
258+ cy . get ( '#github' ) . should ( 'have.attr' , 'href' ) . and ( 'include' , 'https://github.com/dragonflyoss/dragonfly' ) ;
259+ } ) ;
220260 } ) ;
221261} ) ;
0 commit comments