Browser test .click() method Error

Hi i have test function to test logout link, like this

      <form id="logout-form" action="{{ route('auth.logout') }}" method="POST">
      {{ csrfField() }}
      </form>
      <a class="nav-item nav-link" href="#logout" onclick="$('#logout-form').submit()">Logout</a>
await page.click('a[href="#logout"]')
    .waitForNavigation()
    .assertPath('/auth/login')

But return error

1. user can logoout if logged in
  Error: Protocol error (DOM.getBoxModel): Could not compute box model. undefined
    at Session._onMessage (/home/sucipto/Dev/js/devhunt/node_modules/puppeteer/lib/Connection.js:194:25)
    at Connection._onMessage (/home/sucipto/Dev/js/devhunt/node_modules/puppeteer/lib/Connection.js:98:19)
    at emitOne (events.js:115:13)
    at WebSocket.emit (events.js:210:7)
    at Receiver._receiver.onmessage (/home/sucipto/Dev/js/devhunt/node_modules/ws/lib/WebSocket.js:143:47)
    at Receiver.dataMessage (/home/sucipto/Dev/js/devhunt/node_modules/ws/lib/Receiver.js:389:14)
    at Receiver.getData (/home/sucipto/Dev/js/devhunt/node_modules/ws/lib/Receiver.js:330:12)
    at Receiver.startLoop (/home/sucipto/Dev/js/devhunt/node_modules/ws/lib/Receiver.js:165:16)
    at Receiver.add (/home/sucipto/Dev/js/devhunt/node_modules/ws/lib/Receiver.js:139:10)
    at Socket._ultron.on (/home/sucipto/Dev/js/devhunt/node_modules/ws/lib/WebSocket.js:139:22)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:266:12)
    at readableAddChunk (_stream_readable.js:253:11)
    at Socket.Readable.push (_stream_readable.js:211:10)
    at TCP.onread (net.js:585:20)

But it pass when i use submit form like this

await page.submitForm('#logout-form')
    .waitForNavigation()
    .assertPath('/auth/login')

The error says it is unable to locate a DOM node with class model, so something else is breaking the test

Mind sharing the complete code for the test?

Hi @virk this is my test function

test('user can logoout if logged in', async({ browser }) => {
  // User
  const user = await Factory.model('App/Models/User').create()

  // Visit home
  const page = await browser.visit('/home', (request) => {
    request.loginVia(user)
  })

  // Has Logout Link
  await page.assertIsVisible('a[href="#logout"]')

  // Can click logout link (this is not working)
  await page.click('a[href="#logout"]')
    .waitForNavigation()
    .assertPath('/auth/login')

  // Can click logout link (this is working)
  // await page.submitForm('#logout-form')
  //   .waitForNavigation()
  //   .assertPath('/auth/login')
}).timeout(0)

Maybe it caused by puppeter default viewport (800px x 600px) https://github.com/GoogleChrome/puppeteer/blob/master/README.md#usage
and my logout link is hidden (collapsed) due responsive page.

and browser trait doesn’t have .setViewport() method

HI @virk I’ve made a pull request https://github.com/adonisjs/vow-browser/pull/3. I’ve test with my test code and it’s works.

@showcheap any update on this? I’m running into this issue as well.