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

FS-5030: Implementing e2e test running after deploying to dev and test environments #328

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nuwan-samarasinghe
Copy link
Contributor

@nuwan-samarasinghe nuwan-samarasinghe commented Mar 10, 2025

Ticket: https://mhclgdigital.atlassian.net/browse/FS-5030

Change description

Implementing e2e test running after deploying to dev and test environments

After having the discussion with @wjrm500 we have decided to brake this FS-5030 into two sub sections and it is already mentioned in this comment

Once changes are merged into main and docker images is deployed to dev then after that if the e2e run is enabled then this changes will handle the e2e run process against the dev environment & also same for the test once changes are deployed to test it will run the e2e against test environment

Following is one of the testing done by my self : https://github.com/communitiesuk/funding-service-design-fund-application-builder/actions/runs/13763808399

  • Unit tests and other appropriate tests added or updated
  • README and other documentation has been updated / added (if needed)
  • Commit messages are meaningful and follow good commit message guidelines (e.g. "FS-XXXX: Add margin to nav items preventing overlapping of logo")

@wjrm500
Copy link
Contributor

wjrm500 commented Mar 10, 2025

Thank you kindly @nuwan-samarasinghe, quick note before I review properly: I notice we're using the standard boilerplate for the PR description here, but in this case it doesn't really apply (no unit tests or documentation updates, and the commit message format differs from our guidelines).

The actual description ("Implementing e2e test running after deploying to dev and test environments") gives me a general idea of what's going on, but it'd be nice to see a bit more detail about what you've done and why. PR descriptions are an opportunity to help reviewers understand the changes quickly and provide meaningful feedback.

Don't worry about changing the description on this PR, but for future PRs it'd be good to see a bit more information in the description, even if that means ignoring the boilerplate.

Copy link
Contributor

@wjrm500 wjrm500 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @nuwan-samarasinghe, have just finished reviewing the PR, I have flagged some definite issues and also asked several questions. A more detailed PR description would probably have saved me some confusion 😸

# environment: dev
dev_e2e_test:
# Do not run these against the prod environment without addressing the auth/JWT self-signing done by e2e tests.
if: ${{ contains(fromJSON(needs.setup.outputs.jobs_to_run), 'dev') && inputs.run_e2e_tests == true }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this will work - run_e2e_tests is only set as an input param during workflow dispatch (manual trigger via "Actions" tab in GitHub UI), and I believe will default to null in a scenario where a PR is merged. Thus inputs.run_e2e_tests == true will evaluate to false and this job won't run 😿

I think we need something more like the funding-service-pre-award deployment workflow, whereby we have this sort of logic: (github.event_name == 'push' && true) || inputs.run_e2e_tests_assessment - this guarantees the E2E tests run on merge, which is what we're looking for

# Do not run these against the prod environment without addressing the auth/JWT self-signing done by e2e tests.
if: ${{ contains(fromJSON(needs.setup.outputs.jobs_to_run), 'test') && inputs.run_e2e_tests == true }}
name: Run E2E Test
needs: [ dev_deploy ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should depend on test_deploy not dev_deploy

workflow_call:
inputs:
copilot_environment:
description: "Copilot environment to deploy to"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the best description - this workflow doesn't deploy, it runs E2E tests

on:
workflow_call:
inputs:
copilot_environment:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer environment to copilot_environment as more user-friendly and consistent with other jobs in FAB workflow

run: uv run --frozen pytest --e2e --e2e-env ${{ inputs.copilot_environment }}
env:
E2E_DEVTEST_BASIC_AUTH_USERNAME: ${{ secrets.E2E_DEVTEST_BASIC_AUTH_USERNAME }}
E2E_DEVTEST_BASIC_AUTH_PASSWORD: ${{ secrets.E2E_DEVTEST_BASIC_AUTH_USERNAME }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should presumably be secrets.E2E_DEVTEST_BASIC_AUTH_PASSWORD?

Also, how are these env variables actually used?

Given the requirement to do setup external to this PR to get the functionality working, it is extra important to include this info in the PR description to make it clear what steps we need to take alongside simply merging the PR

environment: ${{ inputs.copilot_environment }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Install the latest version of uv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is misleadingly named as it's not installing the "latest" version, just the one defined by the specific commit hash

runs-on: ubuntu-latest
environment: ${{ inputs.copilot_environment }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All steps should be named

uses: astral-sh/setup-uv@f94ec6bedd8674c4426838e6b50417d36b6ab231 # v5
with:
enable-cache: true
github-token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this parameter? Just from looking at uv installation in run-shared-tests.yml - https://github.com/communitiesuk/funding-service-design-workflows/blob/main/.github/workflows/run-shared-tests.yml#L168-L169 - there is no github-token parameter passed

@wjrm500
Copy link
Contributor

wjrm500 commented Mar 10, 2025

Ah yeah, separate thing - please let's cache Playwright browsers - downloading them afresh every time we run E2E tests is heavy stuff. Check this out for reference: https://playwrightsolutions.com/playwright-github-action-to-cache-the-browser-binaries/

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.

2 participants