Skip to content

Review update#2

Open
RomanNadia wants to merge 2 commits intomainfrom
review
Open

Review update#2
RomanNadia wants to merge 2 commits intomainfrom
review

Conversation

@RomanNadia
Copy link
Owner

No description provided.

…-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:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added default case

return driver;
}

// TODO remove it if u don't use it
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused method

public void setPassword(String password) {
this.password = password;
}

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constant is added


public String getErrorMassageText() {
if(!errorMassage.isEmpty()) {
String fullText = errorMassage.get(0).getText();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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");
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using user from DataProviderForLogin method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant