Skip to content

Allow config using DEPLOY_URL instead of DEPLOY_PRIME_URL #350

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ inputs:
# NOTE: does not execute Netlify API redirects or functions
- name: postBuild
description: Run tests against the built static site

# See Netlify docs for available values:
# https://docs.netlify.com/configure-builds/environment-variables/#deploy-urls-and-metadata
- name: deployUrlEnvVar
description: The Netlify environment variable containing the URL Cypress should set as the baseUrl to test
default: DEPLOY_PRIME_URL if not set or invalid value

12 changes: 6 additions & 6 deletions src/onSuccess.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ module.exports = async ({ utils, inputs, constants }) => {

const isLocal = constants.IS_LOCAL
const siteName = process.env.SITE_NAME
const deployPrimeUrl = process.env.DEPLOY_PRIME_URL
const deployUrl = process.env[onSuccessInputs.deployUrlEnvVar] || process.env.DEPLOY_PRIME_URL;
debug('onSuccess against %o', {
siteName,
deployPrimeUrl,
deployUrl,
isLocal,
})

Expand All @@ -36,8 +36,8 @@ module.exports = async ({ utils, inputs, constants }) => {
const errorCallback = utils.build.failPlugin.bind(utils.build)
const summaryCallback = utils.status.show.bind(utils.status)

if (!deployPrimeUrl) {
return errorCallback('Missing DEPLOY_PRIME_URL')
if (!deployUrl) {
return errorCallback('Missing Deploy URL. Please set a valid Netlify environment variable to pull the deploy URL from to set as the baseUrl in your cypress configuration. For example, set deployUrlEnvVar to DEPLOY_PRIME_URL.\nSee https://docs.netlify.com/configure-builds/environment-variables/#deploy-urls-and-metadata for more details on which ENVs can be used')
}

const browser = onSuccessInputs.browser || DEFAULT_BROWSER
Expand Down Expand Up @@ -69,9 +69,9 @@ module.exports = async ({ utils, inputs, constants }) => {

const configFile = onSuccessInputs.configFile

console.log('testing deployed url %s', deployPrimeUrl)
console.log('testing deployed url %s', deployUrl)
const results = await runCypressTests(
deployPrimeUrl,
deployUrl,
record,
spec,
group,
Expand Down