forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
msportalfx-test.d.ts
314 lines (256 loc) · 11 KB
/
msportalfx-test.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
// Type definitions for msportalfx-test
// Project: https://msazure.visualstudio.com/DefaultCollection/AzureUX/_git/portalfx-msportalfx-test
// Definitions by: Julio Casal <https://github.com/julioct>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../q/Q.d.ts" />
declare module MsPortalTestFx {
export module Locators {
export class Locator {
seleniumLocator: any;
findElements(context: any): any;
toString(): string;
}
export class ContentLocator extends Locator {
locators: Array<Locator>;
constructor(innerLocators: Locator[]);
findElements(context: any): any;
toString(): string;
}
export class ChainedLocator extends Locator {
locators: Array<Locator>;
constructor(innerLocators: Locator[]);
findElements(context: any): any;
toString(): string;
}
export class By {
static className(value: string): Locator;
static css(value: string): Locator;
static id(value: string): Locator;
static js(script: any, ...var_args: any[]): Locator;
static linkText(value: string): Locator;
static name(value: string): Locator;
static partialLinkText(value: string): Locator;
static tagName(value: string): Locator;
static xpath(value: string): Locator;
static text(value: string): Locator;
static chained(...values: Locator[]): Locator;
static content(...values: Locator[]): Locator;
}
}
export module ActionBars {
export class ActionBarButton extends PortalElement {
constructor(parentLocator?: Locators.Locator, baseLocator?: Locators.Locator);
click(): Q.Promise<void>;
}
export class CreateActionBar extends PortalElement {
public createButton: ActionBarButton;
constructor(parentLocator?: Locators.Locator);
}
export class DeleteActionBar extends PortalElement {
public deleteButton: ActionBarButton;
public cancelButton: ActionBarButton;
constructor(parentLocator?: Locators.Locator);
}
export class PickerActionBar extends PortalElement {
public selectButton: ActionBarButton;
constructor(parentLocator?: Locators.Locator);
}
}
export module Blades {
export class Blade extends MsPortalTestFx.PortalElement {
public title: string;
constructor(title: string);
clickCommand(commandText: string): Q.Promise<Blade>;
getTiles(): Q.Promise<Parts.Tile[]>;
}
export class CreateBlade extends Blade {
public actionBar: ActionBars.CreateActionBar;
}
export class BrowseResourceBlade extends Blade {
constructor(title: string);
selectResource(resourceName: string): Q.Promise<void>;
filterItems(filter: string): Q.Promise<BrowseResourceBlade>;
}
export class PickerBlade extends Blade {
pickItem(item: string): Q.Promise<void>;
}
export class SpecPickerBlade extends Blade {
pickSpec(specCode: string): Q.Promise<void>;
}
export class QuickStartBlade extends Blade {
constructor();
clickLink(linkText: string): Q.Promise<void>;
}
export class UsersBlade extends Blade {
constructor();
}
}
export module Controls {
export class FormElement extends MsPortalTestFx.PortalElement {
protected label: string;
constructor(baseLocator: Locators.Locator, parentLocator?: Locators.Locator, label?: string);
}
export class CheckBoxField extends FormElement {
constructor(parentLocator?: Locators.Locator, label?: string);
}
export class SelectorField extends FormElement {
constructor(parentLocator?: Locators.Locator, label?: string);
openPicker(): Q.Promise<void>;
}
export class CreatorAndSelectorField extends FormElement {
constructor(parentLocator?: Locators.Locator, selectModeLabel?: string, createModeLabel?: string);
openPicker(): Q.Promise<void>;
clickCreateNew(): Q.Promise<CreatorAndSelectorField>;
enterNewValue(...var_args: string[]): Q.Promise<CreatorAndSelectorField>;
}
export class GridCell extends MsPortalTestFx.PortalElement {
constructor(text: string, parentLocator?: Locators.Locator);
getLocator(): Locators.Locator;
}
export class TextField extends FormElement {
constructor(parentLocator?: Locators.Locator, label?: string, baseLocator?: Locators.Locator);
sendKeys(...var_args: string[]): Q.Promise<void>;
}
export class ResourceFilterTextField extends TextField {
constructor(parentLocator?: Locators.Locator);
}
export class HotSpot extends PortalElement {
constructor(parentLocator?: Locators.Locator, baseLocator?: Locators.Locator);
isSelected(): Q.Promise<boolean>;
}
}
export module Parts {
export class Part extends MsPortalTestFx.PortalElement {
public innerText: string;
constructor(parentLocator?: Locators.Locator, innerText?: string, baseLocator?: Locators.Locator);
isSelected(): Q.Promise<boolean>;
isLoaded(): Q.Promise<boolean>;
waitUntilLoaded(timeout?: number): Q.Promise<boolean>;
isClickable(): Q.Promise<boolean>;
hasError(): Q.Promise<boolean>;
}
export class PartProperty extends MsPortalTestFx.PortalElement {
public name: string;
constructor(name: string, parentLocator?: Locators.Locator);
getValue(): Q.Promise<string>;
}
export class ResourceSummaryPart extends Part {
public properties: Array<PartProperty>;
public resourceGroupProperty: PartProperty;
public quickStartHotSpot: Controls.HotSpot;
public accessHotSpot: Controls.HotSpot;
constructor(parentLocator?: Locators.Locator);
}
class PricingTierPart extends Part {
}
export class Tile extends MsPortalTestFx.PortalElement {
public progressLocator: Locators.Locator;
constructor(parentLocator?: Locators.Locator);
tryPin(): Q.Promise<void>;
getPart(): Part;
waitUntilLoaded(timeout?: number): Q.Promise<void>;
}
}
export module Commands {
export class ContextMenu extends PortalElement {
constructor();
public hasItem(text: string): Q.Promise<boolean>;
public clickItem(text: string): Q.Promise<void>;
}
export class ContextMenuItem extends PortalElement {
constructor(parentLocator: Locators.Locator, text?: string);
}
}
export module Notifications {
export class Notification extends PortalElement {
constructor();
getTitle(): Q.Promise<string>;
getDescription(): Q.Promise<string>;
}
export class NotificationsMenu extends PortalElement {
constructor();
waitForNewNotification(title?: string, description?: string, timeout?: number): Q.Promise<Notification>;
}
}
export module Tests {
export module Parts {
export function canPinAllBladeParts(targetBladeDeepLink: string, targetBladeTitle: string, timeout?: number): Q.Promise<boolean>;
}
}
export class PortalElement {
public baseLocator: Locators.Locator;
protected parentLocator: Locators.Locator;
constructor(baseLocator: Locators.Locator, parentLocator?: Locators.Locator);
click(): Q.Promise<void>;
rightClick(): Q.Promise<void>;
getAttribute(attributeName: string): Q.Promise<string>;
sendKeys(...var_args: string[]): Q.Promise<void>;
getText(): Q.Promise<string>;
isPresent(): Q.Promise<boolean>;
isElementPresent(subLocator: Locators.Locator): Q.Promise<boolean>;
isDisplayed(): Q.Promise<boolean>;
getLocator(): Locators.Locator;
}
export interface TestExtension {
name: string;
uri: string;
}
export interface Feature {
name: string;
value: string;
}
export interface PortalContext {
capabilities: {
browserName: string;
chromeOptions: {
args: string[]
}
},
chromeDriverPath?: string,
portalUrl: string;
signInUrl?: string;
signInEmail?: string;
signInPassword?: string;
features?: Feature[];
testExtensions?: TestExtension[];
}
export enum LogLevel {
All,
Debug,
Info,
Warning,
Severe,
Off
}
export class Portal {
portalContext: PortalContext;
goHome(timeout?: number): Q.Promise<void>;
openGalleryCreateBlade(galleryPackageName: string, bladeTitle: string, timeout?: number): Q.Promise<Blades.CreateBlade>;
openBrowseBlade(resourceProvider: string, resourceType: string, bladeTitle: string, timeout?: number): Q.Promise<Blades.BrowseResourceBlade>;
openResourceBlade(resourceId: string, bladeTitle: string, timeout?: number): Q.Promise<Blades.Blade>;
navigateToDeepLink(deepLink: string, timeout?: number): Q.Promise<any>;
waitForElementVisible(locator: Locators.Locator, timeout?: number): Q.Promise<boolean>;
waitForElementNotVisible(locator: Locators.Locator, timeout?: number): Q.Promise<boolean>;
waitUntilElementContainsAttribute(locator: Locators.Locator, attributeName: string, attributeValue: string, timeout?: number): Q.Promise<any>;
waitUntilElementDoesNotContainAttribute(locator: Locators.Locator, attributeName: string, attributeValue: string, timeout?: number): Q.Promise<any>;
waitForElementLocated(locator: Locators.Locator, timeout?: number): Q.Promise<any>;
waitForElementsLocated(locator: Locators.Locator, timeout?: number): Q.Promise<any[]>;
takeScreenshot(filePrefix?: string): Q.Promise<string>;
getBrowserLogs(level: LogLevel): Q.Promise<string[]>;
executeScript<T>(script: string): Q.Promise<T>;
applyFeature(name: string, value: string): void;
getCurrentUrl(): Q.Promise<string>;
quit(): Q.Promise<any>;
}
export class SplashScreen extends PortalElement {
clickUntrustedExtensionsOkButton(): Q.Promise<void>;
}
export class StartBoard extends PortalElement {
constructor();
getTiles(): Q.Promise<Parts.Tile[]>;
}
export var portal: Portal;
}
declare module "MsPortalFx-Test" {
export = MsPortalTestFx;
}