1 | import { Definition, NightwatchAPI, Awaitable } from "./index";
|
2 |
|
3 | export interface NightwatchExpectResult {
|
4 | value: null;
|
5 | returned: 1;
|
6 | }
|
7 |
|
8 | export interface ExpectLanguageChains<T> {
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | to: T;
|
14 | be: T;
|
15 | been: T;
|
16 | is: T;
|
17 | that: T;
|
18 | which: T;
|
19 | and: T;
|
20 | has: T;
|
21 | have: T;
|
22 | with: T;
|
23 | at: T;
|
24 | does: T;
|
25 | of: T;
|
26 | same: T;
|
27 |
|
28 | |
29 |
|
30 |
|
31 | not: T;
|
32 |
|
33 | |
34 |
|
35 |
|
36 | deep: T;
|
37 | }
|
38 |
|
39 | export interface ExpectEqual<T> {
|
40 | (value: any): Awaitable<T, NightwatchExpectResult>;
|
41 | }
|
42 |
|
43 | export interface ExpectInclude<T> {
|
44 | (value: string): Awaitable<T, NightwatchExpectResult>;
|
45 | }
|
46 |
|
47 | export interface ExpectMatch<T> {
|
48 | (regexp: RegExp): Awaitable<T, NightwatchExpectResult>;
|
49 | }
|
50 |
|
51 | export interface ExpectStartWith<T> {
|
52 | (value: string): Awaitable<T, NightwatchExpectResult>;
|
53 | }
|
54 |
|
55 | export interface ExpectEndWith<T> {
|
56 | (value: string): Awaitable<T, NightwatchExpectResult>;
|
57 | }
|
58 |
|
59 | export interface ExpectAssertions<T> extends ExpectLanguageChains<T> {
|
60 | equal: ExpectEqual<T>;
|
61 | equals: ExpectEqual<T>;
|
62 | eq: ExpectEqual<T>;
|
63 |
|
64 | include: ExpectInclude<T>;
|
65 | includes: ExpectInclude<T>;
|
66 | contain: ExpectInclude<T>;
|
67 | contains: ExpectInclude<T>;
|
68 |
|
69 | match: ExpectMatch<T>;
|
70 | matches: ExpectMatch<T>;
|
71 |
|
72 | startWith: ExpectStartWith<T>;
|
73 | startsWith: ExpectStartWith<T>;
|
74 |
|
75 | endWith: ExpectEndWith<T>;
|
76 | endsWith: ExpectEndWith<T>;
|
77 |
|
78 | before: (ms: number) => Awaitable<T, NightwatchExpectResult>;
|
79 | after: (ms: number) => Awaitable<T, NightwatchExpectResult>;
|
80 |
|
81 |
|
82 | toEqual: (value: any) => NightwatchAPI;
|
83 | toBe: (value: any) => NightwatchAPI;
|
84 | toContain: (value: string) => NightwatchAPI;
|
85 | toMatch: (regexp: RegExp) => NightwatchAPI;
|
86 | toEndWith: (value: string) => NightwatchAPI;
|
87 | }
|
88 |
|
89 | export interface ExpectCookie extends ExpectAssertions<ExpectCookie> {}
|
90 |
|
91 | export interface ExpectElement extends ExpectAssertions<ExpectElement> {
|
92 | |
93 |
|
94 |
|
95 | a(type: string, message?: string): Awaitable<this, NightwatchExpectResult>;
|
96 |
|
97 | |
98 |
|
99 |
|
100 | an(type: string, message?: string): Awaitable<this, NightwatchExpectResult>;
|
101 |
|
102 | |
103 |
|
104 |
|
105 | active: Awaitable<this, NightwatchExpectResult>;
|
106 |
|
107 | |
108 |
|
109 |
|
110 | attribute(attribute: string, message?: string): Awaitable<this, NightwatchExpectResult>;
|
111 |
|
112 | |
113 |
|
114 |
|
115 | css(property: string, message?: string): Awaitable<this, NightwatchExpectResult>;
|
116 |
|
117 | |
118 |
|
119 |
|
120 | enabled: Awaitable<this, NightwatchExpectResult>;
|
121 |
|
122 | |
123 |
|
124 |
|
125 | present: Awaitable<this, NightwatchExpectResult>;
|
126 |
|
127 | |
128 |
|
129 |
|
130 |
|
131 | property(name: string, message?: string): Awaitable<this, NightwatchExpectResult>;
|
132 |
|
133 | |
134 |
|
135 |
|
136 | selected: Awaitable<this, NightwatchExpectResult>;
|
137 |
|
138 | |
139 |
|
140 |
|
141 | text: Awaitable<this, NightwatchExpectResult>;
|
142 |
|
143 | |
144 |
|
145 |
|
146 | value: Awaitable<this, NightwatchExpectResult>;
|
147 |
|
148 | |
149 |
|
150 |
|
151 | visible: Awaitable<this, NightwatchExpectResult>;
|
152 |
|
153 | |
154 |
|
155 |
|
156 |
|
157 | domProperty(propertyName: string, message?: string): Awaitable<this, NightwatchExpectResult>;
|
158 | }
|
159 |
|
160 | export interface ExpectElements extends ExpectAssertions<ExpectElements> {
|
161 | |
162 |
|
163 |
|
164 | count: this;
|
165 | }
|
166 |
|
167 | export interface ExpectTitle extends ExpectAssertions<ExpectTitle> {}
|
168 |
|
169 | export interface ExpectUrl extends ExpectAssertions<ExpectUrl> {}
|
170 |
|
171 | export interface Expect {
|
172 | |
173 |
|
174 |
|
175 |
|
176 | cookie(name: string, domain?: string): ExpectCookie;
|
177 |
|
178 | |
179 |
|
180 |
|
181 | element(property: Definition): ExpectElement;
|
182 |
|
183 | |
184 |
|
185 |
|
186 |
|
187 | elements(property: Definition): ExpectElements;
|
188 |
|
189 | |
190 |
|
191 |
|
192 | title(): ExpectTitle;
|
193 |
|
194 | |
195 |
|
196 |
|
197 | url(): ExpectUrl;
|
198 | }
|