jeudi 28 mars 2019

Running nightmare tests in Browserstack

I recently defined some User Interface test cases using The Nightmare library.

My question is if it is possible to execute these tests in a cloud tool like saucelabs, broswerstack or device farm?

Below i have included some of the code for reference.

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)
    })
  })
})

Aucun commentaire:

Enregistrer un commentaire