@winning-test/component 0.0.100 → 0.0.101

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.
@@ -35,7 +35,18 @@ class SelectComponent extends require("./Component") {
35
35
  while (count > 0) {
36
36
  try {
37
37
  await this._select(...items);
38
- const value = await this.getValue();
38
+ let value = await this.getValue();
39
+ if (!(value)) {
40
+ let strlist = [];
41
+ let strsum = "";
42
+ let xpath = `${this.getXpath()}/parent::div`;
43
+ let divlist = await this.browser.findElements(xpath);
44
+ for (let index = 0; index < divlist.length; index++) {
45
+ strlist[index] = (await divlist[index].getText(true)).trim();
46
+ }
47
+ strlist.forEach((str) => { strsum += str; });
48
+ value = strsum;
49
+ }
39
50
  if (!(value && items.join().indexOf(value) !== -1)) {
40
51
  throw new Error(`选择${items}失败`);
41
52
  }
@@ -65,6 +65,26 @@ class TableComponent extends require("./Component") {
65
65
  return ret;
66
66
  }
67
67
 
68
+ /**
69
+ * 根据列名获取列号
70
+ * @param {columnStr} columnStr 列名
71
+ * @returns 列号
72
+ */
73
+ async getColumnNumberByTitle(columnStr) {
74
+ let xpath = `(${this.getXpath()}${this._createBodyXapth()}//tr)[1]`;
75
+ if (!(await this.browser.isDisplayed(xpath, this.browser.config.timeout))) {
76
+ return;
77
+ }
78
+ await this.browser.sleep(TableComponent.delayTime);
79
+ xpath = `(${this.getXpath()}${this._createHeaderXapth()}//tr)[1]/th`;
80
+ let titles = await this.browser.findElements(xpath);
81
+ for (let i = 0; i < titles.length; i++) {
82
+ titles[i] = (await titles[i].getText(true)).trim() || `#${String(i).padStart(3, "0")}`;
83
+ }
84
+ let columnNumber = titles.indexOf(columnStr) + 1;
85
+ return columnNumber
86
+ }
87
+
68
88
 
69
89
  /**
70
90
  * 获取块组件
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@winning-test/component",
3
- "version": "0.0.100",
3
+ "version": "0.0.101",
4
4
  "description": "",
5
5
  "main": "",
6
6
  "scripts": {
@@ -157,7 +157,7 @@ class Page extends require("@winning-test/autotest-webui").Page {
157
157
  */
158
158
  async loading() {
159
159
  try {
160
- const xpath = "//*[contains(text(),'加载中') or @class='el-loading-mask'][not (ancestor-or-self::*[contains(@style,'display: none')])]";
160
+ const xpath = "//*[contains(text(),'加载中') or @class='el-loading-mask' or @class='el-icon-loading'][not (ancestor-or-self::*[contains(@style,'display: none')])]";
161
161
  if (await this.browser.isDisplayed(xpath, 1000)) {
162
162
  await this.browser.waitUntilElementBeNotVisible(xpath);
163
163
  }