bittoby commented on code in PR #63562:
URL: https://github.com/apache/airflow/pull/63562#discussion_r2936634269
##########
airflow-core/src/airflow/ui/tests/e2e/pages/PluginsPage.ts:
##########
@@ -22,43 +22,19 @@ import { BasePage } from "./BasePage";
export class PluginsPage extends BasePage {
public readonly heading: Locator;
+ public readonly nameColumn: Locator;
public readonly rows: Locator;
+ public readonly sourceColumn: Locator;
public readonly table: Locator;
public constructor(page: Page) {
super(page);
- this.heading = page.getByRole("heading", {
- name: /plugins/i,
- });
+ this.heading = page.getByRole("heading", { name: /plugins/i });
this.table = page.getByTestId("table-list");
- this.rows = this.table.locator("tbody tr").filter({
- has: page.locator("td"),
- });
- }
-
- public async getPluginCount(): Promise<number> {
- return this.rows.count();
- }
-
- public async getPluginNames(): Promise<Array<string>> {
- const count = await this.rows.count();
-
- if (count === 0) {
- return [];
- }
-
- return this.rows.locator("td:first-child").allTextContents();
- }
-
- public async getPluginSources(): Promise<Array<string>> {
- const count = await this.rows.count();
-
- if (count === 0) {
- return [];
- }
-
- return this.rows.locator("td:nth-child(2)").allTextContents();
+ this.rows = this.table.locator("tbody tr").filter({ has:
page.locator("td") });
+ this.nameColumn = this.rows.locator("td:nth-child(1)");
+ this.sourceColumn = this.rows.locator("td:nth-child(2)");
Review Comment:
`data-testid` attributes don't exist on table cells. The `TableList.tsx`
component only has `data-testid="table-list"` on the table root - individual
`<Table.Cell>` elements have no `data-testid`. There's nothing to select.
To use `data-testid` here, you'd have to modify the production
`TableList.tsx` component first - that's out of scope for a test-patterns-only
PR.
`td:nth-child()` is the correct approach and matches what `DagsPage` and
`VariablePage` already do.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]