Skip to content

e2e tests: wait for first compilation #38

Closed
@AlexandreBonaventure

Description

@AlexandreBonaventure

Hi,
Thanks for the package, it is great!
I'm trying to setup e2e tests with SSR with Cypress. The official e2e-cypress-cli-plugin does not allow to specify to run an alternative command to 'serve' (here ssr:serve) so I overcame the problem by creating a custom service such as :

module.exports = (api, opts) => {
  api.registerCommand('test:e2e:ssr', async (args, rawArgs) => {
    const server = await api.service.run('ssr:serve')
    args.url = 'http://localhost:8080'
    const runner = await api.service.run('test:e2e', args, rawArgs)
    runner.on('exit', () => server.close())
    runner.on('error', () => server.close())
    return runner
  })
}

Problem

ssr:serve signature is pretty different from the traditional serve and this code up there ⬆️ wasn't await the initial compilation like you would expect from serve.

PR

In order to be able to wait for the initial compilation before starting e2e tests, I had to return the readyPromise from the app middleware.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions