<commit_before># selenium-smart-wait

[![Build Status](https://travis-ci.org/marmelab/selenium-smart-wait.svg?branch=master)](https://travis-ci.org/marmelab/selenium-smart-wait)

Conditions for common usage of [selenium-webdriver](http://seleniumhq.github.io/selenium/docs/api/javascript/index.html),
built to avoid random test failures on CI.

## Installation

Install with:

```sh
npm install --save-dev selenium-smart-wait
```

or

```sh
yarn add --dev selenium-smart-wait
```

## Usage

Simply import the exported conditions and pass them to `driver.wait`:

```js
import { elementValueIs } from 'selenium-smart-wait';
import { By } from 'selenium-webdriver';

const TIMEOUT = 5000;

// ... mocha, jasmine, whatever ...
await driver.wait(elementValueIs(By.css('.my-input'), 'expected value'), TIMEOUT);

```

All conditions expect either an existing [WebElement](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebElement.html)
, a `locator` such as `By.css('.my_css_class')` (see selenium webdriver documentation on [WebDriver](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html),
especially the `findElement` and `findElements` methods) or a string. If a string is given, it will be considered as a css selector.

## API

- `elementsCountIs`: wait until the specified count of elements is found.
- `elementValueIs`: wait until the element has the specified value. *You should only pass input elements to this condition.*
- `elementIsClicked`: wait until the element has been successfully clicked.
- `elementHasBeenSentKeys`: wait until the element has successfully been sent keys clicked.

Some conditions from `selenium-webdriver` have also been added but you can now pass them a `locator` too (please refer to the
selenium webdriver [documentation](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/until.html)
for details about them):

- `elementIsDisabled`
- `elementIsEnabled`
- `elementIsNotSelected`
- `elementIsNotVisible`
- `elementIsSelected`
- `elementIsVisible`
- `elementTextContains`
- `elementTextIs`
- `elementTextMatches`
- `stalenessOf`

## Contributing

Coverage data is available in `./coverage` after executing `make test`.

An HTML report is generated in `./coverage/lcov-report/index.html`.<commit_msg>Add sample for overriden base selenium conditions<commit_after># selenium-smart-wait

[![Build Status](https://travis-ci.org/marmelab/selenium-smart-wait.svg?branch=master)](https://travis-ci.org/marmelab/selenium-smart-wait)

Conditions for common usage of [selenium-webdriver](http://seleniumhq.github.io/selenium/docs/api/javascript/index.html),
built to avoid random test failures on CI.

## Installation

Install with:

```sh
npm install --save-dev selenium-smart-wait
```

or

```sh
yarn add --dev selenium-smart-wait
```

## Usage

Simply import the exported conditions and pass them to `driver.wait`:

```js
import { elementValueIs } from 'selenium-smart-wait';
import { By } from 'selenium-webdriver';

const TIMEOUT = 5000;

// ... mocha, jasmine, whatever ...
await driver.wait(elementValueIs(By.css('.my-input'), 'expected value'), TIMEOUT);

```

All conditions expect either an existing [WebElement](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebElement.html)
, a `locator` such as `By.css('.my_css_class')` (see selenium webdriver documentation on [WebDriver](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html),
especially the `findElement` and `findElements` methods) or a string. If a string is given, it will be considered as a css selector.

## API

- `elementsCountIs`: wait until the specified count of elements is found.
- `elementValueIs`: wait until the element has the specified value. *You should only pass input elements to this condition.*
- `elementIsClicked`: wait until the element has been successfully clicked.
- `elementHasBeenSentKeys`: wait until the element has successfully been sent keys clicked.

Some conditions from `selenium-webdriver` have also been added but you can now pass them a `locator` too (please refer to the
selenium webdriver [documentation](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/until.html)
for details about them):

- `elementIsDisabled`
- `elementIsEnabled`
- `elementIsNotSelected`
- `elementIsNotVisible`
- `elementIsSelected`
- `elementIsVisible`
- `elementTextContains`
- `elementTextIs`
- `elementTextMatches`
- `stalenessOf`

Use them like this:

```js
import { stalenessOf } from 'selenium-smart-wait';
import { By } from 'selenium-webdriver';

const TIMEOUT = 5000;

// ... mocha, jasmine, whatever ...
await driver.wait(stalenessOf(By.css('.my-input')), TIMEOUT);
```

## Contributing

Coverage data is available in `./coverage` after executing `make test`.

An HTML report is generated in `./coverage/lcov-report/index.html`.
{'fraction_non_alphanumeric': 0.12390786338363781, 'fraction_numerical': 0.0023828435266084196, 'mean_word_length': 5.046818727490996, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3330017', 'n_tokens_mistral': 1619, 'n_tokens_neox': 1516, 'n_words': 443}