Fix lint review

This commit is contained in:
amzac
2017-11-25 21:47:40 +01:00
parent af47b2bfc5
commit a0c5e8a72c
3 changed files with 25 additions and 88 deletions
+24 -13
View File
@@ -4,7 +4,6 @@
// Connor Schlesiger <https://github.com/schlesiger>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface NightwatchCustomPageObjects {
page: {};
}
@@ -632,6 +631,7 @@ export interface NightwatchTypedCallbackResult<T> {
state: Error | string;
}
// tslint:disable-next-line:no-empty-interface
export interface NightwatchCallbackResult extends NightwatchTypedCallbackResult<any> {
}
@@ -885,7 +885,7 @@ export interface NightwatchAPI {
* @param callback: Optional callback function to be called when the command finishes.
* @returns The value of the attribute
*/
getAttribute(selector: string, attribute: string, callback?: (this:NightwatchAPI, result: NightwatchCallbackResult) => void): this;
getAttribute(selector: string, attribute: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this;
/**
* Retrieve a single cookie visible to the current page. The cookie is returned as a cookie JSON object, as defined here.
@@ -1303,7 +1303,7 @@ export interface NightwatchAPI {
* callback providing a done callback function for completion as the first argument. Two parameters: allows for asynchronous execution
* with the "api" object passed in as the first argument, followed by the done callback.
*/
perform(callback: (done?: () => void) => void): this;
perform(callback: (done?: () => void) => void): this; // tslint:disable-line:unified-signatures
/**
* Resizes the current window.
@@ -1557,7 +1557,9 @@ export interface NightwatchAPI {
* ```
* @param selector: The selector (CSS / Xpath) used to locate the element.
* @param time: The number of milliseconds to wait. The runner performs repeated checks every 500 ms.
* @param abortOnFailure: By the default if the element is not found the test will fail. Set this to false if you wish for the test to continue even if the assertion fails. To set this globally you can define a property `abortOnNightwatchAssertionsFailure` in your globals.
* @param abortOnFailure: By the default if the element is not found the test will fail.
* Set this to false if you wish for the test to continue even if the assertion fails.
* To set this globally you can define a property `abortOnNightwatchAssertionsFailure` in your globals.
* @param callback: Optional callback function to be called when the command finishes.
* @param message: Optional message to be shown in the output; the message supports two placeholders: %s for current selector and %d for the time (e.g. Element %s was not in the page for %d ms).
*/
@@ -1845,7 +1847,8 @@ export interface NightwatchAPI {
/**
* Send a sequence of key strokes to the active element. The sequence is defined in the same format as the sendKeys command.
* An object map with available keys and their respective UTF-8 characters, as defined on W3C WebDriver draft spec, is loaded onto the main Nightwatch instance as client.Keys.
* Rather than the setValue, the modifiers are not released at the end of the call. The state of the modifier keys is kept between calls, so mouse interactions can be performed while modifier keys are depressed.
* Rather than the setValue, the modifiers are not released at the end of the call.
* The state of the modifier keys is kept between calls, so mouse interactions can be performed while modifier keys are depressed.
* @param keysToSend: The keys sequence to be sent.
* @param callback: Optional callback function to be called when the command finishes.
*/
@@ -1860,8 +1863,10 @@ export interface NightwatchAPI {
mouseButtonClick(button: string, callback?: () => void): this;
/**
* Click and hold the left mouse button (at the coordinates set by the last moveto command). Note that the next mouse-related command that should follow is mouseButtonUp . Any other mouse command (such as click or another call to buttondown) will yield undefined behaviour.
* Can be used for implementing drag-and-drop. The button can be (0, 1, 2) or ('left', 'middle', 'right'). It defaults to left mouse button, and if you don't pass in a button but do pass in a callback, it will handle it correctly.
* Click and hold the left mouse button (at the coordinates set by the last moveto command). Note that the next mouse-related command that should follow is mouseButtonUp .
* Any other mouse command (such as click or another call to buttondown) will yield undefined behaviour.
* Can be used for implementing drag-and-drop. The button can be (0, 1, 2) or ('left', 'middle', 'right').
* It defaults to left mouse button, and if you don't pass in a button but do pass in a callback, it will handle it correctly.
* @param button: The mouse button
* @param callback: Optional callback function to be called when the command finishes.
*/
@@ -1869,14 +1874,16 @@ export interface NightwatchAPI {
/**
* Releases the mouse button previously held (where the mouse is currently at). Must be called once for every mouseButtonDown command issued.
* Can be used for implementing drag-and-drop. The button can be (0, 1, 2) or ('left', 'middle', 'right'). It defaults to left mouse button, and if you don't pass in a button but do pass in a callback, it will handle it correctly.
* Can be used for implementing drag-and-drop. The button can be (0, 1, 2) or ('left', 'middle', 'right').
* It defaults to left mouse button, and if you don't pass in a button but do pass in a callback, it will handle it correctly.
* @param button: The mouse button
* @param callback: Optional callback function to be called when the command finishes.
*/
mouseButtonUp(button: string, callback?: () => void): this;
/**
* Move the mouse by an offset of the specificed element. If no element is specified, the move is relative to the current mouse cursor. If an element is provided but no offset, the mouse will be moved to the center of the element.
* Move the mouse by an offset of the specificed element. If no element is specified, the move is relative to the current mouse cursor.
* If an element is provided but no offset, the mouse will be moved to the center of the element.
* If the element is not visible, it will be scrolled into view.
* @param element: Opaque ID assigned to the element to move to. If not specified or is null, the offset is relative to current position of the mouse.
* @param xofset: X offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element.
@@ -1995,14 +2002,16 @@ export interface NightwatchAPI {
/**
* Configure the amount of time that a particular type of operation can execute for before they are aborted and a |Timeout| error is returned to the client.
* @param typeOfOperation: The type of operation to set the timeout for. Valid values are: "script" for script timeouts, "implicit" for modifying the implicit wait timeout and "page load" for setting a page load timeout.
* @param typeOfOperation: The type of operation to set the timeout for.
* Valid values are: "script" for script timeouts, "implicit" for modifying the implicit wait timeout and "page load" for setting a page load timeout.
* @param ms: The amount of time, in milliseconds, that time-limited commands are permitted to run.
* @param callback: Optional callback function to be called when the command finishes.
*/
timeouts(typeOfOperation: string, ms: number, callback?: () => void): this;
/**
* Set the amount of time, in milliseconds, that asynchronous scripts executed by /session/:sessionId/execute_async are permitted to run before they are aborted and a |Timeout| error is returned to the client.
* Set the amount of time, in milliseconds, that asynchronous scripts executed by /session/:sessionId/execute_async are permitted
* to run before they are aborted and a |Timeout| error is returned to the client.
* @param ms: The amount of time, in milliseconds, that time-limited commands are permitted to run.
* @param callback: Optional callback function to be called when the command finishes.
*/
@@ -2085,7 +2094,8 @@ export interface NightwatchAPI {
windowMaximize(handleOrName?: string, callback?: () => void): this;
/**
* Change or get the position of the specified window. If the second argument is a function it will be used as a callback and the call will perform a get request to retrieve the existing window position.
* Change or get the position of the specified window. If the second argument is a function it will be used as a callback and the call
* will perform a get request to retrieve the existing window position.
* @param windowHandle:
* @param: offsetX:
* @param: offsetY:
@@ -2142,8 +2152,10 @@ export interface NightwatchAPI {
launch_url: string;
}
/* tslint:disable-next-line:no-empty-interface */
export interface NightwatchCustomCommands {}
/* tslint:disable-next-line:no-empty-interface */
export interface NightwatchCustomAssertions {}
export interface NightwatchBrowser extends NightwatchAPI, NightwatchCustomCommands, NightwatchCustomAssertions, NightwatchCustomPageObjects { }
@@ -2195,4 +2207,3 @@ export interface Nightwatch {
api: NightwatchAPI;
client: NightwatchClient;
}
+1 -1
View File
@@ -7,7 +7,7 @@ const test: NightwatchTests = {
.waitForElementVisible('body', 1000)
.setValue('input[type=text]', 'nightwatch')
.waitForElementVisible('button[name=btnG]', 1000)
.getTitle(function(result){
.getTitle(function(result) {
this.assert.equal(typeof result, 'string');
})
.click('button[name=btnG]')
-74
View File
@@ -1,79 +1,5 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
}