-
-
Notifications
You must be signed in to change notification settings - Fork 160
/
SerenityBDDJsonSchema.ts
125 lines (111 loc) · 4.48 KB
/
SerenityBDDJsonSchema.ts
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/** @package */
import { JSONObject } from 'tiny-types';
// https://github.com/serenity-bdd/serenity-core/tree/50a3b1824001f192da2cdca6326d7525d4dd7f25/serenity-model/src/test/resources
// https://github.com/serenity-bdd/serenity-core/blob/master/serenity-model/src/main/java/net/thucydides/core/model/TestOutcome.java
export interface SerenityBDDReport extends JSONObject {
name: string; // done [x]
id: string; // done [x]
testSteps: TestStep[]; // done [x]
userStory: UserStory; // todo [~] cucumber
// https://github.com/serenity-bdd/serenity-core/blob/c89cd6ee4127738ac88525d29d99537921f34701/
// serenity-core/src/test/resources/historical-reports/sample-report-4.json
featureTag: Tag; // done [x]
title: string; // done [x]
description: string; // done [x]
tags: Tag[]; // done [x]
startTime: number; // done [x]
duration: number; // done [x]
projectKey: string; // todo [ ] protractor <- this typically comes from an env variable
sessionId?: string; // todo [ ] protractor <- how is this used?
driver?: string; // todo [ ] protractor 'chrome:jill' <- how is this used?
context?: string; // done [x]
dataTable?: DataTable; // done [x] cucumber <- can I use this with mocha?
manual: boolean; // done [x]
issues?: string[]; // done [x]
additionalIssues?: string[]; // done [x]
testSource: string; // done [x]
result: string; // done [x]
testFailureCause?: ErrorDetails; // done [x]
backgroundTitle?: string; // todo [ ] cucumber
backgroundDescription?: string; // todo [ ] cucumber
}
export interface TestStep extends JSONObject {
number: number;
description: string;
duration: number;
startTime: number;
result: string;
children?: TestStep[];
screenshots?: Screenshot[];
reportData: ReportData[];
restQuery?: RESTQuery;
exception?: ErrorDetails;
// precondition: false; // not needed?
}
// https://github.com/serenity-bdd/serenity-core/blob/master/serenity-model/src/main/java/net/thucydides/core/model/ReportData.java
export interface ReportData extends JSONObject {
id: string;
isEvidence: boolean;
path: string;
title: string;
contents: string;
}
/**
* https://github.com/serenity-bdd/serenity-core/blob/master/serenity-model/src/main/java/net/thucydides/core/screenshots/ScreenshotAndHtmlSource.java
*/
export interface Screenshot extends JSONObject {
screenshot: string;
htmlSource?: string; // "htmlSource": "pagesource7953468346968205961.html.txt"
}
export interface UserStory extends JSONObject {
id: string; // dashified feature name
storyName: string; // feature name
path: string; // relative feature file path
type: string; // 'feature'
narrative?: string; // cucumber narrative, if any
}
export interface Tag extends JSONObject {
name: string;
displayName: string;
type: string;
}
export interface DataTable extends JSONObject {
headers: string[];
rows: DataTableRow[];
predefinedRows: boolean;
scenarioOutline: string;
dataSetDescriptors: DataTableDataSetDescriptor[];
}
export interface DataTableRow extends JSONObject {
values: string[];
result?: string;
}
export interface DataTableDataSetDescriptor extends JSONObject {
startRow: number;
rowCount: number;
name: string;
description: string;
}
export interface RESTQuery extends JSONObject {
method: string;
path: string;
content: string;
contentType: string;
requestHeaders: string;
requestCookies: string;
responseHeaders: string;
responseCookies: string;
responseBody: string;
statusCode: number;
}
export interface ErrorDetails extends JSONObject {
errorType: string;
message: string;
stackTrace: Array<{
declaringClass: string,
methodName: string,
fileName: string,
lineNumber: number,
}>;
rootCause?: ErrorDetails;
}