|
@@ -1,5 +1,6 @@
|
|
|
import { By } from 'selenium-webdriver'
|
|
import { By } from 'selenium-webdriver'
|
|
|
import fs from 'fs'
|
|
import fs from 'fs'
|
|
|
|
|
+import { expect } from 'chai'
|
|
|
import { Condition } from 'selenium-webdriver'
|
|
import { Condition } from 'selenium-webdriver'
|
|
|
|
|
|
|
|
export async function getActionButtons (webdriver) {
|
|
export async function getActionButtons (webdriver) {
|
|
@@ -13,15 +14,46 @@ export function takeScreenshot (webdriver) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export async function getRootAndWait() {
|
|
export async function getRootAndWait() {
|
|
|
- await webdriver.get(runner.baseUrl())
|
|
|
|
|
- await webdriver.wait(new Condition('wait for initial-marshal-complete', async function() {
|
|
|
|
|
- const body = await webdriver.findElement(By.tagName('body'))
|
|
|
|
|
- const attr = await body.getAttribute('initial-marshal-complete')
|
|
|
|
|
-
|
|
|
|
|
- if (attr == 'true') {
|
|
|
|
|
- return true
|
|
|
|
|
- } else {
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
- }))
|
|
|
|
|
|
|
+ await webdriver.get(runner.baseUrl())
|
|
|
|
|
+ await webdriver.wait(new Condition('wait for initial-marshal-complete', async function() {
|
|
|
|
|
+ const body = await webdriver.findElement(By.tagName('body'))
|
|
|
|
|
+ const attr = await body.getAttribute('initial-marshal-complete')
|
|
|
|
|
+
|
|
|
|
|
+ if (attr == 'true') {
|
|
|
|
|
+ return true
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ }))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+export async function requireExecutionDialogStatus (webdriver, expected) {
|
|
|
|
|
+ const domStatus = await webdriver.findElement(By.id('execution-dialog-status'))
|
|
|
|
|
+
|
|
|
|
|
+ // It seems that webdriver will not give us text if domStatus is hidden (which it will be until complete)
|
|
|
|
|
+ await webdriver.executeScript('window.executionDialog.domExecutionDetails.hidden = false')
|
|
|
|
|
+
|
|
|
|
|
+ await webdriver.wait(new Condition('wait for action to be running', async function () {
|
|
|
|
|
+ const actual = await domStatus.getText()
|
|
|
|
|
+
|
|
|
|
|
+ if (actual === expected) {
|
|
|
|
|
+ return true
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log('Waiting for domStatus text to be: ', expected, ', it is currently: ', actual)
|
|
|
|
|
+ console.log(await webdriver.executeScript('return window.executionDialog.res'))
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ }))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+export async function findExecutionDialog (webdriver) {
|
|
|
|
|
+ return webdriver.findElement(By.id('execution-results-popup'))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+export async function getActionButton (webdriver, title) {
|
|
|
|
|
+ const buttons = await webdriver.findElements(By.css('[title="' + title + '"]'))
|
|
|
|
|
+
|
|
|
|
|
+ expect(buttons).to.have.length(1)
|
|
|
|
|
+
|
|
|
|
|
+ return buttons[0]
|
|
|
}
|
|
}
|