FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
frontend/core-navigation/test/RelatedFeatureTest.scala at events · 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
/
core-navigation
/
test
/
RelatedFeatureTest.scala
Copy path
More file actions
More file actions
Latest commit
History
History
History
68 lines (45 loc) · 2.27 KB
Breadcrumbs
frontend
/
core-navigation
/
test
/
RelatedFeatureTest.scala
Copy path
File metadata and controls
68 lines (45 loc) · 2.27 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
import
org
.
scalatest
.
matchers
.
ShouldMatchers
import
org
.
scalatest
.{
GivenWhenThen
,
FeatureSpec
}
import
test
.
`package`
.
_
class
RelatedFeatureTest
extends
FeatureSpec
with
GivenWhenThen
with
ShouldMatchers
{
feature(
"
Related links
"
) {
//
Feature
info(
"
In order to continue reading more about the story
"
)
info(
"
As a Guardian reader
"
)
info(
"
I want to visit related links to the current article I am reading
"
)
//
Metrics
info(
"
Increase average number of articles 'read' from 1.9% to 2.5%
"
)
//
Features
scenario(
"
Shows related links for each article
"
) {
Given
(
"
there is an article 'Woman tortured during burglary tells of waterboarding ordeal'
"
)
HtmlUnit
(
"
/related/uk/2012/aug/07/woman-torture-burglary-waterboard-surrey
"
) { browser
=>
import
browser
.
_
Then
(
"
I should see the related links
"
)
$(
"
li
"
) should have length
10
}
}
scenario(
"
Shows article metadata for each related link
"
) {
Given
(
"
there is an article 'Woman tortured during burglary tells of waterboarding ordeal'
"
)
HtmlUnit
(
"
/related/uk/2012/aug/07/woman-torture-burglary-waterboard-surrey
"
) { browser
=>
import
browser
.
_
Then
(
"
I should see the headline, trail text for each of the first five related links
"
)
//
We cannot guarantee what exactly gets returned from the content api as related is an algorithm
//
so just checking that items exist and not their values
val
article
=
findFirst(
"
li
"
)
article.findFirst(
"
a
"
).getAttribute(
"
href
"
).length should be
>
0
article.findFirst(
"
h3
"
).getText.length should be
>
0
article.findFirst(
"
.trail__text
"
).getText.length should be
>
0
article.findFirst(
"
time
"
).getAttribute(
"
data-timestamp
"
) should be(
"
1344426007000
"
)
find(
"
li .trail__text
"
) should have length
5
}
}
scenario(
"
Show the published dates for all trails
"
) {
//
GFE-37
Given
(
"
Shell spending millions of dollars on security in Nigeria, leaked data shows
"
)
HtmlUnit
(
"
/related/business/2012/aug/19/shell-spending-security-nigeria-leak
"
) { browser
=>
import
browser
.
_
Then
(
"
I see each trail block displays the published date of the corresponding article
"
)
$(
"
.relative-timestamp
"
) should have length
10
}
}
}
}
Back
|
FazBrowse Home
|
New Git URL