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

Postman tests running against localhost only and not Netlify preview deploy #23

Open
ivelin opened this issue Jun 15, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ivelin
Copy link
Contributor

ivelin commented Jun 15, 2021

Describe the bug
CI flow has a bug. It waits for netlify preview deployment, but does not use it for test run.

- name: Wait for successful preview deployment

      - name: Wait for successful preview deployment
        if: ${{ github.event_name == 'pull_request' }}
        uses: jakepartusch/wait-for-netlify-action@v1
        id: get-netlify-url
        with:
          site_name: "ambianic-serverless"
          max_timeout: 60

      - name: Run tests against deployed preview
        if: ${{ github.event_name == 'pull_request' }}
        run:  npm run test:postman
        env:
          FUNCTION_URL: http://127.0.0.1:4010

Expected behavior
Inspect closely the ambianc-ui flow to understand how netlify wait assigns an environment variable which is then passed on to the test step.

FUNCTION_URL: http://127.0.0.1:4010

@ivelin ivelin added the bug Something isn't working label Jun 15, 2021
@vickywane
Copy link
Contributor

@ivelin i would have to rename and adjust that CI job to run tests locally.

Like we discussed earlier, the tests are making use of the Mock HTTP server provided by Prism and the FUNCTION_URL variable is the endpoint for the test server.

Since the wait-for-netlify-action also ensures that a preview deployment was made successfully on Netlify, i thought it good to keep the action within the workflow. Asides that, the deployed preview is not being used by other steps within the workflow.

@ivelin
Copy link
Contributor Author

ivelin commented Jun 16, 2021

@vickywane testing locally is one step. Testing against preview deploy is a separate step. Both have value.
Currently wait-for-netlify is sitting on its own, but is not used in a follow up test step against the preview deployment.
See again the ambianic-ui lighthouse flow and add the necessary test step to verify the API against the netlify preview deployment using the URL variable provided by wait-for-netlify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants