Comments (4)
@alisman to get test name you can write
const filename = `${expect.getState().currentTestName}.png`;
but how can we use this service to get screenshot running programmatically?
this miss me:
wdioImageComparisonService.afterTest(() => takeScreenshot());
This works but screenshots is taken from the next test.. wdio its have afterTest hook that I cannot configure programmatically:
jasmine.getEnv().addReporter({
specDone: async result => {
if (result.status !== 'disabled') {
if (result.status === 'failed') {
await takeScreenshot();
}
}
}
});
export async function takeScreenshot() {
await browser.saveFullPageScreen(
`${expect.getState().currentTestName}`,
{
fullPageScrollTimeout: '1500'
}
);
}
from visual-testing.
Hi @alisman
Thanks for your issue. This is not a rewrite of the wdio-visual-regression-service
, but a completely different module. Feel free to open a PR for this
from visual-testing.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from visual-testing.
Here's how I did it without rewriting all my tests to invoke such an awkward pattern.
In your wdio.conf.js:
const {default: WdioImageComparisonService} = require('wdio-image-comparison-service');
export.config = {
// your wdio config
// add a mocha hook to reregister the browser commands but with a format that includes the test name
async beforeTest(test) {
const testName = test.title // may want to include test.parent
// prefix image snapshots with test name
const imageService = new WdioImageComparisonService({
...imageComparisonOptions,
formatImageName: `${testName}.{tag}`,
})
const capabilities = [
{
browserName: 'chrome'
}
];
imageService.addCommandsToBrowser(capabilities, browser)
}
}
from visual-testing.
Related Issues (20)
- Chrome support for v112 HOT 1
- Multiremote support seems to be broken HOT 1
- Unable to install wdio-image-comparison-service HOT 1
- "TypeError: browser.saveScreen is not a function" if try to run tests on Saucelabs HOT 5
- Using checkFullPageScreen method, capturing images with duplicate viewport and is not scrolling to the bottom of the page HOT 2
- Not able run the install --save wdio-image-comparison-service on Apple M1 Pro Machines HOT 5
- What is the current requirements for this library to function properly ? HOT 1
- [💡 Feature]: create custom matchers for visual testing
- Auto generate baseline if not existing and make `autoSaveBaseline` default to `true` HOT 2
- checkFullPageScreen is broken in @wdio/visual-service when using Android in Browserstack HOT 7
- Set "!important" to options that adds attributes HOT 12
- Support WebdriverIO options `updateSnapshots` and `resolveSnapshotPath`
- custom commands for visual testing not getting registered HOT 2
- savePerInstance doesn't set the correct name to the folder when using Browserstack HOT 5
- Can't use @wdio/visual-service via remote options HOT 2
- Config file is not finding the visual-service and throws an error on browser.saveScreen("name") function HOT 3
- Use WebdriverIO logger as the default HOT 1
- image comparison with certain misMatch % difference is not allowed to certify via assertion HOT 1
- Issue with running visual-service HOT 4
- Visual-service is getting the wrong type in service.js beforetest hook HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from visual-testing.