@winning-test/component 0.0.113 → 0.0.115

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.113",
3
+ "version": "0.0.115",
4
4
  "description": "",
5
5
  "main": "",
6
6
  "scripts": {
@@ -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) {
@@ -88,6 +88,22 @@ class Component extends require("../../../autotest-webui/src/Component") {
88
88
  }
89
89
  }
90
90
  }
91
+
92
+ async waitUntilValueNotTheValue(theValue ='', count = 50) {
93
+ while (count > 0) {
94
+ const value = await this.getValue();
95
+ if (value === theValue) {
96
+ return value;
97
+ } else {
98
+ if (count > 1) {
99
+ count--;
100
+ await this.browser.sleep(500);
101
+ } else {
102
+ throw new Error('等待出现特定value失败');
103
+ }
104
+ }
105
+ }
106
+ }
91
107
  }
92
108
 
93
109
  module.exports = Component;
@@ -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
  * 获取块组件