froth-webdriverio-framework 7.0.118-uat1.2 → 7.0.119-dev1.0
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/froth_api_calls/browsersatckSessionInfo.js +2 -0
- package/froth_api_calls/getexecutionDetails.js +4 -4
- package/froth_common_actions/assert.js +1 -1
- package/froth_configs/base.config.js +3 -0
- package/froth_configs/commonhook.js +2 -0
- package/froth_configs/local/web.config.js +56 -6
- package/package.json +12 -10
- package/CLAUDE.md +0 -215
- package/log/key-metrics.json +0 -772
- package/log/key-metrics.json.lock +0 -0
- package/log/sdk-cli.log +0 -1647
- package/log/sdk-debug-utility.log +0 -0
|
@@ -212,6 +212,8 @@ async function updateBrowserStackReport(frothUrl, token, bsBuildId, executionId,
|
|
|
212
212
|
data = await response.text();
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
console.log('📥 Response in updateBrowserStackReport:', data);
|
|
216
|
+
|
|
215
217
|
if (response.ok) {
|
|
216
218
|
console.log(`✅ BrowserStack report updated successfully [${status}]`);
|
|
217
219
|
return data;
|
|
@@ -17,7 +17,9 @@ function isValidId(id) {
|
|
|
17
17
|
async function handleResponse(response, context) {
|
|
18
18
|
|
|
19
19
|
if (response.ok) {
|
|
20
|
-
|
|
20
|
+
const data = await response.json();
|
|
21
|
+
console.log('📥 Response in', context, ':', data);
|
|
22
|
+
return data;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
if (response.status === 401) {
|
|
@@ -170,9 +172,7 @@ async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
|
|
|
170
172
|
data = await response.text();
|
|
171
173
|
}
|
|
172
174
|
|
|
173
|
-
|
|
174
|
-
// console.log('📤 API Response Headers:', Array.from(response.headers.entries()));
|
|
175
|
-
// console.log('📤 API Response Body:', data);
|
|
175
|
+
console.log('📥 Response from updateExecuitonDetails:', data);
|
|
176
176
|
|
|
177
177
|
if (!response.ok) {
|
|
178
178
|
console.error(`❌ Failed to update execution details, status ${response.status}`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Function to verify text in Android app
|
|
2
|
-
|
|
2
|
+
const assert = require('assert');
|
|
3
3
|
const amendToBrowserstack = require("../froth_api_calls/browsersatckSessionInfo").amend2Browserstack;
|
|
4
4
|
|
|
5
5
|
async function assertText(elementSelector, expectedText) {
|
|
@@ -4,6 +4,9 @@ console.log('====>SUITE_FILE:', SUITE_FILE);
|
|
|
4
4
|
const { LocalStorage } = require('node-localstorage');
|
|
5
5
|
global.BUFFER = new LocalStorage('./buffer_storage');
|
|
6
6
|
|
|
7
|
+
// Make Util globally available across all test files
|
|
8
|
+
global.Util = require('../froth_common_actions/Utils');
|
|
9
|
+
|
|
7
10
|
module.exports = {
|
|
8
11
|
specs: require(SUITE_FILE).tests,
|
|
9
12
|
exclude: [],
|
|
@@ -339,6 +339,8 @@ const commonHooks = {
|
|
|
339
339
|
onComplete: async (exitCode, _, __, results) => {
|
|
340
340
|
console.log('==== ON COMPLETE ====');
|
|
341
341
|
console.log(`Total: ${results.total || 0}, Passed: ${results.passed || 0}, Failed: ${results.failed || 0}`);
|
|
342
|
+
//console.log("Exit code onComplete===>" + exitCode)
|
|
343
|
+
|
|
342
344
|
if (exitCode === undefined || exitCode === null) {
|
|
343
345
|
exitCode = 1 // treat as failure
|
|
344
346
|
}
|
|
@@ -1,8 +1,58 @@
|
|
|
1
|
-
module.exports = () =>
|
|
2
|
-
|
|
1
|
+
module.exports = (bsCaps) => {
|
|
2
|
+
const browserName = (bsCaps.browserName || 'chrome').toLowerCase();
|
|
3
|
+
//const browserVersion = bsCaps.browserVersion;
|
|
3
4
|
|
|
5
|
+
// Map browser names to their WebdriverIO services
|
|
6
|
+
const browserServiceMap = {
|
|
7
|
+
chrome: 'chromedriver',
|
|
8
|
+
firefox: 'geckodriver',
|
|
9
|
+
edge: 'edgedriver',
|
|
10
|
+
ie: 'iedriver',
|
|
11
|
+
'internet explorer': 'iedriver',
|
|
12
|
+
safari: 'safaridriver'
|
|
13
|
+
};
|
|
4
14
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
15
|
+
const service = browserServiceMap[browserName] || 'chromedriver';
|
|
16
|
+
|
|
17
|
+
const config = {
|
|
18
|
+
services: [service]
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Add browser-specific capabilities
|
|
22
|
+
if (browserName === 'chrome') {
|
|
23
|
+
config.capabilities = [{
|
|
24
|
+
browserName: 'chrome',
|
|
25
|
+
'goog:chromeOptions': {
|
|
26
|
+
// args: browserVersion ? [`--version=${browserVersion}`] : []
|
|
27
|
+
}
|
|
28
|
+
}];
|
|
29
|
+
} else if (browserName === 'firefox') {
|
|
30
|
+
config.capabilities = [{
|
|
31
|
+
browserName: 'firefox',
|
|
32
|
+
'moz:firefoxOptions': {
|
|
33
|
+
// Add Firefox-specific options if needed
|
|
34
|
+
}
|
|
35
|
+
}];
|
|
36
|
+
} else if (browserName === 'edge') {
|
|
37
|
+
config.capabilities = [{
|
|
38
|
+
browserName: 'MicrosoftEdge'
|
|
39
|
+
}];
|
|
40
|
+
} else if (browserName === 'safari') {
|
|
41
|
+
config.capabilities = [{
|
|
42
|
+
browserName: 'safari'
|
|
43
|
+
}];
|
|
44
|
+
} else if (browserName === 'ie' || browserName === 'internet explorer') {
|
|
45
|
+
config.capabilities = [{
|
|
46
|
+
browserName: 'internet explorer'
|
|
47
|
+
}];
|
|
48
|
+
} else {
|
|
49
|
+
// Default to Chrome for unsupported browsers
|
|
50
|
+
config.capabilities = [{
|
|
51
|
+
browserName: 'chrome'
|
|
52
|
+
}];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
console.log(`🌐 Local execution configured for: ${browserName}${browserVersion ? ` (v${browserVersion})` : ''} using service: ${service}`);
|
|
56
|
+
|
|
57
|
+
return config;
|
|
58
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"
|
|
3
|
-
"version": "7.0.118-uat1.2",
|
|
1
|
+
{ "name": "froth-webdriverio-framework",
|
|
2
|
+
"version": "7.0.119-dev1.0",
|
|
4
3
|
"readme": "WebdriverIO Integration",
|
|
5
4
|
"description": "WebdriverIO and BrowserStack App Automate",
|
|
6
5
|
"license": "MIT",
|
|
@@ -18,16 +17,17 @@
|
|
|
18
17
|
"appium"
|
|
19
18
|
],
|
|
20
19
|
"dependencies": {
|
|
21
|
-
|
|
22
|
-
"@wdio/
|
|
23
|
-
"@wdio/
|
|
24
|
-
"@wdio/
|
|
25
|
-
"@wdio/
|
|
20
|
+
|
|
21
|
+
"@wdio/appium-service": "9.23.0",
|
|
22
|
+
"@wdio/browserstack-service": "9.23.0",
|
|
23
|
+
"@wdio/cli": "9.23.0",
|
|
24
|
+
"@wdio/local-runner": "9.23.0",
|
|
25
|
+
"@wdio/mocha-framework": "9.23.0",
|
|
26
26
|
"@wdio/spec-reporter": "^9.20.0",
|
|
27
27
|
"appium": "^3.1.2",
|
|
28
28
|
"appium-uiautomator2-driver": "^6.7.8",
|
|
29
29
|
"assert": "^2.1.0",
|
|
30
|
-
"axios": "
|
|
30
|
+
"axios": "1.14.0",
|
|
31
31
|
"browserstack-local": "^1.5.8",
|
|
32
32
|
"chai": "^6.2.2",
|
|
33
33
|
"crypto-js": "^4.2.0",
|
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
"randexp": "^0.5.3",
|
|
45
45
|
"ts-node": "^10.9.2",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
|
+
|
|
47
48
|
"vm": "^0.1.0"
|
|
49
|
+
|
|
48
50
|
}
|
|
49
|
-
}
|
|
51
|
+
}
|
package/CLAUDE.md
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
**Version:** 9.0.5-ytlc
|
|
8
|
-
|
|
9
|
-
**Repository:** https://github.com/RoboticoDigitalProjects/froth-webdriverio.git
|
|
10
|
-
|
|
11
|
-
This is a WebdriverIO test automation framework (FROTH - "froth-webdriverio-framework") that supports web, Android, and iOS testing on both BrowserStack and local environments. The framework integrates with a Froth TestOps backend API for execution tracking, reporting, and test data management.
|
|
12
|
-
|
|
13
|
-
## Commands
|
|
14
|
-
|
|
15
|
-
### Running Tests
|
|
16
|
-
|
|
17
|
-
Tests are run using the WebdriverIO CLI with platform-specific configurations. Note: Configuration files (`android.conf.js`, `web.conf.js`, etc.) must be created at the root level to reference `froth_configs/wdio.common.conf.js`:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
# Android tests
|
|
21
|
-
npx wdio ./android.conf.js
|
|
22
|
-
|
|
23
|
-
# Web tests
|
|
24
|
-
npx wdio ./web.conf.js
|
|
25
|
-
|
|
26
|
-
# iOS tests
|
|
27
|
-
npx wdio ./ios.conf.js
|
|
28
|
-
|
|
29
|
-
# Lint code
|
|
30
|
-
npm run lint
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Creating Configuration Files
|
|
34
|
-
|
|
35
|
-
Platform-specific config files must be created at the root level. Example `android.conf.js`:
|
|
36
|
-
|
|
37
|
-
```javascript
|
|
38
|
-
exports.config = require('./froth_configs/wdio.common.conf').config;
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Generating Allure Reports
|
|
42
|
-
|
|
43
|
-
Allure reports are generated manually using the Allure CLI:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
# Android reports
|
|
47
|
-
allure generate ./mobile/androidReports/allure-results --clean && allure open
|
|
48
|
-
|
|
49
|
-
# iOS reports
|
|
50
|
-
allure generate ./mobile/iosReports/allure-results --clean && allure open
|
|
51
|
-
|
|
52
|
-
# Web reports
|
|
53
|
-
allure generate ./webReports/allure-results --clean && allure open
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Running Tests
|
|
57
|
-
|
|
58
|
-
Tests are run by specifying environment variables and the config file:
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
SUITE=./android_suites/samplesuite_x.js \
|
|
62
|
-
YML_NAME=./ymls/browserstack/android/android_pixel8.yml \
|
|
63
|
-
PLATFORM=browserstack \
|
|
64
|
-
EXECUTION_ID=123 \
|
|
65
|
-
API_TOKEN=your_token \
|
|
66
|
-
ORGANISATION_DOMAIN_URL=https://devapi.frothtestops.com \
|
|
67
|
-
npx wdio ./android.conf.js
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Architecture
|
|
71
|
-
|
|
72
|
-
### Configuration Hierarchy
|
|
73
|
-
|
|
74
|
-
The framework uses a multi-layered configuration system:
|
|
75
|
-
|
|
76
|
-
1. **Base Configuration** (`froth_configs/base.config.js`): Contains framework settings, specs path, timeouts, and Mocha options. Initializes a global `BUFFER` using `node-localstorage` for cross-module state sharing.
|
|
77
|
-
|
|
78
|
-
2. **Common Configuration** (`froth_configs/wdio.common.conf.js`): Acts as the entry point. It:
|
|
79
|
-
- Loads capabilities from a YAML file specified by `YML_NAME`
|
|
80
|
-
- Decodes BrowserStack credentials from base64
|
|
81
|
-
- Determines platform (web vs mobile) based on `platformName` in capabilities
|
|
82
|
-
- Merges base config with platform-specific config
|
|
83
|
-
|
|
84
|
-
3. **Platform-Specific Configs** (`froth_configs/browserstack/` and `froth_configs/local/`):
|
|
85
|
-
- `web.config.js`: BrowserStack web testing configuration
|
|
86
|
-
- `mobile.config.js`: BrowserStack mobile (Android/iOS) testing configuration
|
|
87
|
-
- Supports `BS_UPLOAD_MEDIA` for injecting media files into tests
|
|
88
|
-
|
|
89
|
-
### Test Lifecycle and Hooks
|
|
90
|
-
|
|
91
|
-
All test lifecycle hooks are defined in `froth_configs/commonhook.js`:
|
|
92
|
-
|
|
93
|
-
- **onPrepare**: Initializes environment variables, execution details, suite details, and test data via `setallDatailinBuffer.js`. Registers global error handlers.
|
|
94
|
-
- **beforeSession**: Validates test syntax, configures BrowserStack capabilities, sets app path for mobile testing
|
|
95
|
-
- **beforeSuite**: Fetches BrowserStack session details, updates CICD run ID
|
|
96
|
-
- **beforeTest/afterTest**: Updates individual script execution status via API
|
|
97
|
-
- **afterSession**: Calculates total execution time, updates final execution status
|
|
98
|
-
- **onComplete**: Clears the BUFFER storage
|
|
99
|
-
|
|
100
|
-
### Directory Structure
|
|
101
|
-
|
|
102
|
-
```
|
|
103
|
-
froth_common_actions/ # Reusable test utilities and actions
|
|
104
|
-
├── Utils.js # Central export point for all utilities
|
|
105
|
-
├── scroll.js # Scrolling helpers (scrollToEnd, scrollDownToView, etc.)
|
|
106
|
-
├── swipe.js # Gesture helpers (swipeUp, swipeDown, swipeWithCoordinates)
|
|
107
|
-
├── click.js # Click helpers (clickIfVisible, doubleClick)
|
|
108
|
-
├── assert.js # Assertion helpers (assertText, assertAttributeValue)
|
|
109
|
-
├── random.js # Random data generators (RANDOMTEXT, RNDNUMBER, etc.)
|
|
110
|
-
├── storeToBuffer.js # Buffer storage helpers for runtime data
|
|
111
|
-
├── dbValidator.js # Database field validation
|
|
112
|
-
└── ... # Other common actions
|
|
113
|
-
|
|
114
|
-
froth_api_calls/ # API integration layer
|
|
115
|
-
├── loginapi.js # Authentication token retrieval
|
|
116
|
-
├── getexecutionDetails.js # Fetch/update execution details via TestOps API
|
|
117
|
-
├── getsuiteDetails.js # Fetch test suite and script mappings
|
|
118
|
-
├── readTestdata.js # Fetch test data by ID
|
|
119
|
-
└── browsersatckSessionInfo.js # BrowserStack session management
|
|
120
|
-
|
|
121
|
-
froth_configs/ # Configuration files
|
|
122
|
-
├── base.config.js
|
|
123
|
-
├── wdio.common.conf.js
|
|
124
|
-
├── commonhook.js
|
|
125
|
-
├── setallDatailinBuffer.js
|
|
126
|
-
├── browserstack/ # BrowserStack-specific configs
|
|
127
|
-
└── local/ # Local execution configs
|
|
128
|
-
|
|
129
|
-
android/ # Android test scripts
|
|
130
|
-
android_suites/ # Android suite definitions (array of test files)
|
|
131
|
-
web/ # Web test scripts
|
|
132
|
-
web_suites/ # Web suite definitions
|
|
133
|
-
ymls/browserstack/ # Capability YAML files for different devices/browsers
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Test Data Flow
|
|
137
|
-
|
|
138
|
-
1. Environment variables are loaded in `setallDatailinBuffer.js` during `onPrepare`
|
|
139
|
-
2. Global state is stored in `BUFFER` (node-localstorage at `./buffer_storage`)
|
|
140
|
-
3. Execution details are fetched from the Froth TestOps API
|
|
141
|
-
4. Test scripts access data via `BUFFER.getItem()` / `BUFFER.setItem()`
|
|
142
|
-
5. Results are posted back to the API via `updateScriptExecutionStatus` and `updateExecuitonDetails`
|
|
143
|
-
|
|
144
|
-
### Test Suite Pattern
|
|
145
|
-
|
|
146
|
-
Suites are defined as simple modules exporting a `tests` array:
|
|
147
|
-
|
|
148
|
-
```javascript
|
|
149
|
-
// Example: android_suites/samplesuite_x.js
|
|
150
|
-
module.exports = {
|
|
151
|
-
tests: [
|
|
152
|
-
'/absolute/path/to/android/test_script.js'
|
|
153
|
-
]
|
|
154
|
-
};
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### Common Actions Usage
|
|
158
|
-
|
|
159
|
-
Tests import utilities from the Utils export:
|
|
160
|
-
|
|
161
|
-
```javascript
|
|
162
|
-
const Util = require('../froth_common_actions/Utils');
|
|
163
|
-
|
|
164
|
-
// Scrolling
|
|
165
|
-
await Util.scrollToEnd(2, 3);
|
|
166
|
-
await Util.scrollDownToView("Some Text");
|
|
167
|
-
|
|
168
|
-
// Swiping
|
|
169
|
-
await Util.swipeWithCoordinates(x1, y1, x2, y2);
|
|
170
|
-
|
|
171
|
-
// Random data
|
|
172
|
-
const randomText = Util.randomtext(10);
|
|
173
|
-
const randomNumber = Util.randomnumber(100, 999);
|
|
174
|
-
|
|
175
|
-
// Buffer storage
|
|
176
|
-
Util.storetext('key', 'value');
|
|
177
|
-
const value = BUFFER.getItem('key');
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
## Required Environment Variables
|
|
181
|
-
|
|
182
|
-
| Variable | Description | Example |
|
|
183
|
-
|----------|-------------|---------|
|
|
184
|
-
| `YML_NAME` | Path to capability YAML file | `./ymls/browserstack/android/android_pixel8.yml` |
|
|
185
|
-
| `SUITE` | Path to suite file | `./android_suites/samplesuite_x.js` |
|
|
186
|
-
| `PLATFORM` | `browserstack`, `browserstacklocal`, or omitted for local | `browserstack` |
|
|
187
|
-
| `EXECUTION_ID` | Test execution ID from TestOps | `123` |
|
|
188
|
-
| `API_TOKEN` | Authentication token for TestOps API | `eyJhbG...` |
|
|
189
|
-
| `ORGANISATION_DOMAIN_URL` | Froth TestOps API base URL | `https://devapi.frothtestops.com` |
|
|
190
|
-
| `CICD_RUN_ID` | CI/CD pipeline run ID (optional) | `build-456` |
|
|
191
|
-
| `BS_UPLOAD_MEDIA` | Comma-separated media URLs for BrowserStack (optional) | `url1,url2` |
|
|
192
|
-
|
|
193
|
-
## Capability YAML Format
|
|
194
|
-
|
|
195
|
-
YAML files define device/browser capabilities. Example for Android:
|
|
196
|
-
|
|
197
|
-
```yaml
|
|
198
|
-
userName: "bs_username"
|
|
199
|
-
accessKey: "base64_encoded_key"
|
|
200
|
-
platformName: "Android"
|
|
201
|
-
deviceName: "Samsung Galaxy S22 Ultra"
|
|
202
|
-
platformVersion: "12.0"
|
|
203
|
-
debug: true
|
|
204
|
-
networkLogs: true
|
|
205
|
-
interactiveDebugging: false
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
## Important Notes
|
|
209
|
-
|
|
210
|
-
- The framework uses `node-localstorage` to create a global `BUFFER` accessible across all modules
|
|
211
|
-
- All API responses from TestOps are AES-decrypted via `aesEncryptionDecryption.js`
|
|
212
|
-
- Test scripts map to TestOps via filename (script name must match `scriptName` in suite details)
|
|
213
|
-
- Mobile tests use Appium selectors like `id:com.example:id/elementId` and `-android uiautomator:...`
|
|
214
|
-
- Web tests use standard WebdriverIO selectors (`$`, `$$`)
|
|
215
|
-
- Framework supports both BrowserStack App Automate (mobile) and Automate (web) sessions
|