我最近使用噩梦库定义了一些用户界面测试用例。
我的问题是,是否可以在诸如ucelabs,broswerstack或设备场之类的云工具中执行这些测试?
下面我提供了一些代码供参考。
const Nightmare = require('nightmare')
const assert = require('assert')
describe('Landing Page', function() {
this.timeout('30s')
let nightmare = null
beforeEach(() => {
nightmare = new Nightmare({ show: true })
})
describe('/ (Home Page)', () => {
it('should render landing page', done => {
nightmare.goto('http://localhost:3000/')
.exists('#root > div > div > div > div > div > div:nth-child(1) > a > img')
.exists('#root > div > div > div > div > div > div:nth-child(1) > a > span > b')
.exists('#root > div > div > div > div > div > div:nth-child(1) > a > small')
.wait(1000)
.click('#root > div > div > div > div > div > div:nth-child(1) > a > img')
.wait(1000)
.end()
.then(function (result) { done() })
.catch(done)
})
})
})