| 7 | import com.microsoft.playwright.BrowserContext; |
| 8 | |
| 9 | public class LoginPage extends ProjectHooks{ |
| 10 | |
| 11 | public LoginPage typeUserName(String username) { |
| 12 | type("#username", username, "Username"); |
| 13 | return this; |
| 14 | } |
| 15 | |
| 16 | public LoginPage typePassword(String password) { |
| 17 | type("#password", password, "Password"); |
| 18 | return this; |
| 19 | } |
| 20 | |
| 21 | public LoginPage clickLogin() { |
| 22 | click("#Login", "Log In"); |
| 23 | return this; |
| 24 | } |
| 25 | |
| 26 | public LoginPage doLogin() { |
| 27 | if(getPage().title().contains("Login")) { |
| 28 | typeUserName(ConfigurationManager.configuration().appUserName()) |
| 29 | .typePassword(ConfigurationManager.configuration().appPassword()) |
| 30 | .clickLogin(); |
| 31 | |
| 32 | getContext().storageState(new BrowserContext.StorageStateOptions().setPath(Paths.get("storage/login.json"))); |
| 33 | } |
| 34 | return this; |
| 35 | |
| 36 | } |
| 37 | |
| 38 | } |
nothing calls this directly
no outgoing calls
no test coverage detected