|
| 1 | +// Copyright The Linux Foundation and each contributor to LFX. |
| 2 | +// SPDX-License-Identifier: MIT |
| 3 | + |
| 4 | +import type { Locator, Page } from '@playwright/test'; |
| 5 | + |
| 6 | +export class RoadmapBoardPage { |
| 7 | + public readonly board: Locator; |
| 8 | + public readonly heading: Locator; |
| 9 | + public readonly totalIdeas: Locator; |
| 10 | + public readonly syncedLabel: Locator; |
| 11 | + public readonly teamFilters: Locator; |
| 12 | + public readonly teamClear: Locator; |
| 13 | + public readonly loading: Locator; |
| 14 | + public readonly kanban: Locator; |
| 15 | + public readonly toggleCompleted: Locator; |
| 16 | + public readonly detailBackdrop: Locator; |
| 17 | + public readonly detailPanel: Locator; |
| 18 | + public readonly detailClose: Locator; |
| 19 | + public readonly detailLoading: Locator; |
| 20 | + public readonly detailSummary: Locator; |
| 21 | + public readonly detailColumn: Locator; |
| 22 | + public readonly detailKey: Locator; |
| 23 | + public readonly detailDescription: Locator; |
| 24 | + public readonly detailComments: Locator; |
| 25 | + public readonly detailNotFound: Locator; |
| 26 | + |
| 27 | + public constructor(public readonly page: Page) { |
| 28 | + this.board = page.locator('[data-testid="roadmap-board"]'); |
| 29 | + this.heading = page.locator('[data-testid="roadmap-heading"]'); |
| 30 | + this.totalIdeas = page.locator('[data-testid="roadmap-total-ideas"]'); |
| 31 | + this.syncedLabel = page.locator('[data-testid="roadmap-synced-label"]'); |
| 32 | + this.teamFilters = page.locator('[data-testid="roadmap-team-filters"]'); |
| 33 | + this.teamClear = page.locator('[data-testid="roadmap-team-clear"]'); |
| 34 | + this.loading = page.locator('[data-testid="roadmap-loading"]'); |
| 35 | + this.kanban = page.locator('[data-testid="roadmap-kanban"]'); |
| 36 | + this.toggleCompleted = page.locator('[data-testid="roadmap-toggle-completed"]'); |
| 37 | + this.detailBackdrop = page.locator('[data-testid="roadmap-detail-backdrop"]'); |
| 38 | + this.detailPanel = page.locator('[data-testid="roadmap-detail-panel"]'); |
| 39 | + this.detailClose = page.locator('[data-testid="roadmap-detail-close"]'); |
| 40 | + this.detailLoading = page.locator('[data-testid="roadmap-detail-loading"]'); |
| 41 | + this.detailSummary = page.locator('[data-testid="roadmap-detail-summary"]'); |
| 42 | + this.detailColumn = page.locator('[data-testid="roadmap-detail-column"]'); |
| 43 | + this.detailKey = page.locator('[data-testid="roadmap-detail-key"]'); |
| 44 | + this.detailDescription = page.locator('[data-testid="roadmap-detail-description"]'); |
| 45 | + this.detailComments = page.locator('[data-testid="roadmap-detail-comments"]'); |
| 46 | + this.detailNotFound = page.locator('[data-testid="roadmap-detail-not-found"]'); |
| 47 | + } |
| 48 | + |
| 49 | + public async goto() { |
| 50 | + await this.page.goto('/roadmap', { waitUntil: 'networkidle' }); |
| 51 | + } |
| 52 | + |
| 53 | + public getColumn(name: string): Locator { |
| 54 | + return this.page.locator(`[data-testid="roadmap-column-${name}"]`); |
| 55 | + } |
| 56 | + |
| 57 | + public getColumnCount(name: string): Locator { |
| 58 | + return this.getColumn(name).locator('[data-testid="roadmap-column-count"]'); |
| 59 | + } |
| 60 | + |
| 61 | + public getColumnEmpty(name: string): Locator { |
| 62 | + return this.getColumn(name).locator('[data-testid="roadmap-column-empty"]'); |
| 63 | + } |
| 64 | + |
| 65 | + public getTeamPill(team: string): Locator { |
| 66 | + return this.page.locator(`[data-testid="roadmap-team-pill-${team}"]`); |
| 67 | + } |
| 68 | + |
| 69 | + public getCard(jiraKey: string): Locator { |
| 70 | + return this.page.locator(`[data-testid="roadmap-card-${jiraKey}"]`); |
| 71 | + } |
| 72 | + |
| 73 | + public getCards(): Locator { |
| 74 | + return this.page.locator('[data-testid^="roadmap-card-"]'); |
| 75 | + } |
| 76 | + |
| 77 | + public getColumns(): Locator { |
| 78 | + return this.page.locator('[data-testid^="roadmap-column-"]').filter({ hasNot: this.page.locator('[data-testid^="roadmap-column-"]') }); |
| 79 | + } |
| 80 | +} |
0 commit comments