@winning-test/component 0.0.114 → 0.0.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@winning-test/component",
3
- "version": "0.0.114",
3
+ "version": "0.0.116",
4
4
  "description": "",
5
5
  "main": "",
6
6
  "scripts": {
@@ -16,7 +16,7 @@ class Component extends require("../../../autotest-webui/src/Component") {
16
16
 
17
17
  getXpath() {
18
18
  //return `${super.getXpath()}[not (ancestor-or-self::*[contains(@style,'display: none')])]`;
19
- return `${super.getXpath()}[not (ancestor-or-self::*[contains(@class,'hide')])]`;
19
+ return `${super.getXpath()}[not (ancestor-or-self::*[contains(@class,' hide')])]`;
20
20
  }
21
21
 
22
22
  async click() {
@@ -73,7 +73,7 @@ class Component extends require("../../../autotest-webui/src/Component") {
73
73
  await this.browser.sleep(Component.delayTime);
74
74
  }
75
75
 
76
- async waitUntilValueNotNull(count = 20) {
76
+ async waitUntilValueNotNull(count = 50) {
77
77
  while (count > 0) {
78
78
  const value = await this.getValue();
79
79
  if (value) {
@@ -89,7 +89,7 @@ class Component extends require("../../../autotest-webui/src/Component") {
89
89
  }
90
90
  }
91
91
 
92
- async waitUntilValueNotTheValue(theValue ='', count = 20) {
92
+ async waitUntilValueNotTheValue(theValue ='', count = 50) {
93
93
  while (count > 0) {
94
94
  const value = await this.getValue();
95
95
  if (value === theValue) {
@@ -67,6 +67,31 @@ class TableComponent extends require("./Component") {
67
67
  return ret;
68
68
  }
69
69
 
70
+ async getTable2Data() {
71
+ let ret = [];
72
+ let xpath = `(${this.getXpath()}${this._createBodyXapth()}//tr)[1]`;
73
+ await this.browser.waitUntilElementBeVisible(xpath);
74
+ await this.browser.sleep(TableComponent.delayTime);
75
+ // 处理表体
76
+ xpath = `(${this.getXpath()}${this._createBodyXapth()})[1]//tr`;
77
+ let trs = await this.browser.findElements(xpath);
78
+ for (let i = 0; i < trs.length; i++) {
79
+ xpath = `(${this.getXpath()}${this._createBodyXapth()}//tr)[${i + 1}]/td`;
80
+ let tds = await this.browser.findElements(xpath);
81
+ let row = {};
82
+ for (let j = 0; j < tds.length; j++) {
83
+ let text = (await tds[j].getText(true)).replaceAll("\n", " ");
84
+ row[j] = text;
85
+ }
86
+ ret.push(row);
87
+ }
88
+ // 去重
89
+ ret = ret.filter((item1, index) => {
90
+ return ret.findIndex(item2 => JSON.stringify(item1) === JSON.stringify(item2)) === index;
91
+ });
92
+ return ret;
93
+ }
94
+
70
95
 
71
96
  /**
72
97
  * 获取块组件