Skip to content

Commit

Permalink
complete basic e2e test, start looking into playwright speciffic loca…
Browse files Browse the repository at this point in the history
…tors
  • Loading branch information
Cristi-Fogel committed Aug 19, 2024
1 parent 1436cba commit 698cff2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
8 changes: 8 additions & 0 deletions tests/PlayWrigthSpecialLocators.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const {test, expect} = require('@playwright/test');

test('Playwrigth SPecial Locators', async ({page})=>
{
await page.goto("https://rahulshettyacademy.com/angularpractice/");


})
26 changes: 14 additions & 12 deletions tests/RS_ClientApp.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,18 @@ test('Browser check', async ({page})=>

//orders page
await page.locator("button[routerlink='/dashboard/myorders']").dispatchEvent('click');
await page.locator("ng-star-inserted").first().waitFor();

const orderRows = await page.locator("tbody tr");
// for(let i = 0; i < orderRows; i++){
// const rowOrderID = await orderRows.nth(i).locator("th").textContent(); //grab orderID of that row
// if(orderID.includes(rowOrderID)){
// await orderRows.nth(i).locator("button").first().click(); //1st button within row is the View button
// break;
// }
// }


await page.locator("tbody").waitFor(); //waiting for whole table-body to loadup, prior to making the evaluation #async breakage
const rows = await page.locator("tbody tr"); //waiting for table data to be loaded up

for(let i=0; i<await rows.count(); i++){
const rowOrderId = await rows.nth(i).locator("th").textContent();
if (orderID.includes(rowOrderId))
{
await rows.nth(i).locator("button").first().click();
break;
}
}
const orderIdDetails = await page.locator(".col-text").textContent();

expect(orderID.includes(orderIdDetails)).toBeTruthy();
})

0 comments on commit 698cff2

Please sign in to comment.