Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for pubrules, to make sure UI runs well #1028

Open
jennyliang220 opened this issue Nov 10, 2020 · 3 comments
Open

Add test for pubrules, to make sure UI runs well #1028

jennyliang220 opened this issue Nov 10, 2020 · 3 comments

Comments

@jennyliang220
Copy link
Contributor

jennyliang220 commented Nov 10, 2020

Estimated time: 3hrs

@jennyliang220 jennyliang220 changed the title Find a test for pubrules UI Add E2E test for pubrules, to make sure UI runs well Nov 12, 2020
@jennyliang220
Copy link
Contributor Author

jennyliang220 commented Nov 12, 2020

E2E candidates:
https://github.com/puppeteer/puppeteer 66.5k stars
https://github.com/segmentio/nightmare 18.7k stars

@jennyliang220 jennyliang220 changed the title Add E2E test for pubrules, to make sure UI runs well Add test for pubrules, to make sure UI runs well Nov 12, 2020
@jennyliang220
Copy link
Contributor Author

jennyliang220 commented Jan 10, 2021

Example using nightmare

const Nightmare = require('nightmare')
const chai = require('chai')
const expect = chai.expect

describe('test duckduckgo search results', () => {
  it('should find the nightmare github link first', function(done) {
    this.timeout('10s')

    const nightmare = Nightmare()
    nightmare
      .goto('https://duckduckgo.com')
      .type('#search_form_input_homepage', 'github nightmare')
      .click('#search_button_homepage')
      .wait('#links .result__a')
      .evaluate(() => document.querySelector('#links .result__a').href)
      .end()
      .then(link => {
        expect(link).to.equal('https://github.com/segmentio/nightmare')
        done()
      })
  })
})

@deniak
Copy link
Member

deniak commented Jan 11, 2021

The main problem is not to interpret the page but running specberus in the test suite and make sure it responds as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants