WebdriverIO + Next.js

时间:2019-08-29 11:06:00

标签: next.js webdriver-io

我试图针对一个简单的nextjs应用程序运行webdriverio,但未成功。有人遇到过类似的问题吗?

代码示例:https://github.com/fernandogc/nextwebdriverio

describe('React App', () => {
  it('App component should exist', () => {
    browser.url('')
    const app =  browser.react$('App')
    expect(app.isDisplayed()).toBe(true)
  })
})
[0-0] 2019-08-29T11:00:38.410Z INFO webdriver: RESULT { error: 'no such element',
  message:
   'no such element: Unable to locate element: {"method":"css selector","selector":"App"}\n  (Session info: chrome=76.0.3809.132)',
  stacktrace: '#0 0x55779335a6e9 <unknown>\n' }
[0-0] Error in "undefined"
Expected false to be true.
[0-0] 2019-08-29T11:00:38.439Z INFO webdriver: COMMAND deleteSession()
[0-0] 2019-08-29T11:00:38.440Z INFO webdriver: [DELETE] http://127.0.0.1:4444/session/97d2f4196d604f05068921f061934c1d
[0-0] FAILED in chrome - /test/specs/basics.js
2019-08-29T11:00:38.624Z INFO @wdio/cli:Launcher: Run onComplete hook

 "spec" Reporter:
------------------------------------------------------------------
[chrome  linux #0-0] Spec: /home/fer/veepee/webdriverio-nextjs/test/specs/basics.js
[chrome  linux #0-0] Running: chrome on linux
[chrome  linux #0-0]
[chrome  linux #0-0] React App
[chrome  linux #0-0]    ✖ App component should exist
[chrome  linux #0-0]
[chrome  linux #0-0] 1 failing (997ms)
[chrome  linux #0-0]
[chrome  linux #0-0] 1) React App App component should exist
[chrome  linux #0-0] Expected false to be true.
[chrome  linux #0-0] Error: Expected false to be true.
[chrome  linux #0-0]     at <Jasmine>
[chrome  linux #0-0]     at <Jasmine>
[chrome  linux #0-0]     at UserContext.toBe (/home/fer/veepee/webdriverio-nextjs/test/specs/basics.js:5:31)


Spec Files:     0 passed, 1 failed, 1 total (100% completed) in 00:00:02

0 个答案:

没有答案