Skip to content

Commit b2b5e56

Browse files
authored
Merge pull request #147 from LambdaTest/dev
Dev -> stage
2 parents 1e1efda + 0891c37 commit b2b5e56

File tree

4 files changed

+1
-108
lines changed

4 files changed

+1
-108
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lambdatest/smartui-cli",
3-
"version": "4.0.5",
3+
"version": "4.0.6",
44
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
55
"files": [
66
"dist/**/*"

src/lib/processSnapshot.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -231,45 +231,6 @@ async function processSnapshot(snapshot: Snapshot, ctx: Context): Promise<Record
231231
return false;
232232
}
233233

234-
if (options.web && Object.keys(options.web).length) {
235-
processedOptions.web = {};
236-
237-
// Check and process viewports in web
238-
if (options.web.viewports && options.web.viewports.length > 0) {
239-
processedOptions.web.viewports = options.web.viewports.filter(viewport =>
240-
Array.isArray(viewport) && viewport.length > 0
241-
);
242-
}
243-
244-
// Check and process browsers in web
245-
if (options.web.browsers && options.web.browsers.length > 0) {
246-
processedOptions.web.browsers = options.web.browsers;
247-
}
248-
}
249-
250-
if (options.mobile && Object.keys(options.mobile).length) {
251-
processedOptions.mobile = {};
252-
253-
// Check and process devices in mobile
254-
if (options.mobile.devices && options.mobile.devices.length > 0) {
255-
processedOptions.mobile.devices = options.mobile.devices;
256-
}
257-
258-
// Check if 'fullPage' is provided and is a boolean, otherwise set default to true
259-
if (options.mobile.hasOwnProperty('fullPage') && typeof options.mobile.fullPage === 'boolean') {
260-
processedOptions.mobile.fullPage = options.mobile.fullPage;
261-
} else {
262-
processedOptions.mobile.fullPage = true; // Default value for fullPage
263-
}
264-
265-
// Check if 'orientation' is provided and is valid, otherwise set default to 'portrait'
266-
if (options.mobile.hasOwnProperty('orientation') && (options.mobile.orientation === 'portrait' || options.mobile.orientation === 'landscape')) {
267-
processedOptions.mobile.orientation = options.mobile.orientation;
268-
} else {
269-
processedOptions.mobile.orientation = 'portrait'; // Default value for orientation
270-
}
271-
}
272-
273234
if (options.element && Object.keys(options.element).length) {
274235
if (options.element.id) processedOptions.element = '#' + options.element.id;
275236
else if (options.element.class) processedOptions.element = '.' + options.element.class;
@@ -379,7 +340,6 @@ async function processSnapshot(snapshot: Snapshot, ctx: Context): Promise<Record
379340
});
380341
}
381342
}
382-
ctx.log.debug(`Processed options: ${JSON.stringify(processedOptions)}`);
383343
}
384344

385345
return {

src/lib/schemaValidation.ts

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -289,64 +289,6 @@ const SnapshotSchema: JSONSchemaType<Snapshot> = {
289289
errorMessage: "Invalid snapshot options; selectDOM xpath array must have unique and non-empty items"
290290
},
291291
}
292-
},
293-
web: {
294-
type: "object",
295-
properties: {
296-
browsers: {
297-
type: "array",
298-
items: {
299-
type: "string",
300-
enum: [constants.CHROME, constants.FIREFOX, constants.SAFARI, constants.EDGE],
301-
minLength: 1
302-
},
303-
uniqueItems: true,
304-
errorMessage: `Invalid snapshot options; allowed browsers - ${constants.CHROME}, ${constants.FIREFOX}, ${constants.SAFARI}, ${constants.EDGE}`
305-
},
306-
viewports: {
307-
type: "array",
308-
items: {
309-
type: "array",
310-
items: {
311-
type: "number",
312-
minimum: 1
313-
},
314-
minItems: 1,
315-
maxItems: 2,
316-
errorMessage: "Invalid snapshot options; each viewport array must contain either a single width or a width and height tuple with positive values."
317-
},
318-
uniqueItems: true,
319-
errorMessage: "Invalid snapshot options; viewports must be an array of unique arrays."
320-
}
321-
},
322-
required: ["viewports"],
323-
errorMessage: "Invalid snapshot options; web must include viewports property."
324-
},
325-
mobile: {
326-
type: "object",
327-
properties: {
328-
devices: {
329-
type: "array",
330-
items: {
331-
type: "string",
332-
enum: Object.keys(constants.SUPPORTED_MOBILE_DEVICES),
333-
minLength: 1
334-
},
335-
uniqueItems: true,
336-
errorMessage: "Invalid snapshot options; devices must be an array of unique supported mobile devices."
337-
},
338-
fullPage: {
339-
type: "boolean",
340-
errorMessage: "Invalid snapshot options; fullPage must be a boolean."
341-
},
342-
orientation: {
343-
type: "string",
344-
enum: [constants.MOBILE_ORIENTATION_PORTRAIT, constants.MOBILE_ORIENTATION_LANDSCAPE],
345-
errorMessage: "Invalid snapshot options; orientation must be either 'portrait' or 'landscape'."
346-
}
347-
},
348-
required: ["devices"],
349-
errorMessage: "Invalid snapshot options; mobile must include devices property."
350292
}
351293
},
352294
additionalProperties: false

src/types.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,6 @@ export interface Snapshot {
8787
class?: string,
8888
cssSelector?: string,
8989
xpath?: string
90-
},
91-
web?: {
92-
browsers?: string[],
93-
viewports: ([number] | [number, number])[]
94-
},
95-
mobile?: {
96-
devices: string[],
97-
fullPage?: boolean,
98-
orientation?: string
9990
}
10091
}
10192
}

0 commit comments

Comments
 (0)