Skip to content

[Issue #8184] allow usage of playwright tags in e2e test jobs#8960

Merged
doug-s-nava merged 4 commits intomainfrom
dschrashun/8184-test-job-tag-groups
Mar 13, 2026
Merged

[Issue #8184] allow usage of playwright tags in e2e test jobs#8960
doug-s-nava merged 4 commits intomainfrom
dschrashun/8184-test-job-tag-groups

Conversation

@doug-s-nava
Copy link
Collaborator

@doug-s-nava doug-s-nava commented Mar 10, 2026

Summary

Fixes for #8184

Changes proposed

Adds support for limiting which playwright tests are run in our e2e testing ci jobs by passing playwright tags.

Context for reviewers

Includes definition of groups to two tests - these are meant to facilitate verification and manual testing of this PR, but the assigned groups are also the correct groups for these, so leaving them in the PR.

Also cleans up the implementation of the "api_logs" param in the local ci job, which was previously accepting free text

Validation steps

  1. note that an experimental / test only job definition can be found in the first commit on this PR
  2. open up previous runs of the experimental job at https://github.com/HHS/simpler-grants-gov/actions/workflows/e2e-experiment.yml
  3. VERIFY: the first run of the job was run with no tags assigned, and proceeded to run all tests
  4. VERIFY: the first run of the job was run with a single tag assigned, and proceeded to run one test
  5. VERIFY: the first run of the job was run with a two tags assigned, and proceeded to run two tests

If you'd like to test this change yourself, feel free to add the experimental job back and play around with it

@doug-s-nava doug-s-nava force-pushed the dschrashun/8184-test-job-tag-groups branch 4 times, most recently from e854e8b to edb8166 Compare March 10, 2026 19:41
@doug-s-nava doug-s-nava changed the title basic acceptance of tags in jobs [Issue #8184] allow usage of playwright tags in e2e test jobs Mar 10, 2026
@doug-s-nava doug-s-nava force-pushed the dschrashun/8184-test-job-tag-groups branch 2 times, most recently from f992a5f to a9ec3b6 Compare March 10, 2026 19:52
@doug-s-nava doug-s-nava marked this pull request as ready for review March 10, 2026 20:00
@doug-s-nava doug-s-nava force-pushed the dschrashun/8184-test-job-tag-groups branch from a9ec3b6 to 9636b66 Compare March 11, 2026 14:06
npx playwright install --with-deps
- name: Run e2e tests (Shard ${{ inputs.shard }}/${{ inputs.total_shards }})
- name: Run all e2e tests (Shard ${{ inputs.shard }}/${{ inputs.total_shards }})
Copy link
Collaborator

Choose a reason for hiding this comment

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

................inputs.current_shard }}/${{ inputs.total_shards }})
Missing -current-?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good catch!

shell: bash


- name: Run e2e tests for ${{ inputs.playwright_tags }} (Shard ${{ inputs.shard }}/${{ inputs.total_shards }})
Copy link
Collaborator

Choose a reason for hiding this comment

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

name: Run e2e tests for ${{ inputs.playwright_tags }} (Shard ${{ inputs.current_shard }}/${{ inputs.total_shards }})

This line also missing -current-

description: "pipe separated list of @tags denoting groups of tests to run"
required: false
type: string
workflow_call:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add these as well?

inputs:
  api_logs:
    description: "print api logs on failure?"
    default: "false"
    type: string
  playwright_tags:
    description: "pipe separated list of @tags denoting groups of tests to run"
    required: false
    type: string

type: choice
options:
- "true"
- "false"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I will use boolean instead:

    default: false
    type: boolean

then update the below :
api_logs: ${{ inputs.api_logs }} to be api_logs: ${{ inputs.api_logs && 'true' || 'false' }}

