Skip to content

Commit 197c876

Browse files
authored
Merge pull request #33 from LambdaTest/stage
Release v2.0.3
2 parents be9c2c8 + 4c90c08 commit 197c876

18 files changed

+884
-674
lines changed

package.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lambdatest/smartui-cli",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
55
"files": [
66
"dist/**/*"
@@ -21,17 +21,22 @@
2121
"author": "LambdaTest <[email protected]>",
2222
"license": "MIT",
2323
"dependencies": {
24+
"@playwright/browser-chromium": "^1.40.1",
25+
"@playwright/browser-firefox": "^1.40.1",
26+
"@playwright/browser-webkit": "^1.40.1",
27+
"@playwright/test": "^1.40.1",
2428
"@types/cross-spawn": "^6.0.4",
2529
"@types/node": "^20.8.9",
2630
"@types/which": "^3.0.2",
31+
"ajv": "^8.12.0",
32+
"ajv-errors": "^3.0.0",
2733
"axios": "^1.6.0",
2834
"chalk": "^4.1.2",
2935
"commander": "^11.1.0",
3036
"cross-spawn": "^7.0.3",
3137
"fastify": "^4.24.3",
3238
"form-data": "^4.0.0",
3339
"listr2": "^7.0.1",
34-
"playwright": "^1.39.0",
3540
"tsup": "^7.2.0",
3641
"which": "^4.0.0",
3742
"winston": "^3.10.0"

pnpm-lock.yaml

+63-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commander/capture.ts

+14-7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import getGitInfo from '../tasks/getGitInfo.js'
88
import createBuild from '../tasks/createBuild.js'
99
import captureScreenshots from '../tasks/captureScreenshots.js'
1010
import finalizeBuild from '../tasks/finalizeBuild.js'
11+
import { validateWebStaticConfig } from '../lib/schemaValidation.js'
1112

1213
const command = new Command();
1314

@@ -18,13 +19,25 @@ command
1819
.action(async function(file, _, command) {
1920
let ctx: Context = ctxInit(command.optsWithGlobals());
2021

22+
if (!fs.existsSync(file)) {
23+
console.log(`Error: Web Static Config file ${file} not found.`);
24+
return;
25+
}
26+
try {
27+
ctx.webStaticConfig = JSON.parse(fs.readFileSync(file, 'utf8'));
28+
if (!validateWebStaticConfig(ctx.webStaticConfig)) throw new Error(validateWebStaticConfig.errors[0].message);
29+
} catch (error: any) {
30+
console.log(`[smartui] Error: Invalid Web Static Config; ${error.message}`);
31+
return;
32+
}
33+
2134
let tasks = new Listr<Context>(
2235
[
2336
auth(ctx),
2437
getGitInfo(ctx),
2538
createBuild(ctx),
2639
captureScreenshots(ctx),
27-
finalizeBuild(ctx, 0)
40+
finalizeBuild(ctx)
2841
],
2942
{
3043
rendererOptions: {
@@ -39,12 +52,6 @@ command
3952
)
4053

4154
try {
42-
if (!fs.existsSync(file)) {
43-
console.log(`Error: Config file ${file} not found.`);
44-
return;
45-
}
46-
ctx.staticConfig = JSON.parse(fs.readFileSync(file, 'utf8'));
47-
4855
await tasks.run(ctx);
4956
} catch (error) {
5057
console.log('\nRefer docs: https://www.lambdatest.com/support/docs/smart-visual-regression-testing/');

src/commander/config.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { Command } from 'commander'
2-
import { createWebConfig, createWebStaticConfig } from '../lib/config.js'
2+
import { createConfig, createWebStaticConfig } from '../lib/config.js'
33

44
export const configWeb = new Command();
55
export const configStatic = new Command();
66

77
configWeb
8-
.name('config:create-web')
9-
.description('Create SmartUI Web config file')
8+
.name('config:create')
9+
.description('Create SmartUI config file')
1010
.argument('[filepath]', 'Optional config filepath')
1111
.action(async function(filepath, options) {
12-
createWebConfig(filepath);
12+
createConfig(filepath);
1313
})
1414

1515
configStatic
16-
.name('config:web-static')
16+
.name('config:create-web-static')
1717
.description('Create Web Static config file')
1818
.argument('[filepath]', 'Optional config filepath')
1919
.action(async function(filepath, options) {

src/commander/exec.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ command
2424
return
2525
}
2626
ctx.args.execCommand = execCommand
27+
ctx.totalSnapshots = 0
2728

2829
let tasks = new Listr<Context>(
2930
[
@@ -32,7 +33,7 @@ command
3233
getGitInfo(ctx),
3334
createBuild(ctx),
3435
exec(ctx),
35-
finalizeBuild(ctx, 30000)
36+
finalizeBuild(ctx)
3637
],
3738
{
3839
rendererOptions: {

0 commit comments

Comments
 (0)