- Run
yarn devat localhost:3000 - Run
yarn testto test all the files (Impt: Please ensure that you have step 1 running in the background)
- Run
yarn test --headlessto test programmatically without the UI - Run
yarn test:debugto print debug info - Run
yarn test <filename>to test an individual file - Run
killall -9 Chromiumto close stale Chromium browsers left behind by failed tests
- To edit a test, do
await qawolf.create();. Include the semi colon otherwise it will break the test. yarn test:edit <test_name>
Because material-ui backdrop's rely on the ClickAwayListener component which basically tracks clicking outside of a specific element (exclusion-based) rather than clicking on a specific element (the usual include-based way). Therefore instead of doing await page.click(), use the following instead: await page.$eval(".MuiBackdrop-root", (el: any) => el.click());
- Note that this is not useful for manipulating DOM nodes.
await page.waitForSelector('table');
const rows = await page.$$eval('tr h6', (trs: any) => {
return trs.map((tr, i) => {
if (tr.textContent === 'QAWolf Automated Test Product 1') return tr.textContent
}).filter((x) => typeof x !== 'undefined')
});
// Get the rows of data
for (const row of rows) {
await page.click(`tr:nth-of-type(${row}) >> text=DELETE`);
await page.click("text=CONFIRM");
}
// Delete product by finding delete button of a row based on the product title text
await page.waitForSelector('table');
const productTitle = await page.$(`text=My Test Product`);
const deleteButton = await page.evaluateHandle(body => body.closest('tr').querySelector('.MuiTableCell-alignRight button:last-child'), productTitle);
await deleteButton.click();
await page.click("text=CONFIRM");
References: