Conversation
…-final-task # Conflicts: # src/main/java/com/saucedemo/driver/managment/DriverManager.java # src/main/java/com/saucedemo/pages/LoginPage.java # src/main/java/com/saucedemo/tests/LoginTest.java
| break; | ||
| // TODO make default case | ||
| case CHROME: | ||
| default: |
| return driver; | ||
| } | ||
|
|
||
| // TODO remove it if u don't use it |
| public void setPassword(String password) { | ||
| this.password = password; | ||
| } | ||
|
|
There was a problem hiding this comment.
added toString method for correct representation of user in logs
| private WebElement loginButton; | ||
|
|
||
| @FindBy(xpath = "//*[@data-test='error']") | ||
| private List<WebElement> errorMassage; // TODO massage is great thing, but we need message :) |
There was a problem hiding this comment.
renamed and change type to WebElement
|
|
||
|
|
||
| public LoginPage enterLoginFields(User user) { | ||
| logger.info("Entering login fields for user: {}", user); // TODO in logs u will have object reference, not the value of user |
There was a problem hiding this comment.
added toString method in User class
|
|
||
|
|
||
| public LoginPage enterUsername(String username) { | ||
| // TODO remove commented-out code if it is not needed or make initialisation of WebDriverWait in the constructor |
There was a problem hiding this comment.
remove commented-out code
| logger.debug("Entered username: {}", username); | ||
| } else { | ||
| String password = passwordArea.getAttribute("value");; | ||
| // TODO I'm not quite understand why do we need get password and refresh page if username is empty |
There was a problem hiding this comment.
I assume page is doing chashing (or something like that), so whithout refresh input fields remember old values which was set to them even after using method clear, so in the button click moment the old values are send.
| loginButton.click(); | ||
| logger.info("Clicked login button"); | ||
|
|
||
| if(driver.getCurrentUrl().equals("https://www.saucedemo.com/")) { // TODO to constants |
|
|
||
| public String getErrorMassageText() { | ||
| if(!errorMassage.isEmpty()) { | ||
| String fullText = errorMassage.get(0).getText(); |
There was a problem hiding this comment.
errorMessage was made as WebElement. Also a check if element exists is remade
| public void testLoginWithCorrectInput() { | ||
| // TODO run this test and check logs, u testing 6 times that "standard_user" and "secret_sauce" are valid credentials | ||
| // TODO also u have this credentials in your DataProviderForLogin | ||
| User correctUser = new User("standard_user", "secret_sauce"); |
There was a problem hiding this comment.
using user from DataProviderForLogin method
No description provided.