@@ -19,12 +19,8 @@ describe('Validate intercept command', () => {
1919 } ) ;
2020
2121 it ( 'Should register multiple unique aliases' , ( ) => {
22- // first api with alias 'accordionSelectApi'
23- cy . interceptApi ( {
24- alias : 'accordionSelectApi' ,
25- urlPattern : / \/ o p s \/ a c c o r d i o n _ s e l e c t \? i d = .* / ,
26- triggerFn : ( ) => cy . accordion ( 'Diagnostics' ) ,
27- } ) ;
22+ // first api with alias 'accordionSelectApi'(Accordion select api wait is handled from cy.accordion command with alias 'accordionSelectApi')
23+ cy . accordion ( 'Diagnostics' ) ;
2824 // second api with alias 'treeSelectApi'(Tree select api wait is handled from selectAccordionItem with alias 'treeSelectApi')
2925 cy . selectAccordionItem ( [ / ^ M a n a g e I Q R e g i o n : / , / ^ Z o n e : / ] ) ;
3026 // verifies that both the aliases are set and the request is intercepted & awaited
@@ -37,31 +33,21 @@ describe('Validate intercept command', () => {
3733 } ) ;
3834
3935 it ( 'Should not register duplicate alias' , ( ) => {
40- // add first api with alias 'accordionSelectApi'
41- cy . interceptApi ( {
42- alias : 'accordionSelectApi' ,
43- urlPattern : / \/ o p s \/ a c c o r d i o n _ s e l e c t \? i d = .* / ,
44- triggerFn : ( ) => cy . accordion ( 'Diagnostics' ) ,
45- } ) . then ( ( ) => {
46- cy . getInterceptedApiAliases ( ) . then ( ( interceptedAliasesObject ) => {
47- expect ( Object . keys ( interceptedAliasesObject ) . length ) . to . equal ( 1 ) ;
48- } ) ;
36+ // first api with alias 'accordionSelectApi'(Accordion select api wait is handled from cy.accordion command with alias 'accordionSelectApi')
37+ cy . accordion ( 'Diagnostics' ) ;
38+ cy . getInterceptedApiAliases ( ) . then ( ( interceptedAliasesObject ) => {
39+ expect ( Object . keys ( interceptedAliasesObject ) . length ) . to . equal ( 1 ) ;
4940 } ) ;
5041 // second api with alias 'treeSelectApi'(Tree select api wait is handled from selectAccordionItem with alias 'treeSelectApi')
5142 cy . selectAccordionItem ( [ / ^ M a n a g e I Q R e g i o n : / , / ^ Z o n e : / ] ) ;
5243 cy . getInterceptedApiAliases ( ) . then ( ( interceptedAliasesObject ) => {
5344 expect ( Object . keys ( interceptedAliasesObject ) . length ) . to . equal ( 2 ) ;
5445 } ) ;
55- // third api with a duplicate alias as above 'accordionSelectApi'
56- cy . interceptApi ( {
57- alias : 'accordionSelectApi' ,
58- urlPattern : / \/ o p s \/ a c c o r d i o n _ s e l e c t \? i d = .* / ,
59- triggerFn : ( ) => cy . accordion ( 'Access Control' ) ,
60- } ) . then ( ( ) => {
61- // assert that the alias is not overwritten
62- cy . getInterceptedApiAliases ( ) . then ( ( interceptedAliasesObject ) => {
63- expect ( Object . keys ( interceptedAliasesObject ) . length ) . to . equal ( 2 ) ;
64- } ) ;
46+ // third api with a duplicate alias as above 'accordionSelectApi'(Accordion select api wait is handled from cy.accordion command with alias 'accordionSelectApi')
47+ cy . accordion ( 'Access Control' ) ;
48+ // assert that the alias is not overwritten
49+ cy . getInterceptedApiAliases ( ) . then ( ( interceptedAliasesObject ) => {
50+ expect ( Object . keys ( interceptedAliasesObject ) . length ) . to . equal ( 2 ) ;
6551 } ) ;
6652 } ) ;
6753} ) ;
0 commit comments