{"id":15093015,"url":"https://github.com/angular/jasminewd","last_synced_at":"2025-04-05T06:10:35.538Z","repository":{"id":17652983,"uuid":"20457532","full_name":"angular/jasminewd","owner":"angular","description":"Adapter for Jasmine-to-WebDriverJS","archived":false,"fork":false,"pushed_at":"2022-06-12T12:31:08.000Z","size":111,"stargazers_count":47,"open_issues_count":26,"forks_count":36,"subscribers_count":12,"default_branch":"jasminewd2","last_synced_at":"2025-03-29T05:09:24.562Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/angular.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-03T20:02:21.000Z","updated_at":"2025-03-20T14:28:49.000Z","dependencies_parsed_at":"2022-09-06T10:50:53.212Z","dependency_job_id":null,"html_url":"https://github.com/angular/jasminewd","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular%2Fjasminewd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular%2Fjasminewd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular%2Fjasminewd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular%2Fjasminewd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angular","download_url":"https://codeload.github.com/angular/jasminewd/tar.gz/refs/heads/jasminewd2","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294541,"owners_count":20915340,"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-09-25T11:02:56.576Z","updated_at":"2025-04-05T06:10:35.522Z","avatar_url":"https://github.com/angular.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"jasminewd2 [![Build Status](https://travis-ci.org/angular/jasminewd.svg?branch=jasminewd2)](https://travis-ci.org/angular/jasminewd)\n=========\n\nAdapter for Jasmine-to-WebDriverJS. Used by [Protractor](http://www.github.com/angular/protractor).\n\n**Important:** There are two active branches of jasminewd.\n\n - [jasminewd1](https://github.com/angular/jasminewd/tree/jasminewd1) is an adapter for Jasmine 1.3, and uses the package minijasminenode. It is published to npm as `jasminewd`.\n - [jasminewd2](https://github.com/angular/jasminewd/tree/jasminewd2) is an adapter for Jasmine 2.x, and uses the package jasmine. It is published to npm as `jasminewd2`.\n\nFeatures\n--------\n\n - Automatically makes tests asynchronously wait until the WebDriverJS control flow is empty.\n\n - If a `done` function is passed to the test, waits for both the control flow and until done is called.\n\n - If a test returns a promise, waits for both the control flow and the promise to resolve.\n\n - Enhances `expect` so that it automatically unwraps promises before performing the assertion.\n\nInstallation\n------------\n```\nnpm install jasminewd2\n```\n\nUsage\n-----\n\nIn your setup:\n\n```js\nvar JasmineRunner = require('jasmine');\nvar jrunner = new JasmineRunner();\nvar webdriver = require('selenium-webdriver');\n\nglobal.driver = new webdriver.Builder().\n    usingServer('http://localhost:4444/wd/hub').\n    withCapabilities({browserName: 'chrome'}).\n    build();\n\nrequire('jasminewd2').init(driver.controlFlow(), webdriver);\n\njrunner.projectBaseDir = '';\njrunner.execute(['**/*_spec.js']);\n```\n\nIn your tests:\n\n```js\ndescribe('tests with webdriver', function() {\n  it('will wait until webdriver is done', function() {\n    // This will be an asynchronous test. It will finish once webdriver has\n    // loaded the page, found the element, and gotten its text.\n    driver.get('http://www.example.com');\n\n    var myElement = driver.findElement(webdriver.By.id('hello'));\n\n    // Here, expect understands that myElement.getText() is a promise,\n    // and resolves it before asserting.\n    expect(myElement.getText()).toEqual('hello world');\n  });\n})\n```\n\nTypeScript\n----------\n\nFor the typings related to the changes in the global jasmine variables (e.g.\nallowing `it()` blocks to return a promise), we publish the package\n`@types/jasminewd2`.  If you are writing tests using jasminewd (including\nProtractor tests), be sure to include `@types/jasminewd2` in your\n`devDependencies`, as these global type modifications are ***not*** bundled with\nthe `jasminewd2` npm module.\n\njasminewd also exports one function directly: `init`.  Unfortunately, we do not\npublish typings for this function.  If you call this function directly (e.g. you\nare a Protractor dev), you should simply do:\n\n```ts\nrequire('jasminewd2').init(controlFlow, webdriver);\n```\n\n`async` functions / `await`\n---------------------------\n\n`async` functions and the `await` keyword are likely coming in ES2017 (ES8), and\navailable via several compilers.  At the moment, they often break the WebDriver\ncontrol flow.\n([GitHub issue](https://github.com/SeleniumHQ/selenium/issues/3037)).  You can\nstill use them, but if you do then you will have to use `await`/Promises for\nalmost all your synchronization.  See `spec/asyncAwaitAdapterSpec.ts` and\n`spec/asyncAwaitErrorSpec.ts` for examples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangular%2Fjasminewd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangular%2Fjasminewd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangular%2Fjasminewd/lists"}