@rpcbase/test 0.11.0 → 0.13.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/package.json +4 -4
- package/src/cli.js +34 -0
- package/dist/cli.js +0 -66
- package/src/cli.ts +0 -27
- package/tsconfig.json +0 -9
- /package/src/{runPlaywright.ts → runPlaywright.js} +0 -0
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/test",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"bin": {
|
|
5
|
-
"rb-test": "./
|
|
5
|
+
"rb-test": "./src/cli.js"
|
|
6
6
|
},
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "wireit",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"wireit": {
|
|
12
12
|
"build": {
|
|
13
|
-
"command": "
|
|
13
|
+
"command": "echo 'build ok' || true",
|
|
14
14
|
"dependencies": []
|
|
15
15
|
},
|
|
16
16
|
"release": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@playwright/test": "1.
|
|
34
|
+
"@playwright/test": "1.49.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {}
|
|
37
37
|
}
|
package/src/cli.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const playwright = require('@playwright/test');
|
|
4
|
+
const fs = require("fs")
|
|
5
|
+
const path = require("path")
|
|
6
|
+
|
|
7
|
+
async function runTests() {
|
|
8
|
+
try {
|
|
9
|
+
const configPath = fs.existsSync(path.join(process.cwd(), 'playwright.config.ts'))
|
|
10
|
+
? path.join(process.cwd(), 'playwright.config.ts')
|
|
11
|
+
: path.join(__dirname, 'playwright.config.ts');
|
|
12
|
+
|
|
13
|
+
// Run tests with options
|
|
14
|
+
const result = await playwright.run({
|
|
15
|
+
config: configPath,
|
|
16
|
+
// Optional parameters
|
|
17
|
+
reporters: ['list'], // or ['html', { outputFolder: 'playwright-report' }]
|
|
18
|
+
quiet: false,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
if (result.ok()) {
|
|
22
|
+
console.log('All tests passed!');
|
|
23
|
+
process.exit(0);
|
|
24
|
+
} else {
|
|
25
|
+
console.error('Tests failed!');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error('Error:', error);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
runTests();
|
package/dist/cli.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
13
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
14
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
15
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
16
|
-
function step(op) {
|
|
17
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
18
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
19
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
20
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
21
|
-
switch (op[0]) {
|
|
22
|
-
case 0: case 1: t = op; break;
|
|
23
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
24
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
25
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
26
|
-
default:
|
|
27
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
28
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
29
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
30
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
31
|
-
if (t[2]) _.ops.pop();
|
|
32
|
-
_.trys.pop(); continue;
|
|
33
|
-
}
|
|
34
|
-
op = body.call(thisArg, _);
|
|
35
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
36
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
var fs_1 = require("fs");
|
|
41
|
-
var path_1 = require("path");
|
|
42
|
-
// @ts-ignore
|
|
43
|
-
var cli_1 = require("@playwright/test/cli");
|
|
44
|
-
var run = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
-
var configPath, result;
|
|
46
|
-
return __generator(this, function (_a) {
|
|
47
|
-
switch (_a.label) {
|
|
48
|
-
case 0:
|
|
49
|
-
configPath = fs_1.default.existsSync(path_1.default.join(process.cwd(), 'playwright.config.ts'))
|
|
50
|
-
? 'playwright.config.ts'
|
|
51
|
-
: path_1.default.join(__dirname, 'playwright.config.ts');
|
|
52
|
-
return [4 /*yield*/, (0, cli_1.runCLI)(["--config=".concat(configPath)])];
|
|
53
|
-
case 1:
|
|
54
|
-
result = _a.sent();
|
|
55
|
-
if (result.exitCode !== 0) {
|
|
56
|
-
console.error('Tests failed!');
|
|
57
|
-
process.exit(result.exitCode);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
console.log('All tests passed!');
|
|
61
|
-
}
|
|
62
|
-
return [2 /*return*/];
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}); };
|
|
66
|
-
run();
|
package/src/cli.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
import { runCLI } from '@playwright/test/cli';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const run = async() => {
|
|
10
|
-
|
|
11
|
-
const configPath = fs.existsSync(path.join(process.cwd(), 'playwright.config.ts'))
|
|
12
|
-
? 'playwright.config.ts'
|
|
13
|
-
: path.join(__dirname, 'playwright.config.ts');
|
|
14
|
-
|
|
15
|
-
const result = await runCLI([`--config=${configPath}`]); // Pass any CLI options here
|
|
16
|
-
|
|
17
|
-
if (result.exitCode !== 0) {
|
|
18
|
-
console.error('Tests failed!');
|
|
19
|
-
process.exit(result.exitCode);
|
|
20
|
-
} else {
|
|
21
|
-
console.log('All tests passed!');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
run()
|
package/tsconfig.json
DELETED
|
File without changes
|