123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- class WorklistPage {
- getTable() {
- return cy.get('table');
- }
- findTableAndDoubleClickFirstRow() {
- cy.get('table').within(() => {
- cy.get('tbody tr[data-testid="row-0"]')
- .scrollIntoView()
- .should('be.visible')
- .dblclick({ force: true });
- });
- }
- /**
- * 获取表头(排除第一列选择框)
- */
- getTableHeaders() {
- return cy.get('table thead th').not(':first');
- }
- /**
- * 获取所有表头
- */
- getAllTableHeaders() {
- return cy.get('table thead th');
- }
- /**
- * 获取特定列
- * @param columnName 列名文本
- */
- getColumn(columnName: string) {
- return cy.get('table thead th').contains(columnName);
- }
- /**
- * 验证列存在
- * @param columnName 列名文本
- */
- columnExists(columnName: string) {
- return this.getTableHeaders().contains(columnName).should('exist');
- }
- /**
- * 验证列不存在
- * @param columnName 列名文本
- */
- columnNotExists(columnName: string) {
- return this.getTableHeaders().contains(columnName).should('not.exist');
- }
- /**
- * 获取列宽
- * @param columnName 列名文本
- */
- getColumnWidth(columnName: string) {
- return cy
- .get('table thead th')
- .contains(columnName)
- .invoke('width');
- }
- /**
- * 验证列的顺序
- * @param expectedOrder 期望的列名顺序数组
- */
- verifyColumnOrder(expectedOrder: string[]) {
- this.getTableHeaders().then(($headers) => {
- expectedOrder.forEach((columnName, index) => {
- cy.wrap($headers.eq(index)).should('contain', columnName);
- });
- });
- }
- /**
- * 获取表头数量
- */
- getHeaderCount() {
- return this.getTableHeaders().its('length');
- }
- }
- export default WorklistPage;
|