Skip to content

Commit cf0cdb3

Browse files
Merge pull request #368 from lt-zeeshan/DOT-6242
Release: Alternative full page screenshot
2 parents 2254617 + e909295 commit cf0cdb3

File tree

5 files changed

+43
-2
lines changed

5 files changed

+43
-2
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.1.30",
3+
"version": "4.1.31",
44
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
55
"files": [
66
"dist/**/*"

src/lib/ctx.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export default (options: Record<string, string>): Context => {
2525
let buildNameObj: string;
2626
let allowDuplicateSnapshotNames: boolean = false;
2727
let useLambdaInternal: boolean = false;
28+
let useExtendedViewport: boolean = false;
29+
let loadDomContent: boolean = false;
2830
try {
2931
if (options.config) {
3032
config = JSON.parse(fs.readFileSync(options.config, 'utf-8'));
@@ -100,6 +102,12 @@ export default (options: Record<string, string>): Context => {
100102
if (config.useLambdaInternal) {
101103
useLambdaInternal = true;
102104
}
105+
if (config.useExtendedViewport) {
106+
useExtendedViewport = true;
107+
}
108+
if (config.loadDomContent) {
109+
loadDomContent = true;
110+
}
103111

104112
//if config.waitForPageRender has value and if its less than 30000 then make it to 30000 default
105113
if (config.waitForPageRender && config.waitForPageRender < 30000) {
@@ -132,6 +140,8 @@ export default (options: Record<string, string>): Context => {
132140
requestHeaders: config.requestHeaders || {},
133141
allowDuplicateSnapshotNames: allowDuplicateSnapshotNames,
134142
useLambdaInternal: useLambdaInternal,
143+
useExtendedViewport: useExtendedViewport,
144+
loadDomContent: loadDomContent,
135145
},
136146
uploadFilePath: '',
137147
webStaticConfig: [],

src/lib/processSnapshot.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ export async function prepareSnapshot(snapshot: Snapshot, ctx: Context): Promise
4646
if (options.loadDomContent) {
4747
processedOptions.loadDomContent = true;
4848
}
49-
49+
if (options.useExtendedViewport) {
50+
processedOptions.useExtendedViewport = true;
51+
}
5052
if (options.sessionId) {
5153
const sessionId = options.sessionId;
5254
processedOptions.sessionId = sessionId
@@ -145,6 +147,13 @@ export async function prepareSnapshot(snapshot: Snapshot, ctx: Context): Promise
145147
}
146148
}
147149

150+
if (ctx.config.loadDomContent) {
151+
processedOptions.loadDomContent = true;
152+
}
153+
if (ctx.config.useExtendedViewport) {
154+
processedOptions.useExtendedViewport = true;
155+
}
156+
148157
processedOptions.allowedAssets = ctx.config.allowedAssets;
149158
processedOptions.selectors = selectors;
150159

@@ -522,6 +531,13 @@ export default async function processSnapshot(snapshot: Snapshot, ctx: Context):
522531
}
523532
}
524533

534+
if (ctx.config.loadDomContent) {
535+
processedOptions.loadDomContent = true;
536+
}
537+
if (ctx.config.useExtendedViewport) {
538+
processedOptions.useExtendedViewport = true;
539+
}
540+
525541
// process for every viewport
526542
let navigated: boolean = false;
527543
let previousDeviceType: string | null = null;

src/lib/schemaValidation.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,14 @@ const ConfigSchema = {
266266
useLambdaInternal: {
267267
type: "boolean",
268268
errorMessage: "Invalid config; useLambdaInternal must be true/false"
269+
},
270+
useExtendedViewport: {
271+
type: "boolean",
272+
errorMessage: "Invalid config; useExtendedViewport must be true/false"
273+
},
274+
loadDomContent: {
275+
type: "boolean",
276+
errorMessage: "Invalid config; loadDomContent must be true/false"
269277
}
270278
},
271279
anyOf: [
@@ -525,6 +533,10 @@ const SnapshotSchema: JSONSchemaType<Snapshot> = {
525533
timeout: {
526534
type: "number",
527535
errorMessage: "Invalid snapshot options; timeout must be a number"
536+
},
537+
useExtendedViewport: {
538+
type: "boolean",
539+
errorMessage: "Invalid snapshot options; useExtendedViewport must be a boolean"
528540
}
529541
},
530542
additionalProperties: false

src/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export interface Context {
3838
requestHeaders?: Array<Record<string, string>>;
3939
allowDuplicateSnapshotNames?: boolean;
4040
useLambdaInternal?: boolean;
41+
useExtendedViewport?: boolean;
42+
loadDomContent?: boolean;
4143
};
4244
uploadFilePath: string;
4345
webStaticConfig: WebStaticConfig;
@@ -153,6 +155,7 @@ export interface Snapshot {
153155
sessionId?: string
154156
sync?: boolean;
155157
contextId?: string;
158+
useExtendedViewport?: boolean;
156159
}
157160
}
158161

0 commit comments

Comments
 (0)