mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(toHaveScreenshot): stylePath as first arg (#29372)
This commit is contained in:
parent
57d841ffae
commit
8c007fd3fc
@ -351,7 +351,7 @@ export async function toHaveScreenshot(
|
||||
expectTypes(pageOrLocator, ['Page', 'Locator'], 'toHaveScreenshot');
|
||||
return await zones.preserve(async () => {
|
||||
// Loading from filesystem resets zones.
|
||||
const style = await loadScreenshotStyles(optOptions.stylePath || config?.stylePath);
|
||||
const style = await loadScreenshotStyles(helper.allOptions.stylePath || config?.stylePath);
|
||||
return toHaveScreenshotContinuation.call(this, helper, page, locator, config, style);
|
||||
});
|
||||
}
|
||||
|
||||
@ -1272,6 +1272,7 @@ test('should support stylePath option', async ({ runInlineTest }) => {
|
||||
snapshotPathTemplate: '__screenshots__/{testFilePath}/{arg}{ext}',
|
||||
}),
|
||||
'__screenshots__/tests/a.spec.js/snapshot.png': createImage(IMG_WIDTH, IMG_HEIGHT, 0, 255, 0),
|
||||
'__screenshots__/tests/a.spec.js/png-1.png': createImage(IMG_WIDTH, IMG_HEIGHT, 0, 255, 0),
|
||||
'screenshot.css': 'body { background: #00FF00; }',
|
||||
'tests/a.spec.js': `
|
||||
const { test, expect } = require('@playwright/test');
|
||||
@ -1280,6 +1281,9 @@ test('should support stylePath option', async ({ runInlineTest }) => {
|
||||
await expect(page).toHaveScreenshot('snapshot.png', {
|
||||
stylePath: './screenshot.css',
|
||||
});
|
||||
await expect(page).toHaveScreenshot({
|
||||
stylePath: './screenshot.css',
|
||||
});
|
||||
});
|
||||
`,
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user