0

使用Nightwatch.js + 测试库运行基本示例时,我不断收到错误消息:

[Ecosia Search With TL] Test Suite
==================================
ℹ Connected to localhost on port 9515 (1077ms).
  Using: chrome (87.0.4280.66) on Mac OS X platform.

Running:  Demo test ecosia.org

matcher.test is not a function

FAILED: 1 errors (935ms)
_________________________________________________

TEST FAILURE: 1 error during execution; 0 tests failed, 0 passed (2.779s)

 ✖ ecosiaSearchWithTL
 – Demo test ecosia.org (935ms)

  Error: [object Object]
       at processTicksAndRejections (internal/process/task_queues.js:97:5)


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

这是我唯一的测试:

const { getQueriesFrom } = require('@testing-library/nightwatch')

module.exports = {

  async beforeEach(browser) {
    await browser.url('https://www.ecosia.org/')
  },

  async 'Demo test ecosia.org'(browser) {
    const { getByRole } = getQueriesFrom(browser)

    const searchBox = await getByRole('searchbox', { name: /search form/i })
    browser.setValue(searchBox, 'nightwatch')
    const submit = await getByRole('button', { name: /submit/i })
    browser.click(submit)
    browser.end()
  }
}

我的nightwatch.conf.js

module.exports = {
    src_folders: ['tests'],
  
    webdriver: {
      start_process: true,
      port: 9515,
      server_path: "node_modules/.bin/chromedriver",
    },
  
    test_settings: {
      default: {
        desiredCapabilities : {
            browserName: "chrome"
        }
      }
    }
  };

知道为什么我不断收到该错误吗?它可以在没有测试库的情况下完美运行。

4

0 回答 0