[MGNLTEST-15] Allow to write custom page objects Created: 02/Mar/20 Updated: 14/Sep/20 Resolved: 26/Aug/20 |
|
| Status: | Closed |
| Project: | Magnolia Test Framework |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.1 |
| Type: | Task | Priority: | Major |
| Reporter: | Maxime Michel | Assignee: | Rishab Dhar |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | QA&Testing, ui-test-fwk | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Template: |
|
||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||
| Task DoR: |
Empty
|
||||||||||||||||
| Release notes required: |
Yes
|
||||||||||||||||
| Date of First Response: | |||||||||||||||||
| Epic Link: | core-TF-features-bugs-improvements | ||||||||||||||||
| Sprint: | TE 7, TE 8, TE 9 | ||||||||||||||||
| Story Points: | 3 | ||||||||||||||||
| Description |
|
I want to write IT/UI tests on a Magnolia setup with Keycloak authentication. I would like to describe the Keycloak login page with a Page object, therefore I would need to be able to register a custom a Page object and have the test framework inject the driver inside of it. |
| Comments |
| Comment by Rishab Dhar [ 26/Aug/20 ] |
|
| Comment by Mikaël Geljić [ 31/Aug/20 ] |
|
SsoModuleITTests.java @Test public void userWithPublisherGroupDoesntSeeAdministrativeApps(CustomPageObjects expect) { ... expect.keycloakLoginPage(username, "marketer-password") .login(); expect.findBar() .clickAppLauncherButton(); assertTrue(expect.appLauncher().hasApp("Pages")); assertFalse(expect.appLauncher().hasApp("Security")); } @Library public static class CustomPageObjects { private WebDriver driver; @Delegate private PageObjects pageObjects; public CustomPageObjects(WebDriver driver) { this.driver = driver; this.pageObjects = new PageObjects(driver); } public KeycloakLoginPage keycloakLoginPage(String username, String password) { return pageObjects.pageObject(driver -> new KeycloakLoginPage(driver, username, password)); } } @AllArgsConstructor public static class KeycloakLoginPage implements PageObject { ... } |