{"id":22382459,"url":"https://github.com/jcoreio/chai-webdriverio-async","last_synced_at":"2026-02-18T01:03:41.539Z","repository":{"id":40783760,"uuid":"236602940","full_name":"jcoreio/chai-webdriverio-async","owner":"jcoreio","description":"chai assertions for webdriverio without node-fibers","archived":false,"fork":false,"pushed_at":"2024-12-10T20:18:32.000Z","size":2770,"stargazers_count":0,"open_issues_count":26,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-10T21:19:09.743Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jcoreio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-27T21:50:11.000Z","updated_at":"2024-12-10T20:17:49.000Z","dependencies_parsed_at":"2024-04-09T03:46:08.325Z","dependency_job_id":null,"html_url":"https://github.com/jcoreio/chai-webdriverio-async","commit_stats":{"total_commits":223,"total_committers":4,"mean_commits":55.75,"dds":0.179372197309417,"last_synced_commit":"0884953f5b5458cdc1e95c7e40bbf8d7a32608d8"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fchai-webdriverio-async","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fchai-webdriverio-async/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fchai-webdriverio-async/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fchai-webdriverio-async/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcoreio","download_url":"https://codeload.github.com/jcoreio/chai-webdriverio-async/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236608479,"owners_count":19176458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-05T00:13:05.640Z","updated_at":"2025-10-15T12:30:41.897Z","avatar_url":"https://github.com/jcoreio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chai-webdriverio-async\n\n[![CircleCI](https://circleci.com/gh/jcoreio/chai-webdriverio-async.svg?style=svg)](https://circleci.com/gh/jcoreio/chai-webdriverio-async)\n[![Coverage Status](https://codecov.io/gh/jcoreio/chai-webdriverio-async/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/chai-webdriverio-async)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![npm version](https://badge.fury.io/js/chai-webdriverio-async.svg)](https://badge.fury.io/js/chai-webdriverio-async)\n\nAsync fork of [chai-webdriverio](https://github.com/marcodejongh/chai-webdriverio).\n\nProvides async [webdriverio](https://npmjs.org/package/webdriverio) sugar for the [Chai](http://chaijs.com/) assertion library. Allows you to create expressive integration tests:\n\n```javascript\nawait expect('.frequency-field').to.have.text('One time')\nawait expect('.toggle-pane').to.not.be.displayed()\n```\n\n## What sorts of assertions can we make?\n\nAll assertions start with a [WebdriverIO-compatible selector](http://webdriver.io/guide/usage/selectors.html), for example:\n\n- `expect('.list')` (CSS selector)\n- `expect('a[href=http://google.com]')` (CSS Selector)\n- `expect('//BODY/DIV[6]/DIV[1]')` (XPath selector)\n- `expect('a*=Save')` (Text selector)\n\nThen, we can add our assertion to the chain.\n\n- `await expect(selector).to.be.clickable()` - Test whether [at least one] matching element is clickable\n- `await expect(selector).to.be.displayed()` - Test whether or not [at least one] matching element is displayed\n- `await expect(selector).to.be.displayedInViewport()` - Test whether or not [at least one] matching element is displayed in viewport\n- `await expect(selector).to.be.existing()` - Test whether [at least one] matching element exists in the DOM\n- `await expect(selector).to.be.focused()` - Test whether or not [at least one] matching element is focused\n- `await expect(selector).to.be.selected()` - Test whether or not [at least one] matching element is selected\n- `await expect(selector).to.have.text('string')` - Test the text value of the selected element(s) against supplied string. Succeeds if at least one element matches exactly\n- `await expect(selector).to.have.text(/regex/)` - Test the text value of the selected element(s) against the supplied regular expression. Succeeds if at least one element matches\n- `await expect(selector).to.have.text(/regex/)` - Test the text value of the selected element(s) against the supplied regular expression. Succeeds if at least one element matches\n- `await expect(selector).text.to.ordered.include.members(['foo', 'bar'])` - Test that the text of the selected elements includes `'foo'` followed by `'bar'`\n- `await expect(selector).text.to.have.members(['foo', 'bar'])` - Test that the text of the selected elements is exactly the set `['foo', 'bar']`, in any order\n- `await expect(selector).text.to.satisfy(fn)` - Test that `fn` returns `true` when called with the array of texts of the selected elements\n- `await expect(selector).to.have.attribute('attributeName')` - Test whether [at least one] matching element has the given attribute\n- `await expect(selector).to.have.attribute('attributeName', 'string')` - Test the attribute value of the selected element(s) against supplied string. Succeeds if at least one element matches exactly\n- `await expect(selector).to.have.attribute('attributeName', /regex/)` - Test the attribute value of the selected element(s) against supplied regular expression. Succeeds if at least one element matches exactly\n- `await expect(selector).to.have.count(n)` - Test that exactly `n` elements exist in the DOM with the supplied selector\n- `await expect(selector).to.have.count.above(n)` - Test that more than `n` elements exist in the DOM with the supplied selector\n- `await expect(selector).to.have.count.below(n)` - Test that less than `n` elements exist in the DOM with the supplied selector\n- `await expect(selector).to.have.count.at.least(n)` - Test that at least `n` elements exist in the DOM with the supplied selector\n- `await expect(selector).to.have.count.at.most(n)` - Test that at most `n` elements exist in the DOM with the supplied selector\n- `await expect(selector).to.have.value('string')` - Test that [at least one] selected element has a value matching the given string\n- `await expect(selector).to.have.value(/regex/)` - Test that [at least one] selected element has a value matching the given regular expression\n- `await expect(selector).value.to.ordered.include.members(['foo', 'bar'])` - Test that the value of the selected elements includes `'foo'` followed by `'bar'`\n- `await expect(selector).value.to.have.members(['foo', 'bar'])` - Test that the value of the selected elements is exactly the set `['foo', 'bar']`, in any order\n- `await expect(selector).value.to.satisfy(fn)` - Test that `fn` returns `true` when called with the array of values of the selected elements\n- `await expect(selector).to.have.focus()` - (alias for `to.be.focused()`)\n\nYou can also always add a `not` in there to negate the assertion:\n\n- `await expect(selector).not.to.have.text('property')`\n\n## Assertions on promises resolving to elements\n\nYou can also use the same assertions above on promises that resolve to an element or array of elements:\n\n```js\nawait expect(browser.$('.foo')).to.be.clickable()\n```\n\nThis allows you to use the [Page Object Pattern](https://webdriver.io/docs/pageobjects/).\n\nHowever, if an assertion fails, the error message won't contain the selector _unless_ you attach it to `promise.selector`, e.g.:\n\n```js\nawait expect(\n  Object.assign(browser.$('.foo'), { selector: '.foo' })\n).to.be.clickable()\n```\n\nObviously you wouldn't want to do this manually, but rather wrap the `browser` methods to attach the `selector` property.\n\n## How to wait for one of these conditions to be true?\n\nJust use [`chai-wait-for`](https://github.com/jcoreio/chai-wait-for) and replace `expect` on any assertion with `waitFor`,\nwhere `waitFor` is created by calling `boundWaitFor`.\n\n[Do not use implicit wait all all, ever.](https://stackoverflow.com/questions/10404160/when-to-use-explicit-wait-vs-implicit-wait-in-selenium-webdriver/28067495#28067495).\n\n## Setup\n\nSetup is pretty easy. Just:\n\n```javascript\nvar chai = require('chai')\nvar chaiWebdriver = require('chai-webdriverio').default\nchai.use(chaiWebdriver(browser))\n\n// And you're good to go!\nawait browser.url('http://github.com')\nawait chai\n  .expect('#site-container h1.heading')\n  .to.not.contain.text(\"I'm a kitty!\")\n```\n\n## Compatability\n\n### WebdriverIO\n\nOnly intended to be compatible with Webdriver 5/6 right now.\n\n### Node.js\n\nRequires Node.js 8.x\n\n**Contributors:**\n\n- [@mltsy](https://github.com/mltsy) : `exist`, `text` assertions, documentation \u0026 test adjustments\n\n## License\n\nApache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcoreio%2Fchai-webdriverio-async","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcoreio%2Fchai-webdriverio-async","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcoreio%2Fchai-webdriverio-async/lists"}