增加step描述,简化报告展示
This commit is contained in:
parent
799d6a5100
commit
4470b83c92
|
@ -1,4 +1,5 @@
|
|||
import type { Page, Locator } from 'playwright-core';
|
||||
import { test } from '@playwright/test'
|
||||
|
||||
export default class Table {
|
||||
readonly tableLocator: Locator
|
||||
|
@ -8,11 +9,14 @@ export default class Table {
|
|||
}
|
||||
|
||||
private async getTableHeaders(): Promise<string[]> {
|
||||
await this.tableLocator.waitFor({ state: "visible" });
|
||||
const headers = await this.tableLocator.locator('thead tr th').all();
|
||||
const headerTexts = await Promise.all(headers.map(async (header) => {
|
||||
return await header.innerText();
|
||||
}));
|
||||
const headerTexts = await test.step('Query table headers and return a list', async () => {
|
||||
await this.tableLocator.waitFor({ state: "visible" });
|
||||
const headers = await this.tableLocator.locator('thead tr th').all();
|
||||
const headerTexts = await Promise.all(headers.map(async (header) => {
|
||||
return await header.innerText();
|
||||
}));
|
||||
return headerTexts;
|
||||
});
|
||||
return headerTexts;
|
||||
}
|
||||
|
||||
|
@ -39,7 +43,4 @@ export default class Table {
|
|||
return rowLocator.locator(`td:nth-child(${col_index + 1})`);
|
||||
}
|
||||
|
||||
//生成正常表达式:判断元素text不等于""或者不等于"-"
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue