Skip to content

fix: correct datatest to data-testid attribute#433

Open
MuraariK13052008 wants to merge 1 commit intohatnote:masterfrom
MuraariK13052008:fix/bug-04-data-testid-attribute
Open

fix: correct datatest to data-testid attribute#433
MuraariK13052008 wants to merge 1 commit intohatnote:masterfrom
MuraariK13052008:fix/bug-04-data-testid-attribute

Conversation

@MuraariK13052008
Copy link
Copy Markdown

@MuraariK13052008 MuraariK13052008 commented Mar 27, 2026

What this fixes

The Edit Campaign button used a non-standard datatest= attribute instead of the standard data-testid= used consistently across the rest of the codebase. The Cypress tests also used [datatest="editbutton"] selectors to match, so the tests passed — but both sides were wrong together.

Root cause

Line 18 of ViewCampaign.vue sets datatest="editbutton" (a made-up attribute). The Cypress tests in campaign.cy.js lines 42 and 55 query [datatest="editbutton"] to match it. Since both sides shared the same non-standard attribute, tests passed. Every other testable element in the codebase uses data-testid=.

Fix

  • Changed datatest=data-testid= in ViewCampaign.vue line 18
  • Updated both Cypress selectors in campaign.cy.js lines 42 and 55 to [data-testid="editbutton"]

Files changed

  • frontend/src/components/Campaign/ViewCampaign.vue
  • frontend/cypress/e2e/campaign.cy.js

How to verify

  1. Run Cypress tests — all existing edit button tests should still pass
  2. Inspect the Edit Campaign button in browser devtools — confirm it has data-testid="editbutton" not datatest="editbutton"

Relates to: T415578

datatest is not recognized by testing tools like Cypress.
Updated to standard data-testid attribute.
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.

1 participant