@@ -3,62 +3,81 @@ import homePage from '../../pages/home';
3
3
describe ( 'Homepage stats' , ( ) => {
4
4
beforeEach ( ( ) => {
5
5
cy . server ( ) ;
6
- cy . route ( 'POST' , '/api/2.0/dojos/users' , [ { userTypes : [ 'champion' ] } ] ) . as ( 'userDojos' ) ;
6
+ cy . route ( 'POST' , '/api/2.0/dojos/users' , [ { userTypes : [ 'champion' ] } ] ) . as (
7
+ 'userDojos' ,
8
+ ) ;
9
+ cy . route (
10
+ 'POST' ,
11
+ '/api/2.0/profiles/user-profile-data' ,
12
+ 'fx:profiles/parent1' ,
13
+ ) . as ( 'userProfile' ) ;
7
14
} ) ;
8
15
9
16
it ( 'should show a message pushing champions to use Zen when no stats is available' , ( ) => {
10
17
cy . route ( '/api/2.0/users/instance' , 'fx:parentLoggedIn' ) . as ( 'loggedIn' ) ;
11
- cy . route ( 'POST' , '/api/2.0/dojos/load-dojo-users' , { response : [ ] } ) . as ( 'dojoUsers' ) ;
12
- cy . route ( 'POST' , '/api/2.0/events/applications/search' , [ ] ) . as ( 'bookedChildren' ) ;
18
+ cy . route ( 'POST' , '/api/2.0/dojos/load-dojo-users' , { response : [ ] } ) . as (
19
+ 'dojoUsers' ,
20
+ ) ;
21
+ cy . route ( 'POST' , '/api/2.0/events/applications/search' , [ ] ) . as (
22
+ 'bookedChildren' ,
23
+ ) ;
13
24
cy . visit ( '/home' ) ;
14
25
cy . wait ( '@loggedIn' ) ;
15
26
cy . wait ( '@userDojos' ) ;
16
27
cy . wait ( '@bookedChildren' ) ;
17
28
cy . wait ( '@dojoUsers' ) ;
18
- cy . wait ( '@dojoUsers' ) ;
19
- cy . get ( homePage . statsUseZenMessage ) . invoke ( 'text' ) . should ( 'eq' , "No statistics are available at the moment.\n The more Zen is used, the more you\'ll find out about your Dojo!" ) ;
29
+ cy . get ( homePage . statsUseZenMessage )
30
+ . invoke ( 'text' )
31
+ . should (
32
+ 'eq' ,
33
+ "No statistics are available at the moment.\n The more Zen is used, the more you'll find out about your Dojo!" ,
34
+ ) ;
20
35
} ) ;
21
36
describe ( 'Youth' , ( ) => {
22
37
it ( 'should show the stats for the number of children booked' , ( ) => {
23
38
cy . route ( '/api/2.0/users/instance' , 'fx:parentLoggedIn' ) . as ( 'loggedIn' ) ;
24
- cy . route ( 'POST' , '/api/2.0/dojos/load-dojo-users' , { response : [
25
- { gender : 'Female' } ,
26
- { gender : 'Male' } ,
27
- { gender : 'Male' }
28
- ] } ) . as ( 'dojoUsers' ) ;
29
- cy . route ( 'POST' , '/api/2.0/events/applications/search' , [ { userId : 'kid1' } ] ) . as ( 'bookedChildren' ) ; ;
39
+ cy . route ( 'POST' , '/api/2.0/dojos/load-dojo-users' , {
40
+ response : [ { gender : 'Female' } , { gender : 'Male' } , { gender : 'Male' } ] ,
41
+ } ) . as ( 'dojoUsers' ) ;
42
+ cy . route ( 'POST' , '/api/2.0/events/applications/search' , [
43
+ { userId : 'kid1' } ,
44
+ ] ) . as ( 'bookedChildren' ) ;
30
45
cy . visit ( '/home' ) ;
31
46
cy . wait ( '@loggedIn' ) ;
32
47
cy . wait ( '@bookedChildren' ) ;
33
48
cy . wait ( '@userDojos' ) ;
34
49
cy . wait ( '@dojoUsers' ) ;
35
50
cy . wait ( '@dojoUsers' ) ;
36
- cy . get ( homePage . statsNbYouthChart ) . invoke ( 'text' ) . should ( 'eq' , '1 ninjas attended your events' ) ;
51
+ cy . get ( homePage . statsNbYouthChart )
52
+ . invoke ( 'text' )
53
+ . should ( 'eq' , '1 ninjas attended your events' ) ;
37
54
} ) ;
38
55
it ( 'should show the stats chart of youth gender' , ( ) => {
39
56
cy . route ( '/api/2.0/users/instance' , 'fx:parentLoggedIn' ) . as ( 'loggedIn' ) ;
40
- cy . route ( 'POST' , '/api/2.0/events/applications/search' , [ { userId : 'kid1' } ] ) . as ( 'bookedChildren' ) ; ;
41
- cy . route ( 'POST' , '/api/2.0/dojos/load-dojo-users' , { response : [
42
- { gender : 'Female' } ,
43
- { gender : 'Male' } ,
44
- { gender : 'Male' }
45
- ] } ) . as ( 'dojoUsers' ) ;
57
+ cy . route ( 'POST' , '/api/2.0/events/applications/search' , [
58
+ { userId : 'kid1' } ,
59
+ ] ) . as ( 'bookedChildren' ) ;
60
+ cy . route ( 'POST' , '/api/2.0/dojos/load-dojo-users' , {
61
+ response : [ { gender : 'Female' } , { gender : ' Male' } , { gender : 'Male' } ] ,
62
+ } ) . as ( 'dojoUsers' ) ;
46
63
cy . visit ( '/home' ) ;
47
64
cy . wait ( '@loggedIn' ) ;
48
65
cy . wait ( '@bookedChildren' ) ;
49
66
cy . wait ( '@userDojos' ) ;
50
67
cy . wait ( '@dojoUsers' ) ;
51
68
cy . wait ( '@dojoUsers' ) ;
52
- cy . get ( homePage . statsYouthGenderChart ) . find ( 'svg' ) . should ( 'be.visible' ) ;
69
+ cy . get ( homePage . statsYouthGenderChart )
70
+ . find ( 'svg' )
71
+ . should ( 'be.visible' ) ;
53
72
} ) ;
54
73
it ( 'should not display the hint for girls message when the girls ratio > 30%' , ( ) => {
55
74
cy . route ( '/api/2.0/users/instance' , 'fx:parentLoggedIn' ) . as ( 'loggedIn' ) ;
56
- cy . route ( 'POST' , '/api/2.0/events/applications/search' , [ { userId : 'kid1' } ] ) . as ( 'bookedChildren' ) ; ;
57
- cy . route ( 'POST' , '/api/2.0/dojos/load-dojo-users' , { response : [
58
- { gender : 'Female' } ,
59
- { gender : 'Male' } ,
60
- { gender : 'Male' }
61
- ] } ) . as ( 'dojoUsers' ) ;
75
+ cy . route ( 'POST' , '/api/2.0/events/applications/search' , [
76
+ { userId : 'kid1' } ,
77
+ ] ) . as ( 'bookedChildren' ) ;
78
+ cy . route ( 'POST' , '/api/2.0/dojos/load-dojo-users' , {
79
+ response : [ { gender : 'Female' } , { gender : ' Male' } , { gender : 'Male' } ] ,
80
+ } ) . as ( 'dojoUsers' ) ;
62
81
cy . visit ( '/home' ) ;
63
82
cy . wait ( '@loggedIn' ) ;
64
83
cy . wait ( '@bookedChildren' ) ;
@@ -69,20 +88,26 @@ describe('Homepage stats', () => {
69
88
} ) ;
70
89
it ( 'should display the hint for girls message when the girls ratio < 30%' , ( ) => {
71
90
cy . route ( '/api/2.0/users/instance' , 'fx:parentLoggedIn' ) . as ( 'loggedIn' ) ;
72
- cy . route ( 'POST' , '/api/2.0/events/applications/search' , [ { userId : 'kid1' } ] ) . as ( 'bookedChildren' ) ; ;
73
- cy . route ( 'POST' , '/api/2.0/dojos/load-dojo-users' , { response : [
74
- { gender : 'Female' } ,
75
- { gender : 'Male' } ,
76
- { gender : 'Male' } ,
77
- { gender : 'Male' } ,
78
- ] } ) . as ( 'dojoUsers' ) ;
91
+ cy . route ( 'POST' , '/api/2.0/events/applications/search' , [
92
+ { userId : 'kid1' } ,
93
+ ] ) . as ( 'bookedChildren' ) ;
94
+ cy . route ( 'POST' , '/api/2.0/dojos/load-dojo-users' , {
95
+ response : [
96
+ { gender : 'Female' } ,
97
+ { gender : 'Male' } ,
98
+ { gender : 'Male' } ,
99
+ { gender : 'Male' } ,
100
+ ] ,
101
+ } ) . as ( 'dojoUsers' ) ;
79
102
cy . visit ( '/home' ) ;
80
103
cy . wait ( '@loggedIn' ) ;
81
104
cy . wait ( '@bookedChildren' ) ;
82
105
cy . wait ( '@userDojos' ) ;
83
106
cy . wait ( '@dojoUsers' ) ;
84
107
cy . wait ( '@dojoUsers' ) ;
85
- cy . get ( homePage . statsYouthGirlsHint ) . invoke ( 'text' ) . should ( 'eq' , 'More information about girls in Dojos' ) ;
108
+ cy . get ( homePage . statsYouthGirlsHint )
109
+ . invoke ( 'text' )
110
+ . should ( 'eq' , 'More information about girls in Dojos' ) ;
86
111
} ) ;
87
112
} ) ;
88
113
} ) ;
0 commit comments