@eclipse-che/che-e2e 7.73.0 → 7.74.0-dev-41d1364
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/.eslintignore +10 -0
- package/.eslintrc.js +183 -0
- package/.prettierignore +10 -0
- package/.prettierrc.json +10 -0
- package/README.md +47 -47
- package/configs/inversify.config.ts +14 -10
- package/configs/inversify.types.ts +29 -29
- package/configs/mocharc.ts +21 -24
- package/constants/API_TEST_CONSTANTS.ts +67 -0
- package/constants/BASE_TEST_CONSTANTS.ts +80 -0
- package/constants/CHROME_DRIVER_CONSTANTS.ts +54 -0
- package/constants/FACTORY_TEST_CONSTANTS.ts +61 -0
- package/constants/MONACO_CONSTANTS.ts +25 -0
- package/constants/OAUTH_CONSTANTS.ts +67 -0
- package/constants/PLUGIN_TEST_CONSTANTS.ts +15 -0
- package/constants/REPORTER_CONSTANTS.ts +53 -0
- package/constants/TIMEOUT_CONSTANTS.ts +131 -0
- package/dist/configs/inversify.config.js +14 -8
- package/dist/configs/inversify.config.js.map +1 -1
- package/dist/configs/inversify.types.js +2 -2
- package/dist/configs/inversify.types.js.map +1 -1
- package/dist/configs/mocharc.js +13 -16
- package/dist/configs/mocharc.js.map +1 -1
- package/dist/constants/{APITestConstants.js → API_TEST_CONSTANTS.js} +13 -13
- package/dist/constants/API_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{BaseTestConstants.js → BASE_TEST_CONSTANTS.js} +17 -16
- package/dist/constants/BASE_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{ChromeDriverConstants.js → CHROME_DRIVER_CONSTANTS.js} +14 -14
- package/dist/constants/CHROME_DRIVER_CONSTANTS.js.map +1 -0
- package/dist/constants/{FactoryTestConstants.js → FACTORY_TEST_CONSTANTS.js} +15 -14
- package/dist/constants/FACTORY_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{MonacoConstants.js → MONACO_CONSTANTS.js} +8 -8
- package/dist/constants/MONACO_CONSTANTS.js.map +1 -0
- package/dist/constants/{OAuthConstants.js → OAUTH_CONSTANTS.js} +15 -15
- package/dist/constants/OAUTH_CONSTANTS.js.map +1 -0
- package/dist/constants/{PluginsTestConstants.js → PLUGIN_TEST_CONSTANTS.js} +7 -7
- package/dist/constants/PLUGIN_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{ReporterConstants.js → REPORTER_CONSTANTS.js} +13 -13
- package/dist/constants/REPORTER_CONSTANTS.js.map +1 -0
- package/dist/constants/{TimeoutConstants.js → TIMEOUT_CONSTANTS.js} +24 -24
- package/dist/constants/TIMEOUT_CONSTANTS.js.map +1 -0
- package/dist/driver/ChromeDriver.js +12 -16
- package/dist/driver/ChromeDriver.js.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/pageobjects/dashboard/CreateWorkspace.js +18 -18
- package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
- package/dist/pageobjects/dashboard/Dashboard.js +27 -27
- package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
- package/dist/pageobjects/dashboard/Workspaces.js +42 -42
- package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +44 -33
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/git-providers/OauthPage.js +37 -35
- package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js +10 -10
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
- package/dist/pageobjects/login/interfaces/ICheLoginPage.js +2 -2
- package/dist/pageobjects/login/interfaces/IOcpLoginPage.js +2 -2
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js +10 -10
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js.map +1 -1
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js +6 -6
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpLoginPage.js +23 -23
- package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js +7 -7
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js +7 -7
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js +11 -11
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js +10 -10
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpApplicationPage.js +7 -7
- package/dist/pageobjects/openshift/OcpApplicationPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js +9 -9
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpMainPage.js +15 -15
- package/dist/pageobjects/openshift/OcpMainPage.js.map +1 -1
- package/dist/specs/MochaHooks.js +27 -24
- package/dist/specs/MochaHooks.js.map +1 -1
- package/dist/specs/SmokeTest.spec.js +17 -13
- package/dist/specs/SmokeTest.spec.js.map +1 -1
- package/dist/specs/api/ContainerOverridesAPI.spec.js +10 -1
- package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -1
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +31 -18
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js +18 -12
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
- package/dist/specs/api/PodOverridesAPI.spec.js +12 -2
- package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +12 -8
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/Quarkus.spec.js +13 -9
- package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +47 -43
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +17 -10
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
- package/dist/specs/factory/Factory.spec.js +28 -26
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +41 -36
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +37 -35
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +18 -5
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -1
- package/dist/tests-library/LoginTests.js +7 -7
- package/dist/tests-library/LoginTests.js.map +1 -1
- package/dist/tests-library/ProjectAndFileTests.js +9 -7
- package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js +61 -78
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/BrowserTabsUtil.js +29 -24
- package/dist/utils/BrowserTabsUtil.js.map +1 -1
- package/dist/utils/CheReporter.js +44 -44
- package/dist/utils/CheReporter.js.map +1 -1
- package/dist/utils/DevWorkspaceConfigurationHelper.js +19 -10
- package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
- package/dist/utils/DevfilesRegistryHelper.js +25 -19
- package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
- package/dist/utils/DriverHelper.js +126 -128
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/KubernetesCommandLineToolsExecutor.js +53 -46
- package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
- package/dist/utils/Logger.js +62 -39
- package/dist/utils/Logger.js.map +1 -1
- package/dist/utils/ScreenCatcher.js +18 -12
- package/dist/utils/ScreenCatcher.js.map +1 -1
- package/dist/utils/ShellExecutor.js +9 -0
- package/dist/utils/ShellExecutor.js.map +1 -1
- package/dist/utils/StringUtil.js +17 -9
- package/dist/utils/StringUtil.js.map +1 -1
- package/dist/utils/request-handlers/CheApiRequestHandler.js +36 -34
- package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js +10 -6
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
- package/dist/utils/request-handlers/headers/IAuthorizationHeaderHandler.js +2 -2
- package/dist/utils/workspace/ApiUrlResolver.js +5 -5
- package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
- package/dist/utils/workspace/ITestWorkspaceUtil.js +2 -2
- package/dist/utils/workspace/TestWorkspaceUtil.js +36 -30
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/dist/utils/workspace/WorkspaceStatus.js +2 -2
- package/dist/utils/workspace/WorkspaceStatus.js.map +1 -1
- package/driver/ChromeDriver.ts +45 -51
- package/driver/IDriver.ts +3 -3
- package/index.ts +9 -9
- package/package.json +59 -49
- package/pageobjects/dashboard/CreateWorkspace.ts +65 -56
- package/pageobjects/dashboard/Dashboard.ts +101 -100
- package/pageobjects/dashboard/Workspaces.ts +197 -166
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +151 -127
- package/pageobjects/git-providers/OauthPage.ts +177 -166
- package/pageobjects/ide/CheCodeLocatorLoader.ts +49 -46
- package/pageobjects/login/interfaces/ICheLoginPage.ts +3 -3
- package/pageobjects/login/interfaces/IOcpLoginPage.ts +3 -3
- package/pageobjects/login/kubernetes/DexLoginPage.ts +32 -31
- package/pageobjects/login/kubernetes/KubernetesLoginPage.ts +16 -15
- package/pageobjects/login/openshift/OcpLoginPage.ts +62 -55
- package/pageobjects/login/openshift/OcpRedHatLoginPage.ts +30 -25
- package/pageobjects/login/openshift/OcpUserLoginPage.ts +16 -19
- package/pageobjects/login/openshift/RedHatLoginPage.ts +49 -44
- package/pageobjects/login/openshift/RegularUserOcpCheLoginPage.ts +39 -35
- package/pageobjects/openshift/OcpApplicationPage.ts +21 -20
- package/pageobjects/openshift/OcpImportFromGitPage.ts +70 -68
- package/pageobjects/openshift/OcpMainPage.ts +69 -68
- package/resources/pod-overrides-airgap.yaml +37 -0
- package/specs/MochaHooks.ts +59 -50
- package/specs/SmokeTest.spec.ts +43 -36
- package/specs/api/ContainerOverridesAPI.spec.ts +33 -26
- package/specs/api/DevfileAcceptanceTestAPI.spec.ts +107 -94
- package/specs/api/EmptyWorkspaceAPI.spec.ts +62 -57
- package/specs/api/PodOverridesAPI.spec.ts +42 -32
- package/specs/dashboard-samples/EmptyWorkspace.spec.ts +31 -27
- package/specs/dashboard-samples/Quarkus.spec.ts +34 -30
- package/specs/dashboard-samples/RecommendedExtensions.spec.ts +192 -170
- package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +62 -55
- package/specs/factory/Factory.spec.ts +178 -166
- package/specs/factory/NoSetupRepoFactory.spec.ts +227 -210
- package/specs/factory/RefusedOAuthFactory.spec.ts +219 -203
- package/specs/miscellaneous/PredefinedNamespace.spec.ts +64 -50
- package/tests-library/LoginTests.ts +34 -32
- package/tests-library/ProjectAndFileTests.ts +21 -18
- package/tests-library/WorkspaceHandlingTests.ts +98 -108
- package/tsconfig.json +15 -15
- package/utils/BrowserTabsUtil.ts +104 -98
- package/utils/CheReporter.ts +142 -148
- package/utils/DevWorkspaceConfigurationHelper.ts +70 -61
- package/utils/DevfilesRegistryHelper.ts +67 -58
- package/utils/DriverHelper.ts +726 -701
- package/utils/KubernetesCommandLineToolsExecutor.ts +196 -172
- package/utils/Logger.ts +104 -75
- package/utils/ScreenCatcher.ts +59 -48
- package/utils/ShellExecutor.ts +19 -11
- package/utils/StringUtil.ts +40 -32
- package/utils/request-handlers/CheApiRequestHandler.ts +92 -87
- package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +32 -21
- package/utils/request-handlers/headers/IAuthorizationHeaderHandler.ts +3 -3
- package/utils/workspace/ApiUrlResolver.ts +31 -26
- package/utils/workspace/ITestWorkspaceUtil.ts +31 -31
- package/utils/workspace/TestWorkspaceUtil.ts +153 -142
- package/utils/workspace/WorkspaceStatus.ts +5 -5
- package/constants/APITestConstants.ts +0 -56
- package/constants/BaseTestConstants.ts +0 -65
- package/constants/ChromeDriverConstants.ts +0 -46
- package/constants/FactoryTestConstants.ts +0 -51
- package/constants/MonacoConstants.ts +0 -22
- package/constants/OAuthConstants.ts +0 -57
- package/constants/PluginsTestConstants.ts +0 -15
- package/constants/ReporterConstants.ts +0 -45
- package/constants/TimeoutConstants.ts +0 -113
- package/dist/constants/APITestConstants.js.map +0 -1
- package/dist/constants/BaseTestConstants.js.map +0 -1
- package/dist/constants/ChromeDriverConstants.js.map +0 -1
- package/dist/constants/FactoryTestConstants.js.map +0 -1
- package/dist/constants/MonacoConstants.js.map +0 -1
- package/dist/constants/OAuthConstants.js.map +0 -1
- package/dist/constants/PluginsTestConstants.js.map +0 -1
- package/dist/constants/ReporterConstants.js.map +0 -1
- package/dist/constants/TimeoutConstants.js.map +0 -1
- package/tslint.json +0 -126
|
@@ -18,17 +18,17 @@ const inversify_types_1 = require("../configs/inversify.types");
|
|
|
18
18
|
const selenium_webdriver_1 = require("selenium-webdriver");
|
|
19
19
|
require("reflect-metadata");
|
|
20
20
|
const Logger_1 = require("./Logger");
|
|
21
|
-
const
|
|
21
|
+
const TIMEOUT_CONSTANTS_1 = require("../constants/TIMEOUT_CONSTANTS");
|
|
22
22
|
let DriverHelper = class DriverHelper {
|
|
23
23
|
constructor(driver) {
|
|
24
24
|
this.driver = driver.get();
|
|
25
25
|
}
|
|
26
26
|
getAction() {
|
|
27
|
-
Logger_1.Logger.trace(
|
|
27
|
+
Logger_1.Logger.trace();
|
|
28
28
|
return this.driver.actions();
|
|
29
29
|
}
|
|
30
30
|
async isVisible(locator) {
|
|
31
|
-
Logger_1.Logger.trace(
|
|
31
|
+
Logger_1.Logger.trace(`${locator}`);
|
|
32
32
|
try {
|
|
33
33
|
const element = await this.driver.findElement(locator);
|
|
34
34
|
return await element.isDisplayed();
|
|
@@ -38,15 +38,15 @@ let DriverHelper = class DriverHelper {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
async wait(milliseconds) {
|
|
41
|
-
Logger_1.Logger.trace(`
|
|
41
|
+
Logger_1.Logger.trace(`(${milliseconds} milliseconds)`);
|
|
42
42
|
await this.driver.sleep(milliseconds);
|
|
43
43
|
}
|
|
44
44
|
async refreshPage() {
|
|
45
|
-
Logger_1.Logger.trace(
|
|
45
|
+
Logger_1.Logger.trace();
|
|
46
46
|
await this.driver.navigate().refresh();
|
|
47
47
|
}
|
|
48
|
-
async waitVisibilityBoolean(locator, attempts =
|
|
49
|
-
Logger_1.Logger.trace(
|
|
48
|
+
async waitVisibilityBoolean(locator, attempts = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_ATTEMPTS, polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING) {
|
|
49
|
+
Logger_1.Logger.trace(`${locator}`);
|
|
50
50
|
for (let i = 0; i < attempts; i++) {
|
|
51
51
|
const isVisible = await this.isVisible(locator);
|
|
52
52
|
if (isVisible) {
|
|
@@ -56,8 +56,8 @@ let DriverHelper = class DriverHelper {
|
|
|
56
56
|
}
|
|
57
57
|
return false;
|
|
58
58
|
}
|
|
59
|
-
async waitDisappearanceBoolean(locator, attempts =
|
|
60
|
-
Logger_1.Logger.trace(
|
|
59
|
+
async waitDisappearanceBoolean(locator, attempts = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_ATTEMPTS, polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING) {
|
|
60
|
+
Logger_1.Logger.trace(`${locator}`);
|
|
61
61
|
for (let i = 0; i < attempts; i++) {
|
|
62
62
|
const isVisible = await this.isVisible(locator);
|
|
63
63
|
if (!isVisible) {
|
|
@@ -67,10 +67,10 @@ let DriverHelper = class DriverHelper {
|
|
|
67
67
|
}
|
|
68
68
|
return false;
|
|
69
69
|
}
|
|
70
|
-
async waitVisibility(elementLocator, timeout =
|
|
71
|
-
const polling =
|
|
70
|
+
async waitVisibility(elementLocator, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
71
|
+
const polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
72
72
|
const attempts = Math.ceil(timeout / polling);
|
|
73
|
-
Logger_1.Logger.trace(
|
|
73
|
+
Logger_1.Logger.trace(`${elementLocator}`);
|
|
74
74
|
for (let i = 0; i < attempts; i++) {
|
|
75
75
|
let element;
|
|
76
76
|
try {
|
|
@@ -78,123 +78,122 @@ let DriverHelper = class DriverHelper {
|
|
|
78
78
|
}
|
|
79
79
|
catch (err) {
|
|
80
80
|
if (i >= attempts - 1) {
|
|
81
|
-
Logger_1.Logger.error(`
|
|
81
|
+
Logger_1.Logger.error(`failed with exception, out of attempts - ${err}`);
|
|
82
82
|
throw err;
|
|
83
83
|
}
|
|
84
84
|
if (err instanceof selenium_webdriver_1.error.TimeoutError) {
|
|
85
|
-
if (attempts !== 1) {
|
|
86
|
-
|
|
85
|
+
if (attempts !== 1) {
|
|
86
|
+
// waitVisibility was spamming other methods when the number of attempts was 1 - only show message if attempts > 1
|
|
87
|
+
Logger_1.Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
|
|
87
88
|
}
|
|
88
89
|
continue;
|
|
89
90
|
}
|
|
90
|
-
if (err instanceof selenium_webdriver_1.error.NoSuchWindowError) {
|
|
91
|
-
|
|
91
|
+
if (err instanceof selenium_webdriver_1.error.NoSuchWindowError) {
|
|
92
|
+
// sometimes waitVisibility fails with NoSuchWindowError when the check is run too soon before the page loads
|
|
93
|
+
Logger_1.Logger.trace(`failed with NoSuchWindow exception. Attempt #${i + 1}, retrying with ${polling}ms timeout`);
|
|
92
94
|
continue;
|
|
93
95
|
}
|
|
94
|
-
Logger_1.Logger.error(`
|
|
96
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
95
97
|
throw err;
|
|
96
98
|
}
|
|
97
99
|
try {
|
|
98
100
|
const visibleWebElement = await this.driver.wait(selenium_webdriver_1.until.elementIsVisible(element), polling);
|
|
99
|
-
Logger_1.Logger.trace('
|
|
101
|
+
Logger_1.Logger.trace('element is located and is visible.');
|
|
100
102
|
return visibleWebElement;
|
|
101
103
|
}
|
|
102
104
|
catch (err) {
|
|
103
105
|
if (err instanceof selenium_webdriver_1.error.TimeoutError) {
|
|
104
|
-
if (attempts !== 1) {
|
|
105
|
-
|
|
106
|
+
if (attempts !== 1) {
|
|
107
|
+
// waitVisibility was spamming other methods when the number of attempts was 1 - only show message if attempts > 1
|
|
108
|
+
Logger_1.Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
|
|
106
109
|
}
|
|
107
110
|
continue;
|
|
108
111
|
}
|
|
109
112
|
if (err instanceof selenium_webdriver_1.error.StaleElementReferenceError) {
|
|
110
|
-
Logger_1.Logger.debug(`
|
|
113
|
+
Logger_1.Logger.debug(`stale element error - ${JSON.stringify(err)}`);
|
|
111
114
|
await this.wait(polling);
|
|
112
115
|
continue;
|
|
113
116
|
}
|
|
114
|
-
Logger_1.Logger.error(`
|
|
117
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
115
118
|
throw err;
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
|
-
throw new selenium_webdriver_1.error.TimeoutError(`Exceeded maximum visibility
|
|
121
|
+
throw new selenium_webdriver_1.error.TimeoutError(`Exceeded maximum visibility checking attempts for '${elementLocator}' element, timeouted after ${timeout}`);
|
|
119
122
|
}
|
|
120
|
-
async waitPresence(elementLocator, timeout =
|
|
121
|
-
const polling =
|
|
123
|
+
async waitPresence(elementLocator, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
124
|
+
const polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
122
125
|
const attempts = Math.ceil(timeout / polling);
|
|
123
|
-
Logger_1.Logger.trace(
|
|
126
|
+
Logger_1.Logger.trace(`${elementLocator}`);
|
|
124
127
|
for (let i = 0; i < attempts; i++) {
|
|
125
128
|
try {
|
|
126
129
|
return await this.driver.wait(selenium_webdriver_1.until.elementLocated(elementLocator), polling);
|
|
127
130
|
}
|
|
128
131
|
catch (err) {
|
|
129
132
|
if (err instanceof selenium_webdriver_1.error.TimeoutError) {
|
|
130
|
-
Logger_1.Logger.trace(`
|
|
133
|
+
Logger_1.Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
|
|
131
134
|
continue;
|
|
132
135
|
}
|
|
133
136
|
if (err instanceof selenium_webdriver_1.error.StaleElementReferenceError) {
|
|
134
137
|
await this.wait(polling);
|
|
135
138
|
continue;
|
|
136
139
|
}
|
|
137
|
-
Logger_1.Logger.error(`
|
|
140
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
138
141
|
throw err;
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
throw new selenium_webdriver_1.error.TimeoutError(`Exceeded maximum presence checking attempts, problems with 'StaleElementReferenceError' of '${elementLocator}' element`);
|
|
142
145
|
}
|
|
143
|
-
async waitAllPresence(elementLocator, timeout =
|
|
144
|
-
const polling =
|
|
146
|
+
async waitAllPresence(elementLocator, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
147
|
+
const polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
145
148
|
const attempts = Math.ceil(timeout / polling);
|
|
146
|
-
Logger_1.Logger.trace(
|
|
149
|
+
Logger_1.Logger.trace(`${elementLocator}`);
|
|
147
150
|
for (let i = 0; i < attempts; i++) {
|
|
148
151
|
try {
|
|
149
152
|
return await this.driver.wait(selenium_webdriver_1.until.elementsLocated(elementLocator), polling);
|
|
150
153
|
}
|
|
151
154
|
catch (err) {
|
|
152
155
|
if (err instanceof selenium_webdriver_1.error.TimeoutError) {
|
|
153
|
-
Logger_1.Logger.trace(`
|
|
156
|
+
Logger_1.Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
|
|
154
157
|
continue;
|
|
155
158
|
}
|
|
156
159
|
if (err instanceof selenium_webdriver_1.error.StaleElementReferenceError) {
|
|
157
160
|
await this.wait(polling);
|
|
158
161
|
continue;
|
|
159
162
|
}
|
|
160
|
-
Logger_1.Logger.error(`
|
|
163
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
161
164
|
throw err;
|
|
162
165
|
}
|
|
163
166
|
}
|
|
164
167
|
throw new selenium_webdriver_1.error.TimeoutError(`Exceeded maximum presence checkings attempts, problems with 'StaleElementReferenceError' of '${elementLocator}' element`);
|
|
165
168
|
}
|
|
166
169
|
async waitAllVisibility(locators, timeout) {
|
|
167
|
-
Logger_1.Logger.trace(
|
|
170
|
+
Logger_1.Logger.trace(`${locators}`);
|
|
168
171
|
for (const elementLocator of locators) {
|
|
169
172
|
await this.waitVisibility(elementLocator, timeout);
|
|
170
173
|
}
|
|
171
174
|
}
|
|
172
|
-
async waitDisappearance(elementLocator, attempts =
|
|
173
|
-
Logger_1.Logger.trace(
|
|
175
|
+
async waitDisappearance(elementLocator, attempts = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_ATTEMPTS, polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING) {
|
|
176
|
+
Logger_1.Logger.trace(`${elementLocator}`);
|
|
174
177
|
const isDisappeared = await this.waitDisappearanceBoolean(elementLocator, attempts, polling);
|
|
175
178
|
if (!isDisappeared) {
|
|
176
179
|
throw new selenium_webdriver_1.error.TimeoutError(`Waiting attempts exceeded, element '${elementLocator}' is still visible`);
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
|
-
async
|
|
180
|
-
Logger_1.Logger.trace(
|
|
181
|
-
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
return true;
|
|
182
|
+
async waitAllDisappearance(locators, attemptsPerLocator = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_ATTEMPTS, pollingPerLocator = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING) {
|
|
183
|
+
Logger_1.Logger.trace(`${locators}`);
|
|
184
|
+
try {
|
|
185
|
+
for (const elementLocator of locators) {
|
|
186
|
+
await this.waitDisappearance(elementLocator, attemptsPerLocator, pollingPerLocator);
|
|
185
187
|
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
Logger_1.Logger.trace(`DriverHelper.waitAllDisappearance ${locators}`);
|
|
190
|
-
for (const elementLocator of locators) {
|
|
191
|
-
await this.waitDisappearance(elementLocator, attemptsPerLocator, pollingPerLocator);
|
|
188
|
+
}
|
|
189
|
+
catch (e) {
|
|
190
|
+
throw e;
|
|
192
191
|
}
|
|
193
192
|
}
|
|
194
|
-
async waitAndClick(elementLocator, timeout =
|
|
195
|
-
const polling =
|
|
193
|
+
async waitAndClick(elementLocator, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
194
|
+
const polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
196
195
|
const attempts = Math.ceil(timeout / polling);
|
|
197
|
-
Logger_1.Logger.trace(
|
|
196
|
+
Logger_1.Logger.trace(`${elementLocator}`);
|
|
198
197
|
for (let i = 0; i < attempts; i++) {
|
|
199
198
|
let element;
|
|
200
199
|
try {
|
|
@@ -202,14 +201,14 @@ let DriverHelper = class DriverHelper {
|
|
|
202
201
|
}
|
|
203
202
|
catch (err) {
|
|
204
203
|
if (i >= attempts - 1) {
|
|
205
|
-
Logger_1.Logger.error(`
|
|
204
|
+
Logger_1.Logger.error(`failed with exception, out of attempts - ${err}`);
|
|
206
205
|
throw err;
|
|
207
206
|
}
|
|
208
207
|
if (err instanceof selenium_webdriver_1.error.TimeoutError) {
|
|
209
|
-
Logger_1.Logger.trace(`
|
|
208
|
+
Logger_1.Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
|
|
210
209
|
continue;
|
|
211
210
|
}
|
|
212
|
-
Logger_1.Logger.error(`
|
|
211
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
213
212
|
throw err;
|
|
214
213
|
}
|
|
215
214
|
try {
|
|
@@ -221,12 +220,12 @@ let DriverHelper = class DriverHelper {
|
|
|
221
220
|
return err instanceof selenium_webdriver_1.error.ElementClickInterceptedError && i === attempts - 1;
|
|
222
221
|
}
|
|
223
222
|
if (err instanceof selenium_webdriver_1.error.StaleElementReferenceError || err instanceof selenium_webdriver_1.error.ElementClickInterceptedError) {
|
|
224
|
-
Logger_1.Logger.debug(
|
|
223
|
+
Logger_1.Logger.debug(`${elementLocator} - ${JSON.stringify(err)}`);
|
|
225
224
|
await this.wait(polling);
|
|
226
225
|
continue;
|
|
227
226
|
}
|
|
228
227
|
if (isElementClickInterceptedOnLastAttempt(err, i)) {
|
|
229
|
-
Logger_1.Logger.debug(
|
|
228
|
+
Logger_1.Logger.debug('element is not clickable, try to perform pointer click');
|
|
230
229
|
await this.getAction()
|
|
231
230
|
.move({
|
|
232
231
|
origin: await this.waitPresence(elementLocator)
|
|
@@ -235,16 +234,16 @@ let DriverHelper = class DriverHelper {
|
|
|
235
234
|
.perform();
|
|
236
235
|
return;
|
|
237
236
|
}
|
|
238
|
-
Logger_1.Logger.error(`
|
|
237
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
239
238
|
throw err;
|
|
240
239
|
}
|
|
241
240
|
}
|
|
242
241
|
throw new selenium_webdriver_1.error.TimeoutError(`Exceeded maximum clicking attempts, the '${elementLocator}' element is not clickable`);
|
|
243
242
|
}
|
|
244
|
-
async waitAndGetElementAttribute(elementLocator, attribute, timeout =
|
|
245
|
-
const polling =
|
|
243
|
+
async waitAndGetElementAttribute(elementLocator, attribute, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
244
|
+
const polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
246
245
|
const attempts = Math.ceil(timeout / polling);
|
|
247
|
-
Logger_1.Logger.trace(
|
|
246
|
+
Logger_1.Logger.trace(`${elementLocator} attribute: '${attribute}'`);
|
|
248
247
|
for (let i = 0; i < attempts; i++) {
|
|
249
248
|
let element;
|
|
250
249
|
try {
|
|
@@ -252,14 +251,14 @@ let DriverHelper = class DriverHelper {
|
|
|
252
251
|
}
|
|
253
252
|
catch (err) {
|
|
254
253
|
if (i >= attempts - 1) {
|
|
255
|
-
Logger_1.Logger.error(`
|
|
254
|
+
Logger_1.Logger.error(`failed with exception, out of attempts - ${err}`);
|
|
256
255
|
throw err;
|
|
257
256
|
}
|
|
258
257
|
if (err instanceof selenium_webdriver_1.error.TimeoutError) {
|
|
259
|
-
Logger_1.Logger.trace(`
|
|
258
|
+
Logger_1.Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
|
|
260
259
|
continue;
|
|
261
260
|
}
|
|
262
|
-
Logger_1.Logger.error(`
|
|
261
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
263
262
|
throw err;
|
|
264
263
|
}
|
|
265
264
|
try {
|
|
@@ -270,16 +269,16 @@ let DriverHelper = class DriverHelper {
|
|
|
270
269
|
await this.wait(polling);
|
|
271
270
|
continue;
|
|
272
271
|
}
|
|
273
|
-
Logger_1.Logger.error(`
|
|
272
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
274
273
|
throw err;
|
|
275
274
|
}
|
|
276
275
|
}
|
|
277
276
|
throw new selenium_webdriver_1.error.TimeoutError(`Exceeded maximum gettin of the '${attribute}' attribute attempts, from the '${elementLocator}' element`);
|
|
278
277
|
}
|
|
279
|
-
async waitAndGetCssValue(elementLocator, cssAttribute, timeout =
|
|
280
|
-
const polling =
|
|
278
|
+
async waitAndGetCssValue(elementLocator, cssAttribute, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
279
|
+
const polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
281
280
|
const attempts = Math.ceil(timeout / polling);
|
|
282
|
-
Logger_1.Logger.trace(
|
|
281
|
+
Logger_1.Logger.trace(`${elementLocator} cssAttribute: ${cssAttribute}`);
|
|
283
282
|
for (let i = 0; i < attempts; i++) {
|
|
284
283
|
let element;
|
|
285
284
|
try {
|
|
@@ -287,14 +286,14 @@ let DriverHelper = class DriverHelper {
|
|
|
287
286
|
}
|
|
288
287
|
catch (err) {
|
|
289
288
|
if (i >= attempts - 1) {
|
|
290
|
-
Logger_1.Logger.error(`
|
|
289
|
+
Logger_1.Logger.error(`failed with exception, out of attempts - ${err}`);
|
|
291
290
|
throw err;
|
|
292
291
|
}
|
|
293
292
|
if (err instanceof selenium_webdriver_1.error.TimeoutError) {
|
|
294
|
-
Logger_1.Logger.trace(`
|
|
293
|
+
Logger_1.Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
|
|
295
294
|
continue;
|
|
296
295
|
}
|
|
297
|
-
Logger_1.Logger.error(`
|
|
296
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
298
297
|
throw err;
|
|
299
298
|
}
|
|
300
299
|
try {
|
|
@@ -305,27 +304,27 @@ let DriverHelper = class DriverHelper {
|
|
|
305
304
|
await this.wait(polling);
|
|
306
305
|
continue;
|
|
307
306
|
}
|
|
308
|
-
Logger_1.Logger.error(`
|
|
307
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
309
308
|
throw err;
|
|
310
309
|
}
|
|
311
310
|
}
|
|
312
311
|
throw new selenium_webdriver_1.error.TimeoutError(`Exceeded maximum gettin of the '${cssAttribute}' css attribute attempts, from the '${elementLocator}' element`);
|
|
313
312
|
}
|
|
314
313
|
async waitAttributeValue(elementLocator, attribute, expectedValue, timeout) {
|
|
315
|
-
Logger_1.Logger.trace(
|
|
314
|
+
Logger_1.Logger.trace(`${elementLocator}`);
|
|
316
315
|
await this.driver.wait(async () => {
|
|
317
316
|
const attributeValue = await this.waitAndGetElementAttribute(elementLocator, attribute, timeout);
|
|
318
317
|
return expectedValue === attributeValue;
|
|
319
318
|
}, timeout, `The '${attribute}' attribute value doesn't match with expected value '${expectedValue}'`);
|
|
320
319
|
}
|
|
321
|
-
async type(elementLocator, text, timeout =
|
|
322
|
-
const polling =
|
|
320
|
+
async type(elementLocator, text, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
321
|
+
const polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
323
322
|
const attempts = Math.ceil(timeout / polling);
|
|
324
323
|
if (elementLocator.toString().toLocaleLowerCase().includes('password')) {
|
|
325
|
-
Logger_1.Logger.trace(
|
|
324
|
+
Logger_1.Logger.trace(`${elementLocator} text: ***`);
|
|
326
325
|
}
|
|
327
326
|
else {
|
|
328
|
-
Logger_1.Logger.trace(
|
|
327
|
+
Logger_1.Logger.trace(`${elementLocator} text: ${text}`);
|
|
329
328
|
}
|
|
330
329
|
for (let i = 0; i < attempts; i++) {
|
|
331
330
|
let element;
|
|
@@ -334,14 +333,14 @@ let DriverHelper = class DriverHelper {
|
|
|
334
333
|
}
|
|
335
334
|
catch (err) {
|
|
336
335
|
if (i >= attempts - 1) {
|
|
337
|
-
Logger_1.Logger.error(`
|
|
336
|
+
Logger_1.Logger.error(`failed with exception, out of attempts - ${err}`);
|
|
338
337
|
throw err;
|
|
339
338
|
}
|
|
340
339
|
if (err instanceof selenium_webdriver_1.error.TimeoutError) {
|
|
341
|
-
Logger_1.Logger.trace(`
|
|
340
|
+
Logger_1.Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
|
|
342
341
|
continue;
|
|
343
342
|
}
|
|
344
|
-
Logger_1.Logger.error(`
|
|
343
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
345
344
|
throw err;
|
|
346
345
|
}
|
|
347
346
|
try {
|
|
@@ -353,16 +352,16 @@ let DriverHelper = class DriverHelper {
|
|
|
353
352
|
await this.wait(polling);
|
|
354
353
|
continue;
|
|
355
354
|
}
|
|
356
|
-
Logger_1.Logger.error(`
|
|
355
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
357
356
|
throw err;
|
|
358
357
|
}
|
|
359
358
|
}
|
|
360
359
|
throw new selenium_webdriver_1.error.TimeoutError(`Exceeded maximum typing attempts, to the '${elementLocator}' element`);
|
|
361
360
|
}
|
|
362
|
-
async typeToInvisible(elementLocator, text, timeout =
|
|
363
|
-
const polling =
|
|
361
|
+
async typeToInvisible(elementLocator, text, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
362
|
+
const polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
364
363
|
const attempts = Math.ceil(timeout / polling);
|
|
365
|
-
Logger_1.Logger.trace(
|
|
364
|
+
Logger_1.Logger.trace(`${elementLocator} text: ${text}`);
|
|
366
365
|
for (let i = 0; i < attempts; i++) {
|
|
367
366
|
let element;
|
|
368
367
|
try {
|
|
@@ -370,14 +369,14 @@ let DriverHelper = class DriverHelper {
|
|
|
370
369
|
}
|
|
371
370
|
catch (err) {
|
|
372
371
|
if (i >= attempts - 1) {
|
|
373
|
-
Logger_1.Logger.error(`
|
|
372
|
+
Logger_1.Logger.error(`failed with exception, out of attempts - ${err}`);
|
|
374
373
|
throw err;
|
|
375
374
|
}
|
|
376
375
|
if (err instanceof selenium_webdriver_1.error.TimeoutError) {
|
|
377
|
-
Logger_1.Logger.trace(`
|
|
376
|
+
Logger_1.Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
|
|
378
377
|
continue;
|
|
379
378
|
}
|
|
380
|
-
Logger_1.Logger.error(`
|
|
379
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
381
380
|
throw err;
|
|
382
381
|
}
|
|
383
382
|
try {
|
|
@@ -389,16 +388,16 @@ let DriverHelper = class DriverHelper {
|
|
|
389
388
|
await this.wait(polling);
|
|
390
389
|
continue;
|
|
391
390
|
}
|
|
392
|
-
Logger_1.Logger.error(`
|
|
391
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
393
392
|
throw err;
|
|
394
393
|
}
|
|
395
394
|
}
|
|
396
395
|
throw new selenium_webdriver_1.error.TimeoutError(`Exceeded maximum typing attempts, to the '${elementLocator}' element`);
|
|
397
396
|
}
|
|
398
|
-
async clear(elementLocator, timeout =
|
|
399
|
-
const polling =
|
|
397
|
+
async clear(elementLocator, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
398
|
+
const polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
400
399
|
const attempts = Math.ceil(timeout / polling);
|
|
401
|
-
Logger_1.Logger.trace(
|
|
400
|
+
Logger_1.Logger.trace(`${elementLocator}`);
|
|
402
401
|
for (let i = 0; i < attempts; i++) {
|
|
403
402
|
let element;
|
|
404
403
|
try {
|
|
@@ -406,14 +405,14 @@ let DriverHelper = class DriverHelper {
|
|
|
406
405
|
}
|
|
407
406
|
catch (err) {
|
|
408
407
|
if (i >= attempts - 1) {
|
|
409
|
-
Logger_1.Logger.error(`
|
|
408
|
+
Logger_1.Logger.error(`failed with exception, out of attempts - ${err}`);
|
|
410
409
|
throw err;
|
|
411
410
|
}
|
|
412
411
|
if (err instanceof selenium_webdriver_1.error.TimeoutError) {
|
|
413
|
-
Logger_1.Logger.trace(`
|
|
412
|
+
Logger_1.Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
|
|
414
413
|
continue;
|
|
415
414
|
}
|
|
416
|
-
Logger_1.Logger.error(`
|
|
415
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
417
416
|
throw err;
|
|
418
417
|
}
|
|
419
418
|
try {
|
|
@@ -425,16 +424,16 @@ let DriverHelper = class DriverHelper {
|
|
|
425
424
|
await this.wait(polling);
|
|
426
425
|
continue;
|
|
427
426
|
}
|
|
428
|
-
Logger_1.Logger.error(`
|
|
427
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
429
428
|
throw err;
|
|
430
429
|
}
|
|
431
430
|
}
|
|
432
431
|
throw new selenium_webdriver_1.error.TimeoutError(`Exceeded maximum clearing attempts, to the '${elementLocator}' element`);
|
|
433
432
|
}
|
|
434
|
-
async clearInvisible(elementLocator, timeout =
|
|
435
|
-
const polling =
|
|
433
|
+
async clearInvisible(elementLocator, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
434
|
+
const polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
436
435
|
const attempts = Math.ceil(timeout / polling);
|
|
437
|
-
Logger_1.Logger.trace(
|
|
436
|
+
Logger_1.Logger.trace(`${elementLocator}`);
|
|
438
437
|
for (let i = 0; i < attempts; i++) {
|
|
439
438
|
let element;
|
|
440
439
|
try {
|
|
@@ -442,14 +441,14 @@ let DriverHelper = class DriverHelper {
|
|
|
442
441
|
}
|
|
443
442
|
catch (err) {
|
|
444
443
|
if (i >= attempts - 1) {
|
|
445
|
-
Logger_1.Logger.error(`
|
|
444
|
+
Logger_1.Logger.error(`failed with exception, out of attempts - ${err}`);
|
|
446
445
|
throw err;
|
|
447
446
|
}
|
|
448
447
|
if (err instanceof selenium_webdriver_1.error.TimeoutError) {
|
|
449
|
-
Logger_1.Logger.trace(`
|
|
448
|
+
Logger_1.Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
|
|
450
449
|
continue;
|
|
451
450
|
}
|
|
452
|
-
Logger_1.Logger.error(`
|
|
451
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
453
452
|
throw err;
|
|
454
453
|
}
|
|
455
454
|
try {
|
|
@@ -461,18 +460,18 @@ let DriverHelper = class DriverHelper {
|
|
|
461
460
|
await this.wait(polling);
|
|
462
461
|
continue;
|
|
463
462
|
}
|
|
464
|
-
Logger_1.Logger.error(`
|
|
463
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
465
464
|
throw err;
|
|
466
465
|
}
|
|
467
466
|
}
|
|
468
467
|
throw new selenium_webdriver_1.error.TimeoutError(`Exceeded maximum clearing attempts, to the '${elementLocator}' element`);
|
|
469
468
|
}
|
|
470
|
-
async enterValue(elementLocator, text, timeout =
|
|
469
|
+
async enterValue(elementLocator, text, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
471
470
|
if (elementLocator.toString().toLocaleLowerCase().includes('password')) {
|
|
472
|
-
Logger_1.Logger.trace(
|
|
471
|
+
Logger_1.Logger.trace(`${elementLocator} text: ***`);
|
|
473
472
|
}
|
|
474
473
|
else {
|
|
475
|
-
Logger_1.Logger.trace(
|
|
474
|
+
Logger_1.Logger.trace(`${elementLocator} text: ${text}`);
|
|
476
475
|
}
|
|
477
476
|
await this.waitVisibility(elementLocator, timeout);
|
|
478
477
|
await this.clear(elementLocator);
|
|
@@ -481,13 +480,13 @@ let DriverHelper = class DriverHelper {
|
|
|
481
480
|
await this.waitAttributeValue(elementLocator, 'value', text, timeout);
|
|
482
481
|
}
|
|
483
482
|
async waitAndSwitchToFrame(iframeLocator, timeout) {
|
|
484
|
-
Logger_1.Logger.trace(
|
|
483
|
+
Logger_1.Logger.trace(`${iframeLocator}`);
|
|
485
484
|
await this.driver.wait(selenium_webdriver_1.until.ableToSwitchToFrame(iframeLocator), timeout);
|
|
486
485
|
}
|
|
487
|
-
async waitAndGetText(elementLocator, timeout =
|
|
488
|
-
const polling =
|
|
486
|
+
async waitAndGetText(elementLocator, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
487
|
+
const polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
489
488
|
const attempts = Math.ceil(timeout / polling);
|
|
490
|
-
Logger_1.Logger.trace(
|
|
489
|
+
Logger_1.Logger.trace(`${elementLocator}`);
|
|
491
490
|
for (let i = 0; i < attempts; i++) {
|
|
492
491
|
let element;
|
|
493
492
|
try {
|
|
@@ -495,14 +494,14 @@ let DriverHelper = class DriverHelper {
|
|
|
495
494
|
}
|
|
496
495
|
catch (err) {
|
|
497
496
|
if (i >= attempts - 1) {
|
|
498
|
-
Logger_1.Logger.error(`
|
|
497
|
+
Logger_1.Logger.error(`failed with exception, out of attempts - ${err}`);
|
|
499
498
|
throw err;
|
|
500
499
|
}
|
|
501
500
|
if (err instanceof selenium_webdriver_1.error.TimeoutError) {
|
|
502
|
-
Logger_1.Logger.trace(`
|
|
501
|
+
Logger_1.Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
|
|
503
502
|
continue;
|
|
504
503
|
}
|
|
505
|
-
Logger_1.Logger.error(`
|
|
504
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
506
505
|
throw err;
|
|
507
506
|
}
|
|
508
507
|
try {
|
|
@@ -513,24 +512,24 @@ let DriverHelper = class DriverHelper {
|
|
|
513
512
|
await this.wait(polling);
|
|
514
513
|
continue;
|
|
515
514
|
}
|
|
516
|
-
Logger_1.Logger.error(`
|
|
515
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
517
516
|
throw err;
|
|
518
517
|
}
|
|
519
518
|
}
|
|
520
519
|
throw new selenium_webdriver_1.error.TimeoutError(`Exceeded maximum text obtaining attempts, from the '${elementLocator}' element`);
|
|
521
520
|
}
|
|
522
521
|
async waitAndGetValue(elementLocator, timeout) {
|
|
523
|
-
Logger_1.Logger.trace(
|
|
522
|
+
Logger_1.Logger.trace(`${elementLocator}`);
|
|
524
523
|
return await this.waitAndGetElementAttribute(elementLocator, 'value', timeout);
|
|
525
524
|
}
|
|
526
525
|
async waitUntilTrue(callback, timeout) {
|
|
527
|
-
Logger_1.Logger.trace(
|
|
526
|
+
Logger_1.Logger.trace();
|
|
528
527
|
await this.driver.wait(callback, timeout);
|
|
529
528
|
}
|
|
530
|
-
async scrollTo(elementLocator, timeout =
|
|
531
|
-
const polling =
|
|
529
|
+
async scrollTo(elementLocator, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
530
|
+
const polling = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
532
531
|
const attempts = Math.ceil(timeout / polling);
|
|
533
|
-
Logger_1.Logger.trace(
|
|
532
|
+
Logger_1.Logger.trace(`${elementLocator}`);
|
|
534
533
|
for (let i = 0; i < attempts; i++) {
|
|
535
534
|
let element;
|
|
536
535
|
try {
|
|
@@ -538,19 +537,18 @@ let DriverHelper = class DriverHelper {
|
|
|
538
537
|
}
|
|
539
538
|
catch (err) {
|
|
540
539
|
if (i >= attempts - 1) {
|
|
541
|
-
Logger_1.Logger.error(`
|
|
540
|
+
Logger_1.Logger.error(`failed with exception, out of attempts - ${err}`);
|
|
542
541
|
throw err;
|
|
543
542
|
}
|
|
544
543
|
if (err instanceof selenium_webdriver_1.error.TimeoutError) {
|
|
545
|
-
Logger_1.Logger.trace(`
|
|
544
|
+
Logger_1.Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
|
|
546
545
|
continue;
|
|
547
546
|
}
|
|
548
|
-
Logger_1.Logger.error(`
|
|
547
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
549
548
|
throw err;
|
|
550
549
|
}
|
|
551
550
|
try {
|
|
552
|
-
await this.getDriver()
|
|
553
|
-
.executeScript('arguments[0].scrollIntoView(true);', element);
|
|
551
|
+
await this.getDriver().executeScript('arguments[0].scrollIntoView(true);', element);
|
|
554
552
|
return;
|
|
555
553
|
}
|
|
556
554
|
catch (err) {
|
|
@@ -558,26 +556,26 @@ let DriverHelper = class DriverHelper {
|
|
|
558
556
|
await this.wait(polling);
|
|
559
557
|
continue;
|
|
560
558
|
}
|
|
561
|
-
Logger_1.Logger.error(`
|
|
559
|
+
Logger_1.Logger.error(`failed with an unexpected exception - ${err}`);
|
|
562
560
|
throw err;
|
|
563
561
|
}
|
|
564
562
|
}
|
|
565
563
|
throw new selenium_webdriver_1.error.TimeoutError(`Exceeded maximum mouse move attempts, for the '${elementLocator}' element`);
|
|
566
564
|
}
|
|
567
|
-
async scrollToAndClick(elementLocator, timeout =
|
|
565
|
+
async scrollToAndClick(elementLocator, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
568
566
|
await this.scrollTo(elementLocator, timeout);
|
|
569
567
|
await this.waitAndClick(elementLocator, timeout);
|
|
570
568
|
}
|
|
571
|
-
async scrollToAndEnterValue(elementLocator, value, timeout =
|
|
569
|
+
async scrollToAndEnterValue(elementLocator, value, timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
572
570
|
await this.scrollTo(elementLocator, timeout);
|
|
573
571
|
await this.enterValue(elementLocator, value, timeout);
|
|
574
572
|
}
|
|
575
573
|
// method is useful to debug page object elements
|
|
576
574
|
async highLightElement(element) {
|
|
577
|
-
await this.getDriver().executeScript('arguments[0].style.border
|
|
575
|
+
await this.getDriver().executeScript('arguments[0].style.border="2px solid red"', element);
|
|
578
576
|
}
|
|
579
577
|
getDriver() {
|
|
580
|
-
Logger_1.Logger.trace(
|
|
578
|
+
Logger_1.Logger.trace();
|
|
581
579
|
return this.driver;
|
|
582
580
|
}
|
|
583
581
|
};
|