test(tracker): fix milestone page-object selectors after startDate field addition

The Gantt schema PR added Milestone.startDate, which:

1. Adds a second datetime-button to the NewMilestone form pool. The
   existing 'div.antiCard-pool button.datetime-button' locator matched
   both buttons and tripped Playwright's strict-mode check. Scope the
   target-date locator to .last() and add a sibling .first() helper for
   the start-date button.

2. Moves Status / Start date / Target date editors from the
   auto-generated side panel into EditMilestone's body
   (div.dates-row > div.date-cell > span.cell-label + <button>) in
   chronological order. The label span no longer has a sibling <div>
   wrapping the button — the button is a direct sibling. Switch the
   buttonStatus/buttonTargetDate XPath to following-sibling::button[1]
   and match the new class="cell-label" span. Add a buttonStartDate
   helper for the new editor row.

Signed-off-by: Michael Uray <michaeluray@users.noreply.github.com>
This commit is contained in:
Michael Uray
2026-06-19 08:59:14 +00:00
parent 12eda959eb
commit 86b1c19ee8
2 changed files with 19 additions and 3 deletions
@@ -4,8 +4,18 @@ import { NewMilestone } from './types'
export class MilestonesDetailsPage extends CommonTrackerPage {
inputTitle = (): Locator => this.page.locator('div.popupPanel-body input[type="text"]')
buttonStatus = (): Locator => this.page.locator('//span[text()="Status"]/following-sibling::div[1]/button')
buttonTargetDate = (): Locator => this.page.locator('//span[text()="Target date"]/following-sibling::div[1]/button')
// EditMilestone now renders Status / Start date / Target date inline in the
// body (`div.date-cell > span.cell-label + <Editor button>`) instead of the
// auto-generated side panel (Gantt schema PR — Milestone.startDate). The
// button is the immediate sibling of the label span, no wrapping div.
buttonStatus = (): Locator =>
this.page.locator('//span[@class="cell-label" and normalize-space(.)="Status"]/following-sibling::button[1]')
buttonStartDate = (): Locator =>
this.page.locator('//span[@class="cell-label" and normalize-space(.)="Start date"]/following-sibling::button[1]')
buttonTargetDate = (): Locator =>
this.page.locator('//span[@class="cell-label" and normalize-space(.)="Target date"]/following-sibling::button[1]')
inputMilestoneName = (): Locator => this.page.locator('input[placeholder="Milestone name"]')
inputDescription = (): Locator => this.page.locator('div.inputMsg div.tiptap')
buttonYesMoveAndDeleteMilestonePopup = (): Locator =>
@@ -14,8 +14,14 @@ export class MilestonesPage extends CommonTrackerPage {
buttonNewMilestoneSetStatus = (): Locator =>
this.page.locator('form[id="tracker:string:NewMilestone"] div.antiCard-pool button[type="button"]')
// NewMilestone form now renders Start Date before Target Date in the pool
// (Gantt schema PR added Milestone.startDate). Match the LAST datetime-button
// so this resolves to the target-date button without strict-mode violations.
buttonNewMilestoneStartDate = (): Locator =>
this.page.locator('form[id="tracker:string:NewMilestone"] div.antiCard-pool button.datetime-button').first()
buttonNewMilestoneTargetDate = (): Locator =>
this.page.locator('form[id="tracker:string:NewMilestone"] div.antiCard-pool button.datetime-button')
this.page.locator('form[id="tracker:string:NewMilestone"] div.antiCard-pool button.datetime-button').last()
buttonNewMilestoneCreate = (): Locator =>
this.page.locator('form[id="tracker:string:NewMilestone"] button[type="submit"]')