@winning-test/component 0.0.88 → 0.0.90
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
|
@@ -10,10 +10,11 @@ class SelectComponent extends require("./Component") {
|
|
|
10
10
|
* @param {String} placeholder 背景文字
|
|
11
11
|
* @param {String} label 标签
|
|
12
12
|
*/
|
|
13
|
-
constructor(browser, placeholder, label) {
|
|
13
|
+
constructor(browser, placeholder, label, force_multi = false) {
|
|
14
14
|
super(browser);
|
|
15
15
|
this.placeholder = placeholder;
|
|
16
16
|
this.label = label;
|
|
17
|
+
this.force_multi = force_multi;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
_createXpath() {
|
|
@@ -35,7 +36,7 @@ class SelectComponent extends require("./Component") {
|
|
|
35
36
|
while (count > 0) {
|
|
36
37
|
try {
|
|
37
38
|
await this._select(...items);
|
|
38
|
-
if (items.length > 1){ // 多选不检查value
|
|
39
|
+
if (items.length > 1 || this.force_multi){ // 多选不检查value
|
|
39
40
|
break;
|
|
40
41
|
}
|
|
41
42
|
const value = await this.getValue();
|
|
@@ -65,7 +66,7 @@ class SelectComponent extends require("./Component") {
|
|
|
65
66
|
await (await this.browser.findElement(xpath)).click();
|
|
66
67
|
let listComponent = new ListComponent(this.browser);
|
|
67
68
|
await listComponent.select(...items);
|
|
68
|
-
if (items.length > 1) {
|
|
69
|
+
if (items.length > 1 || this.force_multi) {
|
|
69
70
|
xpath = this.getXpath();
|
|
70
71
|
await (await this.browser.findElement(xpath)).click();
|
|
71
72
|
}
|
|
@@ -34,12 +34,15 @@ class TableComponent extends require("./Component") {
|
|
|
34
34
|
*/
|
|
35
35
|
async getTableData() {
|
|
36
36
|
let ret = [];
|
|
37
|
+
// 先判断表单是否有数据,没有的话返回[]
|
|
37
38
|
let z_xpath = `${this.getXpath()}${this._createBodyXapth()}`
|
|
38
|
-
await this.browser.
|
|
39
|
+
if(!await this.browser.isDisplayed(`${z_xpath}`, 2000)) {
|
|
40
|
+
return ret;
|
|
41
|
+
}
|
|
39
42
|
if(!await this.browser.isDisplayed(`${z_xpath}//tr`, 2000)) {
|
|
40
43
|
return ret;
|
|
41
44
|
}
|
|
42
|
-
|
|
45
|
+
// 默认表格有数据
|
|
43
46
|
let xpath = `(${this.getXpath()}${this._createBodyXapth()}//tr)[1]`;
|
|
44
47
|
await this.browser.waitUntilElementBeVisible(xpath);
|
|
45
48
|
await this.browser.sleep(TableComponent.delayTime);
|