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

e2e tests: wait for first compilation #38

Closed
AlexandreBonaventure opened this issue Dec 20, 2018 · 0 comments
Closed

e2e tests: wait for first compilation #38

AlexandreBonaventure opened this issue Dec 20, 2018 · 0 comments

Comments

@AlexandreBonaventure
Copy link
Contributor

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.

Akryum pushed a commit that referenced this issue Dec 21, 2018
* await

* return ready promise
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

1 participant