Testing - Error: Cannot find module 'Test/Browser'


#1

I followed the docs and tried to setup the functional test as described here:
https://adonisjs.com/docs/4.1/testing#_functional_tests

So i copy & paste the following code:

const { test, trait } = use('Test/Suite')('Example functional test')
trait('Test/Browser')

test('validate user details', async ({ browser }) => {
  const page = await browser.visit('/')

  await page
    .type('email', 'wrong email')
    .submitForm('form')
    .waitForNavigation()

  page.session.assertError('email', 'Invalid user email address')
})

But if i run adonis test i am getting the error Error: Cannot find module 'Test/Browser’

I am using “@adonisjs/vow”: “^1.0.17” & “@adonisjs/framework”: “^5.0.9”.

How can i install the module?


#2

Hey @kayyyy! :wave:

You need to install the @adonisjs/vow-browser package.

https://adonisjs.com/docs/4.1/browser-tests#_setup