visual-diff-tool
Version:
Visual regression testing tool for comparing two URLs of the same app by capturing screenshots, performing pixel-by-pixel image comparisons, and highlighting visual differences. Ideal for detecting UI changes after deployments or updates.
25 lines (21 loc) • 665 B
JavaScript
// actionHandler.js
class ActionHandler {
constructor(actions = []) {
this.actions = actions;
}
addAction(action) {
this.actions.push(action);
}
async performActions(page) {
for (const action of this.actions) {
if (action.type === 'click') {
await page.click(action.selector);
} else if (action.type === 'type') {
await page.type(action.selector, action.text);
} else if (action.type === 'waitForSelector') {
await page.waitForSelector(action.selector, action.options);
}
}
}
}
module.exports = ActionHandler;