FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
frontend/sport/test/ResultsFeatureTest.scala at test-code-owners · devhttps/frontend · GitHub
devhttps
/
frontend
Public
forked from
guardian/frontend
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
frontend
/
sport
/
test
/
ResultsFeatureTest.scala
Copy path
More file actions
More file actions
Latest commit
History
History
History
91 lines (70 loc) · 3.12 KB
Breadcrumbs
frontend
/
sport
/
test
/
ResultsFeatureTest.scala
Copy path
File metadata and controls
91 lines (70 loc) · 3.12 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package
test
import
org
.
scalatest
.{
DoNotDiscover
,
FeatureSpec
,
GivenWhenThen
,
Matchers
}
import
collection
.
JavaConverters
.
_
import
tools
.
MatchListFeatureTools
@
DoNotDiscover
class
ResultsFeatureTest
extends
FeatureSpec
with
GivenWhenThen
with
Matchers
with
MatchListFeatureTools
with
ConfiguredTestSuite
{
feature(
"
Football Results
"
) {
scenario(
"
Visit the results page
"
) {
Given
(
"
I visit the results page
"
)
goTo(
"
/football/results
"
) { browser
=>
import
browser
.
_
val
matches
=
$(
"
.football-match__team
"
)
Then
(
"
I should see results for previous days
"
)
assertTeamWithScore(matches,
"
Sunderland
"
,
"
1
"
)
assertTeamWithScore(matches,
"
West Ham
"
,
"
1
"
)
assertTeamWithScore(matches,
"
Wigan
"
,
"
1
"
)
assertTeamWithScore(matches,
"
Everton
"
,
"
1
"
)
assertTeamWithScore(matches,
"
Bolton
"
,
"
1
"
)
assertTeamWithScore(matches,
"
Derby
"
,
"
1
"
)
assertTeamWithScore(matches,
"
Fulham
"
,
"
0
"
)
assertTeamWithScore(matches,
"
Norwich
"
,
"
0
"
)
And
(
"
I should not see today's live matches
"
)
assertNotTeamWithScore(matches,
"
Arsenal
"
,
"
1
"
)
assertNotTeamWithScore(matches,
"
Spurs
"
,
"
0
"
)
And
(
"
Matches should not contain form
"
)
$(
"
.football-team__form
"
).size() should be(
0
)
Then
(
"
I should see match comments
"
)
$(
"
.football-match__comments
"
).texts.asScala.exists(_.contains(
"
Bolton win 4-2 on penalties
"
)) should equal(
true
)
}
}
scenario(
"
Next results
"
) {
Given
(
"
I am on the results page
"
)
goTo(
"
/football/results
"
) { browser
=>
import
browser
.
_
And
(
"
I click the 'next' results link
"
)
scrollToElementAndClick(
"
[data-link-name=next]
"
, browser)
Then
(
"
I should see additional results
"
)
val
matches
=
$(
"
.football-match__team
"
)
assertTeamWithScore(matches,
"
Stoke
"
,
"
1
"
)
assertTeamWithScore(matches,
"
Villa
"
,
"
1
"
)
}
}
scenario(
"
Competition results filter
"
) {
//
filter has been removed and will be re-implemented differently
Given
(
"
I am on the the results page
"
)
goTo(
"
/football/results
"
) { browser
=>
import
browser
.
_
When
(
"
I click the filter to premier league link
"
)
el(
"
[data-link-name='view Premier League matches']
"
).click()
browser.await()
Then
(
"
I should navigate to the premier league results page
"
)
val
matches
=
$(
"
.football-match__team
"
)
browser.url() should endWith(
"
/football/premierleague/results
"
)
assertTeamWithScore(matches,
"
Sunderland
"
,
"
1
"
)
assertTeamWithScore(matches,
"
West Ham
"
,
"
1
"
)
And
(
"
I should not see other leagues results
"
)
assertNotTeamWithScore(matches,
"
Arsenal
"
,
"
1
"
)
assertNotTeamWithScore(matches,
"
Spurs
"
,
"
0
"
)
}
}
scenario(
"
Link tracking
"
) {
Given
(
"
I visit the results page
"
)
goTo(
"
/football/results
"
) { browser
=>
import
browser
.
_
Then
(
"
any links I click should be tracked
"
)
$(
"
a
"
).asScala.filter(link
=>
Option
(link.attribute(
"
data-link-name
"
)).isEmpty).foreach { link
=>
fail(
s
"
Link with text
${link.text}
has no data-link-name
"
)
}
}
}
}
}
Back
|
FazBrowse Home
|
New Git URL