Skip to content

Commit a565e57

Browse files
authored
Merge pull request #2249 from Ishavyas9/main
smart ui doc updated
2 parents 55a23a5 + d62ea1a commit a565e57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+9271
-190
lines changed
45.8 KB
Loading

docs/espresso-visual-regression.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,165 @@ By leveraging machine learning algorithms, it accurately detects and crops the s
381381
|---------------------|--------------------|
382382
| <img loading="lazy" src={require('../assets/images/smart-visual-testing/screenshot.webp').default} alt="Profile" width="1360" height="603" className="doc_img"/> | <img loading="lazy" src={require('../assets/images/smart-visual-testing/cropped_ss.jpg').default} alt="Profile" width="1360" height="603" className="doc_img"/> |
383383

384+
## Best Practices
385+
386+
### 1. Project and Build Naming
387+
388+
- Use descriptive, consistent names for projects and builds
389+
- Include app version or release info in build names
390+
- Avoid special characters that might cause issues
391+
- Use consistent naming conventions across test runs
392+
393+
**Example:**
394+
```json
395+
{
396+
"smartUI.project": "MyApp-VisualTests",
397+
"smartUI.build": "Release-1.0.0"
398+
}
399+
```
400+
401+
### 2. Device Selection
402+
403+
- Test on devices that match your user base
404+
- Include multiple device configurations for comprehensive coverage
405+
- Use device patterns for consistent testing (e.g., `Galaxy.*`, `Pixel.*`)
406+
407+
### 3. Smart Crop Configuration
408+
409+
- Enable `cropStatusBar` to focus on core UI elements
410+
- Enable `cropNavigationBar` for Android devices
411+
- Test cropped screenshots to ensure important content isn't removed
412+
413+
### 4. Test Organization
414+
415+
- Use sharding for parallel test execution
416+
- Group related tests in same build
417+
- Use meaningful test names for better organization
418+
419+
### 5. App and Test Suite Management
420+
421+
- Upload apps and test suites before execution
422+
- Use app IDs (`lt://APP...`) for faster execution
423+
- Keep app and test suite versions synchronized
424+
425+
## Troubleshooting
426+
427+
### Common Issues
428+
429+
#### Issue: Screenshots Not Captured
430+
431+
**Symptoms**: Tests run but no screenshots appear in SmartUI dashboard
432+
433+
**Possible Causes**:
434+
- `visual: true` not set in request
435+
- Incorrect project name
436+
- Network connectivity issues
437+
- Authentication issues
438+
439+
**Solutions**:
440+
1. Verify `visual: true` is set in API request:
441+
```json
442+
{
443+
"visual": true,
444+
"smartUI.project": "ProjectName"
445+
}
446+
```
447+
448+
2. Check project name matches exactly (case-sensitive)
449+
450+
3. Verify authentication token is correct:
451+
- Generate base64 encoded token from username:accesskey
452+
- Ensure token is included in Authorization header
453+
454+
4. Check network connectivity to LambdaTest
455+
456+
#### Issue: "Project Not Found" Error
457+
458+
**Symptoms**: Error indicating SmartUI project cannot be found
459+
460+
**Possible Causes**:
461+
- Project name typo or mismatch
462+
- Project deleted
463+
- Wrong account credentials
464+
465+
**Solutions**:
466+
1. Verify project exists in SmartUI dashboard
467+
2. Copy project name directly from dashboard
468+
3. Check credentials match the account with the project
469+
4. Ensure project name is in API request
470+
471+
#### Issue: App Upload Fails
472+
473+
**Symptoms**: App upload returns error or fails
474+
475+
**Possible Causes**:
476+
- Invalid APK file
477+
- File size too large
478+
- Network issues
479+
- Authentication problems
480+
481+
**Solutions**:
482+
1. Verify APK file is valid and not corrupted
483+
2. Check file size limits
484+
3. Retry upload with stable network connection
485+
4. Verify authentication credentials
486+
487+
#### Issue: Test Execution Fails
488+
489+
**Symptoms**: Test suite execution fails or times out
490+
491+
**Possible Causes**:
492+
- Invalid test suite APK
493+
- Device not available
494+
- Timeout settings too low
495+
- Test suite errors
496+
497+
**Solutions**:
498+
1. Verify test suite APK is valid
499+
2. Check device availability
500+
3. Increase `queueTimeout` and `IdleTimeout`:
501+
```json
502+
{
503+
"queueTimeout": 600,
504+
"IdleTimeout": 60
505+
}
506+
```
507+
508+
4. Review device logs for test errors
509+
510+
#### Issue: Screenshots Show Incorrect Content
511+
512+
**Symptoms**: Screenshots captured but show wrong screen or state
513+
514+
**Possible Causes**:
515+
- App state issues
516+
- Timing problems
517+
- Navigation issues
518+
519+
**Solutions**:
520+
1. Ensure app is in correct state before test execution
521+
2. Add appropriate waits in test code
522+
3. Verify test navigation flow
523+
524+
### Getting Help
525+
526+
If you encounter issues not covered here:
527+
528+
- Review the [Comprehensive Troubleshooting Guide](/support/docs/smartui-troubleshooting-guide) for detailed solutions
529+
- Check [SmartUI Configuration Options](/support/docs/smartui-sdk-config-options) documentation
530+
- See [Handling Dynamic Data](/support/docs/smartui-handle-dynamic-data) for dynamic content issues
531+
- Visit [LambdaTest Support](https://www.lambdatest.com/support) for additional resources
532+
- Contact support at [email protected] or use [24/7 Chat Support](https://www.lambdatest.com/support)
533+
534+
## Additional Resources
535+
536+
- [Comprehensive Troubleshooting Guide](/support/docs/smartui-troubleshooting-guide)
537+
- [SmartUI Configuration Options](/support/docs/smartui-sdk-config-options)
538+
- [Handling Dynamic Data](/support/docs/smartui-handle-dynamic-data)
539+
- [Baseline Management](/support/docs/smartui-baseline-management)
540+
- [Running Your First Project](/support/docs/smartui-running-your-first-project)
541+
- [Appium Hooks Documentation](/support/docs/smartui-appium-hooks)
542+
384543

385544
<nav aria-label="breadcrumbs">
386545
<ul className="breadcrumbs">

docs/playwright-visual-regression.md

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,201 @@ For additional information about Playwright framework please explore the documen
251251

252252
**Handling Dynamic Data** - In case if you have any dynamic elements that are not in the same position across test runs, you can ignore or select a specific area to be removed from the comparison. For accessing such HTML DOM Config and Options, click [here](/support/docs/html-dom-smartui-options/#configuration-for-playwright).
253253

254+
## Best Practices
255+
256+
### 1. Capability Configuration
257+
258+
- Always set `visual: true` in your capabilities to enable SmartUI
259+
- Use consistent project and build names across test runs
260+
- Set meaningful test names for better organization
261+
262+
**Example:**
263+
```javascript
264+
const capabilities = {
265+
browserName: 'Chrome',
266+
browserVersion: 'latest',
267+
platformName: 'Windows 10',
268+
'LT:Options': {
269+
username: process.env.LT_USERNAME,
270+
accessKey: process.env.LT_ACCESS_KEY,
271+
visual: true,
272+
name: 'Homepage Visual Test',
273+
build: 'Release 1.0',
274+
'smartUI.project': 'MyProject',
275+
'smartUI.build': 'Build-1.0'
276+
}
277+
};
278+
```
279+
280+
### 2. Screenshot Timing
281+
282+
- Wait for page elements to load before capturing screenshots
283+
- Use Playwright's wait methods for dynamic content
284+
- Consider page load time when setting up tests
285+
286+
**Example:**
287+
```javascript
288+
await page.goto('https://example.com');
289+
await page.waitForSelector('.main-content', { state: 'visible' });
290+
await page.waitForLoadState('networkidle');
291+
```
292+
293+
### 3. Screenshot Naming
294+
295+
- Use descriptive, consistent names
296+
- Include context (page, component, state) in names
297+
- Avoid special characters
298+
299+
### 4. Baseline Management
300+
301+
- Establish baselines from stable builds
302+
- Review and approve baselines before using
303+
- Update baselines when intentional changes are made
304+
305+
### 5. Viewport Selection
306+
307+
- Test on viewports that match your user base
308+
- Include mobile, tablet, and desktop viewports
309+
- Consider both portrait and landscape orientations
310+
311+
## Troubleshooting
312+
313+
### Common Issues
314+
315+
#### Issue: Screenshots Not Captured
316+
317+
**Symptoms**: Tests run but no screenshots appear in SmartUI dashboard
318+
319+
**Possible Causes**:
320+
- `visual: true` not set in capabilities
321+
- Incorrect project name
322+
- Network connectivity issues
323+
- Credentials not set correctly
324+
325+
**Solutions**:
326+
1. Verify `visual: true` is set in capabilities:
327+
```javascript
328+
'LT:Options': {
329+
visual: true, // Must be set
330+
// ... other options
331+
}
332+
```
333+
334+
2. Check project name matches exactly (case-sensitive):
335+
```javascript
336+
'smartUI.project': 'ExactProjectName'
337+
```
338+
339+
3. Verify credentials are set:
340+
```bash
341+
echo $LT_USERNAME
342+
echo $LT_ACCESS_KEY
343+
```
344+
345+
4. Check network connectivity to LambdaTest
346+
347+
#### Issue: "Project Not Found" Error
348+
349+
**Symptoms**: Error indicating SmartUI project cannot be found
350+
351+
**Possible Causes**:
352+
- Project name typo or mismatch
353+
- Project deleted
354+
- Wrong account credentials
355+
356+
**Solutions**:
357+
1. Verify project exists in SmartUI dashboard
358+
2. Copy project name directly from dashboard
359+
3. Check credentials match the account with the project
360+
4. Ensure project name is in capabilities, not just in dashboard
361+
362+
#### Issue: Screenshots Show Blank Pages
363+
364+
**Symptoms**: Screenshots captured but show blank or incomplete content
365+
366+
**Possible Causes**:
367+
- Page not fully loaded
368+
- JavaScript not executed
369+
- Timing issues
370+
- Viewport issues
371+
372+
**Solutions**:
373+
1. Add explicit waits before screenshot:
374+
```javascript
375+
await page.waitForSelector('#content', { state: 'visible' });
376+
await page.waitForLoadState('networkidle');
377+
```
378+
379+
2. Wait for specific elements to be visible:
380+
```javascript
381+
await page.waitForSelector('.main-content', { state: 'visible' });
382+
```
383+
384+
3. Increase wait time for slow-loading pages
385+
386+
4. Check viewport size matches expected dimensions
387+
388+
#### Issue: Build Name Conflicts
389+
390+
**Symptoms**: Screenshots appear in wrong build or build name issues
391+
392+
**Possible Causes**:
393+
- Build name not set consistently
394+
- Special characters in build name
395+
- Build name conflicts
396+
397+
**Solutions**:
398+
1. Set build name in capabilities:
399+
```javascript
400+
'smartUI.build': 'ConsistentBuildName'
401+
```
402+
403+
2. Avoid special characters in build names
404+
405+
3. Use consistent naming convention across team
406+
407+
#### Issue: Mismatch Percentage Unexpected
408+
409+
**Symptoms**: Mismatch percentage higher or lower than expected
410+
411+
**Possible Causes**:
412+
- Threshold settings
413+
- Dynamic content not ignored
414+
- Rendering differences
415+
- Baseline issues
416+
417+
**Solutions**:
418+
1. Review threshold settings in project settings
419+
420+
2. Use `ignoreDOM` for dynamic content:
421+
```javascript
422+
'smartUI.options': {
423+
'ignoreDOM': {
424+
'id': ['timestamp', 'user-id']
425+
}
426+
}
427+
```
428+
429+
3. Check baseline is correct and up-to-date
430+
431+
4. Review comparison settings in project
432+
433+
### Getting Help
434+
435+
If you encounter issues not covered here:
436+
437+
- Review [SmartUI Build Options](/support/docs/build-options-for-visual-regression-testing) documentation
438+
- Check [Advanced Test Settings](https://www.lambdatest.com/support/docs/test-settings-options/) for comparison options
439+
- Visit [LambdaTest Support](https://www.lambdatest.com/support) for additional resources
440+
- Contact support at [email protected] or use [24/7 Chat Support](https://www.lambdatest.com/support)
441+
442+
## Additional Resources
443+
444+
- [SmartUI Build Options](/support/docs/build-options-for-visual-regression-testing)
445+
- [Advanced Test Settings](https://www.lambdatest.com/support/docs/test-settings-options/)
446+
- [Handling Dynamic Data](/support/docs/smartui-handle-dynamic-data)
447+
- [Project Settings](/support/docs/smartui-project-settings)
448+
254449
<!-- <img loading="lazy" src={require('../assets/images/uploads/smart-ui-2.webp').default} alt="cmd" width="768" height="373" className="doc_img"/> -->
255450

256451
<nav aria-label="breadcrumbs">

0 commit comments

Comments
 (0)