@wdio/browserstack-service 8.16.5 → 8.16.7
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/build/accessibility-handler.d.ts +38 -0
- package/build/accessibility-handler.d.ts.map +1 -0
- package/build/accessibility-handler.js +260 -0
- package/build/constants.d.ts +3 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +5 -1
- package/build/cucumber-types.d.ts +17 -0
- package/build/cucumber-types.d.ts.map +1 -1
- package/build/cucumber-types.js +0 -1
- package/build/index.d.ts +5 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -0
- package/build/insights-handler.d.ts +19 -3
- package/build/insights-handler.d.ts.map +1 -1
- package/build/insights-handler.js +274 -18
- package/build/launcher.d.ts +4 -0
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +156 -2
- package/build/log4jsAppender.d.ts +2 -0
- package/build/log4jsAppender.d.ts.map +1 -0
- package/build/log4jsAppender.js +19 -0
- package/build/logPatcher.d.ts +13 -0
- package/build/logPatcher.d.ts.map +1 -0
- package/build/logPatcher.js +38 -0
- package/build/logReportingAPI.d.ts +12 -0
- package/build/logReportingAPI.d.ts.map +1 -0
- package/build/logReportingAPI.js +56 -0
- package/build/reporter.d.ts +6 -0
- package/build/reporter.d.ts.map +1 -1
- package/build/reporter.js +42 -2
- package/build/scripts/test-event-scripts.d.ts +10 -0
- package/build/scripts/test-event-scripts.d.ts.map +1 -0
- package/build/scripts/test-event-scripts.js +65 -0
- package/build/service.d.ts +5 -3
- package/build/service.d.ts.map +1 -1
- package/build/service.js +21 -1
- package/build/types.d.ts +34 -1
- package/build/types.d.ts.map +1 -1
- package/build/util.d.ts +32 -0
- package/build/util.d.ts.map +1 -1
- package/build/util.js +292 -1
- package/package.json +8 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log4jsAppender.d.ts","sourceRoot":"","sources":["../src/log4jsAppender.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,SAAS,WAAY,GAAG,WAAW,GAAG,KAAG,QAMrD,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import logReportingAPI from './logReportingAPI.js';
|
|
2
|
+
const BSTestOpsLogger = new logReportingAPI({});
|
|
3
|
+
//Disabling eslint here as there params can be used later
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
+
function BSTestOpsLog4JSAppender(layout, timezoneOffset) {
|
|
6
|
+
return (loggingEvent) => {
|
|
7
|
+
BSTestOpsLogger.log({
|
|
8
|
+
level: loggingEvent.level ? loggingEvent.level.levelStr : null,
|
|
9
|
+
message: loggingEvent.data ? loggingEvent.data.join(' ') : null
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export const configure = (config, layouts) => {
|
|
14
|
+
let layout = layouts.colouredLayout;
|
|
15
|
+
if (config.layout) {
|
|
16
|
+
layout = layouts.layout(config.layout.type, config.layout);
|
|
17
|
+
}
|
|
18
|
+
return BSTestOpsLog4JSAppender(layout, config.timezoneOffset);
|
|
19
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Transport from 'winston-transport';
|
|
2
|
+
declare class logPatcher extends Transport {
|
|
3
|
+
constructor(opts: any);
|
|
4
|
+
logToTestOps: (level?: string, message?: string[]) => void;
|
|
5
|
+
trace: (...message: any) => void;
|
|
6
|
+
debug: (...message: any) => void;
|
|
7
|
+
info: (...message: any) => void;
|
|
8
|
+
warn: (...message: any) => void;
|
|
9
|
+
error: (...message: any) => void;
|
|
10
|
+
log: (...message: any) => void;
|
|
11
|
+
}
|
|
12
|
+
export default logPatcher;
|
|
13
|
+
//# sourceMappingURL=logPatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logPatcher.d.ts","sourceRoot":"","sources":["../src/logPatcher.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAA;AAMzC,cAAM,UAAW,SAAQ,SAAS;gBAClB,IAAI,EAAE,GAAG;IAIrB,YAAY,+CAQX;IAGD,KAAK,eAAgB,GAAG,UAEvB;IAED,KAAK,eAAe,GAAG,UAEtB;IAED,IAAI,eAAgB,GAAG,UAEtB;IAED,IAAI,eAAgB,GAAG,UAEtB;IAED,KAAK,eAAgB,GAAG,UAEvB;IAED,GAAG,eAAe,GAAG,UAEpB;CACJ;AACD,eAAe,UAAU,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import Transport from 'winston-transport';
|
|
2
|
+
const LOG_LEVELS = {
|
|
3
|
+
INFO: 'INFO', ERROR: 'ERROR', DEBUG: 'DEBUG', TRACE: 'TRACE', WARN: 'WARN',
|
|
4
|
+
};
|
|
5
|
+
class logPatcher extends Transport {
|
|
6
|
+
constructor(opts) {
|
|
7
|
+
super(opts);
|
|
8
|
+
}
|
|
9
|
+
logToTestOps = (level = LOG_LEVELS.INFO, message = ['']) => {
|
|
10
|
+
process.emit(`bs:addLog:${process.pid}`, {
|
|
11
|
+
timestamp: new Date().toISOString(),
|
|
12
|
+
level: level.toUpperCase(),
|
|
13
|
+
message: `"${message.join(', ')}"`,
|
|
14
|
+
kind: 'TEST_LOG',
|
|
15
|
+
http_response: {}
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
/* Patching this would show user an extended trace on their cli */
|
|
19
|
+
trace = (...message) => {
|
|
20
|
+
this.logToTestOps(LOG_LEVELS.TRACE, message);
|
|
21
|
+
};
|
|
22
|
+
debug = (...message) => {
|
|
23
|
+
this.logToTestOps(LOG_LEVELS.DEBUG, message);
|
|
24
|
+
};
|
|
25
|
+
info = (...message) => {
|
|
26
|
+
this.logToTestOps(LOG_LEVELS.INFO, message);
|
|
27
|
+
};
|
|
28
|
+
warn = (...message) => {
|
|
29
|
+
this.logToTestOps(LOG_LEVELS.WARN, message);
|
|
30
|
+
};
|
|
31
|
+
error = (...message) => {
|
|
32
|
+
this.logToTestOps(LOG_LEVELS.ERROR, message);
|
|
33
|
+
};
|
|
34
|
+
log = (...message) => {
|
|
35
|
+
this.logToTestOps(LOG_LEVELS.INFO, message);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export default logPatcher;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Transport from 'winston-transport';
|
|
2
|
+
declare class logReportingAPI extends Transport {
|
|
3
|
+
log(info: any, callback?: undefined | Function): void;
|
|
4
|
+
logToTestOps: (level?: string, message?: string, consoleLog?: boolean) => void;
|
|
5
|
+
trace: (message: any) => void;
|
|
6
|
+
debug: (message: any) => void;
|
|
7
|
+
info: (message: any) => void;
|
|
8
|
+
warn: (message: any) => void;
|
|
9
|
+
error: (message: any) => void;
|
|
10
|
+
}
|
|
11
|
+
export default logReportingAPI;
|
|
12
|
+
//# sourceMappingURL=logReportingAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logReportingAPI.d.ts","sourceRoot":"","sources":["../src/logReportingAPI.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAA;AAWzC,cAAM,eAAgB,SAAQ,SAAS;IACnC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,GAAE,SAAS,GAAC,QAAoB;IAkBvD,YAAY,mEAWX;IAGD,KAAK,YAAa,GAAG,UAEpB;IAED,KAAK,YAAa,GAAG,UAEpB;IAED,IAAI,YAAa,GAAG,UAEnB;IAED,IAAI,YAAa,GAAG,UAEnB;IAED,KAAK,YAAa,GAAG,UAEpB;CACJ;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import Transport from 'winston-transport';
|
|
2
|
+
import { consoleHolder } from './constants.js';
|
|
3
|
+
const LOG_LEVELS = {
|
|
4
|
+
INFO: 'INFO',
|
|
5
|
+
ERROR: 'ERROR',
|
|
6
|
+
DEBUG: 'DEBUG',
|
|
7
|
+
TRACE: 'TRACE',
|
|
8
|
+
WARN: 'WARN',
|
|
9
|
+
};
|
|
10
|
+
class logReportingAPI extends Transport {
|
|
11
|
+
log(info, callback = undefined) {
|
|
12
|
+
setImmediate(() => {
|
|
13
|
+
this.emit('logged', info);
|
|
14
|
+
});
|
|
15
|
+
if (typeof (info) === 'object') {
|
|
16
|
+
/* From log appender */
|
|
17
|
+
this.logToTestOps(info.level || LOG_LEVELS.INFO, info.message, false);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
/* From default console */
|
|
21
|
+
this.logToTestOps(LOG_LEVELS.INFO, info);
|
|
22
|
+
}
|
|
23
|
+
if (callback && typeof callback === 'function') {
|
|
24
|
+
callback();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
logToTestOps = (level = LOG_LEVELS.INFO, message = '', consoleLog = true) => {
|
|
28
|
+
if (consoleLog) {
|
|
29
|
+
consoleHolder[level.toLowerCase()](message);
|
|
30
|
+
}
|
|
31
|
+
process.emit(`bs:addLog:${process.pid}`, {
|
|
32
|
+
timestamp: new Date().toISOString(),
|
|
33
|
+
level: level.toUpperCase(),
|
|
34
|
+
message: message,
|
|
35
|
+
kind: 'TEST_LOG',
|
|
36
|
+
http_response: {}
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
/* Patching this would show user an extended trace on their cli */
|
|
40
|
+
trace = (message) => {
|
|
41
|
+
this.logToTestOps(LOG_LEVELS.TRACE, message);
|
|
42
|
+
};
|
|
43
|
+
debug = (message) => {
|
|
44
|
+
this.logToTestOps(LOG_LEVELS.DEBUG, message);
|
|
45
|
+
};
|
|
46
|
+
info = (message) => {
|
|
47
|
+
this.logToTestOps(LOG_LEVELS.INFO, message);
|
|
48
|
+
};
|
|
49
|
+
warn = (message) => {
|
|
50
|
+
this.logToTestOps(LOG_LEVELS.WARN, message);
|
|
51
|
+
};
|
|
52
|
+
error = (message) => {
|
|
53
|
+
this.logToTestOps(LOG_LEVELS.ERROR, message);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export default logReportingAPI;
|
package/build/reporter.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SuiteStats, TestStats, RunnerStats, HookStats } from '@wdio/reporter';
|
|
2
2
|
import WDIOReporter from '@wdio/reporter';
|
|
3
|
+
import type { CurrentRunInfo, StdLog } from './types.js';
|
|
3
4
|
import type { TestMeta } from './types.js';
|
|
4
5
|
declare class _TestReporter extends WDIOReporter {
|
|
5
6
|
private _capabilities;
|
|
@@ -12,7 +13,12 @@ declare class _TestReporter extends WDIOReporter {
|
|
|
12
13
|
private static _tests;
|
|
13
14
|
private _gitConfigPath?;
|
|
14
15
|
private _gitConfigured;
|
|
16
|
+
private _currentHook;
|
|
17
|
+
private _currentTest;
|
|
15
18
|
onRunnerStart(runnerStats: RunnerStats): Promise<void>;
|
|
19
|
+
registerListeners(): void;
|
|
20
|
+
appendTestItemLog(stdLog: StdLog): Promise<void>;
|
|
21
|
+
setCurrentHook(hookDetails: CurrentRunInfo): void;
|
|
16
22
|
configureGit(): Promise<void>;
|
|
17
23
|
static getTests(): Record<string, TestMeta>;
|
|
18
24
|
onSuiteStart(suiteStats: SuiteStats): void;
|
package/build/reporter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACnF,OAAO,YAAY,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACnF,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAKzC,OAAO,KAAK,EAAE,cAAc,EAAE,M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AAe,YAAY,CAAA"}
|
package/build/reporter.js
CHANGED
|
@@ -3,7 +3,7 @@ import logger from '@wdio/logger';
|
|
|
3
3
|
import WDIOReporter from '@wdio/reporter';
|
|
4
4
|
import * as url from 'node:url';
|
|
5
5
|
import { v4 as uuidv4 } from 'uuid';
|
|
6
|
-
import { getCloudProvider, uploadEventData, o11yClassErrorHandler, getGitMetaData, removeAnsiColors, getHookType } from './util.js';
|
|
6
|
+
import { getCloudProvider, uploadEventData, o11yClassErrorHandler, getGitMetaData, removeAnsiColors, getHookType, pushDataToQueue } from './util.js';
|
|
7
7
|
import RequestQueueHandler from './request-handler.js';
|
|
8
8
|
const log = logger('@wdio/browserstack-service');
|
|
9
9
|
class _TestReporter extends WDIOReporter {
|
|
@@ -17,6 +17,8 @@ class _TestReporter extends WDIOReporter {
|
|
|
17
17
|
static _tests = {};
|
|
18
18
|
_gitConfigPath;
|
|
19
19
|
_gitConfigured = false;
|
|
20
|
+
_currentHook = {};
|
|
21
|
+
_currentTest = {};
|
|
20
22
|
async onRunnerStart(runnerStats) {
|
|
21
23
|
this._capabilities = runnerStats.capabilities;
|
|
22
24
|
this._config = runnerStats.config;
|
|
@@ -25,6 +27,40 @@ class _TestReporter extends WDIOReporter {
|
|
|
25
27
|
this._observability = this._config.testObservability;
|
|
26
28
|
}
|
|
27
29
|
await this.configureGit();
|
|
30
|
+
this.registerListeners();
|
|
31
|
+
}
|
|
32
|
+
registerListeners() {
|
|
33
|
+
if (this._config?.framework !== 'jasmine') {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
process.removeAllListeners(`bs:addLog:${process.pid}`);
|
|
37
|
+
process.on(`bs:addLog:${process.pid}`, this.appendTestItemLog.bind(this));
|
|
38
|
+
}
|
|
39
|
+
async appendTestItemLog(stdLog) {
|
|
40
|
+
if (this._currentHook.uuid && !this._currentHook.finished) {
|
|
41
|
+
stdLog.hook_run_uuid = this._currentHook.uuid;
|
|
42
|
+
}
|
|
43
|
+
else if (this._currentTest.uuid) {
|
|
44
|
+
stdLog.test_run_uuid = this._currentTest.uuid;
|
|
45
|
+
}
|
|
46
|
+
if (stdLog.hook_run_uuid || stdLog.test_run_uuid) {
|
|
47
|
+
await pushDataToQueue({
|
|
48
|
+
event_type: 'LogCreated',
|
|
49
|
+
logs: [stdLog]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
setCurrentHook(hookDetails) {
|
|
54
|
+
if (hookDetails.finished) {
|
|
55
|
+
if (this._currentHook.uuid === hookDetails.uuid) {
|
|
56
|
+
this._currentHook.finished = true;
|
|
57
|
+
}
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
this._currentHook = {
|
|
61
|
+
uuid: hookDetails.uuid,
|
|
62
|
+
finished: false
|
|
63
|
+
};
|
|
28
64
|
}
|
|
29
65
|
async configureGit() {
|
|
30
66
|
if (this._gitConfigured) {
|
|
@@ -93,8 +129,10 @@ class _TestReporter extends WDIOReporter {
|
|
|
93
129
|
if (testStats.fullTitle === '<unknown test>') {
|
|
94
130
|
return;
|
|
95
131
|
}
|
|
132
|
+
const uuid = uuidv4();
|
|
133
|
+
this._currentTest.uuid = uuid;
|
|
96
134
|
_TestReporter._tests[testStats.fullTitle] = {
|
|
97
|
-
uuid:
|
|
135
|
+
uuid: uuid,
|
|
98
136
|
};
|
|
99
137
|
await this.sendTestRunEvent(testStats, 'TestRunStarted');
|
|
100
138
|
}
|
|
@@ -104,6 +142,7 @@ class _TestReporter extends WDIOReporter {
|
|
|
104
142
|
}
|
|
105
143
|
const identifier = this.getHookIdentifier(hookStats);
|
|
106
144
|
const hookId = uuidv4();
|
|
145
|
+
this.setCurrentHook({ uuid: hookId });
|
|
107
146
|
_TestReporter._tests[identifier] = {
|
|
108
147
|
uuid: hookId,
|
|
109
148
|
startedAt: (new Date()).toISOString()
|
|
@@ -123,6 +162,7 @@ class _TestReporter extends WDIOReporter {
|
|
|
123
162
|
finishedAt: (new Date()).toISOString()
|
|
124
163
|
};
|
|
125
164
|
}
|
|
165
|
+
this.setCurrentHook({ uuid: _TestReporter._tests[identifier].uuid, finished: true });
|
|
126
166
|
if (!hookStats.state && !hookStats.error) {
|
|
127
167
|
hookStats.state = 'passed';
|
|
128
168
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function testStartEvent(): void;
|
|
2
|
+
export declare function testForceStop(): void;
|
|
3
|
+
export declare function testStop(this: any): void;
|
|
4
|
+
export declare function accessibilityResults(): Promise<Array<{
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}>>;
|
|
7
|
+
export declare function accessibilityResultsSummary(): Promise<{
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=test-event-scripts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-event-scripts.d.ts","sourceRoot":"","sources":["../../src/scripts/test-event-scripts.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,SAY7B;AAED,wBAAgB,aAAa,SAG5B;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,GAAG,QAgBjC;AAED,wBAAgB,oBAAoB,IAAK,OAAO,CAAC,KAAK,CAAC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CAAE,CAAC,CAAC,CAc/E;AAED,wBAAgB,2BAA2B,IAAK,OAAO,CAAC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CAAE,CAAC,CAc/E"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export function testStartEvent() {
|
|
2
|
+
const callback = arguments[arguments.length - 1];
|
|
3
|
+
const fn = () => {
|
|
4
|
+
window.addEventListener('A11Y_TAP_STARTED', fn2);
|
|
5
|
+
const e = new CustomEvent('A11Y_FORCE_START');
|
|
6
|
+
window.dispatchEvent(e);
|
|
7
|
+
};
|
|
8
|
+
const fn2 = () => {
|
|
9
|
+
window.removeEventListener('A11Y_TAP_STARTED', fn);
|
|
10
|
+
callback();
|
|
11
|
+
};
|
|
12
|
+
fn();
|
|
13
|
+
}
|
|
14
|
+
export function testForceStop() {
|
|
15
|
+
const e = new CustomEvent('A11Y_FORCE_STOP');
|
|
16
|
+
window.dispatchEvent(e);
|
|
17
|
+
}
|
|
18
|
+
export function testStop() {
|
|
19
|
+
const callback = arguments[arguments.length - 1];
|
|
20
|
+
this.res = null;
|
|
21
|
+
if (arguments[0].saveResults) {
|
|
22
|
+
window.addEventListener('A11Y_TAP_TRANSPORTER', (event) => {
|
|
23
|
+
window.tapTransporterData = event.detail;
|
|
24
|
+
this.res = window.tapTransporterData;
|
|
25
|
+
callback(this.res);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const e = new CustomEvent('A11Y_TEST_END', { detail: arguments[0] });
|
|
29
|
+
window.dispatchEvent(e);
|
|
30
|
+
if (arguments[0].saveResults !== true) {
|
|
31
|
+
callback();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function accessibilityResults() {
|
|
35
|
+
return new Promise(function (resolve, reject) {
|
|
36
|
+
try {
|
|
37
|
+
const event = new CustomEvent('A11Y_TAP_GET_RESULTS');
|
|
38
|
+
const fn = function (event) {
|
|
39
|
+
window.removeEventListener('A11Y_RESULTS_RESPONSE', fn);
|
|
40
|
+
resolve(event.detail.data);
|
|
41
|
+
};
|
|
42
|
+
window.addEventListener('A11Y_RESULTS_RESPONSE', fn);
|
|
43
|
+
window.dispatchEvent(event);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
reject();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export function accessibilityResultsSummary() {
|
|
51
|
+
return new Promise(function (resolve, reject) {
|
|
52
|
+
try {
|
|
53
|
+
const event = new CustomEvent('A11Y_TAP_GET_RESULTS_SUMMARY');
|
|
54
|
+
const fn = function (event) {
|
|
55
|
+
window.removeEventListener('A11Y_RESULTS_SUMMARY_RESPONSE', fn);
|
|
56
|
+
resolve(event.detail.summary);
|
|
57
|
+
};
|
|
58
|
+
window.addEventListener('A11Y_RESULTS_SUMMARY_RESPONSE', fn);
|
|
59
|
+
window.dispatchEvent(event);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
reject();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
package/build/service.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Services, Capabilities, Options, Frameworks } from '@wdio/types';
|
|
2
2
|
import type { BrowserstackConfig, MultiRemoteAction } from './types.js';
|
|
3
|
-
import type { Pickle, Feature, ITestCaseHookParameter } from './cucumber-types.js';
|
|
3
|
+
import type { Pickle, Feature, ITestCaseHookParameter, CucumberHook } from './cucumber-types.js';
|
|
4
4
|
export default class BrowserstackService implements Services.ServiceInstance {
|
|
5
5
|
private _caps;
|
|
6
6
|
private _config;
|
|
@@ -17,6 +17,8 @@ export default class BrowserstackService implements Services.ServiceInstance {
|
|
|
17
17
|
private _observability;
|
|
18
18
|
private _currentTest?;
|
|
19
19
|
private _insightsHandler?;
|
|
20
|
+
private _accessibility;
|
|
21
|
+
private _accessibilityHandler?;
|
|
20
22
|
constructor(options: BrowserstackConfig & Options.Testrunner, _caps: Capabilities.RemoteCapability, _config: Options.Testrunner);
|
|
21
23
|
_updateCaps(fn: (caps: Capabilities.Capabilities | Capabilities.DesiredCapabilities) => void): void;
|
|
22
24
|
beforeSession(config: Omit<Options.Testrunner, 'capabilities'>): void;
|
|
@@ -29,8 +31,8 @@ export default class BrowserstackService implements Services.ServiceInstance {
|
|
|
29
31
|
* and `suite.fullTitle` is `undefined`, so no alternative to use for the job name.
|
|
30
32
|
*/
|
|
31
33
|
beforeSuite(suite: Frameworks.Suite): Promise<void>;
|
|
32
|
-
beforeHook(test: Frameworks.Test, context: any): Promise<void>;
|
|
33
|
-
afterHook(test: Frameworks.Test, context: unknown, result: Frameworks.TestResult): Promise<void>;
|
|
34
|
+
beforeHook(test: Frameworks.Test | CucumberHook, context: any): Promise<void>;
|
|
35
|
+
afterHook(test: Frameworks.Test | CucumberHook, context: unknown, result: Frameworks.TestResult): Promise<void>;
|
|
34
36
|
beforeTest(test: Frameworks.Test): Promise<void>;
|
|
35
37
|
afterTest(test: Frameworks.Test, context: never, results: Frameworks.TestResult): Promise<void>;
|
|
36
38
|
after(result: number): Promise<void>;
|
package/build/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAW9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAmB,MAAM,YAAY,CAAA;AACxF,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAShG,MAAM,CAAC,OAAO,OAAO,mBAAoB,YAAW,QAAQ,CAAC,eAAe;IAmBpE,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,OAAO;IAnBnB,OAAO,CAAC,eAAe,CAAmD;IAC1E,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,iBAAiB,CAAe;IACxC,OAAO,CAAC,gBAAgB,CAA4D;IACpF,OAAO,CAAC,QAAQ,CAAC,CAAqB;IACtC,OAAO,CAAC,WAAW,CAAC,CAAQ;IAC5B,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,QAAQ,CAAyC;IACzD,OAAO,CAAC,SAAS,CAAi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AE,KAAK,EAAE,sBAAsB;IAuB5C,UAAU,CAAE,IAAI,EAAE,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM;IAKzD,SAAS,CAAE,IAAI,EAAE,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,YAAY;IAIzF,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAgCzD,cAAc,IAAI,OAAO;IAMzB,UAAU,CAAE,WAAW,EAAE,GAAG;IAU5B,kBAAkB,CAAE,MAAM,EAAE,iBAAiB;IAqB7C,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG;IAarC,gBAAgB;YAuBR,eAAe;IA0B7B,OAAO,CAAC,cAAc;YAIR,eAAe;CAqBhC"}
|
package/build/service.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import logger from '@wdio/logger';
|
|
2
2
|
import got from 'got';
|
|
3
3
|
import PerformanceTester from './performance-tester.js';
|
|
4
|
-
import { getBrowserDescription, getBrowserCapabilities, isBrowserstackCapability, getParentSuiteName, isBrowserstackSession, } from './util.js';
|
|
4
|
+
import { getBrowserDescription, getBrowserCapabilities, isBrowserstackCapability, getParentSuiteName, isBrowserstackSession, patchConsoleLogs, } from './util.js';
|
|
5
5
|
import InsightsHandler from './insights-handler.js';
|
|
6
6
|
import TestReporter from './reporter.js';
|
|
7
7
|
import { DEFAULT_OPTIONS } from './constants.js';
|
|
8
8
|
import CrashReporter from './crash-reporter.js';
|
|
9
|
+
import AccessibilityHandler from './accessibility-handler.js';
|
|
9
10
|
const log = logger('@wdio/browserstack-service');
|
|
10
11
|
export default class BrowserstackService {
|
|
11
12
|
_caps;
|
|
@@ -23,6 +24,8 @@ export default class BrowserstackService {
|
|
|
23
24
|
_observability;
|
|
24
25
|
_currentTest;
|
|
25
26
|
_insightsHandler;
|
|
27
|
+
_accessibility;
|
|
28
|
+
_accessibilityHandler;
|
|
26
29
|
constructor(options, _caps, _config) {
|
|
27
30
|
this._caps = _caps;
|
|
28
31
|
this._config = _config;
|
|
@@ -30,6 +33,7 @@ export default class BrowserstackService {
|
|
|
30
33
|
// added to maintain backward compatibility with webdriverIO v5
|
|
31
34
|
this._config || (this._config = this._options);
|
|
32
35
|
this._observability = this._options.testObservability;
|
|
36
|
+
this._accessibility = this._options.accessibility;
|
|
33
37
|
if (this._observability) {
|
|
34
38
|
this._config.reporters?.push(TestReporter);
|
|
35
39
|
if (process.env.BROWSERSTACK_O11Y_PERF_MEASUREMENT) {
|
|
@@ -73,6 +77,7 @@ export default class BrowserstackService {
|
|
|
73
77
|
}
|
|
74
78
|
this._scenariosThatRan = [];
|
|
75
79
|
if (this._observability && this._browser) {
|
|
80
|
+
patchConsoleLogs();
|
|
76
81
|
try {
|
|
77
82
|
this._insightsHandler = new InsightsHandler(this._browser, this._isAppAutomate(), this._config.framework);
|
|
78
83
|
await this._insightsHandler.before();
|
|
@@ -90,6 +95,15 @@ export default class BrowserstackService {
|
|
|
90
95
|
CrashReporter.uploadCrashReport(`Error in service class before function: ${err}`, err && err.stack);
|
|
91
96
|
}
|
|
92
97
|
}
|
|
98
|
+
if (this._browser && isBrowserstackSession(this._browser)) {
|
|
99
|
+
try {
|
|
100
|
+
this._accessibilityHandler = new AccessibilityHandler(this._browser, this._caps, this._isAppAutomate(), this._config.framework, this._accessibility, this._options.accessibilityOptions);
|
|
101
|
+
await this._accessibilityHandler.before();
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
log.error(`[Accessibility Test Run] Error in service class before function: ${err}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
93
107
|
return await this._printSessionURL();
|
|
94
108
|
}
|
|
95
109
|
/**
|
|
@@ -102,6 +116,7 @@ export default class BrowserstackService {
|
|
|
102
116
|
async beforeSuite(suite) {
|
|
103
117
|
this._suiteTitle = suite.title;
|
|
104
118
|
this._insightsHandler?.setSuiteFile(suite.file);
|
|
119
|
+
this._accessibilityHandler?.setSuiteFile(suite.file);
|
|
105
120
|
if (suite.title && suite.title !== 'Jasmine__TopLevel__Suite') {
|
|
106
121
|
await this._setSessionName(suite.title);
|
|
107
122
|
}
|
|
@@ -132,6 +147,7 @@ export default class BrowserstackService {
|
|
|
132
147
|
await this._setSessionName(suiteTitle, test);
|
|
133
148
|
await this._setAnnotation(`Test: ${test.fullName ?? test.title}`);
|
|
134
149
|
await this._insightsHandler?.beforeTest(test);
|
|
150
|
+
await this._accessibilityHandler?.beforeTest(suiteTitle, test);
|
|
135
151
|
}
|
|
136
152
|
async afterTest(test, context, results) {
|
|
137
153
|
this._specsRan = true;
|
|
@@ -140,6 +156,7 @@ export default class BrowserstackService {
|
|
|
140
156
|
this._failReasons.push((error && error.message) || 'Unknown Error');
|
|
141
157
|
}
|
|
142
158
|
await this._insightsHandler?.afterTest(test, results);
|
|
159
|
+
await this._accessibilityHandler?.afterTest(this._suiteTitle, test);
|
|
143
160
|
}
|
|
144
161
|
async after(result) {
|
|
145
162
|
const { preferScenarioName, setSessionName, setSessionStatus } = this._options;
|
|
@@ -175,6 +192,7 @@ export default class BrowserstackService {
|
|
|
175
192
|
this._suiteTitle = feature.name;
|
|
176
193
|
await this._setSessionName(feature.name);
|
|
177
194
|
await this._setAnnotation(`Feature: ${feature.name}`);
|
|
195
|
+
await this._insightsHandler?.beforeFeature(uri, feature);
|
|
178
196
|
}
|
|
179
197
|
/**
|
|
180
198
|
* Runs before a Cucumber Scenario.
|
|
@@ -183,6 +201,7 @@ export default class BrowserstackService {
|
|
|
183
201
|
async beforeScenario(world) {
|
|
184
202
|
this._currentTest = world;
|
|
185
203
|
await this._insightsHandler?.beforeScenario(world);
|
|
204
|
+
await this._accessibilityHandler?.beforeScenario(world);
|
|
186
205
|
const scenarioName = world.pickle.name || 'unknown scenario';
|
|
187
206
|
await this._setAnnotation(`Scenario: ${scenarioName}`);
|
|
188
207
|
}
|
|
@@ -200,6 +219,7 @@ export default class BrowserstackService {
|
|
|
200
219
|
this._failReasons.push(exception);
|
|
201
220
|
}
|
|
202
221
|
await this._insightsHandler?.afterScenario(world);
|
|
222
|
+
await this._accessibilityHandler?.afterScenario(world);
|
|
203
223
|
}
|
|
204
224
|
async beforeStep(step, scenario) {
|
|
205
225
|
await this._insightsHandler?.beforeStep(step, scenario);
|
package/build/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Capabilities, Options } from '@wdio/types';
|
|
1
|
+
import type { Capabilities, Options, Frameworks } from '@wdio/types';
|
|
2
2
|
import type { Options as BSOptions } from 'browserstack-local';
|
|
3
3
|
export interface SessionResponse {
|
|
4
4
|
automation_session: {
|
|
@@ -48,6 +48,20 @@ export interface BrowserstackConfig {
|
|
|
48
48
|
* For e.g. buildName, projectName, BrowserStack access credentials, etc.
|
|
49
49
|
*/
|
|
50
50
|
testObservabilityOptions?: TestObservabilityOptions;
|
|
51
|
+
/**
|
|
52
|
+
* Set this to true to enable BrowserStack Accessibility Automation which will
|
|
53
|
+
* automically conduct accessibility testing on your pre-existing test builds
|
|
54
|
+
* and generate health reports which can be viewed in the Accessibility dashboard.
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
accessibility?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Customise the Accessibility-related config options under this key.
|
|
60
|
+
* For e.g. wcagVersion, bestPractice issues, needsReview issues etc.
|
|
61
|
+
*/
|
|
62
|
+
accessibilityOptions?: {
|
|
63
|
+
[key: string]: any;
|
|
64
|
+
};
|
|
51
65
|
/**
|
|
52
66
|
* Set this with app file path present locally on your device or
|
|
53
67
|
* app hashed id returned after uploading app to BrowserStack or
|
|
@@ -139,6 +153,13 @@ export interface TestMeta {
|
|
|
139
153
|
name: string;
|
|
140
154
|
};
|
|
141
155
|
examples?: string[];
|
|
156
|
+
hookType?: string;
|
|
157
|
+
testRunId?: string;
|
|
158
|
+
}
|
|
159
|
+
export interface CurrentRunInfo {
|
|
160
|
+
uuid?: string;
|
|
161
|
+
test?: Frameworks.Test;
|
|
162
|
+
finished?: boolean;
|
|
142
163
|
}
|
|
143
164
|
export interface TestData {
|
|
144
165
|
uuid?: string;
|
|
@@ -178,6 +199,9 @@ export interface UserConfig {
|
|
|
178
199
|
buildTag?: string;
|
|
179
200
|
bstackServiceVersion?: string;
|
|
180
201
|
buildIdentifier?: string;
|
|
202
|
+
accessibilityOptions?: {
|
|
203
|
+
[key: string]: any;
|
|
204
|
+
};
|
|
181
205
|
}
|
|
182
206
|
export interface UploadType {
|
|
183
207
|
event_type: string;
|
|
@@ -185,6 +209,15 @@ export interface UploadType {
|
|
|
185
209
|
test_run?: TestData;
|
|
186
210
|
logs?: any[];
|
|
187
211
|
}
|
|
212
|
+
export interface StdLog {
|
|
213
|
+
timestamp: string;
|
|
214
|
+
kind: string;
|
|
215
|
+
level?: string;
|
|
216
|
+
message?: string;
|
|
217
|
+
http_response?: any;
|
|
218
|
+
test_run_uuid?: string;
|
|
219
|
+
hook_run_uuid?: string;
|
|
220
|
+
}
|
|
188
221
|
export interface LaunchResponse {
|
|
189
222
|
jwt: string;
|
|
190
223
|
build_hashed_id: string;
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,KAAK,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9D,MAAM,WAAW,eAAe;IAE5B,kBAAkB,EAAE;QAEhB,WAAW,EAAE,MAAM,CAAA;KACtB,CAAA;CACJ;AAED,MAAM,MAAM,i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M,GAAG,SAAS,CAAC;QAC9C,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;KACjC,CAAA;CACF;AAED,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,UAAU,iBAAiB;IACvB,YAAY,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,YAAY;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AAED,UAAU,QAAQ;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,OAAO;IACb,SAAS,EAAE,MAAM,EAAE,CAAA;CACtB"}
|
package/build/util.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ import http from 'node:http';
|
|
|
4
4
|
import https from 'node:https';
|
|
5
5
|
import type { Capabilities, Frameworks, Options } from '@wdio/types';
|
|
6
6
|
import type { BeforeCommandArgs, AfterCommandArgs } from '@wdio/reporter';
|
|
7
|
+
import type { Method } from 'got';
|
|
7
8
|
import type { UploadType, BrowserstackConfig } from './types.js';
|
|
8
9
|
import type { ITestCaseHookParameter } from './cucumber-types.js';
|
|
10
|
+
import RequestQueueHandler from './request-handler.js';
|
|
9
11
|
export declare const DEFAULT_REQUEST_CONFIG: {
|
|
10
12
|
agent: {
|
|
11
13
|
http: http.Agent;
|
|
@@ -35,11 +37,28 @@ export declare function getBrowserCapabilities(browser: WebdriverIO.Browser | We
|
|
|
35
37
|
export declare function isBrowserstackCapability(cap?: Capabilities.Capabilities): boolean;
|
|
36
38
|
export declare function getParentSuiteName(fullTitle: string, testSuiteTitle: string): string;
|
|
37
39
|
export declare function o11yErrorHandler(fn: Function): (...args: any) => any;
|
|
40
|
+
export declare function errorHandler(fn: Function): (...args: any) => any;
|
|
41
|
+
export declare function nodeRequest(requestType: Method, apiEndpoint: string, options: any, apiUrl: string, timeout?: number): Promise<Object>;
|
|
38
42
|
type ClassType = {
|
|
39
43
|
new (...args: any[]): any;
|
|
40
44
|
};
|
|
41
45
|
export declare function o11yClassErrorHandler<T extends ClassType>(errorClass: T): T;
|
|
42
46
|
export declare const launchTestSession: (...args: any) => any;
|
|
47
|
+
export declare const validateCapsWithA11y: (deviceName?: any, platformMeta?: {
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
} | undefined, chromeOptions?: any) => boolean;
|
|
50
|
+
export declare const shouldScanTestForAccessibility: (suiteTitle: string | undefined, testTitle: string, accessibilityOptions?: {
|
|
51
|
+
[key: string]: any;
|
|
52
|
+
} | undefined) => boolean | undefined;
|
|
53
|
+
export declare const isAccessibilityAutomationSession: (accessibilityFlag?: boolean | string) => boolean | "" | undefined;
|
|
54
|
+
export declare const createAccessibilityTestRun: (...args: any) => any;
|
|
55
|
+
export declare const getA11yResults: (browser: WebdriverIO.Browser, isBrowserStackSession?: boolean, isAccessibility?: boolean | string) => Promise<{
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
}[]>;
|
|
58
|
+
export declare const getA11yResultsSummary: (browser: WebdriverIO.Browser, isBrowserStackSession?: boolean, isAccessibility?: boolean | string) => Promise<{
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
}>;
|
|
61
|
+
export declare const stopAccessibilityTestRun: (...args: any) => any;
|
|
43
62
|
export declare const stopBuildUpstream: (...args: any) => any;
|
|
44
63
|
export declare function getCiInfo(): {
|
|
45
64
|
name: string;
|
|
@@ -100,7 +119,20 @@ export declare function getObservabilityKey(options: BrowserstackConfig & Option
|
|
|
100
119
|
export declare function getObservabilityProject(options: BrowserstackConfig & Options.Testrunner, bstackProjectName?: string): string | undefined;
|
|
101
120
|
export declare function getObservabilityBuild(options: BrowserstackConfig & Options.Testrunner, bstackBuildName?: string): string;
|
|
102
121
|
export declare function getObservabilityBuildTags(options: BrowserstackConfig & Options.Testrunner, bstackBuildTag?: string): string[];
|
|
122
|
+
export declare function getBrowserStackUser(config: Options.Testrunner): string | undefined;
|
|
123
|
+
export declare function getBrowserStackKey(config: Options.Testrunner): string | undefined;
|
|
124
|
+
export declare function isUndefined(value: any): boolean;
|
|
125
|
+
export declare function isTrue(value?: any): boolean;
|
|
103
126
|
export declare function frameworkSupportsHook(hook: string, framework?: string): boolean;
|
|
127
|
+
export declare function patchConsoleLogs(): void;
|
|
128
|
+
export declare function getFailureObject(error: string | Error): {
|
|
129
|
+
failure: {
|
|
130
|
+
backtrace: string[];
|
|
131
|
+
}[];
|
|
132
|
+
failure_reason: string;
|
|
133
|
+
failure_type: string | null;
|
|
134
|
+
};
|
|
135
|
+
export declare function pushDataToQueue(data: UploadType, requestQueueHandler?: RequestQueueHandler | undefined): Promise<void>;
|
|
104
136
|
export declare const sleep: (ms?: number) => Promise<unknown>;
|
|
105
137
|
export {};
|
|
106
138
|
//# sourceMappingURL=util.d.ts.map
|