@alex_neo/playwright-azure-reporter 1.5.6 → 1.5.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/.eslintignore +2 -0
- package/.github/workflows/tests.yml +2 -0
- package/CHANGELOG.md +9 -0
- package/dist/debug.js +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/playwright-azure-reporter.d.ts +1 -1
- package/package.json +7 -3
- package/playwright.config.ts +5 -4
- package/tests/config/serverFixtures.ts +45 -45
- package/tests/config/utils.ts +5 -9
- package/tests/reporter/assets/azure-reporter/azureAreas.js +669 -669
- package/tests/reporter/assets/azure-reporter/azureCoreOptionsResponse.json +107 -107
- package/tests/reporter/assets/azure-reporter/azureHeaders.js +2 -2
- package/tests/reporter/assets/azure-reporter/azureLocationOptionsResponse.json +27 -27
- package/tests/reporter/assets/azure-reporter/azureTestOptionsResponse.json +772 -772
- package/tests/reporter/assets/azure-reporter/completeRunValidResponse.json +1 -1
- package/tests/reporter/assets/azure-reporter/createRunInvalidResponse.json +1 -1
- package/tests/reporter/assets/azure-reporter/createRunValidResponse.json +1 -1
- package/tests/reporter/assets/azure-reporter/getTestResultsByQueryResponse.json +2 -4
- package/tests/reporter/assets/azure-reporter/points3-7Response.json +2 -4
- package/tests/reporter/assets/azure-reporter/points33InvalidResponse.json +2 -4
- package/tests/reporter/assets/azure-reporter/points3Response.json +2 -4
- package/tests/reporter/assets/azure-reporter/points7Response.json +2 -4
- package/tests/reporter/assets/azure-reporter/pointsResponseMapper.js +113 -0
- package/tests/reporter/assets/azure-reporter/projectInvalidResponse.json +1 -1
- package/tests/reporter/assets/azure-reporter/projectValidResponse.json +1 -1
- package/tests/reporter/assets/azure-reporter/runResultsAttachmentsResponse.json +1 -1
- package/tests/reporter/assets/azure-reporter/testResultsByQueryResponseMapping.js +147 -0
- package/tests/reporter/assets/azure-reporter/testRunResults3-7ValidResponse.json +1 -1
- package/tests/reporter/assets/azure-reporter/testRunResults3ValidResponse.json +1 -1
- package/tests/reporter/assets/azure-reporter/testRunResults7ValidResponse.json +1 -1
- package/tests/reporter/assets/azure-reporter/testRunResultsMapper.js +65 -0
- package/tests/reporter/playwright.config.ts +3 -3
- package/tests/reporter/reporter-build.spec.ts +35 -0
- package/tests/reporter/reporter-constructor.spec.ts +98 -51
- package/tests/reporter/reporter-publish-testResult.spec.ts +154 -87
- package/tests/reporter/reporter-publish-testRun.spec.ts +289 -74
- package/tests/reporter/reporter-utils.spec.ts +6 -6
- package/tests/reporter/reporterPath.ts +3 -0
- package/tests/reporter/test-fixtures.ts +102 -77
package/.eslintignore
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [1.5.7](https://github.com/alexneo2003/playwright-azure-reporter/compare/v1.5.6...v1.5.7) (2023-04-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* last symbol was sliced at console message ([56c8228](https://github.com/alexneo2003/playwright-azure-reporter/commit/56c8228d858ca43d3a1a502a17188d6728654c8a))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
## [1.5.6](https://github.com/alexneo2003/playwright-azure-reporter/compare/v1.5.6-beta.1...v1.5.6) (2023-04-12)
|
|
2
11
|
|
|
3
12
|
|
package/dist/debug.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const chalk_1 = __importDefault(require("chalk"));
|
|
7
7
|
const debug_1 = __importDefault(require("debug"));
|
|
8
8
|
debug_1.default.formatArgs = function (args) {
|
|
9
|
-
args[0] = `${chalk_1.default.magenta.bold('azure:')} ${args[0]
|
|
9
|
+
args[0] = `${chalk_1.default.magenta.bold('azure:')} ${args[0]}`;
|
|
10
10
|
return args;
|
|
11
11
|
};
|
|
12
12
|
exports.default = debug_1.default;
|
package/dist/debug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,kDAA0B;AAE1B,eAAK,CAAC,UAAU,GAAG,UAAU,IAAI;IAC/B,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,eAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,kDAA0B;AAE1B,eAAK,CAAC,UAAU,GAAG,UAAU,IAAI;IAC/B,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,eAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACvD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,kBAAe,eAAK,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { Reporter, TestCase, TestResult } from '@playwright/test/reporter';
|
|
|
2
2
|
import * as TestInterfaces from 'azure-devops-node-api/interfaces/TestInterfaces';
|
|
3
3
|
import { TestPoint } from 'azure-devops-node-api/interfaces/TestInterfaces';
|
|
4
4
|
declare const attachmentTypesArray: readonly ["screenshot", "video", "trace"];
|
|
5
|
-
type TAttachmentType = Array<typeof attachmentTypesArray[number] | RegExp>;
|
|
5
|
+
type TAttachmentType = Array<(typeof attachmentTypesArray)[number] | RegExp>;
|
|
6
6
|
type TTestRunConfig = Omit<TestInterfaces.RunCreateModel, 'name' | 'automated' | 'plan' | 'pointIds'> | undefined;
|
|
7
7
|
type TPublishTestResults = 'testResult' | 'testRun';
|
|
8
8
|
export interface AzureReporterOptions {
|
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alex_neo/playwright-azure-reporter",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.7",
|
|
4
4
|
"description": "Playwright Azure Reporter",
|
|
5
5
|
"main": "./dist/playwright-azure-reporter.js",
|
|
6
6
|
"types": "./dist/playwright-azure-reporter.d.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "npx playwright test",
|
|
9
9
|
"test:reporter": "npx playwright test -c tests/reporter/playwright.config.ts",
|
|
10
|
-
"lint": "tsc --noEmit --skipLibCheck --pretty && eslint
|
|
10
|
+
"lint": "tsc --noEmit --skipLibCheck --pretty && eslint --ext .ts .",
|
|
11
11
|
"lint:fix": "eslint src/** tests/** --ext .ts --fix",
|
|
12
|
-
"
|
|
12
|
+
"format": "prettier --write src/**/*.ts tests/**/*.ts",
|
|
13
|
+
"build": "yarn run clean && yarn run dev",
|
|
13
14
|
"clean": "rm -rf dist || true",
|
|
14
15
|
"prepublishOnly": "tsc",
|
|
16
|
+
"dev": "yarn run lint && tsc",
|
|
17
|
+
"dev:watch": "nodemon --watch src --exec \"yarn run build\"",
|
|
15
18
|
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md",
|
|
16
19
|
"release": "conventional-github-releaser -p angular",
|
|
17
20
|
"prepare": "husky install"
|
|
@@ -57,6 +60,7 @@
|
|
|
57
60
|
"eslint-plugin-promise": "^6.1.1",
|
|
58
61
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
59
62
|
"husky": "^8.0.3",
|
|
63
|
+
"prettier": "^2.8.7",
|
|
60
64
|
"socksv5": "^0.0.6",
|
|
61
65
|
"typescript": "^5.0.3"
|
|
62
66
|
}
|
package/playwright.config.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { PlaywrightTestConfig } from '@playwright/test';
|
|
2
2
|
import { TestCase } from '@playwright/test/reporter';
|
|
3
3
|
import { TestPoint } from 'azure-devops-node-api/interfaces/TestInterfaces';
|
|
4
|
+
|
|
4
5
|
import azureConfig from './azure.config.json';
|
|
5
|
-
import { AzureReporterOptions } from './
|
|
6
|
+
import { AzureReporterOptions } from './dist/playwright-azure-reporter';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* See https://playwright.dev/docs/test-configuration.
|
|
@@ -40,7 +41,7 @@ const config: PlaywrightTestConfig = {
|
|
|
40
41
|
comment: 'Playwright Test Run',
|
|
41
42
|
},
|
|
42
43
|
testPointMapper: async (testCase: TestCase, testPoints: TestPoint[]) => {
|
|
43
|
-
switch(testCase.parent.project()?.use.browserName) {
|
|
44
|
+
switch (testCase.parent.project()?.use.browserName) {
|
|
44
45
|
case 'chromium':
|
|
45
46
|
return testPoints.filter((testPoint) => testPoint.configuration.id === '3');
|
|
46
47
|
case 'firefox':
|
|
@@ -48,9 +49,9 @@ const config: PlaywrightTestConfig = {
|
|
|
48
49
|
case 'webkit':
|
|
49
50
|
return testPoints.filter((testPoint) => testPoint.configuration.id === '5');
|
|
50
51
|
default:
|
|
51
|
-
throw new Error(
|
|
52
|
+
throw new Error('invalid test configuration!');
|
|
52
53
|
}
|
|
53
|
-
}
|
|
54
|
+
},
|
|
54
55
|
} as AzureReporterOptions,
|
|
55
56
|
],
|
|
56
57
|
],
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { Fixtures } from
|
|
19
|
+
import { Fixtures } from '@playwright/test';
|
|
20
20
|
import path from 'path';
|
|
21
21
|
import socks from 'socksv5';
|
|
22
22
|
|
|
23
|
-
import { TestServer } from
|
|
23
|
+
import { TestServer } from './TestServer';
|
|
24
24
|
|
|
25
25
|
export type ServerWorkerOptions = {
|
|
26
26
|
loopback?: string;
|
|
@@ -36,53 +36,53 @@ export type ServerFixtures = {
|
|
|
36
36
|
|
|
37
37
|
export const serverFixtures: Fixtures<ServerFixtures, ServerWorkerOptions> = {
|
|
38
38
|
loopback: [undefined, { scope: 'worker', option: true }],
|
|
39
|
-
__servers: [
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
__servers: [
|
|
40
|
+
async ({ loopback }, run, workerInfo) => {
|
|
41
|
+
const assetsPath = path.join(__dirname, '..', 'assets');
|
|
42
|
+
const cachedPath = path.join(__dirname, '..', 'assets', 'cached');
|
|
42
43
|
|
|
44
|
+
const port = 8907 + workerInfo.workerIndex * 4;
|
|
45
|
+
const server = await TestServer.create(assetsPath, port, loopback);
|
|
46
|
+
server.enableHTTPCache(cachedPath);
|
|
43
47
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
const httpsPort = port + 1;
|
|
49
|
+
const httpsServer = await TestServer.createHTTPS(assetsPath, httpsPort, loopback);
|
|
50
|
+
httpsServer.enableHTTPCache(cachedPath);
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
const socksServer = socks.createServer((info, accept, deny) => {
|
|
53
|
+
const socket = accept(true);
|
|
54
|
+
if (socket) {
|
|
55
|
+
// Catch and ignore ECONNRESET errors.
|
|
56
|
+
socket.on('error', () => {});
|
|
57
|
+
const body = '<html><title>Served by the SOCKS proxy</title></html>';
|
|
58
|
+
socket.end(
|
|
59
|
+
[
|
|
60
|
+
'HTTP/1.1 200 OK',
|
|
61
|
+
'Connection: close',
|
|
62
|
+
'Content-Type: text/html',
|
|
63
|
+
'Content-Length: ' + Buffer.byteLength(body),
|
|
64
|
+
'',
|
|
65
|
+
body,
|
|
66
|
+
].join('\r\n')
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const socksPort = port + 2;
|
|
71
|
+
socksServer.listen(socksPort, 'localhost');
|
|
72
|
+
socksServer.useAuth(socks.auth.None());
|
|
51
73
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
'HTTP/1.1 200 OK',
|
|
60
|
-
'Connection: close',
|
|
61
|
-
'Content-Type: text/html',
|
|
62
|
-
'Content-Length: ' + Buffer.byteLength(body),
|
|
63
|
-
'',
|
|
64
|
-
body
|
|
65
|
-
].join('\r\n'));
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
const socksPort = port + 2;
|
|
69
|
-
socksServer.listen(socksPort, 'localhost');
|
|
70
|
-
socksServer.useAuth(socks.auth.None());
|
|
74
|
+
await run({
|
|
75
|
+
asset: (p: string) => path.join(__dirname, '..', 'assets', ...p.split('/')),
|
|
76
|
+
server,
|
|
77
|
+
httpsServer,
|
|
78
|
+
socksPort,
|
|
79
|
+
socksServer,
|
|
80
|
+
});
|
|
71
81
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
socksPort,
|
|
77
|
-
socksServer,
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
await Promise.all([
|
|
81
|
-
server.stop(),
|
|
82
|
-
httpsServer.stop(),
|
|
83
|
-
socksServer.close(),
|
|
84
|
-
]);
|
|
85
|
-
}, { scope: 'worker' }],
|
|
82
|
+
await Promise.all([server.stop(), httpsServer.stop(), socksServer.close()]);
|
|
83
|
+
},
|
|
84
|
+
{ scope: 'worker' },
|
|
85
|
+
],
|
|
86
86
|
|
|
87
87
|
server: async ({ __servers }, run) => {
|
|
88
88
|
__servers.server.reset();
|
|
@@ -101,4 +101,4 @@ export const serverFixtures: Fixtures<ServerFixtures, ServerWorkerOptions> = {
|
|
|
101
101
|
asset: async ({ __servers }, run) => {
|
|
102
102
|
await run(__servers.asset);
|
|
103
103
|
},
|
|
104
|
-
};
|
|
104
|
+
};
|
package/tests/config/utils.ts
CHANGED
|
@@ -4,15 +4,11 @@ export function setHeaders(response, headers) {
|
|
|
4
4
|
const head = {};
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
6
|
for (const [i, _] of headers.entries()) {
|
|
7
|
-
if (i % 2 === 0)
|
|
8
|
-
head[headers[i]] = headers[i + 1];
|
|
9
|
-
|
|
7
|
+
if (i % 2 === 0) head[headers[i]] = headers[i + 1];
|
|
10
8
|
}
|
|
11
|
-
for (const [key, value] of Object.entries(head))
|
|
12
|
-
response.setHeader(key, value);
|
|
13
|
-
|
|
9
|
+
for (const [key, value] of Object.entries(head)) response.setHeader(key, value);
|
|
14
10
|
}
|
|
15
11
|
|
|
16
|
-
export async function getRequestBody(req: import('http').IncomingMessage & { postBody: Promise<Buffer
|
|
17
|
-
return req.postBody.then(body => body.toString('utf-8')).then(body => JSON.parse(body));
|
|
18
|
-
}
|
|
12
|
+
export async function getRequestBody(req: import('http').IncomingMessage & { postBody: Promise<Buffer> }) {
|
|
13
|
+
return req.postBody.then((body) => body.toString('utf-8')).then((body) => JSON.parse(body));
|
|
14
|
+
}
|