@@ -6,17 +6,17 @@ var page = null;
66
77describe ( 'Babitch : Choose player' , function ( ) {
88
9- beforeEach ( function ( ) {
10- page = new BabitchGamePage ( browser ) ;
11- } ) ;
9+ beforeEach ( function ( ) {
10+ page = new BabitchGamePage ( browser ) ;
11+ } ) ;
1212
13- it ( 'should not display startButton' , function ( ) {
14- expect ( page . startButton . isDisplayed ( ) ) . toBe ( false ) ;
15- } ) ;
13+ it ( 'should not display startButton' , function ( ) {
14+ expect ( page . startButton . isDisplayed ( ) ) . toBe ( false ) ;
15+ } ) ;
1616
17- it ( 'should have 4 selectable players' , function ( ) {
18- expect ( page . playersLocation . count ( ) ) . toBe ( 4 ) ;
19- } ) ;
17+ it ( 'should have 4 selectable players' , function ( ) {
18+ expect ( page . playersLocation . count ( ) ) . toBe ( 4 ) ;
19+ } ) ;
2020
2121 it ( 'should not display startButton without less than 4 selected players' , function ( ) {
2222 var playerLocation = page . getPlayerLocation ( 0 ) ;
@@ -29,174 +29,173 @@ describe('Babitch : Choose player', function() {
2929 var playerLocation1 = page . getPlayerLocation ( 0 ) ;
3030 playerLocation1 . selectPlayer ( 0 ) ;
3131 expect ( playerLocation1 . getPlayerName ( ) ) . toBe ( 'Adrien' ) ;
32+
33+ var playerLocation2 = page . getPlayerLocation ( 1 ) ;
34+ playerLocation2 . selectPlayer ( 1 ) ;
35+ expect ( playerLocation2 . getPlayerName ( ) ) . toBe ( 'Antony' ) ;
36+
37+ var playerLocation3 = page . getPlayerLocation ( 2 ) ;
38+ playerLocation3 . selectPlayer ( 2 ) ;
39+ expect ( playerLocation3 . getPlayerName ( ) ) . toBe ( 'Aurelian' ) ;
40+
41+ playerLocation3 = page . getPlayerLocation ( 3 ) ;
42+ playerLocation3 . selectPlayer ( 3 ) ;
43+ expect ( playerLocation3 . getPlayerName ( ) ) . toBe ( 'Benjamin' ) ;
44+
45+ expect ( page . startButton . isDisplayed ( ) ) . toBe ( true ) ;
46+
47+ //Ugly $timeout e2e issue here :/
48+ page . startButton . click ( ) ;
49+
50+ expect ( page . score . isDisplayed ( ) ) . toBe ( true ) ;
51+
52+ // et de 0-0
53+ expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
54+ expect ( page . secondTeamScore . getText ( ) ) . toBe ( '0' ) ;
55+ } ) ;
56+ } ) ;
3257
33- var playerLocation2 = page . getPlayerLocation ( 1 ) ;
34- playerLocation2 . selectPlayer ( 1 ) ;
35- expect ( playerLocation2 . getPlayerName ( ) ) . toBe ( 'Antony' ) ;
36-
37- var playerLocation3 = page . getPlayerLocation ( 2 ) ;
38- playerLocation3 . selectPlayer ( 2 ) ;
39- expect ( playerLocation3 . getPlayerName ( ) ) . toBe ( 'Aurelian' ) ;
40-
41- var playerLocation3 = page . getPlayerLocation ( 3 ) ;
42- playerLocation3 . selectPlayer ( 3 ) ;
43- expect ( playerLocation3 . getPlayerName ( ) ) . toBe ( 'Benjamin' ) ;
44-
45-
46- expect ( page . startButton . isDisplayed ( ) ) . toBe ( true ) ;
58+ describe ( 'Babitch : Game' , function ( ) {
59+ beforeEach ( function ( ) {
60+ page = new BabitchGamePage ( browser ) ;
4761
48- //Ugly $timeout e2e issue here :/
49- page . startButton . click ( ) ;
62+ //Choose 4 players
63+ var playerLocation1 = page . getPlayerLocation ( 0 ) ;
64+ playerLocation1 . selectPlayer ( 0 ) ;
65+ expect ( playerLocation1 . getPlayerName ( ) ) . toBe ( 'Adrien' ) ;
5066
51- expect ( page . score . isDisplayed ( ) ) . toBe ( true ) ;
67+ var playerLocation2 = page . getPlayerLocation ( 1 ) ;
68+ playerLocation2 . selectPlayer ( 1 ) ;
69+ expect ( playerLocation2 . getPlayerName ( ) ) . toBe ( 'Antony' ) ;
5270
53- // et de 0-0
54- expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
55- expect ( page . secondTeamScore . getText ( ) ) . toBe ( '0' ) ;
56- } ) ;
57- } ) ;
71+ var playerLocation3 = page . getPlayerLocation ( 2 ) ;
72+ playerLocation3 . selectPlayer ( 2 ) ;
73+ expect ( playerLocation3 . getPlayerName ( ) ) . toBe ( 'Aurelian' ) ;
5874
59- describe ( 'Babitch : Game' , function ( ) {
60- beforeEach ( function ( ) {
61- page = new BabitchGamePage ( browser ) ;
75+ playerLocation3 = page . getPlayerLocation ( 3 ) ;
76+ playerLocation3 . selectPlayer ( 3 ) ;
77+ expect ( playerLocation3 . getPlayerName ( ) ) . toBe ( 'Benjamin' ) ;
6278
63- //Choose 4 players
64- var playerLocation1 = page . getPlayerLocation ( 0 ) ;
65- playerLocation1 . selectPlayer ( 0 ) ;
66- expect ( playerLocation1 . getPlayerName ( ) ) . toBe ( 'Adrien' ) ;
79+ //Begin a match
80+ page . startButton . click ( ) ;
6781
68- var playerLocation2 = page . getPlayerLocation ( 1 ) ;
69- playerLocation2 . selectPlayer ( 1 ) ;
70- expect ( playerLocation2 . getPlayerName ( ) ) . toBe ( 'Antony' ) ;
82+ browser . waitForAngular ( ) ;
83+ } , 60000 ) ;
7184
72- var playerLocation3 = page . getPlayerLocation ( 2 ) ;
73- playerLocation3 . selectPlayer ( 2 ) ;
74- expect ( playerLocation3 . getPlayerName ( ) ) . toBe ( 'Aurelian' ) ;
85+ //Defense goal
86+ it ( 'should add a goal for the blue team if the blue defender goal' , function ( ) {
87+ var playerLocation = page . getPlayerLocation ( 3 ) ;
88+ playerLocation . goal ( ) ;
89+ expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
90+ expect ( page . secondTeamScore . getText ( ) ) . toBe ( '1' ) ;
91+ } ) ;
7592
76- var playerLocation3 = page . getPlayerLocation ( 3 ) ;
77- playerLocation3 . selectPlayer ( 3 ) ;
78- expect ( playerLocation3 . getPlayerName ( ) ) . toBe ( 'Benjamin' ) ;
7993
80- //Begin a match
81- page . startButton . click ( ) ;
94+ it ( 'should add a goal for the red team if the red defender goal' , function ( ) {
95+ var playerLocation = page . getPlayerLocation ( 0 ) ;
96+ playerLocation . goal ( ) ;
97+ expect ( page . firstTeamScore . getText ( ) ) . toBe ( '1' ) ;
98+ expect ( page . secondTeamScore . getText ( ) ) . toBe ( '0' ) ;
99+ } ) ;
82100
83- browser . waitForAngular ( ) ;
84- } , 60000 ) ;
101+ //Defense CSC
102+ it ( 'should add a goal for red team if the blue defender goal csc' , function ( ) {
103+ var playerLocation = page . getPlayerLocation ( 3 ) ;
104+ playerLocation . autogoal ( ) ;
105+ expect ( page . firstTeamScore . getText ( ) ) . toBe ( '1' ) ;
106+ expect ( page . secondTeamScore . getText ( ) ) . toBe ( '0' ) ;
107+ } ) ;
85108
86- //Defense goal
87- it ( 'should add a goal for the blue team if the blue defender goal' , function ( ) {
88- var playerLocation = page . getPlayerLocation ( 3 ) ;
89- playerLocation . goal ( ) ;
90- expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
91- expect ( page . secondTeamScore . getText ( ) ) . toBe ( '1' ) ;
92- } ) ;
109+ it ( 'should add a goal for blue team if the red defender goal csc' , function ( ) {
110+ var playerLocation = page . getPlayerLocation ( 1 ) ;
111+ playerLocation . autogoal ( ) ;
112+ expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
113+ expect ( page . secondTeamScore . getText ( ) ) . toBe ( '1' ) ;
114+ } ) ;
93115
116+ //Attack Goal
117+ it ( 'should add a goal for the blue team if the blue attacker goal' , function ( ) {
118+ var playerLocation = page . getPlayerLocation ( 2 ) ;
119+ playerLocation . goal ( ) ;
120+ expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
121+ expect ( page . secondTeamScore . getText ( ) ) . toBe ( '1' ) ;
122+ } ) ;
94123
95- it ( 'should add a goal for the red team if the red defender goal' , function ( ) {
124+ it ( 'should add a goal for the red team if the red attacker goal' , function ( ) {
96125 var playerLocation = page . getPlayerLocation ( 0 ) ;
97126 playerLocation . goal ( ) ;
98127 expect ( page . firstTeamScore . getText ( ) ) . toBe ( '1' ) ;
99128 expect ( page . secondTeamScore . getText ( ) ) . toBe ( '0' ) ;
100129 } ) ;
101130
102- //Defense CSC
103- it ( 'should add a goal for red team if the blue defender goal csc' , function ( ) {
104- var playerLocation = page . getPlayerLocation ( 3 ) ;
105- playerLocation . autogoal ( ) ;
106- expect ( page . firstTeamScore . getText ( ) ) . toBe ( '1' ) ;
107- expect ( page . secondTeamScore . getText ( ) ) . toBe ( '0' ) ;
108- } ) ;
109-
110- it ( 'should add a goal for blue team if the red defender goal csc' , function ( ) {
111- var playerLocation = page . getPlayerLocation ( 1 ) ;
112- playerLocation . autogoal ( ) ;
113- expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
114- expect ( page . secondTeamScore . getText ( ) ) . toBe ( '1' ) ;
115- } ) ;
116-
117- //Attack Goal
118- it ( 'should add a goal for the blue team if the blue attacker goal' , function ( ) {
119- var playerLocation = page . getPlayerLocation ( 2 ) ;
120- playerLocation . goal ( ) ;
121- expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
122- expect ( page . secondTeamScore . getText ( ) ) . toBe ( '1' ) ;
123- } ) ;
124-
125- it ( 'should add a goal for the red team if the red attacker goal' , function ( ) {
126- var playerLocation = page . getPlayerLocation ( 0 ) ;
127- playerLocation . goal ( ) ;
128- expect ( page . firstTeamScore . getText ( ) ) . toBe ( '1' ) ;
129- expect ( page . secondTeamScore . getText ( ) ) . toBe ( '0' ) ;
130- } ) ;
131-
132- //Attack CSC
133- it ( 'should add a goal for red team if the blue attacker goal csc' , function ( ) {
134- var playerLocation = page . getPlayerLocation ( 2 ) ;
135- playerLocation . autogoal ( ) ;
136- expect ( page . firstTeamScore . getText ( ) ) . toBe ( '1' ) ;
137- expect ( page . secondTeamScore . getText ( ) ) . toBe ( '0' ) ;
138- } ) ;
139-
140- it ( 'should add a goal for blue team if the red attacker goal csc' , function ( ) {
141- var playerLocation = page . getPlayerLocation ( 1 ) ;
142- playerLocation . autogoal ( ) ;
143- expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
144- expect ( page . secondTeamScore . getText ( ) ) . toBe ( '1' ) ;
145- } ) ;
146-
147- //Cancel a Goal
148- it ( 'should cancel last goal' , function ( ) {
149- var cancelLastGoalButton = page . getCancelLastGoalButton ( ) ,
150- optionButtion = page . getOptionButton ( ) ;
151-
152- expect ( cancelLastGoalButton . isDisplayed ( ) ) . toBe ( false ) ;
153-
154- var playerLocation = page . getPlayerLocation ( 3 ) ;
155- playerLocation . goal ( ) ;
156- expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
157- expect ( page . secondTeamScore . getText ( ) ) . toBe ( '1' ) ;
158-
159- optionButtion . click ( ) . then ( function ( ) {
160- browser . waitForAngular ( ) ;
161- } ) . then ( function ( ) {
162- //Cancel the goal
163- expect ( cancelLastGoalButton . isDisplayed ( ) ) . toBe ( true ) ;
164- cancelLastGoalButton . click ( ) ;
165-
166- //The button must be hidden
167- expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
168- expect ( page . secondTeamScore . getText ( ) ) . toBe ( '0' ) ;
169- expect ( cancelLastGoalButton . isDisplayed ( ) ) . toBe ( false ) ;
170- } ) ;
171- } ) ;
172-
173- it ( 'should propose to restart or to make a new game' , function ( ) {
174- expect ( page . theEnd . isDisplayed ( ) ) . toBe ( false ) ;
175- var playerLocation = page . getPlayerLocation ( 2 ) ;
176- for ( var i = 0 ; i < 10 ; i ++ ) {
177- playerLocation . goal ( ) ;
178- }
179- expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
180- expect ( page . secondTeamScore . getText ( ) ) . toBe ( '10' ) ;
181- expect ( page . theEnd . isDisplayed ( ) ) . toBe ( true ) ;
182- } , 60000 ) ;
183-
184- it ( 'should start a new game' , function ( ) {
185- var playerLocation = page . getPlayerLocation ( 2 ) ;
186- expect ( page . score . isDisplayed ( ) ) . toBe ( true ) ;
187- for ( var i = 0 ; i < 10 ; i ++ ) {
188- playerLocation . goal ( ) ;
189- }
190- expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
191- expect ( page . secondTeamScore . getText ( ) ) . toBe ( '10' ) ;
192- expect ( page . theEnd . isDisplayed ( ) ) . toBe ( true ) ;
193- page . theEndNewGame . click ( ) ;
194- expect ( page . score . isDisplayed ( ) ) . toBe ( false ) ;
195-
196- //Select adrien again
197- var playerLocation1 = page . getPlayerLocation ( 0 ) ;
198- playerLocation1 . selectPlayer ( 0 ) ;
199- expect ( playerLocation1 . getPlayerName ( ) ) . toBe ( 'Adrien' ) ;
200- } , 60000 ) ;
131+ //Attack CSC
132+ it ( 'should add a goal for red team if the blue attacker goal csc' , function ( ) {
133+ var playerLocation = page . getPlayerLocation ( 2 ) ;
134+ playerLocation . autogoal ( ) ;
135+ expect ( page . firstTeamScore . getText ( ) ) . toBe ( '1' ) ;
136+ expect ( page . secondTeamScore . getText ( ) ) . toBe ( '0' ) ;
137+ } ) ;
138+
139+ it ( 'should add a goal for blue team if the red attacker goal csc' , function ( ) {
140+ var playerLocation = page . getPlayerLocation ( 1 ) ;
141+ playerLocation . autogoal ( ) ;
142+ expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
143+ expect ( page . secondTeamScore . getText ( ) ) . toBe ( '1' ) ;
144+ } ) ;
145+
146+ //Cancel a Goal
147+ it ( 'should cancel last goal' , function ( ) {
148+ var cancelLastGoalButton = page . getCancelLastGoalButton ( ) ,
149+ optionButtion = page . getOptionButton ( ) ;
150+
151+ expect ( cancelLastGoalButton . isDisplayed ( ) ) . toBe ( false ) ;
152+
153+ var playerLocation = page . getPlayerLocation ( 3 ) ;
154+ playerLocation . goal ( ) ;
155+ expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
156+ expect ( page . secondTeamScore . getText ( ) ) . toBe ( '1' ) ;
157+
158+ optionButtion . click ( ) . then ( function ( ) {
159+ browser . waitForAngular ( ) ;
160+ } ) . then ( function ( ) {
161+ //Cancel the goal
162+ expect ( cancelLastGoalButton . isDisplayed ( ) ) . toBe ( true ) ;
163+ cancelLastGoalButton . click ( ) ;
164+
165+ //The button must be hidden
166+ expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
167+ expect ( page . secondTeamScore . getText ( ) ) . toBe ( '0' ) ;
168+ expect ( cancelLastGoalButton . isDisplayed ( ) ) . toBe ( false ) ;
169+ } ) ;
170+ } ) ;
171+
172+ it ( 'should propose to restart or to make a new game' , function ( ) {
173+ expect ( page . theEnd . isDisplayed ( ) ) . toBe ( false ) ;
174+ var playerLocation = page . getPlayerLocation ( 2 ) ;
175+ for ( var i = 0 ; i < 10 ; i ++ ) {
176+ playerLocation . goal ( ) ;
177+ }
178+ expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
179+ expect ( page . secondTeamScore . getText ( ) ) . toBe ( '10' ) ;
180+ expect ( page . theEnd . isDisplayed ( ) ) . toBe ( true ) ;
181+ } , 60000 ) ;
182+
183+ it ( 'should start a new game' , function ( ) {
184+ var playerLocation = page . getPlayerLocation ( 2 ) ;
185+ expect ( page . score . isDisplayed ( ) ) . toBe ( true ) ;
186+ for ( var i = 0 ; i < 10 ; i ++ ) {
187+ playerLocation . goal ( ) ;
188+ }
189+ expect ( page . firstTeamScore . getText ( ) ) . toBe ( '0' ) ;
190+ expect ( page . secondTeamScore . getText ( ) ) . toBe ( '10' ) ;
191+ expect ( page . theEnd . isDisplayed ( ) ) . toBe ( true ) ;
192+ page . theEndNewGame . click ( ) ;
193+ expect ( page . score . isDisplayed ( ) ) . toBe ( false ) ;
194+
195+ //Select adrien again
196+ var playerLocation1 = page . getPlayerLocation ( 0 ) ;
197+ playerLocation1 . selectPlayer ( 0 ) ;
198+ expect ( playerLocation1 . getPlayerName ( ) ) . toBe ( 'Adrien' ) ;
199+ } , 60000 ) ;
201200
202201} ) ;
0 commit comments