{"_id":"@bretkikehara/karma-webdriverio-launcher","_rev":"1-a2b9df9a5658e288dee5303af90821bc","name":"@bretkikehara/karma-webdriverio-launcher","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.2":{"name":"@bretkikehara/karma-webdriverio-launcher","version":"0.0.2","description":"A Karma plugin. Wrapper for running tests on Selenium server using the webdriverio bindings.","main":"dist/index.js","scripts":{"build":"tsc -p tsconfig.json","watch":"tsc -p tsconfig.json -w"},"repository":{"type":"git","url":"git@github.com:bretkikehara/karma-webdriverio-launcher.git"},"keywords":["karma","karma-plugin","karma-launcher","webdriverio","webdriver","screenshots","screenshot","selenium"],"author":{"name":"Bret K. Ikehara","email":"bret.k.ikehara@gmail.com"},"license":"MIT","devDependencies":{"@types/node":"^8.0.0"},"dependencies":{"webdriverio":"^5.0.0"},"engines":{"node":">=8.0.0"},"licenseText":"Copyright 2019 Bret K. Ikehara <bret.k.ikehara@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@bretkikehara/karma-webdriverio-launcher@0.0.2","dist":{"shasum":"876b3b6fb029c649e27f0922b2b554c4b3ad0e11","integrity":"sha512-SKpcqEnyd/PWPfD1nnbowlngWrIaHxllnvWJSwwD1xv1VHMbzXhCK/NmoZiJqhAVRDamjwQTBE1fiNDLQY/Lww==","tarball":"https://registry.npmjs.org/@bretkikehara/karma-webdriverio-launcher/-/karma-webdriverio-launcher-0.0.2.tgz","fileCount":18,"unpackedSize":14570,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcl1WKCRA9TVsSAnZWagAAeg8P+gNR1b9chLWmHfaHSC81\nFGVmWzUyEYD5vdctS+434R/zNIpY5aZdCFZs/bDJG/nZoV5el8HQmYMhGzTT\nFnSiCz09rHXNwz2WAJPR+3ow1tiu2HVGL94PtGAjqSzh3AktCVn9H6blntFU\na1jyntAdF+rwHz4qBkO6Ilp0sBYvDCnpBj9L3YdnjX4pUKy3MOesgQHBPGNW\nOZfmOFFzCNc1Sd/rKXxl8bvKafZN+vcOdwbW9Le+E+r0x/g7LZuHqK8mCp4p\nxd7ZQrmp+IteZcyIBzTRimVvqqXHLkAsPn1bS63sC0bIMBmnj4Duiz15TgsX\nMbq3f9UMpnKUNH5fejp4AV3ylaimo7qNKjCczZyUpG+ykYgd4c6ynq1Xvmfz\nwQ5aJYKOh3RC922hWur/JQJ4N0MUOjg/lkIAK0Jo1WMv1PDUUYYwXyjT9qUq\ny/jWeWnP28sEymHo4nqKT/ZJbfLARwsQhL0wDrbFGLpW5GYVIf3gQrnUQfYJ\nqVEZudSc6Rx1zsq0MiY5zW4Y2hXuSPtdiV0Cs5583ZaMm5MA3Uk1s+PBn9Ov\nQMnIVDllgbiOhqswpsMYaBZOpUJ2DnO+xelw+vbxEpQBGMSyaesw0BMmLm1k\nadGyN+oqDD0r/Tgdcaln0pcAvUzurtLz6s8KUsP2IwOAXDIxWlbELQj894pm\ng9Pu\r\n=zwpd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC2rXYrk7cfpEiyHJH89Zz/Xhgr+L6XGflHmxyt20vPDgIhAII8B4EvWybPz3ACowIQm64YcFOYSs5JJyOCNSKFhoNr"}]},"maintainers":[{"name":"bretkikehara","email":"bret.k.ikehara@gmail.com"}],"_npmUser":{"name":"bretkikehara","email":"bret.k.ikehara@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/karma-webdriverio-launcher_0.0.2_1553421705293_0.4088324560582377"},"_hasShrinkwrap":false}},"time":{"created":"2019-03-24T10:01:45.293Z","0.0.2":"2019-03-24T10:01:45.685Z","modified":"2022-04-04T20:31:31.444Z"},"maintainers":[{"name":"bretkikehara","email":"bret.k.ikehara@gmail.com"}],"description":"A Karma plugin. Wrapper for running tests on Selenium server using the webdriverio bindings.","keywords":["karma","karma-plugin","karma-launcher","webdriverio","webdriver","screenshots","screenshot","selenium"],"repository":{"type":"git","url":"git@github.com:bretkikehara/karma-webdriverio-launcher.git"},"author":{"name":"Bret K. Ikehara","email":"bret.k.ikehara@gmail.com"},"license":"MIT","readme":"karma-webdriverio-launcher\n============================================================\n\n# Minimun config\n\nThere are 3 configs that power this tool: `wdioLauncher`, `middleware`, and `customLaunchers`.\n\n* `wdioLauncher` defines the hooks to manipulate a test. This will be run once per browser instance.\n* `middleware` enables the tests to signify which hook to run.\n* `customLaunchers` defines the browser configuration.\n\n```js\n// karma.conf.js\nmodule.exports = function (config) {\n  config.set({\n    frameworks: ['mocha', 'chai'],\n    // NOTE: This is how the tests signifies to karma server to run the custom commands.\n    middleware: ['webdriverio'],\n    browsers: ['selenium_firefox', 'selenium_chrome'],\n    // NOTE: Defines the custom selenium browsers!\n    customLaunchers: {\n      selenium_firefox: {\n        // webdriverio base launcher\n        base: 'webdriverio',\n        // user generated name\n        name: 'wd_firefox',\n        // selenium capabilties config\n        capabilities: {\n          browserName: 'firefox',\n        }\n      },\n      selenium_chrome: {\n        // webdriverio base launcher\n        base: 'webdriverio',\n        // user generated name\n        name: 'wd_chrome',\n        // selenium capabilties config\n        capabilities: {\n          browserName: 'chrome',\n        },\n      },\n    },\n    files: [\n      // your test files\n    ],\n    // NOTE: Defines the custom commands to run!\n    wdioLauncher: {\n      screenshot(driver, { meta }) {\n        // dumps screenshots in the ./tmp/screenshots path.\n        return driver.saveScreenshot('./tmp/screenshots/' + meta + '.png');\n      },\n    },\n  });\n};\n```\n\n### Define a custom job\n\nIn the `wdioLauncher` config, define a function. The\n\n* `driver` WDIO browser instance.\n* `cmd` The command object\n    * `raw` The raw command\n    * `typ` should be CMD\n    * `action` the action that is running.\n    * `meta` the data that was sent.\n\n```\nwdioLauncher: {\n  screenshotXYZ(driver, cmd) {\n    // dumps screenshots in the ./tmp/screenshots path.\n    return driver.saveScreenshot('./tmp/screenshots/' + cmd.meta + '.png');\n  },\n}\n```\n\n### Run a custom job\n\n```\nimport { execCallback, execPromise } from '@bretkikehara/karma-webdriverio-launcher/dist/browser';\n\ndescribe('mytest', () => {\n  it('add element', (done) => {\n    var div = document.createElement('div');\n    div.style.display = 'inline-block';\n    div.style.background = 'red';\n    div.style.height = '20px';\n    div.style.width = '20px';\n    document.body.appendChild(div);\n\n    var action = 'screenshotXYZ';\n    var meta = 'my-picture-cb';\n    execCallback(action, meta, done);\n  });\n\n  it('add element', async (done) => {\n    var div = document.createElement('div');\n    div.style.display = 'inline-block';\n    div.style.background = 'red';\n    div.style.height = '20px';\n    div.style.width = '20px';\n    document.body.appendChild(div);\n\n    var action = 'screenshotXYZ';\n    var meta = 'my-picture-pr';\n    await execPromise(action, meta);\n  });\n});\n```\n","readmeFilename":"README.md"}