@@ -19,12 +19,8 @@ describe('Validate intercept command', () => {
19
19
} ) ;
20
20
21
21
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' ) ;
28
24
// second api with alias 'treeSelectApi'(Tree select api wait is handled from selectAccordionItem with alias 'treeSelectApi')
29
25
cy . selectAccordionItem ( [ / ^ M a n a g e I Q R e g i o n : / , / ^ Z o n e : / ] ) ;
30
26
// verifies that both the aliases are set and the request is intercepted & awaited
@@ -37,31 +33,21 @@ describe('Validate intercept command', () => {
37
33
} ) ;
38
34
39
35
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 ) ;
49
40
} ) ;
50
41
// second api with alias 'treeSelectApi'(Tree select api wait is handled from selectAccordionItem with alias 'treeSelectApi')
51
42
cy . selectAccordionItem ( [ / ^ M a n a g e I Q R e g i o n : / , / ^ Z o n e : / ] ) ;
52
43
cy . getInterceptedApiAliases ( ) . then ( ( interceptedAliasesObject ) => {
53
44
expect ( Object . keys ( interceptedAliasesObject ) . length ) . to . equal ( 2 ) ;
54
45
} ) ;
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 ) ;
65
51
} ) ;
66
52
} ) ;
67
53
} ) ;
0 commit comments