Skip to content

Commit

Permalink
test: remove use of standalone mode just to verify where commands are…
Browse files Browse the repository at this point in the history
… registered
  • Loading branch information
tehhowch committed Feb 27, 2024
1 parent 210fdfc commit ff1bbcc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Update repo GH action dependencies
- Update WDIO to v8.32 to fix Chromedriver download URL (thanks @seanpoulter)
- Fix property check that broke compatibility with WDIO versions before v6.10
- Fix issue with unit test concurrency by removing unnecessary use of WebdriverIO `remote`

### [ [>](https://github.com/webdriverio-community/wdio-intercept-service/tree/v4.3.0) ] 4.4.0 / 24.02.2023
- Promptly throw if the user passes an invalid "index" parameter to `getRequest`
Expand Down
19 changes: 8 additions & 11 deletions test/spec/plugin_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
'use strict';

const assert = require('assert');
const { remote } = require('webdriverio');
const WebdriverAjax = require('../../index').default;
const { TestHeaders } = require('../utils/header-parser');
// Since we serve the content from a file, the content-length depends on if the host is
Expand Down Expand Up @@ -42,18 +41,16 @@ describe('webdriverajax', function testSuite() {

describe('before hook', function () {
it('registers service methods with specific browser instance when provided', async function () {
const browser = await remote({
capabilities: {
browserName: 'chrome',
'goog:chromeOptions': {
args: ['--headless', '--disable-gpu'],
},
},
});
const commands = [];
const instanceBrowser = { addCommand: (name) => commands.push(name) };

new WebdriverAjax().before(null, null, browser);
new WebdriverAjax().before(null, null, instanceBrowser);

assert.strictEqual(typeof browser.setupInterceptor, 'function');
assert.strictEqual(
commands.some((name) => name === 'setupInterceptor'),
true,
'should add commands to specific browser instance',
);
});

it('registers service methods on the global browser when not provided a specific instance', async function () {
Expand Down

0 comments on commit ff1bbcc

Please sign in to comment.