-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
178 lines (153 loc) · 5.65 KB
/
index.d.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import {EventEmitter} from "events";
declare namespace testableUtils {
var isLocal: boolean;
var isSmokeTest: boolean;
var events: EventEmitter;
function init(): void;
function execute(func: Function);
function stopwatch(code: Function, metricName?: string, resource?: string);
function waitForFinish(): Promise<void>;
function describe(suiteName: string, fn: Function): Promise<void>;
function it(testName: string, fn: Function): Promise<void>;
function before(fn: Function): void;
function after(fn: Function): void;
function beforeEach(fn: Function): void;
function afterEach(fn: Function): void;
interface Log {
debug(message?: any);
error(message?: any);
fatal(message?: any);
info(message?: any);
trace(message?: any);
}
var log: Log;
interface DataRow {
index: number;
data: object;
indexed: Array<any>;
}
interface DataTable{
get(i: number): Promise<DataRow>;
random(): Promise<DataRow>;
next(options?: object): Promise<Array<DataRow>>;
}
var dataTable: {
open(name: string): DataTable;
};
interface Chunk {
id: number;
executionType: string;
agent: string;
createdAt: Date;
updatedAt: Date;
startedAt: Date;
concurrentClients: number;
}
interface Execution {
id: number;
createdAt: Date;
updatedAt: Date;
startedAt: Date;
concurrentClients: number;
}
interface Region {
id: number;
createdAt: Date;
updatedAt: Date;
name: string;
public: boolean;
latitude: number;
longitude: number;
description: string;
active: boolean;
}
var info: {
expectedFinishTimestamp: number;
iteration: number;
client: number;
globalClientIndex: number;
regionalClientIndex: number;
chunk: Chunk;
agent: string;
execution: Execution;
region: Region;
outputDir: string;
}
interface ValueCondition {
name: string;
value?: number;
key?: string;
}
interface Condition {
condition: (val: number) => boolean;
name: string;
key?: string;
}
interface Result {
timing(options: ResultOptions): Promise<void>;
timing(name: string, key?: string, val?: number, units?: string): Promise<void>;
counter(options: ResultOptions): Promise<void>;
counter(name: string, key?: string, val?: number, units?: string): Promise<void>;
histogram(options: ResultOptions): Promise<void>;
histogram(name: string, key?: string, val?: number, units?: string): Promise<void>;
metered(options: ResultOptions): Promise<void>;
metered(name: string, key?: string, val?: number, units?: string): Promise<void>;
setTraceStatus(status: string): void;
markAsSuccess(): void;
markAsFailure(): void;
data: { resource: string, url: string };
}
interface ResultOptions {
namespace?: string;
name: string;
key?: string;
val?: number;
units?: string;
}
interface GetOptions {
namespace?: string;
name: string;
key?: string;
}
var results: {
(resource?: string, url?: string): Result;
get(options: GetOptions): Promise<number>;
get(name: string, key?: string): Promise<number>;
waitForCondition(options: Condition): Promise<void>;
waitForValue(options: ValueCondition): Promise<void>;
incrementAndWaitForValue(name: string, value?: number): Promise<void>;
barrier(name: string, value?: number): Promise<void>;
toResourceName: (url: string) => string;
current: Result;
}
}
export = testableUtils
declare global {
namespace WebdriverIO {
interface Browser {
testableLogDebug: (message?: any) => any;
testableLogError: (message?: any) => any;
testableLogFatal: (message?: any) => any;
testableLogInfo: (message?: any) => any;
testableLogTrace: (message?: any) => any;
testableCsvGet: (name: string, index: number) => Promise<testableUtils.DataRow>;
testableCsvRandom: (name: string) => Promise<testableUtils.DataRow>;
testableCsvNext: (name: string, options?: any) => Promise<Array<testableUtils.DataRow>>;
testableResult: (resource?: string, url?: string) => any;
testableTiming: (result: any, options: testableUtils.ResultOptions) => Promise<void>;
testableCounter: (result: any, options: testableUtils.ResultOptions) => Promise<void>;
testableHistogram: (result: any, options: testableUtils.ResultOptions) => Promise<void>;
testableMetered: (result: any, options: testableUtils.ResultOptions) => Promise<void>;
testableGetMetric: () => any;
testableWaitForCondition: (options: testableUtils.Condition) => Promise<void>;
testableWaitForValue: (options: testableUtils.ValueCondition) => Promise<void>;
testableIncrementAndWaitForValue: (name: string, value?: number) => Promise<void>;
testableBarrier: (name: string, value?: any) => any;
testableInfo: () => any;
testableScreenshot: (name: string) => Promise<any>;
testableStopwatch: (code: Function, metricName?: string, resource?: string) => any;
testableWaitForEvent: (eventName: string, timeout?: number, defaultVal?: any) => any;
testableWaitForFinish: () => Promise<void>;
}
}
}