@testivai/witness-playwright 0.1.9 → 0.1.11

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.
@@ -119,7 +119,12 @@ function mergeTestConfig(projectConfig, testConfig) {
119
119
  ...projectConfig.ai,
120
120
  ...testConfig.ai
121
121
  },
122
- selectors: testConfig.selectors
122
+ performance: {
123
+ ...projectConfig.performance,
124
+ ...testConfig.performance
125
+ },
126
+ selectors: testConfig.selectors,
127
+ useCDP: testConfig.useCDP
123
128
  };
124
129
  }
125
130
  /**
package/dist/snapshot.js CHANGED
@@ -102,6 +102,24 @@ async function snapshot(page, testInfo, name, config) {
102
102
  const client = await page.context().newCDPSession(page);
103
103
  // Enable Page domain
104
104
  await client.send('Page.enable');
105
+ // Temporarily remove height constraints to get the full scrollable content
106
+ await page.addStyleTag({
107
+ content: `
108
+ html, body {
109
+ height: auto !important;
110
+ min-height: auto !important;
111
+ max-height: none !important;
112
+ }
113
+ #testivai-layout-root, [class*="h-screen"] {
114
+ height: auto !important;
115
+ min-height: auto !important;
116
+ max-height: none !important;
117
+ overflow: visible !important;
118
+ }
119
+ `
120
+ });
121
+ // Wait a bit for styles to apply
122
+ await page.waitForTimeout(100);
105
123
  // Get layout metrics to determine full page size
106
124
  const layoutMetrics = await client.send('Page.getLayoutMetrics');
107
125
  // Calculate full page dimensions
@@ -129,6 +147,14 @@ async function snapshot(page, testInfo, name, config) {
129
147
  });
130
148
  // Save the screenshot
131
149
  await fs.writeFile(screenshotPath, Buffer.from(screenshot.data, 'base64'));
150
+ // Remove the temporary style tag
151
+ await page.evaluate(`
152
+ const styleTags = document.querySelectorAll('style');
153
+ // Remove the last added style tag (our temporary one)
154
+ if (styleTags.length > 0) {
155
+ styleTags[styleTags.length - 1].remove();
156
+ }
157
+ `);
132
158
  // Close CDP session
133
159
  await client.detach();
134
160
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testivai/witness-playwright",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Playwright sensor for Testivai Visual Regression Test system",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -90,7 +90,12 @@ export function mergeTestConfig(
90
90
  ...projectConfig.ai,
91
91
  ...testConfig.ai
92
92
  },
93
- selectors: testConfig.selectors
93
+ performance: {
94
+ ...projectConfig.performance,
95
+ ...testConfig.performance
96
+ },
97
+ selectors: testConfig.selectors,
98
+ useCDP: testConfig.useCDP
94
99
  };
95
100
  }
96
101
 
package/src/snapshot.ts CHANGED
@@ -80,6 +80,26 @@ export async function snapshot(
80
80
  // Enable Page domain
81
81
  await client.send('Page.enable');
82
82
 
83
+ // Temporarily remove height constraints to get the full scrollable content
84
+ await page.addStyleTag({
85
+ content: `
86
+ html, body {
87
+ height: auto !important;
88
+ min-height: auto !important;
89
+ max-height: none !important;
90
+ }
91
+ #testivai-layout-root, [class*="h-screen"] {
92
+ height: auto !important;
93
+ min-height: auto !important;
94
+ max-height: none !important;
95
+ overflow: visible !important;
96
+ }
97
+ `
98
+ });
99
+
100
+ // Wait a bit for styles to apply
101
+ await page.waitForTimeout(100);
102
+
83
103
  // Get layout metrics to determine full page size
84
104
  const layoutMetrics = await client.send('Page.getLayoutMetrics');
85
105
 
@@ -112,6 +132,15 @@ export async function snapshot(
112
132
  // Save the screenshot
113
133
  await fs.writeFile(screenshotPath, Buffer.from(screenshot.data, 'base64'));
114
134
 
135
+ // Remove the temporary style tag
136
+ await page.evaluate(`
137
+ const styleTags = document.querySelectorAll('style');
138
+ // Remove the last added style tag (our temporary one)
139
+ if (styleTags.length > 0) {
140
+ styleTags[styleTags.length - 1].remove();
141
+ }
142
+ `);
143
+
115
144
  // Close CDP session
116
145
  await client.detach();
117
146