mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
fixing the typings for selenium-webdriver/testing (#15854)
This commit is contained in:
parent
8595416269
commit
42c26dbe9c
3
types/selenium-webdriver/index.d.ts
vendored
3
types/selenium-webdriver/index.d.ts
vendored
@ -3,7 +3,8 @@
|
||||
// Definitions by: Bill Armstrong <https://github.com/BillArmstrong>,
|
||||
// Yuki Kokubun <https://github.com/Kuniwak>,
|
||||
// Craig Nishina <https://github.com/cnishina>,
|
||||
// Simon Gellis <https://github.com/SupernaviX>
|
||||
// Simon Gellis <https://github.com/SupernaviX>,
|
||||
// Ben Dixon <https://github.com/bendxn>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
|
||||
@ -959,30 +959,3 @@ async function TestAsyncAwaitable() {
|
||||
let thenable: webdriver.promise.Promise<string> = new webdriver.promise.Promise<string>((resolve, reject) => resolve('foo'));
|
||||
let str: string = await thenable;
|
||||
}
|
||||
|
||||
function TestTestingModule() {
|
||||
testing.before(() => {
|
||||
});
|
||||
|
||||
testing.beforeEach(() => {
|
||||
});
|
||||
|
||||
testing.describe('My test suite', () => {
|
||||
testing.it('My test', () => {
|
||||
});
|
||||
|
||||
testing.iit('My exclusive test.', () => {
|
||||
});
|
||||
});
|
||||
|
||||
testing.xdescribe('My disabled suite', () => {
|
||||
testing.xit('My disabled test.', () => {
|
||||
});
|
||||
});
|
||||
|
||||
testing.after(() => {
|
||||
});
|
||||
|
||||
testing.afterEach(() => {
|
||||
});
|
||||
}
|
||||
|
||||
46
types/selenium-webdriver/test/testing.ts
Normal file
46
types/selenium-webdriver/test/testing.ts
Normal file
@ -0,0 +1,46 @@
|
||||
import { Builder, By, until, WebDriver } from 'selenium-webdriver';
|
||||
import { describe, before, after, it, ignore, xdescribe, xit, beforeEach, afterEach, controlFlow } from 'selenium-webdriver/testing';
|
||||
|
||||
describe('Google Search', () => {
|
||||
let driver: WebDriver;
|
||||
|
||||
before(() => {
|
||||
driver = new Builder().forBrowser('firefox').build();
|
||||
});
|
||||
|
||||
beforeEach(() => { });
|
||||
|
||||
after(() => {
|
||||
driver.quit();
|
||||
});
|
||||
|
||||
afterEach(() => { });
|
||||
|
||||
it('should append query to title', () => {
|
||||
const flow = controlFlow();
|
||||
flow.execute(() => {
|
||||
driver.get('http://www.google.com/ncr');
|
||||
driver.findElement(By.name('q')).sendKeys('webdriver');
|
||||
driver.findElement(By.name('btnG')).click();
|
||||
driver.wait(until.titleIs('webdriver - Google Search'), 1000);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
ignore(maybe).it('is flaky', () => {
|
||||
if (Math.random() < 0.5) throw Error();
|
||||
});
|
||||
|
||||
function maybe() { return Math.random() < 0.5; }
|
||||
|
||||
describe.only('just this', () => {
|
||||
it.only('just this too', () => { });
|
||||
});
|
||||
|
||||
describe.skip('not this', () => {
|
||||
it.skip('not this either', () => { });
|
||||
});
|
||||
|
||||
xdescribe('not this', () => {
|
||||
xit('not this either', () => { });
|
||||
});
|
||||
85
types/selenium-webdriver/testing.d.ts
vendored
85
types/selenium-webdriver/testing.d.ts
vendored
@ -1,9 +1,30 @@
|
||||
/**
|
||||
* Registers a new test suite.
|
||||
* @param name The suite name.
|
||||
* @param fn The suite function, or {@code undefined} to define a pending test suite.
|
||||
*/
|
||||
export function describe(name: string, fn: Function): void;
|
||||
import { promise } from './index';
|
||||
import * as Testing from './testing';
|
||||
|
||||
export const describe: {
|
||||
/**
|
||||
* Registers a new test suite.
|
||||
* @param name The suite name.
|
||||
* @param fn The suite function, or {@code undefined} to define a pending test suite.
|
||||
*/
|
||||
(name: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* An alias for {@link #describe()} that marks the suite as exclusive,
|
||||
* suppressing all other test suites.
|
||||
* @param {string} name The suite name.
|
||||
* @param {function()=} opt_fn The suite function, or `undefined` to define
|
||||
* a pending test suite.
|
||||
*/
|
||||
only(name: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* Defines a suppressed test suite.
|
||||
* @param name The suite name.
|
||||
* @param fn The suite function, or {@code undefined} to define a pending test suite.
|
||||
*/
|
||||
skip(name: string, fn: Function): void;
|
||||
};
|
||||
|
||||
/**
|
||||
* Defines a suppressed test suite.
|
||||
@ -36,20 +57,30 @@ export function before(fn: Function): void;
|
||||
*/
|
||||
export function beforeEach(fn: Function): void;
|
||||
|
||||
/**
|
||||
* Add a test to the current suite.
|
||||
* @param name The test name.
|
||||
* @param fn The test function, or {@code undefined} to define a pending test case.
|
||||
*/
|
||||
export function it(name: string, fn: Function): void;
|
||||
export const it: {
|
||||
/**
|
||||
* Add a test to the current suite.
|
||||
* @param name The test name.
|
||||
* @param fn The test function, or {@code undefined} to define a pending test case.
|
||||
*/
|
||||
(name: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* An alias for {@link #it()} that flags the test as the only one that should
|
||||
* be run within the current suite.
|
||||
* @param name The test name.
|
||||
* @param fn The test function, or {@code undefined} to define a pending test case.
|
||||
*/
|
||||
export function iit(name: string, fn: Function): void;
|
||||
/**
|
||||
* An alias for {@link #it()} that flags the test as the only one that should
|
||||
* be run within the current suite.
|
||||
* @param {string} name The test name.
|
||||
* @param {function()=} opt_fn The test function, or `undefined` to define
|
||||
* a pending test case.
|
||||
*/
|
||||
only(name: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* Adds a test to the current suite while suppressing it so it is not run.
|
||||
* @param name The test name.
|
||||
* @param fn The test function, or {@code undefined} to define a pending test case.
|
||||
*/
|
||||
skip(name: string, fn: Function): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a test to the current suite while suppressing it so it is not run.
|
||||
@ -57,3 +88,19 @@ export function iit(name: string, fn: Function): void;
|
||||
* @param fn The test function, or {@code undefined} to define a pending test case.
|
||||
*/
|
||||
export function xit(name: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* @return {!promise.ControlFlow} the control flow instance used by this module
|
||||
* to coordinate test actions.
|
||||
*/
|
||||
export function controlFlow(): promise.ControlFlow;
|
||||
|
||||
/**
|
||||
* Ignores the test chained to this function if the provided predicate returns
|
||||
* true.
|
||||
* @param {function(): boolean} predicateFn A predicate to call to determine
|
||||
* if the test should be suppressed. This function MUST be synchronous.
|
||||
* @return {!Object} An object with wrapped versions of {@link #it()} and
|
||||
* {@link #describe()} that ignore tests as indicated by the predicate.
|
||||
*/
|
||||
export function ignore(predicateFn: () => boolean): typeof Testing;
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
"test/index.ts",
|
||||
"test/chrome.ts",
|
||||
"test/firefox.ts",
|
||||
"test/remote.ts"
|
||||
"test/remote.ts",
|
||||
"test/testing.ts"
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user