From 1bdba85d16610d88b436514ef0be3220399834bc Mon Sep 17 00:00:00 2001 From: Qube Date: Wed, 21 Aug 2013 20:03:12 +1000 Subject: [PATCH 01/13] Initial module and class structure. --- siesta/siesta-tests.ts | 10 +++ siesta/siesta.d.ts | 173 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 183 insertions(+) create mode 100644 siesta/siesta-tests.ts create mode 100644 siesta/siesta.d.ts diff --git a/siesta/siesta-tests.ts b/siesta/siesta-tests.ts new file mode 100644 index 000000000..2439ff84f --- /dev/null +++ b/siesta/siesta-tests.ts @@ -0,0 +1,10 @@ +/// + +StartTest(function (t: Siesta.Test) { +}); + +startTest(function (t: Siesta.Test) { +}); + +describe(function (t: Siesta.Test) { +}); \ No newline at end of file diff --git a/siesta/siesta.d.ts b/siesta/siesta.d.ts new file mode 100644 index 000000000..6a368ced7 --- /dev/null +++ b/siesta/siesta.d.ts @@ -0,0 +1,173 @@ +declare function StartTest(testScript: (t: Siesta.Test) => void): void; + +declare var startTest: typeof StartTest; + +declare var describe: typeof StartTest; + +declare module Siesta { + export class Harness { + } + + export module Harness { + export class Browser { + } + + export module Browser { + export class ExtJS { + } + + export class ExtJSCore { + } + + export class SenchaTouch { + } + } + + export class NodeJS { + } + } + + export class Test { + } + + export module Test { + export class Action { + } + + export module Action { + export module Role { + export class HasTarget { + } + } + + export class Click { + } + + export class Done { + } + + export class DoubleClick { + } + + export class DoubleTap { + } + + export class Drag { + } + + export class Eval { + } + + export class LongPress { + } + + export class MouseDown { + } + + export class MouseUp { + } + + export class MoveCursor { + } + + export class MoveCursorTo { + } + + export class RightClick { + } + + export class Swipe { + } + + export class Tap { + } + + export class Type { + } + + export class Wait { + } + } + + export class BDD { + } + + export module BDD { + export class Expectation { + } + } + + export class ExtJS { + } + + export module ExtJS { + export class Ajax { + } + + export class Component { + } + + export class DataView { + } + + export class Element { + } + + export class FormField { + } + + export class Grid { + } + + export class Observable { + } + + export class Store { + } + } + + export module Simulate { + export class Event { + } + + export class Keyboard { + } + + export module KeyCodes { + } + + export class Mouse { + } + } + + export class ActionTarget { + } + + export class Browser { + } + + export class Date { + } + + export class Element { + } + + export class ExtJSCore { + } + + export class Function { + } + + export class jQuery { + } + + export class More { + } + + export class SenchaTouch { + } + + export class TextSelection { + } + } +} \ No newline at end of file From 0ff1cbd9aa7cc0a9738acb337509699e7aae8178 Mon Sep 17 00:00:00 2001 From: Qube Date: Wed, 21 Aug 2013 20:22:20 +1000 Subject: [PATCH 02/13] Wired up Siesta class inheritance. --- siesta/siesta.d.ts | 50 +++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/siesta/siesta.d.ts b/siesta/siesta.d.ts index 6a368ced7..2046f7089 100644 --- a/siesta/siesta.d.ts +++ b/siesta/siesta.d.ts @@ -9,25 +9,25 @@ declare module Siesta { } export module Harness { - export class Browser { + export class Browser extends Harness { } export module Browser { - export class ExtJS { + export class ExtJS extends Browser implements ExtJSCore { } export class ExtJSCore { } - export class SenchaTouch { + export class SenchaTouch extends Browser implements ExtJSCore { } } - export class NodeJS { + export class NodeJS implements Harness { } } - export class Test { + export class Test implements Test.BDD, Test.Date, Test.Function, Test.More { } export module Test { @@ -40,52 +40,52 @@ declare module Siesta { } } - export class Click { + export class Click extends Action implements Role.HasTarget { } - export class Done { + export class Done extends Action { } - export class DoubleClick { + export class DoubleClick extends Action implements Role.HasTarget { } - export class DoubleTap { + export class DoubleTap extends Action implements Role.HasTarget { } - export class Drag { + export class Drag extends Action { } - export class Eval { + export class Eval extends Action { } - export class LongPress { + export class LongPress extends Action implements Role.HasTarget { } - export class MouseDown { + export class MouseDown extends Action implements Role.HasTarget { } - export class MouseUp { + export class MouseUp extends Action implements Role.HasTarget { } - export class MoveCursor { + export class MoveCursor extends Action implements Role.HasTarget { } - export class MoveCursorTo { + export class MoveCursorTo extends Action implements Role.HasTarget { } - export class RightClick { + export class RightClick extends Action implements Role.HasTarget { } - export class Swipe { + export class Swipe extends Action implements Role.HasTarget { } - export class Tap { + export class Tap extends Action implements Role.HasTarget { } - export class Type { + export class Type extends Action implements Role.HasTarget { } - export class Wait { + export class Wait extends Action { } } @@ -97,7 +97,7 @@ declare module Siesta { } } - export class ExtJS { + export class ExtJS extends Browser implements ExtJS.Ajax, ExtJS.Component, ExtJS.DataView, ExtJS.Element, ExtJS.FormField, ExtJS.Grid, ExtJS.Observable, ExtJS.Store, ExtJSCore { } export module ExtJS { @@ -143,7 +143,7 @@ declare module Siesta { export class ActionTarget { } - export class Browser { + export class Browser implements Simulate.Event, Simulate.Keyboard, Simulate.Mouse, TextSelection { } export class Date { @@ -158,13 +158,13 @@ declare module Siesta { export class Function { } - export class jQuery { + export class jQuery extends Browser { } export class More { } - export class SenchaTouch { + export class SenchaTouch extends Browser implements ExtJS.Component, ExtJS.Element, ExtJS.FormField, ExtJS.Observable, ExtJS.Store, ExtJSCore { } export class TextSelection { From 604061b44db014a35c7cb0a62ce166f338668108 Mon Sep 17 00:00:00 2001 From: Qube Date: Thu, 22 Aug 2013 17:10:45 +1000 Subject: [PATCH 03/13] Switched from classes to interfaces. --- siesta/siesta.d.ts | 200 ++++++++++++++++++++++++++++++++------------- 1 file changed, 144 insertions(+), 56 deletions(-) diff --git a/siesta/siesta.d.ts b/siesta/siesta.d.ts index 2046f7089..858f0ff9d 100644 --- a/siesta/siesta.d.ts +++ b/siesta/siesta.d.ts @@ -5,169 +5,257 @@ declare var startTest: typeof StartTest; declare var describe: typeof StartTest; declare module Siesta { - export class Harness { - } - export module Harness { - export class Browser extends Harness { - } - export module Browser { - export class ExtJS extends Browser implements ExtJSCore { + export interface ExtJS extends Browser, ExtJSCore { } - export class ExtJSCore { + export interface ExtJSCore { } - export class SenchaTouch extends Browser implements ExtJSCore { + export interface SenchaTouch extends Browser, ExtJSCore { } } - export class NodeJS implements Harness { + export interface Browser extends Harness { + autoRun: boolean; + + autoScrollElementsIntoView: boolean; + + breakOnFail: boolean; + + coverageUnit: string; + + disableCaching: boolean; + + enableCodeCoverage: boolean; + + excludeCoverageUnits: RegExp; + + hostPageUrl: string; + + includeCoverageUnits: RegExp; + + maintainViewportSize: boolean; + + runCore: string; + + separateContext: boolean; + + simulateEventsWith: string; + + speedRun: boolean; + + testClass: Function; + + useStrictMode: boolean; + + viewDOM: boolean; + + viewportHeight: number; + + viewportWidth: number; + } + + export interface NodeJS extends Harness { } } - export class Test implements Test.BDD, Test.Date, Test.Function, Test.More { + /** + * `Siesta.Harness` is an abstract base harness interface in Siesta hierarchy. This interface provides no UI, you should use one of it subinterfacees, for example Siesta.Harness.Browser. + */ + export interface Harness { + alsoPreload: any[]; + + autoCheckGlobals: boolean; + + cachePreload: boolean; + + defaultTimeout: boolean; + + disableColoring: boolean; + + expectedGlobals: string[]; + + isReadyTimeout: number; + + keepNLastResults: number; + + keepResults: boolean; + + listenters: { + [key: string]: (event: Event, ...args: any[]) => void; + } + + maxThreads: number; + + needDone: boolean; + + overrideSetTimeout: boolean; + + pauseBetweenTests: number; + + preload: any[]; + + runCore: string; + + subTestTimeout: number; + + testClass: Function; + + title: string; + + transparentEx: boolean; + + waitForTimeout: number; + + configure(config: any): void; + + start(...descriptors: any[]): void; } export module Test { - export class Action { - } - export module Action { export module Role { - export class HasTarget { + export interface HasTarget { } } - export class Click extends Action implements Role.HasTarget { + export interface Click extends Action, Role.HasTarget { } - export class Done extends Action { + export interface Done extends Action { } - export class DoubleClick extends Action implements Role.HasTarget { + export interface DoubleClick extends Action, Role.HasTarget { } - export class DoubleTap extends Action implements Role.HasTarget { + export interface DoubleTap extends Action, Role.HasTarget { } - export class Drag extends Action { + export interface Drag extends Action { } - export class Eval extends Action { + export interface Eval extends Action { } - export class LongPress extends Action implements Role.HasTarget { + export interface LongPress extends Action, Role.HasTarget { } - export class MouseDown extends Action implements Role.HasTarget { + export interface MouseDown extends Action, Role.HasTarget { } - export class MouseUp extends Action implements Role.HasTarget { + export interface MouseUp extends Action, Role.HasTarget { } - export class MoveCursor extends Action implements Role.HasTarget { + export interface MoveCursor extends Action, Role.HasTarget { } - export class MoveCursorTo extends Action implements Role.HasTarget { + export interface MoveCursorTo extends Action, Role.HasTarget { } - export class RightClick extends Action implements Role.HasTarget { + export interface RightClick extends Action, Role.HasTarget { } - export class Swipe extends Action implements Role.HasTarget { + export interface Swipe extends Action, Role.HasTarget { } - export class Tap extends Action implements Role.HasTarget { + export interface Tap extends Action, Role.HasTarget { } - export class Type extends Action implements Role.HasTarget { + export interface Type extends Action, Role.HasTarget { } - export class Wait extends Action { + export interface Wait extends Action { } } - export class BDD { + export interface Action { } export module BDD { - export class Expectation { + export interface Expectation { } } - export class ExtJS extends Browser implements ExtJS.Ajax, ExtJS.Component, ExtJS.DataView, ExtJS.Element, ExtJS.FormField, ExtJS.Grid, ExtJS.Observable, ExtJS.Store, ExtJSCore { + export interface BDD { + //any(clsConstructor: Function): any; } export module ExtJS { - export class Ajax { + export interface Ajax { } - export class Component { + export interface Component { } - export class DataView { + export interface DataView { } - export class Element { + export interface Element { } - export class FormField { + export interface FormField { } - export class Grid { + export interface Grid { } - export class Observable { + export interface Observable { } - export class Store { + export interface Store { } } + export interface ExtJS extends Browser, ExtJS.Ajax, ExtJS.Component, ExtJS.DataView, ExtJS.Element, ExtJS.FormField, ExtJS.Grid, ExtJS.Observable, ExtJS.Store, ExtJSCore { + } + export module Simulate { - export class Event { + export interface Event { } - export class Keyboard { + export interface Keyboard { } - export module KeyCodes { + export interface KeyCodes { } - export class Mouse { + export interface Mouse { } } - export class ActionTarget { + export interface ActionTarget { } - export class Browser implements Simulate.Event, Simulate.Keyboard, Simulate.Mouse, TextSelection { + export interface Browser extends Simulate.Event, Simulate.Keyboard, Simulate.Mouse, TextSelection { } - export class Date { + export interface Date { } - export class Element { + export interface Element { } - export class ExtJSCore { + export interface ExtJSCore { } - export class Function { + export interface Function { } - export class jQuery extends Browser { + export interface jQuery extends Browser { } - export class More { + export interface More { } - export class SenchaTouch extends Browser implements ExtJS.Component, ExtJS.Element, ExtJS.FormField, ExtJS.Observable, ExtJS.Store, ExtJSCore { + export interface SenchaTouch extends Browser, ExtJS.Component, ExtJS.Element, ExtJS.FormField, ExtJS.Observable, ExtJS.Store, ExtJSCore { } - export class TextSelection { + export interface TextSelection { } } + + export interface Test extends Test.BDD, Test.Date, Test.Function, Test.More { + } } \ No newline at end of file From 9e5144ad93e268ebcc49742b6c15436ae8c7a84c Mon Sep 17 00:00:00 2001 From: Qube Date: Thu, 22 Aug 2013 20:22:02 +1000 Subject: [PATCH 04/13] Flattening attempt. --- siesta/siesta-tests.ts | 4 +- siesta/siesta.d.ts | 409 ++++++++++++++++++++++------------------- 2 files changed, 224 insertions(+), 189 deletions(-) diff --git a/siesta/siesta-tests.ts b/siesta/siesta-tests.ts index 2439ff84f..618e47aef 100644 --- a/siesta/siesta-tests.ts +++ b/siesta/siesta-tests.ts @@ -7,4 +7,6 @@ startTest(function (t: Siesta.Test) { }); describe(function (t: Siesta.Test) { -}); \ No newline at end of file +}); + +var Harness = Siesta.Harness.Browser.ExtJS; \ No newline at end of file diff --git a/siesta/siesta.d.ts b/siesta/siesta.d.ts index 858f0ff9d..1562b964c 100644 --- a/siesta/siesta.d.ts +++ b/siesta/siesta.d.ts @@ -1,70 +1,8 @@ -declare function StartTest(testScript: (t: Siesta.Test) => void): void; - -declare var startTest: typeof StartTest; - -declare var describe: typeof StartTest; - declare module Siesta { - export module Harness { - export module Browser { - export interface ExtJS extends Browser, ExtJSCore { - } - export interface ExtJSCore { - } + //#region Harness - export interface SenchaTouch extends Browser, ExtJSCore { - } - } - - export interface Browser extends Harness { - autoRun: boolean; - - autoScrollElementsIntoView: boolean; - - breakOnFail: boolean; - - coverageUnit: string; - - disableCaching: boolean; - - enableCodeCoverage: boolean; - - excludeCoverageUnits: RegExp; - - hostPageUrl: string; - - includeCoverageUnits: RegExp; - - maintainViewportSize: boolean; - - runCore: string; - - separateContext: boolean; - - simulateEventsWith: string; - - speedRun: boolean; - - testClass: Function; - - useStrictMode: boolean; - - viewDOM: boolean; - - viewportHeight: number; - - viewportWidth: number; - } - - export interface NodeJS extends Harness { - } - } - - /** - * `Siesta.Harness` is an abstract base harness interface in Siesta hierarchy. This interface provides no UI, you should use one of it subinterfacees, for example Siesta.Harness.Browser. - */ - export interface Harness { + interface IHarness { alsoPreload: any[]; autoCheckGlobals: boolean; @@ -114,148 +52,243 @@ declare module Siesta { start(...descriptors: any[]): void; } - export module Test { - export module Action { - export module Role { - export interface HasTarget { - } - } + interface IHarnessBrowser extends IHarness { + autoRun: boolean; - export interface Click extends Action, Role.HasTarget { - } + autoScrollElementsIntoView: boolean; - export interface Done extends Action { - } + breakOnFail: boolean; - export interface DoubleClick extends Action, Role.HasTarget { - } + coverageUnit: string; - export interface DoubleTap extends Action, Role.HasTarget { - } + disableCaching: boolean; - export interface Drag extends Action { - } + enableCodeCoverage: boolean; - export interface Eval extends Action { - } + excludeCoverageUnits: RegExp; - export interface LongPress extends Action, Role.HasTarget { - } + hostPageUrl: string; - export interface MouseDown extends Action, Role.HasTarget { - } + includeCoverageUnits: RegExp; - export interface MouseUp extends Action, Role.HasTarget { - } + maintainViewportSize: boolean; - export interface MoveCursor extends Action, Role.HasTarget { - } + runCore: string; - export interface MoveCursorTo extends Action, Role.HasTarget { - } + separateContext: boolean; - export interface RightClick extends Action, Role.HasTarget { - } + simulateEventsWith: string; - export interface Swipe extends Action, Role.HasTarget { - } + speedRun: boolean; - export interface Tap extends Action, Role.HasTarget { - } + testClass: Function; - export interface Type extends Action, Role.HasTarget { - } + useStrictMode: boolean; - export interface Wait extends Action { - } - } + viewDOM: boolean; - export interface Action { - } + viewportHeight: number; - export module BDD { - export interface Expectation { - } - } - - export interface BDD { - //any(clsConstructor: Function): any; - } - - export module ExtJS { - export interface Ajax { - } - - export interface Component { - } - - export interface DataView { - } - - export interface Element { - } - - export interface FormField { - } - - export interface Grid { - } - - export interface Observable { - } - - export interface Store { - } - } - - export interface ExtJS extends Browser, ExtJS.Ajax, ExtJS.Component, ExtJS.DataView, ExtJS.Element, ExtJS.FormField, ExtJS.Grid, ExtJS.Observable, ExtJS.Store, ExtJSCore { - } - - export module Simulate { - export interface Event { - } - - export interface Keyboard { - } - - export interface KeyCodes { - } - - export interface Mouse { - } - } - - export interface ActionTarget { - } - - export interface Browser extends Simulate.Event, Simulate.Keyboard, Simulate.Mouse, TextSelection { - } - - export interface Date { - } - - export interface Element { - } - - export interface ExtJSCore { - } - - export interface Function { - } - - export interface jQuery extends Browser { - } - - export interface More { - } - - export interface SenchaTouch extends Browser, ExtJS.Component, ExtJS.Element, ExtJS.FormField, ExtJS.Observable, ExtJS.Store, ExtJSCore { - } - - export interface TextSelection { - } + viewportWidth: number; } - export interface Test extends Test.BDD, Test.Date, Test.Function, Test.More { + interface IHarnessBrowserExtJS extends IHarnessBrowser, IHarnessBrowserExtJSCore { } -} \ No newline at end of file + + interface IHarnessBrowserExtJSCore { + } + + interface IHarnessBrowserSenchaTouch extends IHarnessBrowser, IHarnessBrowserExtJSCore { + } + + interface IHarnessBrowserSingleton extends IHarnessBrowser { + ExtJS: IHarnessBrowserExtJS; + SenchaTouch: IHarnessBrowserSenchaTouch; + } + + interface IHarnessNodeJS extends IHarness { + } + + interface IHarnessSingleton { + Browser: IHarnessBrowserSingleton; + NojeJS: IHarnessNodeJS; + } + + /** + * `Siesta.Harness` is an abstract base harness interface in Siesta hierarchy. This interface provides no UI, you should use one of it subinterfacees, for example Siesta.Harness.Browser. + */ + var Harness: IHarnessSingleton; + + //#endregion + + //#region Test + + interface ITest extends ITestBDD, ITestDate, ITestFunction, ITestMore { + } + + interface ITestBDD { + any(clsConstructor: Function): any; + } + + interface ITestBDDExpectation { + } + + interface ITestDate { + } + + interface ITestFunction { + } + + interface ITestMore { + } + + interface ITestAction { + } + + interface ITestActionClick extends ITestAction, ITestActionRoleHasTarget { + } + + interface ITestActionDone extends ITestAction { + } + + interface ITestActionDoubleClick extends ITestAction, ITestActionRoleHasTarget { + } + + interface ITestActionDoubleTap extends ITestAction, ITestActionRoleHasTarget { + } + + interface ITestActionDrag extends ITestAction { + } + + interface ITestActionEval extends ITestAction { + } + + interface ITestActionLongPress extends ITestAction, ITestActionRoleHasTarget { + } + + interface ITestActionMouseDown extends ITestAction, ITestActionRoleHasTarget { + } + + interface ITestActionMouseUp extends ITestAction, ITestActionRoleHasTarget { + } + + interface ITestActionMoveCursor extends ITestAction, ITestActionRoleHasTarget { + } + + interface ITestActionMoveCursorTo extends ITestAction, ITestActionRoleHasTarget { + } + + interface ITestActionRightClick extends ITestAction, ITestActionRoleHasTarget { + } + + interface ITestActionSwipe extends ITestAction, ITestActionRoleHasTarget { + } + + interface ITestActionTap extends ITestAction, ITestActionRoleHasTarget { + } + + interface ITestActionType extends ITestAction, ITestActionRoleHasTarget { + } + + interface ITestActionWait extends ITestAction { + } + + interface ITestActionRoleHasTarget { + } + + interface ITestBrowser extends ITestElement, ITestSimulateEvent, ITestSimulateKeyboard, ITestSimulateMouse, ITestTextSelection { + } + + interface ITestElement { + } + + interface ITestExtJS extends ITestBrowser, ITestExtJSAjax, ITestExtJSComponent, ITestExtJSDataView, ITestExtJSElement, ITestExtJSFormField, ITestExtJSGrid, ITestExtJSObservable, ITestExtJSStore, ITestExtJSCore { + } + + interface ITestExtJSCore { + } + + interface ITestExtJSAjax { + } + + interface ITestExtJSComponent { + } + + interface ITestExtJSDataView { + } + + interface ITestExtJSElement { + } + + interface ITestExtJSFormField { + } + + interface ITestExtJSGrid { + } + + interface ITestExtJSObservable { + } + + interface ITestExtJSStore { + } + + interface ITestSimulateEvent { + } + + interface ITestSimulateKeyboard { + } + + interface ITestSimulateKeyCodes { + } + + interface ITestSimulateMouse { + } + + interface ITestTextSelection { + } + + interface ITestjQuery extends ITestBrowser { + } + + interface ITestSenchaTouch extends ITestBrowser, ITestExtJSComponent, ITestExtJSElement, ITestExtJSFormField, ITestExtJSObservable, ITestExtJSStore, ITestExtJSCore { + } + + interface ITestSingleton { + new (): Test; + + BDD: { + Expectation: { + new (): ITestBDDExpectation + } + }; + + ExtJS: { + new (): ITestExtJS; + }; + + Browser: { + new (): ITestBrowser; + } + + jQuery: { + new (): ITestjQuery; + }; + + SenchaTouch: { + new (): ITestSenchaTouch; + }; + } + + interface Test extends ITest { + } + + var Test: ITestSingleton; + + //#endregion +} + +declare function StartTest(testScript: (t: Siesta.Test) => void): void; + +declare var startTest: typeof StartTest; + +declare var describe: typeof StartTest; \ No newline at end of file From 98eeae62d72af4ab7a12a5c6fe533f8a184004a8 Mon Sep 17 00:00:00 2001 From: Qube Date: Sat, 24 Aug 2013 21:28:33 +1000 Subject: [PATCH 05/13] Completed harness namespace. --- siesta/siesta-tests.ts | 18 +++++ siesta/siesta.d.ts | 168 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 173 insertions(+), 13 deletions(-) diff --git a/siesta/siesta-tests.ts b/siesta/siesta-tests.ts index 2439ff84f..213990aa7 100644 --- a/siesta/siesta-tests.ts +++ b/siesta/siesta-tests.ts @@ -7,4 +7,22 @@ startTest(function (t: Siesta.Test) { }); describe(function (t: Siesta.Test) { +}); + +var Harness = Siesta.Harness.Browser; + +Harness.start({ + group: 'MyGroup', + items: [ + 'test-script01.js', + 'test-script02.js', + { + url: 'http://somesite.com/test-script03.js', + preload: [{ + type: 'css', + url: 'http://somesite.com/test-script03.css' + }] + } + ], + option1: true }); \ No newline at end of file diff --git a/siesta/siesta.d.ts b/siesta/siesta.d.ts index 2046f7089..e987f3ce6 100644 --- a/siesta/siesta.d.ts +++ b/siesta/siesta.d.ts @@ -5,28 +5,170 @@ declare var startTest: typeof StartTest; declare var describe: typeof StartTest; declare module Siesta { - export class Harness { + + //#region Harness + + class Harness { + alsoPreload: any[]; + + autoCheckGlobals: boolean; + + cachePreload: boolean; + + defaultTimeout: boolean; + + disableColoring: boolean; + + expectedGlobals: string[]; + + isReadyTimeout: number; + + keepNLastResults: number; + + keepResults: boolean; + + listenters: { + [key: string]: (event: Event, ...args: any[]) => void; + } + + maxThreads: number; + + needDone: boolean; + + overrideSetTimeout: boolean; + + pauseBetweenTests: number; + + preload: any[]; + + runCore: string; + + subTestTimeout: number; + + testClass: Siesta.Test; + + title: string; + + transparentEx: boolean; + + waitForTimeout: number; + + configure(config: any): void; + + start(...descriptors: any[]): void; } - export module Harness { - export class Browser extends Harness { + module Harness { + interface ITestGroupDescriptor { + group: string; + + items: any[]; } - export module Browser { - export class ExtJS extends Browser implements ExtJSCore { - } - - export class ExtJSCore { - } - - export class SenchaTouch extends Browser implements ExtJSCore { - } + interface ITestUrlDescriptor { + url: string; } - export class NodeJS implements Harness { + interface IPreloadUrlDescriptor { + type: string; + + url: string; } + + interface IPreloadContentDescriptor { + type: string; + + content: string; + } + + interface IPreloadTextDescriptor { + text: string; + } + + interface IBrowser extends Harness { + autoRun: boolean; + + autoScrollElementsIntoView: boolean; + + breakOnFail: boolean; + + coverageUnit: string; + + disableCaching: boolean; + + enableCodeCoverage: boolean; + + excludeCoverageUnits: RegExp; + + hostPageUrl: string; + + includeCoverageUnits: RegExp; + + maintainViewportSize: boolean; + + runCore: string; + + separateContext: boolean; + + simulateEventsWith: string; + + speedRun: boolean; + + testClass: Function; + + useStrictMode: boolean; + + viewDOM: boolean; + + viewportHeight: number; + + viewportWidth: number; + } + + interface IBrowserExtJSCore { + coverageUnit: string; + + excludeCoverageUnits: RegExp; + + installLoaderInstrumentationHook: boolean; + } + + interface IBrowserExtJS extends IBrowser, IBrowserExtJSCore { + allowExtVersionChange: boolean; + + loaderPath: any; + + waitForAppReady; + + waitForExtReady; + } + + interface IBrowserSenchaTouch extends IBrowser, IBrowserExtJSCore { + loaderPath: any; + + performSetup: boolean; + + runCore: string; + + transparentEx: boolean + } + + interface IBrowserSingleton extends IBrowser { + ExtJS: IBrowserExtJS; + + SenchaTouch: IBrowserSenchaTouch; + } + + interface IHarnessNodeJS extends Harness { + } + + var Browser: IBrowserSingleton; + + var NodeJS: IHarnessNodeJS; } + //#endregion + export class Test implements Test.BDD, Test.Date, Test.Function, Test.More { } From 1745f8ebe5bbb9251e1aeb2837fb191ce0181744 Mon Sep 17 00:00:00 2001 From: Qube Date: Sun, 25 Aug 2013 15:46:08 +1000 Subject: [PATCH 06/13] Fleshed out test namespace. --- siesta/siesta-tests.ts | 20 ++- siesta/siesta.d.ts | 396 ++++++++++++++++++++++++++++++----------- 2 files changed, 308 insertions(+), 108 deletions(-) diff --git a/siesta/siesta-tests.ts b/siesta/siesta-tests.ts index 213990aa7..8962c042f 100644 --- a/siesta/siesta-tests.ts +++ b/siesta/siesta-tests.ts @@ -1,28 +1,32 @@ /// -StartTest(function (t: Siesta.Test) { +StartTest(function (t: Siesta.Test.ExtJS) { }); -startTest(function (t: Siesta.Test) { +startTest(function (t: Siesta.Test.Browser) { }); -describe(function (t: Siesta.Test) { +describe(function (t: Siesta.Test.jQuery) { }); var Harness = Siesta.Harness.Browser; -Harness.start({ +Harness.start({ group: 'MyGroup', items: [ 'test-script01.js', 'test-script02.js', - { + { url: 'http://somesite.com/test-script03.js', - preload: [{ + preload: [{ type: 'css', - url: 'http://somesite.com/test-script03.css' + url: 'http://somesite.com/test-script03.ashx' }] } ], option1: true -}); \ No newline at end of file +}); + +var temp: Siesta.Test.ExtJS; + +var temps: Shapes.Point; diff --git a/siesta/siesta.d.ts b/siesta/siesta.d.ts index e987f3ce6..bf2ec6c1f 100644 --- a/siesta/siesta.d.ts +++ b/siesta/siesta.d.ts @@ -1,14 +1,11 @@ -declare function StartTest(testScript: (t: Siesta.Test) => void): void; - -declare var startTest: typeof StartTest; - -declare var describe: typeof StartTest; - declare module Siesta { //#region Harness - class Harness { + /** + * @abstract + */ + interface IHarness { alsoPreload: any[]; autoCheckGlobals: boolean; @@ -45,7 +42,7 @@ declare module Siesta { subTestTimeout: number; - testClass: Siesta.Test; + testClass: Siesta.ITest; title: string; @@ -59,33 +56,36 @@ declare module Siesta { } module Harness { - interface ITestGroupDescriptor { - group: string; + //interface ITestGroupDescriptor { + // group: string; - items: any[]; - } + // items: any[]; + //} - interface ITestUrlDescriptor { - url: string; - } + //interface ITestUrlDescriptor { + // url: string; + //} - interface IPreloadUrlDescriptor { - type: string; + //interface IPreloadUrlDescriptor { + // type: string; - url: string; - } + // url: string; + //} - interface IPreloadContentDescriptor { - type: string; + //interface IPreloadContentDescriptor { + // type: string; - content: string; - } + // content: string; + //} - interface IPreloadTextDescriptor { - text: string; - } + //interface IPreloadTextDescriptor { + // text: string; + //} - interface IBrowser extends Harness { + /** + * @singleton + */ + interface IBrowser extends IHarness { autoRun: boolean; autoScrollElementsIntoView: boolean; @@ -114,8 +114,6 @@ declare module Siesta { speedRun: boolean; - testClass: Function; - useStrictMode: boolean; viewDOM: boolean; @@ -125,6 +123,9 @@ declare module Siesta { viewportWidth: number; } + /** + * @mixin + */ interface IBrowserExtJSCore { coverageUnit: string; @@ -133,6 +134,9 @@ declare module Siesta { installLoaderInstrumentationHook: boolean; } + /** + * @singleton + */ interface IBrowserExtJS extends IBrowser, IBrowserExtJSCore { allowExtVersionChange: boolean; @@ -143,6 +147,9 @@ declare module Siesta { waitForExtReady; } + /** + * @singleton + */ interface IBrowserSenchaTouch extends IBrowser, IBrowserExtJSCore { loaderPath: any; @@ -159,7 +166,10 @@ declare module Siesta { SenchaTouch: IBrowserSenchaTouch; } - interface IHarnessNodeJS extends Harness { + /** + * @singleton + */ + interface IHarnessNodeJS extends IHarness { } var Browser: IBrowserSingleton; @@ -169,147 +179,333 @@ declare module Siesta { //#endregion - export class Test implements Test.BDD, Test.Date, Test.Function, Test.More { + //#region Test + + /** + * @abstract + */ + interface ITest extends Test.IBDD, Test.IDate, Test.IFunction, Test.IMore { } - export module Test { - export class Action { + module Test { + /** + * @abstract + */ + interface IAction { + desc?: string; } - export module Action { - export module Role { - export class HasTarget { + module Action { + module Role { + /** + * @mixin + */ + interface IHasTarget { + passTargetToNext?: boolean; + + target?: any; + + el?: typeof target; } } - export class Click extends Action implements Role.HasTarget { + /** + * @class + */ + interface Click extends IAction, Role.IHasTarget { + options?: any; } - export class Done extends Action { + /** + * @class + */ + interface Done extends IAction { + delay?: number; } - export class DoubleClick extends Action implements Role.HasTarget { + /** + * @class + */ + interface DoubleClick extends IAction, Role.IHasTarget { + options?: any; } - export class DoubleTap extends Action implements Role.HasTarget { + /** + * @class + */ + interface DoubleTap extends IAction, Role.IHasTarget { } - export class Drag extends Action { + /** + * @class + */ + interface Drag extends IAction { + by?: any; + + dragOnly?: boolean; + + source?: any; + + target?: any; + + to?: any; } - export class Eval extends Action { + /** + * @class + */ + interface Eval extends IAction { + options?: any; } - export class LongPress extends Action implements Role.HasTarget { + /** + * @class + */ + interface LongPress extends IAction, Role.IHasTarget { } - export class MouseDown extends Action implements Role.HasTarget { + /** + * @class + */ + interface MouseDown extends IAction, Role.IHasTarget { + options?: any; } - export class MouseUp extends Action implements Role.HasTarget { + /** + * @class + */ + interface MouseUp extends IAction, Role.IHasTarget { + options?: any; } - export class MoveCursor extends Action implements Role.HasTarget { + /** + * @class + */ + interface MoveCursor extends IAction, Role.IHasTarget { + by?: any; + + to?: any; } - export class MoveCursorTo extends Action implements Role.HasTarget { + /** + * @class + */ + interface MoveCursorTo extends IAction, Role.IHasTarget { } - export class RightClick extends Action implements Role.HasTarget { + /** + * @class + */ + interface RightClick extends IAction, Role.IHasTarget { + options?: any; } - export class Swipe extends Action implements Role.HasTarget { + /** + * @class + */ + interface Swipe extends IAction, Role.IHasTarget { + direction?: string; } - export class Tap extends Action implements Role.HasTarget { + /** + * @class + */ + interface Tap extends IAction, Role.IHasTarget { + options?: any; + + text?: string; } - export class Type extends Action implements Role.HasTarget { + /** + * @class + */ + interface Type extends IAction, Role.IHasTarget { } - export class Wait extends Action { + /** + * @class + */ + interface Wait extends IAction { + args?: any[]; + + delay?: number; + + timeout?: number; + + waitFor?: string; } } - export class BDD { + /** + * @mixin + */ + interface IBDD { + any(clsConstructor: Function): any; + + ddescribe(name: string, code: Function, timeout?: number); + + describe(name: string, code: Function, timeout?: number); + + expect(value: any): BDD.Expectation; + + iit(name: string, code: Function, timeout?: number); + + it(name: string, code: Function, timeout?: number); + + xdescribe(name: string, code: Function, timeout?: number); + + xit(name: string, code: Function, timeout?: number); } - export module BDD { - export class Expectation { + module BDD { + /** + @class + */ + interface Expectation { } } - export class ExtJS extends Browser implements ExtJS.Ajax, ExtJS.Component, ExtJS.DataView, ExtJS.Element, ExtJS.FormField, ExtJS.Grid, ExtJS.Observable, ExtJS.Store, ExtJSCore { + /** + * @mixin + */ + interface IExtJSAjax { } - export module ExtJS { - export class Ajax { + /** + * @mixin + */ + interface IExtJSComponent { + } + + /** + * @mixin + */ + interface IExtJSDataView { + } + + /** + * @mixin + */ + interface IExtJSElement { + } + + /** + * @mixin + */ + interface IExtJSFormField { + } + + /** + * @mixin + */ + interface IExtJSGrid { + } + + /** + * @mixin + */ + interface IExtJSObservable { + } + + /** + * @mixin + */ + interface IExtJSStore { + } + + /** + * @class + */ + interface ExtJS extends Browser, IExtJSAjax, IExtJSComponent, IExtJSDataView, IExtJSElement, IExtJSFormField, IExtJSGrid, IExtJSObservable, IExtJSStore, IExtJSCore { + } + + module Simulate { + /** + * @mixin + */ + interface IEvent { + simulateEventsWith: string; + + simulateEvent(el: any, type: string, the?: any, suppressLog?: boolean): void; } - export class Component { + /** + * @mixin + */ + interface IKeyboard { } - export class DataView { + module KeyCodes { } - export class Element { - } - - export class FormField { - } - - export class Grid { - } - - export class Observable { - } - - export class Store { + /** + * @mixin + */ + interface IMouse { } } - export module Simulate { - export class Event { - } - - export class Keyboard { - } - - export module KeyCodes { - } - - export class Mouse { - } + /** + * @class + */ + interface Browser extends Simulate.IEvent, Simulate.IKeyboard, Simulate.IMouse, IElement, ITextSelection { } - export class ActionTarget { + /** + * @mixin + */ + interface IDate { } - export class Browser implements Simulate.Event, Simulate.Keyboard, Simulate.Mouse, TextSelection { + /** + * @mixin + */ + interface IElement { } - export class Date { + /** + * @mixin + */ + interface IExtJSCore { } - export class Element { + /** + * @mixin + */ + interface IFunction { } - export class ExtJSCore { + /** + * @class + */ + interface jQuery extends Browser { } - export class Function { + /** + * @mixin + */ + interface IMore { } - export class jQuery extends Browser { + /** + * @class + */ + interface SenchaTouch extends Browser, IExtJSComponent, IExtJSElement, IExtJSFormField, IExtJSObservable, IExtJSStore, IExtJSCore { } - export class More { - } - - export class SenchaTouch extends Browser implements ExtJS.Component, ExtJS.Element, ExtJS.FormField, ExtJS.Observable, ExtJS.Store, ExtJSCore { - } - - export class TextSelection { + /** + * @mixin + */ + interface ITextSelection { } } -} \ No newline at end of file + + //#endregion + +} + +declare function StartTest(testScript: (t: Siesta.ITest) => void): void; + +declare var startTest: typeof StartTest; + +declare var describe: typeof StartTest; From ff63b1670642fbb1533e4bc370852b6207f2e5ff Mon Sep 17 00:00:00 2001 From: Qube Date: Sun, 25 Aug 2013 19:28:06 +1000 Subject: [PATCH 07/13] Filled in more Test namespace. --- siesta/siesta-tests.ts | 4 - siesta/siesta.d.ts | 244 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 220 insertions(+), 28 deletions(-) diff --git a/siesta/siesta-tests.ts b/siesta/siesta-tests.ts index 8962c042f..e800d5d7f 100644 --- a/siesta/siesta-tests.ts +++ b/siesta/siesta-tests.ts @@ -26,7 +26,3 @@ Harness.start({ ], option1: true }); - -var temp: Siesta.Test.ExtJS; - -var temps: Shapes.Point; diff --git a/siesta/siesta.d.ts b/siesta/siesta.d.ts index bf2ec6c1f..aa4f47aaa 100644 --- a/siesta/siesta.d.ts +++ b/siesta/siesta.d.ts @@ -56,31 +56,31 @@ declare module Siesta { } module Harness { - //interface ITestGroupDescriptor { - // group: string; + interface ITestGroupDescriptor { + group: string; - // items: any[]; - //} + items: any[]; + } - //interface ITestUrlDescriptor { - // url: string; - //} + interface ITestUrlDescriptor { + url: string; + } - //interface IPreloadUrlDescriptor { - // type: string; + interface IPreloadUrlDescriptor { + type: string; - // url: string; - //} + url: string; + } - //interface IPreloadContentDescriptor { - // type: string; + interface IPreloadContentDescriptor { + type: string; - // content: string; - //} + content: string; + } - //interface IPreloadTextDescriptor { - // text: string; - //} + interface IPreloadTextDescriptor { + text: string; + } /** * @singleton @@ -188,6 +188,14 @@ declare module Siesta { } module Test { + interface IActionCall extends IAction { + (next: (...args: any[]) => void, ...previous: any[]): void; + + action?: IActionCall; + + timeout?: number; + } + /** * @abstract */ @@ -342,19 +350,19 @@ declare module Siesta { interface IBDD { any(clsConstructor: Function): any; - ddescribe(name: string, code: Function, timeout?: number); + ddescribe(name: string, code: Function, timeout?: number): void; - describe(name: string, code: Function, timeout?: number); + describe(name: string, code: Function, timeout?: number): void; expect(value: any): BDD.Expectation; - iit(name: string, code: Function, timeout?: number); + iit(name: string, code: Function, timeout?: number): void; - it(name: string, code: Function, timeout?: number); + it(name: string, code: Function, timeout?: number): void; - xdescribe(name: string, code: Function, timeout?: number); + xdescribe(name: string, code: Function, timeout?: number): void; - xit(name: string, code: Function, timeout?: number); + xit(name: string, code: Function, timeout?: number): void; } module BDD { @@ -362,6 +370,35 @@ declare module Siesta { @class */ interface Expectation { + not: Expectation; + + toBe(expectedValue: any): void; + + toBeCloseTo(expectedValue: number, precision?: number): void; + + toBeDefined(expectedValue: any): void; + + toBeFalsy(expectedValue: any): void; + + toBeGreaterThan(expectedValue: any): void; + + toBeLessThan(expectedValue: any): void; + + toBeNaN(expectedValue: any): void; + + toBeNull(expectedValue: any): void; + + toBeTruthy(expectedValue: any): void; + + toBeUndefined(value: any): void; + + toContain(element: any): void; + + toEqual(expectedValue: any): void; + + toMatch(regexp: RegExp): void; + + toThrow(): void; } } @@ -433,6 +470,9 @@ declare module Siesta { * @mixin */ interface IKeyboard { + keyPress(el: any, key: string, options: any): void; + + type(el: any, text: string, callback?: Function, scope?: any, options?: any): void; } module KeyCodes { @@ -442,6 +482,42 @@ declare module Siesta { * @mixin */ interface IMouse { + dragDelay: number; + + dragPrecision: number; + + moveCursorBetweenPoints: boolean; + + click(el?: any, callback?: Function, scope?: any, options?: any): void; + click(callback?: Function, scope?: any, options?: any): void; + + doubleClick(el?: any, callback?: Function, scope?: any, options?: any): void; + doubleClick(callback?: Function, scope?: any, options?: any): void; + + drag(source: any, target?: any, delta?: number[], callback?: Function, scope?: any, options?: any): void; + + dragBy(source: any, delta: number[], callback?: Function, scope?: any, options?: any, dragOnly?: boolean): void; + + dragTo(source: any, target: any, callback?: Function, scope?: any, options?: any, dragOnly?: boolean): void; + + mouseDown(el: any, options: any): void; + + mouseOut(el: any, options: any): void; + + mouseOver(el: any, options: any): void; + + mouseUp(el: any, options: any): void; + + moveCursorBy(delta: number[], callback?: Function, scope?: any): void; + + moveCursorTo(target?: any, callback?: Function, scope?: any): void; + + moveMouseBy(delta: number[], callback?: Function, scope?: any): void; + + moveMouseTo(target?: any, callback?: Function, scope?: any): void; + + rightClick(el?: any, callback?: Function, scope?: any, options?: any): void; + rightClick(callback?: Function, scope?: any, options?: any): void; } } @@ -449,12 +525,34 @@ declare module Siesta { * @class */ interface Browser extends Simulate.IEvent, Simulate.IKeyboard, Simulate.IMouse, IElement, ITextSelection { + clearTimeout(timeoutId: number): void; + + elementFromPoint(x: number, y: number, shallow?: boolean): HTMLElement; + + firesAtLeastNTimes(observable: any, event: string, n: number, desc: string); + + firesOk(options: any): void; + + firesOnce(observable: any, event: string, desc: string): void; + + isntFired(observable: any, event: string, desc: string): void; + + setTimeout(func: Function, delay: number): number; + + waitForEvent(observable: any, event: string, callback: Function, scope: any, timeout: number): void; + + waitForPageLoad(callback: Function, scope: any): void; + + willFireNTimes(observable: any, event: string, n: number, desc: string): void; + + wontFire(observable: any, event: string, desc: string): void; } /** * @mixin */ interface IDate { + isDateEqual(got: Date, expectedDate: Date, description?: string): void; } /** @@ -473,6 +571,32 @@ declare module Siesta { * @mixin */ interface IFunction { + isCalled(fn: string, host: any, desc: string): void; + isCalled(fn: Function, host: any, desc: string): void; + + isCalledNTimes(fn: string, host: any, n: number, desc: string): void; + isCalledNTimes(fn: Function, host: any, n: number, desc: string): void; + + isCalledOnce(fn: string, host: any, desc: string): void; + isCalledOnce(fn: Function, host: any, desc: string): void; + + isntCalled(fn: string, host: any, n: number, desc: string): void; + isntCalled(fn: Function, host: any, n: number, desc: string): void; + + methodIsCalled(fn: string, className: string, desc: string): void; + methodIsCalled(fn: Function, className: string, desc: string): void; + methodIsCalled(fn: string, className: Function, desc: string): void; + methodIsCalled(fn: Function, className: Function, desc: string): void; + + methodIsCalledNTimes(fn: string, className: string, n: number, desc: string): void; + methodIsCalledNTimes(fn: Function, className: string, n: number, desc: string): void; + methodIsCalledNTimes(fn: string, className: Function, n: number, desc: string): void; + methodIsCalledNTimes(fn: Function, className: Function, n: number, desc: string): void; + + methodIsntCalled(fn: string, className: string, desc: string): void; + methodIsntCalled(fn: Function, className: string, desc: string): void; + methodIsntCalled(fn: string, className: Function, desc: string): void; + methodIsntCalled(fn: Function, className: Function, desc: string): void; } /** @@ -481,10 +605,82 @@ declare module Siesta { interface jQuery extends Browser { } + interface IWaitForConfig { + method: Function; + + callback: Function; + + scope?: any; + + timeout?: number; + + interval?: number; + } + + interface IWaitForReturn { + force: Function + } + /** * @mixin */ interface IMore { + waitForTimeout: number; + + chain(steps: IAction[]): void; + chain(...step: IAction[]): void; + + expectGlobals(...names: any[]): void; + + isApprox(value1: number, value2: number, threshHold: number, desc: string): void; + + isArray(value: any, desc: string): void; + + isBoolean(value: any, desc: string): void; + + isDate(value: any, desc: string): void; + + isDeeply(obj1: any, obj2: any, desc: string): void; + + isDeeplyStrict(obj1: any, obj2: any, desc: string): void; + + isFunction(value: any, desc: string): void; + + isGreater(value1: any, value2: any, desc: string): void; + + isGreaterOrEqual(value1: any, value2: any, desc: string): void; + + isLess(value1: any, value2: any, desc: string): void; + + isLessOrEqual(value1: any, value2: any, desc: string): void; + + isNumber(value: any, desc: string): void; + + isObject(value: any, desc: string): void; + + isRegExp(value: any, desc: string): void; + + isString(value: any, desc: string): void; + + isaOk(value: any, className: string, desc: string): void; + isaOk(value: any, className: Function, desc: string): void; + + like(string: string, regex: string, desc: string): void; + like(string: string, regex: RegExp, desc: string): void; + + livesOk(func: Function, desc: string): void; + + throwsOk(func: Function, expected: string, desc: string): void; + throwsOk(func: Function, expected: RegExp, desc: string): void; + + unlike(string: string, regex: string, desc: string): void; + unlike(string: string, regex: RegExp, desc: string): void; + + verifyGlobals(...names: string[]): void; + + waitFor(wait: number, callback: Function, scope: any, timeout: number, interval?: number): IWaitForReturn; + waitFor(method: Function, callback: Function, scope: any, timeout: number, interval?: number): IWaitForReturn; + waitFor(config: IWaitForConfig): IWaitForReturn; } /** From 641da752e331815c8f4c61a0de82cf0acdde9abe Mon Sep 17 00:00:00 2001 From: Qube Date: Sat, 31 Aug 2013 11:00:00 +1000 Subject: [PATCH 08/13] Populated IElement and IExtCore --- siesta/siesta.d.ts | 229 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 216 insertions(+), 13 deletions(-) diff --git a/siesta/siesta.d.ts b/siesta/siesta.d.ts index aa4f47aaa..4548fec1c 100644 --- a/siesta/siesta.d.ts +++ b/siesta/siesta.d.ts @@ -1,7 +1,4 @@ declare module Siesta { - - //#region Harness - /** * @abstract */ @@ -177,10 +174,6 @@ declare module Siesta { var NodeJS: IHarnessNodeJS; } - //#endregion - - //#region Test - /** * @abstract */ @@ -188,9 +181,11 @@ declare module Siesta { } module Test { - interface IActionCall extends IAction { + interface IActionCall { (next: (...args: any[]) => void, ...previous: any[]): void; + } + interface IActionConfig extends IActionCall, IAction { action?: IActionCall; timeout?: number; @@ -475,7 +470,117 @@ declare module Siesta { type(el: any, text: string, callback?: Function, scope?: any, options?: any): void; } - module KeyCodes { + enum KeyCodes { + '\b' = 8, + 'BACKSPACE' = 8, + + '\t' = 9, + 'TAB' = 9, + + '\r' = 13, + 'RETURN' = 13, + 'ENTER' = 13, + + 'SHIFT' = 16, + 'CTRL' = 17, + 'ALT' = 18, + + 'PAUSE-BREAK' = 19, + 'CAPS' = 20, + 'ESCAPE' = 27, + 'NUM-LOCK' = 144, + 'SCROLL-LOCK' = 145, + 'PRINT' = 44, + + 'PAGE-UP' = 33, + 'PAGE-DOWN' = 34, + 'END' = 35, + 'HOME' = 36, + 'LEFT' = 37, + 'UP' = 38, + 'RIGHT' = 39, + 'DOWN' = 40, + 'INSERT' = 45, + 'DELETE' = 46, + + ' ' = 32, + '0' = 48, + '1' = 49, + '2' = 50, + '3' = 51, + '4' = 52, + '5' = 53, + '6' = 54, + '7' = 55, + '8' = 56, + '9' = 57, + 'A' = 65, + 'B' = 66, + 'C' = 67, + 'D' = 68, + 'E' = 69, + 'F' = 70, + 'G' = 71, + 'H' = 72, + 'I' = 73, + 'J' = 74, + 'K' = 75, + 'L' = 76, + 'M' = 77, + 'N' = 78, + 'O' = 79, + 'P' = 80, + 'Q' = 81, + 'R' = 82, + 'S' = 83, + 'T' = 84, + 'U' = 85, + 'V' = 86, + 'W' = 87, + 'X' = 88, + 'Y' = 89, + 'Z' = 90, + + 'NUM0' = 96, + 'NUM1' = 97, + 'NUM2' = 98, + 'NUM3' = 99, + 'NUM4' = 100, + 'NUM5' = 101, + 'NUM6' = 102, + 'NUM7' = 103, + 'NUM8' = 104, + 'NUM9' = 105, + 'NUM*' = 106, + 'NUM+' = 107, + //'NUM-' = 109, + //'NUM.' = 110, + //'NUM/' = 111, + + ';' = 186, + '=' = 187, + ',' = 188, + '-' = 189, + '.' = 190, + '/' = 191, + '`' = 192, + '[' = 219, + '\\' = 220, + ']' = 221, + '\'' = 222, + + 'F1' = 112, + 'F2' = 113, + 'F3' = 114, + 'F4' = 115, + 'F5' = 116, + 'F6' = 117, + 'F7' = 118, + 'F8' = 119, + 'F9' = 120, + 'F10' = 121, + 'F11' = 122, + 'F12' = 123 } /** @@ -524,7 +629,7 @@ declare module Siesta { /** * @class */ - interface Browser extends Simulate.IEvent, Simulate.IKeyboard, Simulate.IMouse, IElement, ITextSelection { + interface Browser extends ITest, Simulate.IEvent, Simulate.IKeyboard, Simulate.IMouse, IElement, ITextSelection { clearTimeout(timeoutId: number): void; elementFromPoint(x: number, y: number, shallow?: boolean): HTMLElement; @@ -559,12 +664,113 @@ declare module Siesta { * @mixin */ interface IElement { + chainClick(elements: any[], callback: Function): void; + + clickSelector(selector: string, callback: Function, scope?: any): void; + clickSelector(selector: string, root: any, callback: Function, scope?: any): void; + + contentLike(el: any, text: string, description?: string): void; + + contentNotLike(el: any, text: string, description?: string): void; + + elementIsAt(el: any, xy: number[], allowChildren: boolean, description?: string): void; + + elementIsInView(el: any): void; + + elementIsNotTopElement(el: any, allowChildren: boolean, description?: string): void; + + elementIsNotVisible(el: any, description?: string): void; + + elementIsTop(el: any, allowChildren: boolean): boolean; + + elementIsTopElement(el: any, allowChildren: boolean, description?: string, strict?): void; + + elementIsVisible(el: any, description?: string): void; + + findCenter(el: any, local?: boolean): number[]; + + hasCls(el: any, cls: string, description?: string): void; + + hasNotCls(el: any, cls: string, description?: string): void; + + hasNotStyle(el: any, property: string, value: string, description?: string): void; + + hasStyle(el: any, property: string, value: string, description?: string): void; + + isElementVisible(el: any): boolean; + + isInView(el: any, description?: string): void; + + monkeyTest(el: any, nbrInteractions: number, description?: string, callback?: Function, scope?: any): void; + + scrollHorizontallyTo(el: any, newLeft: number, delay?: number, callback?: Function): number; + + scrollVerticallyTo(el: any, newTop: number, delay?: number, callback?: Function): number; + + selectorCountIs(selector: string, count: number, description: string): void; + selectorCountIs(selector: string, root: any, count: number, description: string): void; + + selectorExists(selector: string, description?: string): void; + + selectorIsAt(selector: string, xy: number[], allowChildren: boolean, description?: string): void; + + selectorNotExists(selector: string, description?: string): void; + + waitForContentLike(el: any, text: string, callback: Function, scope: any, timeout: number): void; + + waitForContentNotLike(el: any, text: string, callback: Function, scope: any, timeout: number): void; + + waitForElementNotTop(el: any, callback: Function, scope: any, timeout: number): void; + + waitForElementNotVisible(el: any, callback: Function, scope: any, timeout: number): void; + + waitForElementTop(el: any, callback: Function, scope: any, timeout: number): void; + + waitForElementVisible(el: any, callback: Function, scope: any, timeout: number): void; + + waitForScrollChange(el: any, side: string, callback: Function, scope: any, timeout: number): void; + + waitForScrollLeftChange(el: any, callback: Function, scope: any, timeout: number): void; + + waitForScrollTopChange(el: any, callback: Function, scope: any, timeout: number): void; + + waitForSelector(selector: string, callback: Function, scope: any, timeout: number): void; + waitForSelector(selector: string, root: any, callback: Function, scope: any, timeout: number): void; + + waitForSelectorAt(xy: number[], selector: string, callback: Function, scope: any, timeout: number): void; + + waitForSelectorAtCursor(xy: number[], selector: string, callback: Function, scope: any, timeout: number): void; + + waitForSelectorNotFound(selector: string, callback: Function, scope: any, timeout: number): void; + waitForSelectorNotFound(selector: string, root: any, callback: Function, scope: any, timeout: number): void; + + waitForSelectors(selectors: string[], callback: Function, scope: any, timeout: number): void; + waitForSelectors(selectors: string[], root: any, callback: Function, scope: any, timeout: number): void; + + waitUntilInView(el: any, callback: Function, scope: any, timeout: number): void; } /** * @mixin */ interface IExtJSCore { + Ext(): any; + + clickCQ(selector: string, root: any, callback: Function); + + clickComponentQuery(selector: string, root: any, callback: Function); + + compositeQuery(selector: string, root: any, allowEmpty: boolean): HTMLElement[]; + + cq(selector: string); + + cq1(selector: string); + + getExt(): any; + + knownBugIn(frameworkVersion: string, fn: Function, reason: string); + + requireOk(...args: any[]): void; } /** @@ -695,9 +901,6 @@ declare module Siesta { interface ITextSelection { } } - - //#endregion - } declare function StartTest(testScript: (t: Siesta.ITest) => void): void; From 291d5f5644d76ed0fdf09d388e6e0c11c80403bc Mon Sep 17 00:00:00 2001 From: Qube Date: Sun, 1 Sep 2013 09:24:16 +1000 Subject: [PATCH 09/13] jQuery and Sencha Touch. --- siesta/siesta.d.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/siesta/siesta.d.ts b/siesta/siesta.d.ts index 4548fec1c..9dba36c93 100644 --- a/siesta/siesta.d.ts +++ b/siesta/siesta.d.ts @@ -809,6 +809,7 @@ declare module Siesta { * @class */ interface jQuery extends Browser { + get$(): any; } interface IWaitForConfig { @@ -889,16 +890,40 @@ declare module Siesta { waitFor(config: IWaitForConfig): IWaitForReturn; } + interface IPositionConfig { + x?: number; + + y?: number; + } + /** * @class */ interface SenchaTouch extends Browser, IExtJSComponent, IExtJSElement, IExtJSFormField, IExtJSObservable, IExtJSStore, IExtJSCore { + doubleTap(target: any, callback?: Function, scope?: any, offset?: number[]): void; + + longpress(target: any, callback?: Function, scope?: any, offset?: number[]): void; + + moveFingerBy(delta: number[], callback?: Function, scope?: any): void; + + moveFingerTo(target: any, callback?: Function, scope?: any, offset?: number[]): void; + + scrollUntilElementVisible(scrollable: any, direction: string, actionTarget: any, callback: Function, scope: any): void; + + swipe(target: any, direction: string, callback?: Function, scope?: any): void; + + tap(target: any, callback?: Function, scope?: any): void; + + waitForScrollerPosition(scroller: any, position: IPositionConfig, callback: Function, scope: any, timeout: number): void; } /** * @mixin */ interface ITextSelection { + getSelectedText(el: any): string; + + selectText(el: any, start?: number, end?: number): void; } } } From 73c3b95565d54edf3fcebe62ce6b681599cafc13 Mon Sep 17 00:00:00 2001 From: Qube Date: Sun, 1 Sep 2013 14:44:15 +1000 Subject: [PATCH 10/13] Ext Ajax, Component and DataView. --- siesta/siesta.d.ts | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/siesta/siesta.d.ts b/siesta/siesta.d.ts index 9dba36c93..c4c42331a 100644 --- a/siesta/siesta.d.ts +++ b/siesta/siesta.d.ts @@ -401,18 +401,69 @@ declare module Siesta { * @mixin */ interface IExtJSAjax { + ajaxRequestAndThen(url: string, callback: Function, scope: any): void; + + isAjaxLoading(object?: any, description?: string): void; + + waitForAjaxRequest(callback: Function, scope: any, timeout: number): void; + waitForAjaxRequest(object: any, callback: Function, scope: any, timeout: number): void; } /** * @mixin */ interface IExtJSComponent { + destroysOk(components: any[], description?: string): void; + destroysOk(components: string, description?: string): void; + destroysOk(components: any, description?: string): void; + + hasPosition(component: string, x: number, y: number, description?: string): void; + hasPosition(component: any, x: number, y: number, description?: string): void; + + hasSize(component: string, width: number, height: number, description?: string): void; + hasSize(component: any, width: number, height: number, description?: string): void; + + waitForCQ(query: string, root: any, callback: Function, scope: any, timeout: number): void; + + waitForCQNotFound(query: string, callback: Function, scope: any, timeout: number): void; + + waitForCQNotVisible(query: string, callback: Function, scope: any, timeout: number): void; + + waitForCQVisible(query: string, callback: Function, scope: any, timeout: number): void; + + waitForComponent(component: string, rendered: boolean, callback: Function, scope: any, timeout: number): void; + + waitForComponentNotVisible(component: string, callback: Function, scope: any, timeout: number): void; + waitForComponentNotVisible(component: any, callback: Function, scope: any, timeout: number): void; + + waitForComponentQuery(query: string, root: any, callback: Function, scope: any, timeout: number): void; + + waitForComponentQueryNotFound(query: string, root: any, callback: Function, scope: any, timeout: number): void; + + waitForComponentQueryNotVisible(query: string, root: any, callback: Function, scope: any, timeout: number): void; + + waitForComponentQueryVisible(query: string, root: any, callback: Function, scope: any, timeout: number): void; + + waitForComponentVisible(component: string, callback: Function, scope: any, timeout: number): void; + waitForComponentVisible(component: any, callback: Function, scope: any, timeout: number): void; + + waitForCompositeQuery(query: string, root: any, callback: Function, scope: any, timeout: number): void; + + waitForCompositeQueryNotFound(query: string, root: any, callback: Function, scope: any, timeout: number): void; + + waitForXType(xtype: string, callback: Function, scope: any, timeout: number): void; + waitForXType(xtype: string, root: any, callback: Function, scope: any, timeout: number): void; } /** * @mixin */ interface IExtJSDataView { + getFirstItem(view: string): any; + getFirstItem(view: any): any; + + waitForViewRendered(view: string, callback: Function, scope: any, timeout: number): void; + waitForViewRendered(view: any, callback: Function, scope: any, timeout: number): void; } /** From b620577785f939a2629c68227c46d85d1511e28d Mon Sep 17 00:00:00 2001 From: Qube Date: Sun, 1 Sep 2013 15:06:46 +1000 Subject: [PATCH 11/13] Ext Element, FormField, Grid, Observable and Store. --- siesta/siesta.d.ts | 51 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/siesta/siesta.d.ts b/siesta/siesta.d.ts index c4c42331a..de066a5bd 100644 --- a/siesta/siesta.d.ts +++ b/siesta/siesta.d.ts @@ -413,14 +413,10 @@ declare module Siesta { * @mixin */ interface IExtJSComponent { - destroysOk(components: any[], description?: string): void; - destroysOk(components: string, description?: string): void; destroysOk(components: any, description?: string): void; - hasPosition(component: string, x: number, y: number, description?: string): void; hasPosition(component: any, x: number, y: number, description?: string): void; - hasSize(component: string, width: number, height: number, description?: string): void; hasSize(component: any, width: number, height: number, description?: string): void; waitForCQ(query: string, root: any, callback: Function, scope: any, timeout: number): void; @@ -433,7 +429,6 @@ declare module Siesta { waitForComponent(component: string, rendered: boolean, callback: Function, scope: any, timeout: number): void; - waitForComponentNotVisible(component: string, callback: Function, scope: any, timeout: number): void; waitForComponentNotVisible(component: any, callback: Function, scope: any, timeout: number): void; waitForComponentQuery(query: string, root: any, callback: Function, scope: any, timeout: number): void; @@ -444,7 +439,6 @@ declare module Siesta { waitForComponentQueryVisible(query: string, root: any, callback: Function, scope: any, timeout: number): void; - waitForComponentVisible(component: string, callback: Function, scope: any, timeout: number): void; waitForComponentVisible(component: any, callback: Function, scope: any, timeout: number): void; waitForCompositeQuery(query: string, root: any, callback: Function, scope: any, timeout: number): void; @@ -459,10 +453,8 @@ declare module Siesta { * @mixin */ interface IExtJSDataView { - getFirstItem(view: string): any; getFirstItem(view: any): any; - waitForViewRendered(view: string, callback: Function, scope: any, timeout: number): void; waitForViewRendered(view: any, callback: Function, scope: any, timeout: number): void; } @@ -470,36 +462,79 @@ declare module Siesta { * @mixin */ interface IExtJSElement { + hasRegion(el: any, region: any, description?: string): void; } /** * @mixin */ interface IExtJSFormField { + fieldHasValue(field: any, value: any, description?: string): void; + + isFieldEmpty(field: any, description?: string): void; } /** * @mixin */ interface IExtJSGrid { + getCell(panel: any, row: number, column: number): HTMLElement; + + getFirstCell(panel: any): HTMLElement; + + getFirstRow(panel: any): any; + + getLastCellInRow(panel: any, row: number): HTMLElement; + + getRow(panel: any, index: number): any; + + matchGridCellContent(panel: any, row: number, column: number, string: RegExp, description?: string): void; + matchGridCellContent(panel: any, row: number, column: number, string: string, description?: string): void; + + waitForRowsVisible(panel: any, callback: Function, scope: any, timeout: number): void; } /** * @mixin */ interface IExtJSObservable { + firesAtLeastNTimes(observable: any, event: string, n: number, desc: string): void; + + firesOnce(observable: any, event: string, desc: string): void; + + hasListener(observable: any, eventName: string, description?: string): void; + + isFiredWithSignature(observable: any, event: string, checkerFn: Function, desc: string): void; + + waitForEvent(observable: any, event: string, callback: Function, scope: any, timeout: number): void; + + wontFire(observable: any, event: string, desc: string): void; } /** * @mixin */ interface IExtJSStore { + isStoreEmpty(store: any, description?: string): void; + + loadStoresAndThen(...args: any[]): void; + + waitForStoresToLoad(...args: any[]): void; } /** * @class */ interface ExtJS extends Browser, IExtJSAjax, IExtJSComponent, IExtJSDataView, IExtJSElement, IExtJSFormField, IExtJSGrid, IExtJSObservable, IExtJSStore, IExtJSCore { + assertMaxNumberOfGlobalExtOverrides(maxNumber: number, description?): void; + + assertNoGlobalExtOverrides(description?: string): void; + + assertNoLayoutTriggered(fn: Function, scope: any, description?: string): void; + + getTotalLayoutCounter(): number; + + waitForPageLoad(callback: Function, scope: any): void; } module Simulate { From cb6db2460c0bc9a4b71a3ae9d5e3795057d9cd0a Mon Sep 17 00:00:00 2001 From: Qube Date: Sun, 1 Sep 2013 16:27:28 +1000 Subject: [PATCH 12/13] Optional scope, tests. --- siesta/siesta-tests.ts | 13 ++++++ siesta/siesta.d.ts | 95 +++++++++++++++++++++++------------------- 2 files changed, 64 insertions(+), 44 deletions(-) diff --git a/siesta/siesta-tests.ts b/siesta/siesta-tests.ts index e800d5d7f..e0af1d74a 100644 --- a/siesta/siesta-tests.ts +++ b/siesta/siesta-tests.ts @@ -1,12 +1,25 @@ /// StartTest(function (t: Siesta.Test.ExtJS) { + t.waitForComponentQuery('#myItemId', () => { + t.ajaxRequestAndThen('http://some/url', () => { + t.isBoolean(123, 'not a boolean'); + }, null); + }, null, 2000); }); startTest(function (t: Siesta.Test.Browser) { + t.waitForSelectors(['.class', '#id'], () => { }); }); describe(function (t: Siesta.Test.jQuery) { + var library = t.get$(); + + t.describe('My Module', () => { + t.it('should do something', () => { + t.expect('some string').not.toBe('some other string'); + }); + }); }); var Harness = Siesta.Harness.Browser; diff --git a/siesta/siesta.d.ts b/siesta/siesta.d.ts index de066a5bd..dfffdb45d 100644 --- a/siesta/siesta.d.ts +++ b/siesta/siesta.d.ts @@ -405,8 +405,8 @@ declare module Siesta { isAjaxLoading(object?: any, description?: string): void; - waitForAjaxRequest(callback: Function, scope: any, timeout: number): void; - waitForAjaxRequest(object: any, callback: Function, scope: any, timeout: number): void; + waitForAjaxRequest(callback: Function, scope?: any, timeout?: number): void; + waitForAjaxRequest(object: any, callback: Function, scope?: any, timeout?: number): void; } /** @@ -419,34 +419,41 @@ declare module Siesta { hasSize(component: any, width: number, height: number, description?: string): void; - waitForCQ(query: string, root: any, callback: Function, scope: any, timeout: number): void; + waitForCQ(query: string, callback: Function, scope?: any, timeout?: number): void; + waitForCQ(query: string, root: any, callback: Function, scope?: any, timeout?: number): void; - waitForCQNotFound(query: string, callback: Function, scope: any, timeout: number): void; + waitForCQNotFound(query: string, callback: Function, scope?: any, timeout?: number): void; - waitForCQNotVisible(query: string, callback: Function, scope: any, timeout: number): void; + waitForCQNotVisible(query: string, callback: Function, scope?: any, timeout?: number): void; - waitForCQVisible(query: string, callback: Function, scope: any, timeout: number): void; + waitForCQVisible(query: string, callback: Function, scope?: any, timeout?: number): void; - waitForComponent(component: string, rendered: boolean, callback: Function, scope: any, timeout: number): void; + waitForComponent(component: string, rendered: boolean, callback: Function, scope?: any, timeout?: number): void; - waitForComponentNotVisible(component: any, callback: Function, scope: any, timeout: number): void; + waitForComponentNotVisible(component: any, callback: Function, scope?: any, timeout?: number): void; - waitForComponentQuery(query: string, root: any, callback: Function, scope: any, timeout: number): void; + waitForComponentQuery(query: string, callback: Function, scope?: any, timeout?: number): void; + waitForComponentQuery(query: string, root: any, callback: Function, scope?: any, timeout?: number): void; - waitForComponentQueryNotFound(query: string, root: any, callback: Function, scope: any, timeout: number): void; + waitForComponentQueryNotFound(query: string, callback: Function, scope?: any, timeout?: number): void; + waitForComponentQueryNotFound(query: string, root: any, callback: Function, scope?: any, timeout?: number): void; - waitForComponentQueryNotVisible(query: string, root: any, callback: Function, scope: any, timeout: number): void; + waitForComponentQueryNotVisible(query: string, callback: Function, scope?: any, timeout?: number): void; + waitForComponentQueryNotVisible(query: string, root: any, callback: Function, scope?: any, timeout?: number): void; - waitForComponentQueryVisible(query: string, root: any, callback: Function, scope: any, timeout: number): void; + waitForComponentQueryVisible(query: string, callback: Function, scope?: any, timeout?: number): void; + waitForComponentQueryVisible(query: string, root: any, callback: Function, scope?: any, timeout?: number): void; - waitForComponentVisible(component: any, callback: Function, scope: any, timeout: number): void; + waitForComponentVisible(component: any, callback: Function, scope?: any, timeout?: number): void; - waitForCompositeQuery(query: string, root: any, callback: Function, scope: any, timeout: number): void; + waitForCompositeQuery(query: string, callback: Function, scope?: any, timeout?: number): void; + waitForCompositeQuery(query: string, root: any, callback: Function, scope?: any, timeout?: number): void; - waitForCompositeQueryNotFound(query: string, root: any, callback: Function, scope: any, timeout: number): void; + waitForCompositeQueryNotFound(query: string, callback: Function, scope?: any, timeout?: number): void; + waitForCompositeQueryNotFound(query: string, root: any, callback: Function, scope?: any, timeout?: number): void; - waitForXType(xtype: string, callback: Function, scope: any, timeout: number): void; - waitForXType(xtype: string, root: any, callback: Function, scope: any, timeout: number): void; + waitForXType(xtype: string, callback: Function, scope?: any, timeout?: number): void; + waitForXType(xtype: string, root: any, callback: Function, scope?: any, timeout?: number): void; } /** @@ -455,7 +462,7 @@ declare module Siesta { interface IExtJSDataView { getFirstItem(view: any): any; - waitForViewRendered(view: any, callback: Function, scope: any, timeout: number): void; + waitForViewRendered(view: any, callback: Function, scope?: any, timeout?: number): void; } /** @@ -491,7 +498,7 @@ declare module Siesta { matchGridCellContent(panel: any, row: number, column: number, string: RegExp, description?: string): void; matchGridCellContent(panel: any, row: number, column: number, string: string, description?: string): void; - waitForRowsVisible(panel: any, callback: Function, scope: any, timeout: number): void; + waitForRowsVisible(panel: any, callback: Function, scope?: any, timeout?: number): void; } /** @@ -506,7 +513,7 @@ declare module Siesta { isFiredWithSignature(observable: any, event: string, checkerFn: Function, desc: string): void; - waitForEvent(observable: any, event: string, callback: Function, scope: any, timeout: number): void; + waitForEvent(observable: any, event: string, callback: Function, scope?: any, timeout?: number): void; wontFire(observable: any, event: string, desc: string): void; } @@ -534,7 +541,7 @@ declare module Siesta { getTotalLayoutCounter(): number; - waitForPageLoad(callback: Function, scope: any): void; + waitForPageLoad(callback: Function, scope?: any): void; } module Simulate { @@ -730,9 +737,9 @@ declare module Siesta { setTimeout(func: Function, delay: number): number; - waitForEvent(observable: any, event: string, callback: Function, scope: any, timeout: number): void; + waitForEvent(observable: any, event: string, callback: Function, scope?: any, timeout?: number): void; - waitForPageLoad(callback: Function, scope: any): void; + waitForPageLoad(callback: Function, scope?: any): void; willFireNTimes(observable: any, event: string, n: number, desc: string): void; @@ -802,38 +809,38 @@ declare module Siesta { selectorNotExists(selector: string, description?: string): void; - waitForContentLike(el: any, text: string, callback: Function, scope: any, timeout: number): void; + waitForContentLike(el: any, text: string, callback: Function, scope?: any, timeout?: number): void; - waitForContentNotLike(el: any, text: string, callback: Function, scope: any, timeout: number): void; + waitForContentNotLike(el: any, text: string, callback: Function, scope?: any, timeout?: number): void; - waitForElementNotTop(el: any, callback: Function, scope: any, timeout: number): void; + waitForElementNotTop(el: any, callback: Function, scope?: any, timeout?: number): void; - waitForElementNotVisible(el: any, callback: Function, scope: any, timeout: number): void; + waitForElementNotVisible(el: any, callback: Function, scope?: any, timeout?: number): void; - waitForElementTop(el: any, callback: Function, scope: any, timeout: number): void; + waitForElementTop(el: any, callback: Function, scope?: any, timeout?: number): void; - waitForElementVisible(el: any, callback: Function, scope: any, timeout: number): void; + waitForElementVisible(el: any, callback: Function, scope?: any, timeout?: number): void; - waitForScrollChange(el: any, side: string, callback: Function, scope: any, timeout: number): void; + waitForScrollChange(el: any, side: string, callback: Function, scope?: any, timeout?: number): void; - waitForScrollLeftChange(el: any, callback: Function, scope: any, timeout: number): void; + waitForScrollLeftChange(el: any, callback: Function, scope?: any, timeout?: number): void; - waitForScrollTopChange(el: any, callback: Function, scope: any, timeout: number): void; + waitForScrollTopChange(el: any, callback: Function, scope?: any, timeout?: number): void; - waitForSelector(selector: string, callback: Function, scope: any, timeout: number): void; - waitForSelector(selector: string, root: any, callback: Function, scope: any, timeout: number): void; + waitForSelector(selector: string, callback: Function, scope?: any, timeout?: number): void; + waitForSelector(selector: string, root: any, callback: Function, scope?: any, timeout?: number): void; - waitForSelectorAt(xy: number[], selector: string, callback: Function, scope: any, timeout: number): void; + waitForSelectorAt(xy: number[], selector: string, callback: Function, scope?: any, timeout?: number): void; - waitForSelectorAtCursor(xy: number[], selector: string, callback: Function, scope: any, timeout: number): void; + waitForSelectorAtCursor(xy: number[], selector: string, callback: Function, scope?: any, timeout?: number): void; - waitForSelectorNotFound(selector: string, callback: Function, scope: any, timeout: number): void; - waitForSelectorNotFound(selector: string, root: any, callback: Function, scope: any, timeout: number): void; + waitForSelectorNotFound(selector: string, callback: Function, scope?: any, timeout?: number): void; + waitForSelectorNotFound(selector: string, root: any, callback: Function, scope?: any, timeout?: number): void; - waitForSelectors(selectors: string[], callback: Function, scope: any, timeout: number): void; - waitForSelectors(selectors: string[], root: any, callback: Function, scope: any, timeout: number): void; + waitForSelectors(selectors: string[], callback: Function, scope?: any, timeout?: number): void; + waitForSelectors(selectors: string[], root: any, callback: Function, scope?: any, timeout?: number): void; - waitUntilInView(el: any, callback: Function, scope: any, timeout: number): void; + waitUntilInView(el: any, callback: Function, scope?: any, timeout?: number): void; } /** @@ -971,8 +978,8 @@ declare module Siesta { verifyGlobals(...names: string[]): void; - waitFor(wait: number, callback: Function, scope: any, timeout: number, interval?: number): IWaitForReturn; - waitFor(method: Function, callback: Function, scope: any, timeout: number, interval?: number): IWaitForReturn; + waitFor(wait: number, callback: Function, scope?: any, timeout?: number, interval?: number): IWaitForReturn; + waitFor(method: Function, callback: Function, scope?: any, timeout?: number, interval?: number): IWaitForReturn; waitFor(config: IWaitForConfig): IWaitForReturn; } @@ -1000,7 +1007,7 @@ declare module Siesta { tap(target: any, callback?: Function, scope?: any): void; - waitForScrollerPosition(scroller: any, position: IPositionConfig, callback: Function, scope: any, timeout: number): void; + waitForScrollerPosition(scroller: any, position: IPositionConfig, callback: Function, scope?: any, timeout?: number): void; } /** From e0050868f9a9b064307a95527e84b55e8cac167a Mon Sep 17 00:00:00 2001 From: Qube Date: Sun, 1 Sep 2013 16:43:33 +1000 Subject: [PATCH 13/13] Test core. --- siesta/siesta.d.ts | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/siesta/siesta.d.ts b/siesta/siesta.d.ts index dfffdb45d..449bf262c 100644 --- a/siesta/siesta.d.ts +++ b/siesta/siesta.d.ts @@ -178,6 +178,49 @@ declare module Siesta { * @abstract */ interface ITest extends Test.IBDD, Test.IDate, Test.IFunction, Test.IMore { + isReadyTimeout: number; + + beginAsync(time: number, errback: Function): any; + + compareObjects(obj1: any, obj2: any, strict?: boolean, onlyPrimitives?: boolean, asObjects?: boolean): boolean; + + diag(desc: string): void; + + done(delay: number): void; + + endAsync(frame: any): void; + + endWait(title: string): void; + + fail(desc: string, annotation: any): void; + + getSubTest(name: string, code: (t: ITest) => void, timeout?: number): ITest; + + is(got: any, expected: any, desc: string): void; + + isNot(got: any, expected: any, desc: string): void; + + isNotStrict(got: any, expected: any, desc: string): void; + + isReady(): any; + + isStrict(got: any, expected: any, desc: string): void; + + launchSubTest(subTest: ITest, callback: Function): void; + + notOk(value: any, desc: string): void; + + ok(value: any, desc: string): void; + + pass(desc: string, annotation: any): void; + + subTest(desc: string, code: (t: ITest) => void, callback: Function, timeout?: number): void; + + todo(why: string, code: Function): void; + + typeOf(object: any): string; + + wait(title: string, howLong: number): void; } module Test {