cypress-io / netlify-plugin-cypress

Runs Cypress end-to-end tests after Netlify builds the site but before it is deployed

Home Page:https://www.cypress.io/blog/2020/03/30/run-cypress-tests-on-netlify-using-a-single-line/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plugin should use the deployed netlify subdomain to run tests, not localhost

quantizor opened this issue ยท comments

Versions

  • What is this plugin's version? latest
  • What is Cypress version? latest
  • What Netlify build image are you using? Ubuntu Xenial 16.04
  • What is the Node version if you know it? 12
  • What is the NPM version if you know it? 6

Describe the bug
When running a netlify build, the plugin serves the built assets itself to run tests, rather than setting baseUrl to the deployed netlify domain:

async function postBuild({ fullPublishFolder, record, spec, group, tag, buildUtils }) {
const port = 8080
const server = serveFolder(fullPublishFolder, port)
debug('local server listening on port %d', port)
const baseUrl = `http://localhost:${port}`
const results = await runCypressTests(baseUrl, record, spec, group, tag)
await new Promise((resolve, reject) => {
server.close(err => {
if (err) {
return reject(err)
}
debug('closed local server on port %d', port)
resolve()
})
})
processCypressResults(results, buildUtils)
}

It should run tests against the live version because simply serving the built assets is missing any redirects, etc that are relevant to the application and set up in either netlify.toml or the netlify UI.

Blocked until Netlify plugins receive onDeploy hook from the outside system

๐ŸŽ‰ This issue has been resolved in version 1.8.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€