Я пытаюсь интегрировать Applitools с проектом webdriverio. подробности ниже,
версия узла: v12.18.2
npm версия: 6.14.5
версия wdio: 6.3.6 Мой файл wdio
имеет службу, как показано ниже,
службы: ['selenium-standalone'],
Затем я установил приложения с помощью команды npm install '@applitools/eyes.webdriverio' --save-dev
, теперь, когда я запускаю проект с использованием npm run test
, я получаю следующую ошибку:
> webdriverio-applitools_1@1.0.0 test D:\WebDriverIO\WebDriverIo-Applitools_1
> wdio wdio.conf.js
Execution of 1 spec files started at 2020-08-04T11:33:02.577Z
2020-08-04T11:33:02.725Z INFO @wdio/cli:launcher: Run onPrepare hook
2020-08-04T11:33:04.515Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2020-08-04T11:33:04.518Z INFO @wdio/local-runner: Start worker 0-0 with arg: wdio.conf.js
[0-0] 2020-08-04T11:33:04.903Z INFO @wdio/local-runner: Run worker command: run
[0-0] 2020-08-04T11:33:04.911Z INFO webdriverio: Initiate new session using the ./protocol-stub protocol
[0-0] RUNNING in chrome - D:\WebDriverIO\WebDriverIo-Applitools_1\main\visual.js
[0-0] 2020-08-04T11:33:06.448Z INFO webdriverio: Initiate new session using the webdriver protocol
[0-0] 2020-08-04T11:33:06.449Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session
[0-0] 2020-08-04T11:33:06.450Z INFO webdriver: DATA {
capabilities: {
alwaysMatch: { browserName: 'chrome', acceptInsecureCerts: true },
firstMatch: [ {} ]
},
desiredCapabilities: { browserName: 'chrome', acceptInsecureCerts: true }
}
[0-0] 2020-08-04T11:33:09.975Z INFO webdriver: COMMAND getTitle()
[0-0] 2020-08-04T11:33:09.975Z INFO webdriver: [GET] http://localhost:4444/wd/hub/session/4e3081702a2e0e07eba23d42fa81fce4/title
[0-0] Title of page is [object Promise]
[0-0] 2020-08-04T11:33:09.980Z INFO webdriver: COMMAND navigateTo("https://applitools.com/helloworld")
[0-0] 2020-08-04T11:33:09.980Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/4e3081702a2e0e07eba23d42fa81fce4/url
2020-08-04T11:33:09.980Z INFO webdriver: DATA { url: 'https://applitools.com/helloworld' }
[0-0] TypeError in "my first visual test should look visually perfect"
browser.getViewportSize is not a function
[0-0] 2020-08-04T11:33:09.988Z INFO webdriver: COMMAND deleteSession()
[0-0] 2020-08-04T11:33:09.988Z INFO webdriver: [DELETE] http://localhost:4444/wd/hub/session/4e3081702a2e0e07eba23d42fa81fce4
[0-0] 2020-08-04T11:33:09.997Z INFO webdriver: RESULT
[0-0] FAILED in chrome - D:\WebDriverIO\WebDriverIo-Applitools_1\main\visual.js
2020-08-04T11:33:12.348Z INFO @wdio/cli:launcher: Run onComplete hook
2020-08-04T11:33:12.349Z INFO @wdio/selenium-standalone-service: shutting down all browsers
"spec" Reporter:
------------------------------------------------------------------
[chrome 84.0.4147.105 windows #0-0] Spec: D:\WebDriverIO\WebDriverIo-Applitools_1\main\visual.js
[chrome 84.0.4147.105 windows #0-0] Running: chrome (v84.0.4147.105) on windows
[chrome 84.0.4147.105 windows #0-0] Session ID: 4e3081702a2e0e07eba23d42fa81fce4
[chrome 84.0.4147.105 windows #0-0]
[chrome 84.0.4147.105 windows #0-0] my first visual test
[chrome 84.0.4147.105 windows #0-0] ✖ should look visually perfect
[chrome 84.0.4147.105 windows #0-0]
[chrome 84.0.4147.105 windows #0-0] 1 failing (2.2s)
[chrome 84.0.4147.105 windows #0-0]
[chrome 84.0.4147.105 windows #0-0] 1) my first visual test should look visually perfect
[chrome 84.0.4147.105 windows #0-0] browser.getViewportSize is not a function
[chrome 84.0.4147.105 windows #0-0] TypeError: browser.getViewportSize is not a function
[chrome 84.0.4147.105 windows #0-0] at Context.<anonymous> (D:\WebDriverIO\WebDriverIo-Applitools_1\main\/visual.js:15:42)
[chrome 84.0.4147.105 windows #0-0] at Context.executeAsync (D:\WebDriverIO\WebDriverIo-Applitools_1\node_modules\@wdio\utils\build\shim.js:123:21)
[chrome 84.0.4147.105 windows #0-0] at Context.testFrameworkFnWrapper (D:\WebDriverIO\WebDriverIo-Applitools_1\node_modules\@wdio\utils\build\test-framework\testFnWrapper.js:49:28)
Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:09
2020-08-04T11:33:12.353Z INFO @wdio/local-runner: Shutting down spawned worker
2020-08-04T11:33:12.603Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2020-08-04T11:33:12.604Z INFO @wdio/local-runner: shutting down
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webdriverio-applitools_1@1.0.0 test: `wdio wdio.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webdriverio-applitools_1@1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\soham\AppData\Roaming\npm-cache\_logs\2020-08-04T11_33_12_626Z-debug.log
У меня есть тестовый пример, который выглядит следующим образом:
const {Eyes, Target} = require('@applitools/eyes.webdriverio');
const eyes = new Eyes();
eyes.setApiKey('API KEY');
describe('my first visual test', function () {
it('should look visually perfect', async function () {
browser.url('./helloworld');
const pageTitle = browser.getTitle();
console.log(`Title of page is ${pageTitle}`)
try {
//const viewportSize = browser.getViewportSize();
await eyes.open(browser, 'Hello World!', 'My first Javascript test!');
await eyes.check('Main Page', Target.window());
browser.click('button');
await eyes.check('Click!', Target.window());
await eyes.close();
} finally {
await eyes.abortIfNotClosed();
}
})
});
Кто-нибудь может сказать мне, что мне здесь не хватает? или что мне делать?