简体   繁体   English

Webdriver.IO收到:“ npm ERR! 测试失败。 详情请参见上文。”但看不到错误

[英]Webdriver.IO receiving: “npm ERR! Test failed. See above for more details.” but can't see the errors

I've created a simple test which verify that the appearance number of breadcrumbs in a specific site is 2: 我创建了一个简单的测试,以验证特定站点中面包屑的出现数量为2:

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

The 2 breadcrumbs (in blue circle): breadcrumbs_screenshot 2个面包屑(在蓝色圆圈中): 面包屑 _ 屏幕截图

My test: ('[itemprop="item"]' is the breadcrumbs button CSS selector) 我的测试:( “ [itemprop =“ item”]“是面包屑按钮CSS选择器)

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

And for 2 it works well. 对于2来说效果很好。

However, just for testing purpose when I insert 3: 但是,当我插入3时,仅出于测试目的:

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

It obviously fails, with the output: "npm ERR! Test failed. See above for more details." 它显然失败了,输出为:“ npm ERR!测试失败。有关更多详细信息,请参见上文。”

However when I scrolling above I don't see any error messages that can give me extra information on why it fails... 但是,当我在上方滚动时,没有看到任何错误消息可以为我提供有关失败原因的更多信息...

It shows: 表明:

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.

Do you have an idea why? 你知道为什么吗?

Thanks a lot! 非常感谢!

LE: This is related to a issue ( BUG#2639 ) that will be fixed in WebdriverIO Version 5 ( webdriverio@5.xx ), somewhere in the near future. LE:这与一个问题( BUG#2639 )有关,该问题将在不久的将来在WebdriverIO版本5( webdriverio@5.xx )中修复。 This behavior affects all sync: true WDIO setups. 此行为会影响所有sync: true WDIO设置。

To conclude, here's the project lead maintainer's take on the matter: 总结一下,这是项目负责人维护者对此事的看法:

Just fyi: this will be fixed in v5 where the underlying monad structure is more simplified and will actually work. 仅供参考:v5中将解决此问题,该版本中的底层monad结构得到了更简化,并且可以实际使用。

If anyone is interested in a fix for this, feel free to propose a PR on the v4 branch. 如果有人对此修复程序感兴趣,请随时在v4分支上提出PR。 This is most likely fixed in v5. 这很可能在v5中已修复。


I think that is pretty much custom with the setup you're running, unless you add some fancy reporters for extra verbosity & display swag. 我认为这与您正在运行的设置几乎是自定义的,除非您添加一些奇特的报告程序以获取更多的详细信息和显示赃物。 Just visit the Reporters section from the Official Guide . 只需访问“ 官方指南”中的“ 记者”部分即可。

Alternatives: 备择方案:

a.) You can enhance verbosity at the assertion-level, using the optional msg param as so: a。)您可以使用可选的msg参数,在断言级别上提高详细程度:

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

b.) Or, increase the log verbosity ( logLevel: verbose ) in your wdio.conf.js file: b。)或者,增加wdio.conf.js文件中的日志详细程度( logLevel: verbose ):

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM