UNPKG

fintech-automation-test

Version:
58 lines (51 loc) 1.48 kB
const { heal, ai } = require('codeceptjs'); heal.addRecipe('ai', { priority: 10, suggest: true, prepare: { html: async ({ I }) => await I.grabHTMLFrom('body'), }, steps: [ 'click', 'fillField', 'appendField', 'selectOption', 'attachFile', 'checkOption', 'uncheckOption', 'doubleClick', 'waitForElement', ], fn: async (args) => { try { const suggestion = await ai.healFailedStep(args); // // Log the entire suggestion object to the console // console.log('Healing suggestion received:', JSON.stringify(suggestion, null, 2)); // // Check and log if a locator change was suggested // if (suggestion && suggestion.locator) { // console.log(`Suggested Locator Change: ${JSON.stringify(suggestion.locator, null, 2)}`); // } else { // console.log('No specific locator suggestions were found.'); // } return suggestion; } catch (error) { console.error('Error during healing process:', error.message); } }, }); // heal.addRecipe('clickAndType', { // priority: 1, // steps: [ // 'fillField', // 'appendField', // ], // fn: async ({ step }) => { // const locator = step.args[0]; // const text = step.args[1]; // return ({ I }) => { // I.click(locator); // I.wait(1); // to open modal or something // I.type(text); // }; // }, // });