|
1 | 1 | import type { ImageCompareResult } from '@wdio/image-comparison-core' |
2 | | -import { join } from 'node:path' |
3 | 2 | import { browser, expect } from '@wdio/globals' |
4 | 3 | import { fileExists } from '../helpers/fileExists.ts' |
5 | 4 |
|
@@ -45,22 +44,20 @@ describe('@wdio/visual-service desktop', () => { |
45 | 44 |
|
46 | 45 | it(`should not store an actual image for '${browserName}' when the diff is below the threshold (#1115)`, async function () { |
47 | 46 | const tag = 'noActualStoredOnDiff' |
48 | | - const baselineFolder = join(process.cwd(), '.tmp/1115-baseline') |
49 | 47 |
|
50 | | - await browser.saveScreen(tag, { |
51 | | - actualFolder: baselineFolder, |
52 | | - enableLayoutTesting: false, |
| 48 | + await browser.execute(() => { |
| 49 | + const el = document.createElement('div') |
| 50 | + el.id = 'test-diff-element' |
| 51 | + el.style.cssText = 'position:fixed;top:10px;left:10px;width:500px;height:500px;background:red;z-index:9999;' |
| 52 | + document.body.appendChild(el) |
53 | 53 | }) |
54 | 54 |
|
55 | 55 | const result = await browser.checkScreen(tag, { |
56 | | - baselineFolder, |
57 | 56 | returnAllCompareData: true, |
58 | | - enableLayoutTesting: true, |
59 | 57 | }) as ImageCompareResult |
60 | 58 |
|
61 | 59 | expect(result.misMatchPercentage).toBeGreaterThan(0) |
62 | | - expect(result.misMatchPercentage).toBeLessThanOrEqual(50) |
63 | | - |
| 60 | + expect(result.misMatchPercentage).toBeLessThanOrEqual(70) |
64 | 61 | expect(fileExists(result.folders.actual)).toBe(false) |
65 | 62 | }) |
66 | 63 | }) |
0 commit comments