mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-30 17:04:20 +08:00
add types for chai-webdriverio (#21891)
* add types for chai-webdriverio * fix lint warning and remove extra lint rules * fix compilation * added types from webdriverio * try to fix build * try to fix build
This commit is contained in:
committed by
Mohamed Hegazy
parent
6449d48de9
commit
5b310b110f
30
types/chai-webdriverio/chai-webdriverio-tests.ts
Normal file
30
types/chai-webdriverio/chai-webdriverio-tests.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import chai = require('chai');
|
||||
import webdriverio = require('webdriverio');
|
||||
import chaiWebdriverio = require('chai-webdriverio');
|
||||
|
||||
const options = {
|
||||
desiredCapabilities: {
|
||||
browserName: 'firefox'
|
||||
}
|
||||
};
|
||||
|
||||
const browser = webdriverio.remote(options);
|
||||
chai.use(chaiWebdriverio(browser));
|
||||
|
||||
const selector = 'Hello, World!';
|
||||
|
||||
chai.expect(selector).to.be.there();
|
||||
|
||||
chai.expect(selector).to.be.visible();
|
||||
|
||||
chai.expect(selector).to.have.text(selector);
|
||||
|
||||
chai.expect(selector).to.have.text(/regex/);
|
||||
|
||||
chai.expect(selector).to.have.count(10);
|
||||
|
||||
chai.expect(selector).to.have.value('x');
|
||||
|
||||
chai.expect(selector).to.have.value(/regex/);
|
||||
|
||||
chai.expect(selector).to.have.focus();
|
||||
24
types/chai-webdriverio/index.d.ts
vendored
Normal file
24
types/chai-webdriverio/index.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// Type definitions for chai-webdriverio 0.4
|
||||
// Project: https://github.com/marcodejongh/chai-webdriverio
|
||||
// Definitions by: Nikolai Orekhov <https://github.com/sherlock1982>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="webdriverio" />
|
||||
/// <reference types="chai" />
|
||||
|
||||
declare namespace Chai {
|
||||
interface Assertion {
|
||||
count: (count: number) => void;
|
||||
focus: () => void;
|
||||
text: (expected: string|number|RegExp) => void;
|
||||
there: () => void;
|
||||
value: (expected: string|number|RegExp) => void;
|
||||
visible: () => void;
|
||||
immediately: Assertion;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'chai-webdriverio' {
|
||||
function chaiWebdriverIO(client: WebdriverIO.Client<void>, options?: any): (chai: any, utils: any) => void;
|
||||
export = chaiWebdriverIO;
|
||||
}
|
||||
24
types/chai-webdriverio/tsconfig.json
Normal file
24
types/chai-webdriverio/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"chai-webdriverio-tests.ts"
|
||||
]
|
||||
}
|
||||
7
types/chai-webdriverio/tslint.json
Normal file
7
types/chai-webdriverio/tslint.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-single-declare-module" : false,
|
||||
"no-declare-current-package": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user