-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87acd8a
commit 4d2d8df
Showing
4 changed files
with
251 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { test, expect, Request, Response } from "@playwright/test"; | ||
|
||
//Different wait available in Playwright | ||
// 1. waitForTimeout -- Thread.sleep() | ||
|
||
// 2. waitForRequest | ||
test("test waitForRequest demo", async ({ page }) => { | ||
const request: Request = await page.waitForRequest(/ohrm_logo.png/); | ||
console.log(request.url()); | ||
}); | ||
// 3. waitForResponse | ||
test("test waitForResponse demo", async ({ page }) => { | ||
const response: Response = await page.waitForResponse(/ohrm_logo.png/); | ||
console.log(response.request().url()); | ||
}); | ||
|
||
// 4. waitForUrl | ||
// 5. waitForLoadState | ||
// 6. waitForSelector | ||
|
||
test("test waitForSelector demo", async ({ page }) => { | ||
//use below approach than using waitForSelector | ||
await expect(page.getByAltText("OrangeHRM")).toBeVisible({ timeout: 3_000 }); | ||
}); | ||
// 7. waitForFunction | ||
test("test waitForFunction demo", async ({ page }) => { | ||
await page.waitForFunction(() => { | ||
window.scrollBy(0, 600); | ||
}); | ||
}); | ||
|
||
// 8. waitForEvent | ||
|
||
test("test waitForEvent demo", async ({ page }) => { | ||
await page.waitForEvent("domcontentloaded"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
{ | ||
"App": { | ||
"Login": { | ||
"objType": "page", | ||
"OrangeHRMLogo": { | ||
"objType": "img", | ||
"locatorType": "xpath", | ||
"locatorValue": "//img[@alt='company-branding']" | ||
}, | ||
"LoginInfo": {}, | ||
"UsernameText": { | ||
"objType": "text", | ||
"locatorType": "xpath", | ||
"locatorValue": "//label[normalize-space()='Username']", | ||
"label": "Username" | ||
}, | ||
"Username": { | ||
"objType": "input", | ||
"locatorType": "xpath", | ||
"locatorValue": "//input[@placeholder='Username']", | ||
"label": "", | ||
"validTestData": "a,abcde", | ||
"invalidTestData": ",abcdef,%%%%,$$$$", | ||
"saveTestData": "admin,test", | ||
"fieldErrorMessage": "Required,invalid error" | ||
}, | ||
"PasswordText": { | ||
"objType": "text", | ||
"locatorType": "xpath", | ||
"locatorValue": "//label[normalize-space()='Password']", | ||
"label": "Password" | ||
}, | ||
"Password": { | ||
"objType": "input", | ||
"locatorType": "xpath", | ||
"locatorValue": "//input[@placeholder='Password']", | ||
"label": "", | ||
"validTestData": "", | ||
"invalidTestData": "", | ||
"saveTestData": "", | ||
"fieldErrorMessage": "" | ||
}, | ||
"Login": { | ||
"elementType": "button", | ||
"locatorType": "xpath", | ||
"locatorValue": "//button[normalize-space()='Login']", | ||
"labelName": "Login" | ||
}, | ||
"Forgotyourpassword": { | ||
"elementType": "link", | ||
"locatorType": "xpath", | ||
"locatorValue": "//p[normalize-space()='Forgot your password?']", | ||
"labelName": "Forgot your password?" | ||
} | ||
}, | ||
"Admin": { | ||
"objType": "sidebar", | ||
"locatorType": "xpath", | ||
"locatorValue": "//a[@class='oxd-main-menu-item active']//span[1]", | ||
"label": "Admin", | ||
"UserManagement": { | ||
"objType": "tab", | ||
"locatorType": "xpath", | ||
"locatorValue": "//span[normalize-space()='User Management']", | ||
"label": "User Management", | ||
"Users": { | ||
"objType": "subtab", | ||
"locatorType": "xpath", | ||
"locatorValue": "//a[text()='Users']", | ||
"SystemUsers": { | ||
"objType": "section", | ||
"locatorType": "xpath", | ||
"locatorValue": "//*[text()='System Users']", | ||
"UsernameText": { | ||
"objType": "text", | ||
"locatorType": "xpath", | ||
"locatorValue": "//label[text()='Username']", | ||
"label": "Username", | ||
"Username": { | ||
"objType": "input", | ||
"locatorType": "xpath", | ||
"locatorValue": "//input[@class='oxd-input oxd-input--active']", | ||
"label": "", | ||
"validTestData": "", | ||
"invalidTestData": "", | ||
"saveTestData": "", | ||
"fieldErrorMessage": "", | ||
"UserRoleText": { | ||
"objType": "text", | ||
"locatorType": "xpath", | ||
"locatorValue": "//label[text()='User Role']", | ||
"label": "User Role", | ||
"UserRole": { | ||
"objType": "input", | ||
"locatorType": "xpath", | ||
"locatorValue": "//div[@class='oxd-select-text-input']", | ||
"label": "", | ||
"validTestData": "", | ||
"invalidTestData": "", | ||
"saveTestData": "", | ||
"fieldErrorMessage": "", | ||
"EmployeeNameText": { | ||
"objType": "text", | ||
"locatorType": "xpath", | ||
"locatorValue": "//label[text()='Employee Name']", | ||
"label": "Employee Name", | ||
"EmployeeName": { | ||
"objType": "input", | ||
"locatorType": "xpath", | ||
"locatorValue": "//input[@placeholder='Type for hints...']", | ||
"label": "", | ||
"validTestData": "", | ||
"invalidTestData": "", | ||
"saveTestData": "", | ||
"fieldErrorMessage": "", | ||
"StatusText": { | ||
"objType": "text", | ||
"locatorType": "xpath", | ||
"locatorValue": "//label[text()='Status']", | ||
"label": "User Role", | ||
"Status": { | ||
"objType": "input", | ||
"locatorType": "xpath", | ||
"locatorValue": "//div[@class='oxd-select-text-input']", | ||
"label": "", | ||
"validTestData": "", | ||
"invalidTestData": "", | ||
"saveTestData": "", | ||
"fieldErrorMessage": "", | ||
"Reset": { | ||
"elementType": "button", | ||
"locatorType": "xpath", | ||
"locatorValue": "//button[text()=' Reset ']", | ||
"labelName": "Reset", | ||
"Search": { | ||
"elementType": "button", | ||
"locatorType": "xpath", | ||
"locatorValue": "//button[text()=' Search ']", | ||
"labelName": "Search", | ||
"Add": { | ||
"elementType": "button", | ||
"locatorType": "xpath", | ||
"locatorValue": "//button[text()=' Add ']", | ||
"labelName": "Add", | ||
"RecordsTable": { | ||
"objType": "table/grid", | ||
"locatorType": "xpath", | ||
"locatorValue": "//div[@role='table']" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |