|
| 1 | +// Type definitions for Angular Scenario Testing |
| 2 | +// Project: [http://angularjs.org] |
| 3 | +// Definitions by: [RomanoLindano] |
| 4 | +// Definitions: https://github.com/borisyankov/DefinitelyTyped |
1 | 5 |
|
2 |
| -declare module scenario |
3 |
| -{ |
4 |
| - interface ISleep |
5 |
| - { |
6 |
| - (timeSeconds: number): void; |
| 6 | +declare module angularScenario { |
| 7 | + export interface AngularModel { |
| 8 | + scenario: any; |
7 | 9 | }
|
8 | 10 |
|
9 |
| - interface IBrowser |
10 |
| - { |
11 |
| - (): IBrowser; |
12 |
| - navigateTo(url: string); |
13 |
| - navigateTo(url: string, delegate: (url: string) => string); |
14 |
| - reload(); |
15 |
| - window(): IWindowApi; |
16 |
| - location(): ILocationApi; |
| 11 | + export interface RunFunction { |
| 12 | + (functionToRun: any): any; |
| 13 | + } |
| 14 | + export interface RunFunctionWithDescription { |
| 15 | + (description: string, functionToRun: any): any; |
17 | 16 | }
|
18 | 17 |
|
19 |
| - interface IWindowApi |
20 |
| - { |
21 |
| - href(): void; |
22 |
| - path(): void; |
23 |
| - search(): void; |
24 |
| - hash(): void; |
| 18 | + export interface PauseFunction { |
| 19 | + (): any; |
25 | 20 | }
|
26 | 21 |
|
27 |
| - interface ILocationApi |
28 |
| - { |
29 |
| - url(): void; |
30 |
| - path(): void; |
31 |
| - search(): void; |
32 |
| - hash(): void; |
| 22 | + export interface SleepFunction { |
| 23 | + (seconds: number): any; |
33 | 24 | }
|
34 | 25 |
|
| 26 | + export interface Future { |
| 27 | + } |
35 | 28 |
|
| 29 | + export interface testWindow { |
| 30 | + href(): Future; |
| 31 | + path(): Future; |
| 32 | + search(): Future; |
| 33 | + hash(): Future; |
| 34 | + } |
36 | 35 |
|
37 |
| - interface IElement |
38 |
| - { |
39 |
| - (): IElement; |
40 |
| - (selector: string): IElement; |
41 |
| - count(): number; |
42 |
| - click(): void; |
| 36 | + export interface testLocation { |
| 37 | + url(): Future; |
| 38 | + path(): Future; |
| 39 | + search(): Future; |
| 40 | + hash(): Future; |
| 41 | + } |
43 | 42 |
|
| 43 | + export interface Browser { |
| 44 | + navigateTo(url: string): void; |
| 45 | + navigateTo(urlDescription: string, urlFunction: () => string): void; |
| 46 | + reload(): void; |
| 47 | + window(): testWindow; |
| 48 | + location(): testLocation; |
| 49 | + } |
| 50 | + |
| 51 | + export interface Matchers { |
| 52 | + toEqual(value: any): void; |
| 53 | + toBe(value: any): void; |
| 54 | + toBeDefined(): void; |
| 55 | + toBeTruthy(): void; |
| 56 | + toBeFalsy(): void; |
| 57 | + toMatch(regularExpression: any): void; |
| 58 | + toBeNull(): void; |
| 59 | + toContain(value: any): void; |
| 60 | + toBeLessThan(value: any): void; |
| 61 | + toBeGreaterThan(value: any): void; |
44 | 62 | }
|
45 | 63 |
|
| 64 | + export interface CustomMatchers extends Matchers{ |
| 65 | + } |
46 | 66 |
|
| 67 | + export interface Expect extends CustomMatchers { |
| 68 | + not(): angularScenario.CustomMatchers; |
| 69 | + } |
47 | 70 |
|
48 |
| -} |
| 71 | + export interface UsingFunction { |
| 72 | + (selector: string, selectorDescription?: string): void; |
| 73 | + } |
| 74 | + |
| 75 | + export interface BindingFunction { |
| 76 | + (bracketBindingExpression: string): Future; |
| 77 | + } |
| 78 | + |
| 79 | + export interface Input { |
| 80 | + enter(value: any); |
| 81 | + check(): any; |
| 82 | + select(radioButtonValue: any): any; |
| 83 | + val(): Future; |
| 84 | + } |
| 85 | + |
| 86 | + export interface Repeater { |
| 87 | + count(): Future; |
| 88 | + row(index: number): Future; |
| 89 | + column(ngBindingExpression: string): Future; |
| 90 | + } |
49 | 91 |
|
| 92 | + export interface Select { |
| 93 | + option(value: any): any; |
| 94 | + option(...listOfValues: any[]): any; |
| 95 | + } |
50 | 96 |
|
51 |
| -declare var browser: scenario.IBrowser; |
52 |
| -declare var element: scenario.IElement; |
53 |
| -declare var sleep: scenario.ISleep; |
| 97 | + export interface Element { |
| 98 | + count(): Future; |
| 99 | + click(): any; |
| 100 | + query(callback: (selectedDOMElements: any[], callbackWhenDone: (objNull: any, futureValue: any) => any) =>any): any; |
| 101 | + val(): Future; |
| 102 | + text(): Future; |
| 103 | + html(): Future; |
| 104 | + height(): Future; |
| 105 | + innerHeight(): Future; |
| 106 | + outerHeight(): Future; |
| 107 | + width(): Future; |
| 108 | + innerWidth(): Future; |
| 109 | + outerWidth(): Future; |
| 110 | + position(): Future; |
| 111 | + scrollLeft(): Future; |
| 112 | + scrollTop(): Future; |
| 113 | + offset(): Future; |
| 114 | + |
| 115 | + val(value: any): void; |
| 116 | + text(value: any): void; |
| 117 | + html(value: any): void; |
| 118 | + height(value: any): void; |
| 119 | + innerHeight(value: any): void; |
| 120 | + outerHeight(value: any): void; |
| 121 | + width(value: any): void; |
| 122 | + innerWidth(value: any): void; |
| 123 | + outerWidth(value: any): void; |
| 124 | + position(value: any): void; |
| 125 | + scrollLeft(value: any): void; |
| 126 | + scrollTop(value: any): void; |
| 127 | + offset(value: any): void; |
| 128 | + |
| 129 | + attr(key: any): Future; |
| 130 | + prop(key: any): Future; |
| 131 | + css(key: any): Future; |
| 132 | + |
| 133 | + attr(key: any, value: any): void; |
| 134 | + prop(key: any, value: any): void; |
| 135 | + css(key: any, value: any): void; |
| 136 | + } |
| 137 | +} |
54 | 138 |
|
| 139 | +declare var describe: angularScenario.RunFunctionWithDescription; |
| 140 | +declare var xdescribe: angularScenario.RunFunctionWithDescription; |
| 141 | +declare var beforeEach: angularScenario.RunFunction; |
| 142 | +declare var afterEach: angularScenario.RunFunction; |
| 143 | +declare var it: angularScenario.RunFunctionWithDescription; |
| 144 | +declare var xit: angularScenario.RunFunctionWithDescription; |
| 145 | +declare var pause: angularScenario.PauseFunction; |
| 146 | +declare var sleep: angularScenario.SleepFunction; |
| 147 | +declare function browser(): angularScenario.Browser; |
| 148 | +declare function expect(expectation: angularScenario.Future): angularScenario.Expect; |
| 149 | +declare var using: angularScenario.UsingFunction; |
| 150 | +declare var binding: angularScenario.BindingFunction; |
| 151 | +declare function input(ngModelBinding: string): angularScenario.Input; |
| 152 | +declare function repeater(selector: string, repeaterDescription?: string): angularScenario.Repeater; |
| 153 | +declare function select(ngModelBinding: string): angularScenario.Select; |
| 154 | +declare function element(selector: string, elementDescription?: string): angularScenario.Element; |
| 155 | +declare var angular: angularScenario.AngularModel; |
0 commit comments