-
Notifications
You must be signed in to change notification settings - Fork 405
Expand file tree
/
Copy pathFailuresOverviewPageTest.java
More file actions
70 lines (53 loc) · 1.85 KB
/
FailuresOverviewPageTest.java
File metadata and controls
70 lines (53 loc) · 1.85 KB
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
package net.masterthought.cucumber.generators;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.ArrayList;
import java.util.List;
import org.apache.velocity.VelocityContext;
import org.junit.Before;
import org.junit.Test;
import net.masterthought.cucumber.generators.integrations.PageTest;
import net.masterthought.cucumber.json.Element;
import net.masterthought.cucumber.json.Feature;
/**
* @author Damian Szczepanik (damianszczepanik@github)
*/
public class FailuresOverviewPageTest extends PageTest {
@Before
public void setUp() {
setUpWithJson(SAMPLE_JSON);
}
@Test
public void getWebPage_ReturnsFailureReportFileName() {
// given
page = new FailuresOverviewPage(reportResult, configuration);
// when
String fileName = page.getWebPage();
// then
assertThat(fileName).isEqualTo(FailuresOverviewPage.WEB_PAGE);
}
@Test
public void prepareReport_AddsCustomProperties() {
// given
page = new FailuresOverviewPage(reportResult, configuration);
// this page only has failed scenarios (elements) so extract them into
// a list to compare
List<Element> failures = new ArrayList<>();
for (Feature feature : features) {
if (feature.getStatus().isPassed()) {
continue;
}
for (Element element : feature.getElements()) {
if (element.getStepsStatus().isPassed())
continue;
failures.add(element);
}
}
// when
page.prepareReport();
// then
VelocityContext context = page.context;
assertThat(context.getKeys()).hasSize(12);
List<Element> elements = (List<Element>) context.get("failures");
assertThat(elements).hasSameElementsAs(failures);
}
}