@@ -37,12 +41,14 @@ jobs:
- name: Set target
run: if [[ -z "${{ inputs.target }}" ]]; then echo "defaulted_target=staging" >> "$GITHUB_ENV"; else echo 'defaulted_target="${{ inputs.target }}"' >> "$GITHUB_ENV"; fi
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know it is not new changes but this seem weird:
maybe fix the ' and "?
run: if [[ -z "${{ inputs.target }}" ]]; then echo "defaulted_target=staging" >> "$GITHUB_ENV"; else echo "defaulted_target=${{ inputs.target }}" >> "$GITHUB_ENV"; fi


test("has title", async ({ page }) => {
test("has title", { tag: "@smoke" }, async ({ page }) => {
await expect(page).toHaveTitle(/Simpler.Grants.gov/);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe fix this one as well. I type in this comment and it is not showing correctly so I attached picture.

Image

/https:\/\/github.com\/HHS\/simpler-grants-gov/,
);
});
test(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I will do this:

test(
"clicking 'follow on GitHub' link opens a new tab pointed at Github repository",
{ tag: "@full-regression" },
async ({ page, context }) => {
const pagePromise = context.waitForEvent("page");
// Click the Follow on GitHub link
await page.getByRole("link", { name: "Follow on GitHub" }).click();
const newPage = await pagePromise;
await expect(newPage).toHaveURL(
/^https://github.com/HHS/simpler-grants-gov(?:/)?$/,
);
},
);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just to confirm, the change here is to change the regex from /https:\/\/github.com\/HHS\/simpler-grants-gov/ to /^https://github.com/HHS/simpler-grants-gov(?:/)?$/, or is there something else?

Copy link
Collaborator Author

@doug-s-nava doug-s-nava Mar 12, 2026

Choose a reason for hiding this comment

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

We should escape the period, but with escaping, I think ^https:\/\/github\.com\/HHS\/simpler-grants-gov(?:\/)\?$ is what you're proposing, and I'm not sure how that is functionally any different from /https:\/\/github\.com\/HHS\/simpler-grants-gov in this case (where we're assuming that the protocol of the url will come at the beginning)

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is what I type but this git comment is not showing what I type in comment

Image

Copy link
Collaborator

@aoysimmons-GH aoysimmons-GH Mar 12, 2026

Choose a reason for hiding this comment

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

Suggested change
test(
test(
"clicking 'follow on GitHub' link opens a new tab pointed at Github repository",
{ tag: "@full-regression" },
async ({ page, context }) => {
const pagePromise = context.waitForEvent("page");
// Click the Follow on GitHub link
await page.getByRole("link", { name: "Follow on GitHub" }).click();
const newPage = await pagePromise;
await expect(newPage).toHaveURL(
/^https:\/\/github\.com\/HHS\/simpler-grants-gov(?:\/)?$/,
);
},
);

Copy link
Collaborator

Choose a reason for hiding this comment

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

I just learned that I have to put the 'add a suggestion' to put code in comment. This is what I type.

const newPage = await pagePromise;
await newPage.waitForLoadState();
await expect(newPage).toHaveURL(
/^https:\/\/github\.com\/HHS\/simpler-grants-gov/,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one will allow:
https://github.com/HHS/simpler-grants-gov/issues
https://github.com/HHS/simpler-grants-gov?x=1
Anything that starts with that prefix

This one only allows:

Suggested change
/^https:\/\/github\.com\/HHS\/simpler-grants-gov/,
/^https:\/\/github\.com\/HHS\/simpler-grants-gov(?:\/)?$/,

https://github.com/HHS/simpler-grants-gov
https://github.com/HHS/simpler-grants-gov/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

got it - this does make this more specific. At this point it should probably just be a string though. I'll make that change

@Bhavna-Ramachandran
Copy link
Collaborator

Reviewed the changes in this PR and verified that they work as intended.

Copy link
Collaborator

@aoysimmons-GH aoysimmons-GH left a comment

Choose a reason for hiding this comment

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

Approved

@doug-s-nava doug-s-nava merged commit 16d47e9 into main Mar 13, 2026
17 of 20 checks passed
@doug-s-nava doug-s-nava deleted the dschrashun/8184-test-job-tag-groups branch March 13, 2026 15:46
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.

3 participants