Skip to content

fix: use netlify deploy domain for baseurl #66

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

Conversation

quantizor
Copy link

@quantizor quantizor commented Jul 16, 2020

@CLAassistant
Copy link

CLAassistant commented Jul 16, 2020

CLA assistant check
All committers have signed the CLA.

@bahmutov
Copy link
Contributor

Hi @probablyup

Unfortunately, this would not work. The Netlify calls plugins before the deploy, and in fact that's the purpose of testing the local built site - to ensure that it won't be deployed if there are failing tests. See https://docs.netlify.com/configure-builds/build-plugins/create-plugins/#plug-in-to-build-events

I am waiting for Netlify to implement onDeployed hook that would be executed after a successful deploy, then we could just run the tests against the DEPLOY url.

@bahmutov bahmutov closed this Jul 23, 2020
@quantizor
Copy link
Author

quantizor commented Jul 23, 2020

@bahmutov yeah that makes sense, I ended up setting things up using github actions to achieve the same effect:

- name: Waiting for 200 from Netlify Deploy
  uses: probablyup/[email protected]
  id: waitForDeployment
  with:
    site_id: "[redacted]"
  env:
    NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }}

- name: Run Cypress
  uses: cypress-io/github-action@v2
  with:
    record: true
    config: baseUrl=${{ steps.waitForDeployment.outputs.url }}
  env:
    # pass the Dashboard record key as an environment variable
    CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
    # pass GitHub token to allow accurately detecting a build vs a re-run build
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

Successfully merging this pull request may close these issues.

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