@winning-test/component 0.0.43 → 0.0.45
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/edis5.6/page/Page.js +30 -2
- package/package.json +1 -1
- package/rhm5.6/page/Page.js +5 -0
package/edis5.6/page/Page.js
CHANGED
|
@@ -157,11 +157,11 @@ class Page extends require("@winning-test/autotest-webui").Page {
|
|
|
157
157
|
async loading() {
|
|
158
158
|
try {
|
|
159
159
|
let xpath = "//*[contains(@class,'el-loading-mask') and (not (ancestor-or-self::*[contains(@style,'display: none')]))]";
|
|
160
|
-
if (await this.browser.isDisplayed(xpath,
|
|
160
|
+
if (await this.browser.isDisplayed(xpath, 250)) {
|
|
161
161
|
await this.browser.waitUntilElementBeNotVisible(xpath);
|
|
162
162
|
}
|
|
163
163
|
xpath = "//*[contains(text(),'加载中') and (not (ancestor-or-self::*[contains(@style,'display: none')]))]";
|
|
164
|
-
if (await this.browser.isDisplayed(xpath,
|
|
164
|
+
if (await this.browser.isDisplayed(xpath, 250)) {
|
|
165
165
|
await this.browser.waitUntilElementBeNotVisible(xpath);
|
|
166
166
|
}
|
|
167
167
|
} catch (error) {
|
|
@@ -169,6 +169,34 @@ class Page extends require("@winning-test/autotest-webui").Page {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
/**
|
|
173
|
+
* 关闭打印窗口
|
|
174
|
+
* @param {Number} timeout 等待时间, 单位: ms
|
|
175
|
+
*/
|
|
176
|
+
async closePrintWindow(timeout = 10000) {
|
|
177
|
+
let count = timeout / 500;
|
|
178
|
+
while (count > 0) {
|
|
179
|
+
let windows = await this.browser.webDriver.getAllWindowHandles();
|
|
180
|
+
if (windows.length === 1) {
|
|
181
|
+
await this.browser.sleep(500);
|
|
182
|
+
count--;
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
const js = "document.querySelector('print-preview-app').shadowRoot.querySelector('print-preview-sidebar').shadowRoot.querySelector('print-preview-button-strip').shadowRoot.querySelector('cr-button.cancel-button').click()";
|
|
186
|
+
for (let i = 1; i < windows.length; i++) {
|
|
187
|
+
try {
|
|
188
|
+
await this.browser.switchToWindow(i);
|
|
189
|
+
await this.browser.executeScript(js);
|
|
190
|
+
break;
|
|
191
|
+
} catch (error) {
|
|
192
|
+
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
await this.browser.switchToWindow();
|
|
198
|
+
}
|
|
199
|
+
|
|
172
200
|
}
|
|
173
201
|
|
|
174
202
|
module.exports = Page;
|
package/package.json
CHANGED
package/rhm5.6/page/Page.js
CHANGED
|
@@ -163,6 +163,10 @@ class Page extends require("@winning-test/autotest-webui").Page {
|
|
|
163
163
|
if (await this.browser.isDisplayed(xpath, 200)) {
|
|
164
164
|
await this.browser.waitUntilElementBeNotVisible(xpath);
|
|
165
165
|
}
|
|
166
|
+
xpath = "//span[@id='processText'][contains(text(),'请稍候')]";
|
|
167
|
+
if (await this.browser.isDisplayed(xpath, 100)) {
|
|
168
|
+
await this.browser.waitUntilElementBeNotVisible(xpath);
|
|
169
|
+
}
|
|
166
170
|
} catch (error) {
|
|
167
171
|
|
|
168
172
|
}
|
|
@@ -191,6 +195,7 @@ class Page extends require("@winning-test/autotest-webui").Page {
|
|
|
191
195
|
xpath = `//*[@id='menuconfig']//*[text()='${firstItem}']/ancestor::ul/li[2]//*[text()='${secondItem}']`;
|
|
192
196
|
await that.blockComponent(xpath).click();
|
|
193
197
|
await that.switchToActiveFrame();
|
|
198
|
+
await that.loading();
|
|
194
199
|
}
|
|
195
200
|
|
|
196
201
|
}
|