11describe ( 'Menu' , ( ) => {
2- beforeEach ( ( ) => {
3- cy . visit ( 'e2e/standalone.html' ) ;
4- } ) ;
2+ describe ( '3.0 spec' , ( ) => {
3+ beforeEach ( ( ) => {
4+ cy . visit ( 'e2e/standalone.html' ) ;
5+ } ) ;
6+ it ( 'should have valid items count' , ( ) => {
7+ cy . get ( '.menu-content' ) . find ( 'li' ) . should ( 'have.length' , 35 ) ;
8+ } ) ;
59
6- it ( 'should have valid items count' , ( ) => {
7- cy . get ( '.menu-content' ) . find ( 'li' ) . should ( 'have.length' , 34 ) ;
8- } ) ;
10+ it ( 'should sync active menu items while scroll' , ( ) => {
11+ cy . contains ( 'h1' , 'Introduction' )
12+ . scrollIntoView ( )
13+ . get ( '[role=menuitem] > label.active' )
14+ . should ( 'have.text' , 'Introduction' ) ;
915
10- it ( 'should sync active menu items while scroll' , ( ) => {
11- cy . contains ( 'h1' , 'Introduction' )
12- . scrollIntoView ( )
13- . get ( '[role=menuitem].active' )
14- . should ( 'have.text' , 'Introduction' ) ;
16+ cy . contains ( 'h2' , 'Add a new pet to the store' )
17+ . scrollIntoView ( )
18+ . wait ( 100 )
19+ . get ( '[role=menuitem] > label.active' )
20+ . children ( )
21+ . last ( )
22+ . should ( 'have.text' , 'Add a new pet to the store' )
23+ . should ( 'be.visible' ) ;
24+ } ) ;
1525
16- cy . contains ( 'h2' , 'Add a new pet to the store' )
17- . scrollIntoView ( )
18- . wait ( 100 )
19- . get ( '[role=menuitem].active' )
20- . children ( )
21- . last ( )
22- . should ( 'have.text' , 'Add a new pet to the store' )
23- . should ( 'be.visible' ) ;
24- } ) ;
26+ it ( 'should sync active menu items while scroll back and scroll again' , ( ) => {
27+ cy . contains ( 'h2' , 'Add a new pet to the store' )
28+ . scrollIntoView ( )
29+ . wait ( 100 )
30+ . get ( '[role=menuitem] > label.active' )
31+ . children ( )
32+ . last ( )
33+ . should ( 'have.text' , 'Add a new pet to the store' )
34+ . should ( 'be.visible' ) ;
2535
26- it ( 'should sync active menu items while scroll back and scroll again' , ( ) => {
27- cy . contains ( 'h2' , 'Add a new pet to the store' )
28- . scrollIntoView ( )
29- . wait ( 100 )
30- . get ( '[role=menuitem].active' )
31- . children ( )
32- . last ( )
33- . should ( 'have.text' , 'Add a new pet to the store' )
34- . should ( 'be.visible' ) ;
36+ cy . contains ( 'h1' , 'Swagger Petstore' ) . scrollIntoView ( ) . wait ( 100 ) ;
3537
36- cy . contains ( 'h1' , 'Swagger Petstore' ) . scrollIntoView ( ) . wait ( 100 ) ;
38+ cy . contains ( 'h1' , 'Introduction' )
39+ . scrollIntoView ( )
40+ . wait ( 100 )
41+ . get ( '[role=menuitem] > label.active' )
42+ . should ( 'have.text' , 'Introduction' ) ;
3743
38- cy . contains ( 'h1' , 'Introduction' )
39- . scrollIntoView ( )
40- . wait ( 100 )
41- . get ( '[role=menuitem].active' )
42- . should ( 'have.text' , 'Introduction' ) ;
44+ cy . url ( ) . should ( 'include' , '#section/Introduction' ) ;
45+ } ) ;
4346
44- cy . url ( ) . should ( 'include' , '#section/Introduction' ) ;
45- } ) ;
47+ it ( 'should update URL hash when clicking on menu items' , ( ) => {
48+ cy . contains ( '[role=menuitem] > label.-depth1' , 'pet' ) . click ( { force : true } ) ;
49+ cy . get ( 'li[data-item-id="schema/Cat"]' )
50+ . should ( 'have.text' , 'schemaCat' )
51+ . click ( { force : true } ) ;
52+ cy . location ( 'hash' ) . should ( 'equal' , '#schema/Cat' ) ;
53+ } ) ;
4654
47- it ( 'should update URL hash when clicking on menu items ' , ( ) => {
48- cy . contains ( '[role=menuitem].-depth1' , 'pet' ) . click ( { force : true } ) ;
49- cy . location ( 'hash' ) . should ( 'equal' , '#tag/pet' ) ;
55+ it ( 'should contains Cat schema in Pet using x-tags ' , ( ) => {
56+ cy . contains ( '[role=menuitem] > label .-depth1' , 'pet' ) . click ( { force : true } ) ;
57+ cy . location ( 'hash' ) . should ( 'equal' , '#tag/pet' ) ;
5058
51- cy . contains ( '[role=menuitem]' , 'Find pet by ID' ) . click ( { force : true } ) ;
52- cy . location ( 'hash' ) . should ( 'equal' , '#tag/pet/operation/getPetById' ) ;
53- } ) ;
59+ cy . contains ( '[role=menuitem]' , 'Find pet by ID' ) . click ( { force : true } ) ;
60+ cy . location ( 'hash' ) . should ( 'equal' , '#tag/pet/operation/getPetById' ) ;
61+ } ) ;
5462
55- it ( 'should deactivate tag when other is activated' , ( ) => {
56- const petItem = ( ) => cy . contains ( '[role=menuitem].-depth1' , 'pet' ) ;
63+ it ( 'should deactivate tag when other is activated' , ( ) => {
64+ const petItem = ( ) => cy . contains ( '[role=menuitem] > label .-depth1' , 'pet' ) ;
5765
58- petItem ( ) . click ( { force : true } ) . should ( 'have.class' , 'active' ) ;
59- cy . contains ( '[role=menuitem].-depth1' , 'store' ) . click ( { force : true } ) ;
60- petItem ( ) . should ( 'not.have.class' , 'active' ) ;
61- } ) ;
66+ petItem ( ) . click ( { force : true } ) . should ( 'have.class' , 'active' ) ;
67+ cy . contains ( '[role=menuitem] > label .-depth1' , 'store' ) . click ( { force : true } ) ;
68+ petItem ( ) . should ( 'not.have.class' , 'active' ) ;
69+ } ) ;
6270
63- it ( 'should be able to open a response object to see more details' , ( ) => {
64- cy . contains ( 'h2' , 'Find pet by ID' )
65- . scrollIntoView ( )
66- . wait ( 100 )
67- . parent ( )
68- . find ( 'div h3' )
69- . should ( 'have.text' , 'Responses' )
70- . parent ( )
71- . find ( 'div:first button' )
72- . click ( )
73- . should ( 'have.attr' , 'aria-expanded' , 'true' )
74- . parent ( )
75- . find ( 'div h5' )
76- . then ( $h5 => $h5 [ 0 ] . firstChild ! . nodeValue ! . trim ( ) )
77- . should ( 'eq' , 'Response Schema:' ) ;
71+ it ( 'should be able to open a response object to see more details' , ( ) => {
72+ cy . contains ( 'h2' , 'Find pet by ID' )
73+ . scrollIntoView ( )
74+ . wait ( 100 )
75+ . parent ( )
76+ . find ( 'div h3' )
77+ . should ( 'have.text' , 'Responses' )
78+ . parent ( )
79+ . find ( 'div:first button' )
80+ . click ( )
81+ . should ( 'have.attr' , 'aria-expanded' , 'true' )
82+ . parent ( )
83+ . find ( 'div h5' )
84+ . then ( $h5 => $h5 [ 0 ] . firstChild ! . nodeValue ! . trim ( ) )
85+ . should ( 'eq' , 'Response Schema:' ) ;
86+ } ) ;
7887 } ) ;
7988
8089 it ( 'should be able to open the operation details when the operation IDs have quotes' , ( ) => {
@@ -85,7 +94,7 @@ describe('Menu', () => {
8594 cy . url ( ) . should ( 'include' , 'deletePetBy%22Id' ) ;
8695 } ) ;
8796
88- it . only ( 'should encode URL when the operation IDs have backslashes' , ( ) => {
97+ it ( 'should encode URL when the operation IDs have backslashes' , ( ) => {
8998 cy . visit ( 'e2e/standalone-3-1.html' ) ;
9099 cy . get ( 'label span[title="pet"]' ) . click ( { multiple : true , force : true } ) ;
91100 cy . get ( 'li' ) . contains ( 'OperationId with backslash' ) . click ( { multiple : true , force : true } ) ;
0 commit comments