joelgriffith / navalia

A bullet-proof, fast, and reliable headless browser API
https://joelgriffith.github.io/navalia/
GNU General Public License v3.0
957 stars 33 forks source link

Setting window size causes screenshot test to timeout #56

Closed traverse closed 7 years ago

traverse commented 7 years ago

Hello I was trying out Navalia for the first time and it's awesome 👍 I'm just having one problem. Whenever I add chrome.size(1024, 768) to a test it'll timeout on this part navalia:chrome :screenshot() > saving screenshotpage

I'm using Navalia 1.2.0 and Jest 21.0.1 with Node 8.4.0.

My test:

import { Chrome } from 'navalia'
import { toMatchImageSnapshot } from 'jest-image-snapshot'

expect.extend({ toMatchImageSnapshot })

jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000

describe('Navalia', () => {
  let chrome

  beforeEach(() => {
    chrome = new Chrome()
  })

  afterEach(() => {
    chrome.done()
  })

  it('should create a screenshot', async () => {
    await chrome.goto('http://localhost:3000')
    await chrome.size(1024, 768)

    const image = await chrome.screenshot()

    expect(image).toMatchImageSnapshot()
  })
})

I've tried increasing the timeout interval to 5 minutes but it just stays stuck on the saving screenshot part until it times out. However as soon as I uncomment the chrome.size(1024, 768) part it'll work without any problems.

I'm not sure if I'm doing anything wrong or if it's an issue with Navalia, any idea what it could be?

traverse commented 7 years ago

Saw the issue about Navalia getting merged into Chromeless so closing this issue as it's irrelevant.