Skip to content

frontend: e2e: Add e2e tests for CreateResourceForm - #5291

Open
vyncent-t wants to merge 1 commit into
kubernetes-sigs:mainfrom
vyncent-t:create-resource-form-playwright
Open

frontend: e2e: Add e2e tests for CreateResourceForm#5291
vyncent-t wants to merge 1 commit into
kubernetes-sigs:mainfrom
vyncent-t:create-resource-form-playwright

Conversation

@vyncent-t

@vyncent-t vyncent-t commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a Playwright e2e test for the new data-driven CreateResourceForm, exercising the Pod resource type end-to-end via the form (no YAML typing). The test covers two flows: validation of the Apply button state as required fields are filled, and a happy-path pod creation that verifies the new pod appears in the list afterward.

Changes

  • New page object e2e-tests/tests/createResourceFormPage.ts
    • Opens the Create Pod activity from the global Create Pod button and switches to the Form tab
    • Exposes stable role/aria-label locators for the fields exposed by CreateResourceForm / ContainerTextField: Name, Namespace, Container name, Container image, Apply, Close
    • Provides small helpers: fillMetadata, fillFirstContainer, addContainer, clickApply, closeCreateDialog, waitForAppliedToast
    • Includes an a11y() helper using @axe-core/playwright, matching other page objects
  • New spec e2e-tests/tests/createResourceForm.spec.ts (test.describe('CreateResourceForm – Pod'))
    • Authenticates against the test cluster and short-circuits when pod permissions are missing (same pattern as namespaces.spec.ts and podsPage.spec.ts)
    • Apply stays disabled until required fields are filled — asserts the Apply button stays disabled at each intermediate state (nothing filled, metadata only, container name only) and only becomes enabled once the container image is filled too
    • creates a pod via the form — opens the form, fills metadata and the seeded first container, clicks Apply, closes the activity via the X, waits for the Applied … toast, navigates back to the pods list, and confirms the new pod link is visible; uses a per-retry unique name so retries don't collide with leftovers

Steps to Test

  1. cd e2e-tests && npm install
  2. Start Headlamp against a cluster with pod permissions
  3. Run: HEADLAMP_TEST_URL=<url> HEADLAMP_TEST_TOKEN=<token> npx playwright test tests/createResourceForm.spec.ts
  4. Both tests should pass

Notes for the Reviewer

  • The page object targets the Pod form specifically. The base Pod seeds one empty container row, so fillFirstContainer fills the seeded row rather than adding a new one.
  • Pod names are suffixed with testInfo.retry so a leftover pod from a failed prior attempt doesn't turn the Apply click into a duplicate-create no-op.
  • The Namespace combobox lookup falls back to the first combobox in the form because the underlying MUI Autocomplete label association isn't always picked up by role/name.

@vyncent-t vyncent-t self-assigned this Apr 28, 2026
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 28, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: vyncent-t
Once this PR has been reviewed and has the lgtm label, please assign yolossn for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 28, 2026
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 28, 2026
@vyncent-t
vyncent-t force-pushed the create-resource-form-playwright branch 3 times, most recently from 8c31878 to ff767ed Compare May 11, 2026 22:43
@vyncent-t
vyncent-t force-pushed the create-resource-form-playwright branch from ff767ed to b5dbf45 Compare June 24, 2026 18:25
@vyncent-t
vyncent-t marked this pull request as ready for review June 24, 2026 18:25
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 24, 2026
@kubernetes-prow
kubernetes-prow Bot requested a review from yolossn June 24, 2026 18:25
@vyncent-t
vyncent-t requested review from skoeva and removed request for joaquimrocha and yolossn June 24, 2026 18:26
@vyncent-t
vyncent-t force-pushed the create-resource-form-playwright branch from b5dbf45 to 11386bb Compare June 25, 2026 17:29
@vyncent-t
vyncent-t force-pushed the create-resource-form-playwright branch 3 times, most recently from 902e051 to ffb0521 Compare July 14, 2026 19:00
@illume illume added a11y Accessibility related issues e2e-tests End to end tests frontend Issues related to the frontend testing labels Jul 25, 2026
@illume illume added this to the v0.44.0 milestone Jul 27, 2026
@illume illume self-assigned this Jul 27, 2026
@illume illume modified the milestones: v0.44.0, v0.45.0 Jul 27, 2026
@illume illume removed their assignment Jul 27, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vyncent-t

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 29, 2026
@vyncent-t
vyncent-t force-pushed the create-resource-form-playwright branch 4 times, most recently from 687ef78 to a13437f Compare August 11, 2026 18:54
@vyncent-t
vyncent-t force-pushed the create-resource-form-playwright branch 2 times, most recently from f86de43 to 4470464 Compare August 11, 2026 19:33
@illume illume assigned illume and unassigned vyncent-t Aug 14, 2026
@illume
illume requested a balanced review from Copilot August 14, 2026 12:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Playwright coverage for creating Pods through CreateResourceForm.

Changes:

  • Adds a Pod creation form page object.
  • Tests required-field validation and Pod creation.
  • Two reliability issues were identified: an unscoped combobox locator and stale Pod reuse.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
e2e-tests/tests/createResourceFormPage.ts Adds form locators and interaction helpers.
e2e-tests/tests/createResourceForm.spec.ts Adds validation and creation scenarios.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +45 to +48
return this.page
.getByRole('combobox', { name: 'Namespace' })
.or(this.page.getByRole('combobox').first())
.first();
Comment on lines +62 to +64
// Unique name per retry so a leftover from a failed prior attempt doesn't
// turn the Apply click into a duplicate-create no-op.
const name = `e2e-form-pod-${testInfo.retry}`;

@illume illume left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please see copilot review comments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a11y Accessibility related issues approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. e2e-tests End to end tests frontend Issues related to the frontend size/L Denotes a PR that changes 100-499 lines, ignoring generated files. testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants