gpt4 book ai didi

javascript - Webdriver.IO 接收到 : "npm ERR! Test failed. See above for more details." but can't see the errors

转载 作者:行者123 更新时间:2023-11-30 06:19:27 25 4
gpt4 key购买 nike

我创建了一个简单的测试来验证特定站点中面包屑的出现次数是否为 2:

站点是:https://theculturetrip.com/europe/united-kingdom/england/london/before-you-go/

2 个面包屑导航(蓝色圆圈): breadcrumbs_screenshot

我的测试:('[itemprop="item"]' 是面包屑按钮 CSS 选择器)

it.only('Upper display shows the breadcrumbs', function () {
let breadcrumbsAppearancesNumber = $$('[itemprop="item"]').length;
expect(breadcrumbsAppearancesNumber).to.equal(2);
});

对于 2,它运行良好。

但是,当我插入 3 时只是为了测试目的:

it.only('Upper display shows the breadcrumbs', function () {
let breadcrumbsAppearancesNumber = $$('[itemprop="item"]').length;
expect(breadcrumbsAppearancesNumber).to.equal(3);
});

它显然失败了,输出为:“npm ERR!测试失败。有关更多详细信息,请参见上文。”

但是,当我在上方滚动时,我没有看到任何错误消息可以为我提供有关失败原因的额外信息...

显示:

Stdout:

2019-01-06T11:35:15.971Z INFO wdio-cli:Launcher: Run onPrepare hook

2019-01-06T11:35:19.200Z INFO wdio-local-runner: Start worker 0-0 with arg: --spec=tests/InnerArticleTest.js

[0-0] 2019-01-06T11:35:19.579Z INFO wdio-local-runner: Run worker command: run

[0-0] 2019-01-06T11:35:19.749Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session

[0-0] 2019-01-06T11:35:19.749Z INFO webdriver: DATA { capabilities:

{ alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },

desiredCapabilities: { browserName: 'chrome' } }

[0-0] 2019-01-06T11:35:22.427Z INFO webdriver: COMMAND navigateTo("https://theculturetrip.com/europe/united-kingdom/england/london/before-you-go/")

[0-0] 2019-01-06T11:35:22.428Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session/d7e2b630ea4d1841e919ec800890b592/url

[0-0] 2019-01-06T11:35:22.428Z INFO webdriver: DATA { url:

'https://theculturetrip.com/europe/united-kingdom/england/london/before-you-go/' }

[0-0] 2019-01-06T11:35:28.394Z INFO webdriver: COMMAND findElement("css selector", "[class*="LayoutWrapper"]")

[0-0] 2019-01-06T11:35:28.394Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session/d7e2b630ea4d1841e919ec800890b592/element

[0-0] 2019-01-06T11:35:28.394Z INFO webdriver: DATA { using: 'css selector', value: '[class*="LayoutWrapper"]' }

[0-0] 2019-01-06T11:35:28.417Z INFO webdriver: RESULT { ELEMENT: '0.5487788910074598-1' }

[0-0] 2019-01-06T11:35:28.439Z INFO webdriver: COMMAND isElementDisplayed("0.5487788910074598-1")

[0-0] 2019-01-06T11:35:28.439Z INFO webdriver: [GET] http://127.0.0.1:4444/wd/hub/session/d7e2b630ea4d1841e919ec800890b592/element/0.5487788910074598-1/displayed

[0-0] 2019-01-06T11:35:28.455Z INFO webdriver: RESULT true

[0-0] 2019-01-06T11:35:28.456Z INFO webdriver: COMMAND findElement("css selector", "[class*="_Icon-"]")

[0-0] 2019-01-06T11:35:28.456Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session/d7e2b630ea4d1841e919ec800890b592/element

[0-0] 2019-01-06T11:35:28.456Z INFO webdriver: DATA { using: 'css selector', value: '[class*="_Icon-"]' }

[0-0] 2019-01-06T11:35:28.471Z INFO webdriver: RESULT { ELEMENT: '0.5487788910074598-2' }

[0-0] 2019-01-06T11:35:28.473Z INFO webdriver: COMMAND elementClick("0.5487788910074598-2")

[0-0] 2019-01-06T11:35:28.473Z INFO webdriver: COMMAND elementClick("0.5487788910074598-2")

[0-0] 2019-01-06T11:35:28.473Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session/d7e2b630ea4d1841e919ec800890b592/element/0.5487788910074598-2/click

[0-0] 2019-01-06T11:35:28.528Z INFO webdriver: COMMAND findElements("css selector", "[itemprop="item"]")

[0-0] 2019-01-06T11:35:28.528Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session/d7e2b630ea4d1841e919ec800890b592/elements

[0-0] 2019-01-06T11:35:28.528Z INFO webdriver: DATA { using: 'css selector', value: '[itemprop="item"]' }

[0-0] 2019-01-06T11:35:28.543Z INFO webdriver: RESULT [ { ELEMENT: '0.5487788910074598-3' },

{ ELEMENT: '0.5487788910074598-4' } ]

[0-0] 2019-01-06T11:35:28.556Z INFO webdriver: COMMAND deleteSession()

[0-0] 2019-01-06T11:35:28.556Z INFO webdriver: [DELETE] http://127.0.0.1:4444/wd/hub/session/d7e2b630ea4d1841e919ec800890b592

2019-01-06T11:35:28.788Z DEBUG wdio-local-runner: Runner 0-0 finished with exit code 1



Test Suites: 0 passed, 1 failed, 1 total (100% completed)

Time: 🕑 13.05s



npm ERR! Test failed. See above for more details.

你知道为什么吗?

非常感谢!

最佳答案

LE: 这与将在 WebdriverIO 版本 5 (webdriverio@5.x.x) 中修复的问题 ( BUG#2639) 有关,在附近的某个地方 future 。此行为会影响所有 sync: true WDIO 设置。

总而言之,这是项目负责人维护者对此事的看法:

Just fyi: this will be fixed in v5 where the underlying monad structure is more simplified and will actually work.

If anyone is interested in a fix for this, feel free to propose a PR on the v4 branch. This is most likely fixed in v5.


我认为这对您正在运行的设置来说是非常自定义的,除非您添加一些花哨的报告器来增加冗长程度和显示效果。只需访问 Official Guide 中的记者部分.

备选方案:

a.) 您可以使用可选的 msg 参数在断言级别增强冗长性:

expect(breadcrumbsAppearancesNumber, `Found: ${breadcrumbsAppearancesNumber} breadcrumbs | Expected: 3 breadcrumbs`).to.equal(3);

b.) 或者,在您的 wdio.conf.js 文件中增加日志详细程度(logLevel: verbose):

exports.config = {
// ...
//
// Level of logging verbosity: silent | verbose | command | data | result | error
logLevel: 'verbose',
//
// ...
};

关于javascript - Webdriver.IO 接收到 : "npm ERR! Test failed. See above for more details." but can't see the errors,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54061846/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com