-
Notifications
You must be signed in to change notification settings - Fork 44
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
Showing
5 changed files
with
65 additions
and
104 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
17 changes: 0 additions & 17 deletions
17
src/test/java/serenityswag/authentication/LoginActions.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
32 changes: 14 additions & 18 deletions
32
src/test/java/serenityswag/authentication/WhenLoggingOn.java
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 |
---|---|---|
@@ -1,36 +1,32 @@ | ||
package serenityswag.authentication; | ||
|
||
import net.serenitybdd.core.Serenity; | ||
import net.serenitybdd.junit.runners.SerenityRunner; | ||
import net.thucydides.core.annotations.Managed; | ||
import net.thucydides.core.annotations.Steps; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import net.serenitybdd.annotations.Managed; | ||
import net.serenitybdd.core.annotations.findby.By; | ||
import net.serenitybdd.junit5.SerenityJUnit5Extension; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.openqa.selenium.WebDriver; | ||
import serenityswag.inventory.InventoryPage; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static serenityswag.authentication.User.STANDARD_USER; | ||
|
||
@RunWith(SerenityRunner.class) | ||
@ExtendWith(SerenityJUnit5Extension.class) | ||
public class WhenLoggingOn { | ||
|
||
@Managed | ||
WebDriver driver; | ||
|
||
@Steps | ||
LoginActions login; | ||
|
||
InventoryPage inventoryPage; | ||
|
||
@Test | ||
public void usersCanLogOnViaTheHomePage() { | ||
|
||
login.as(STANDARD_USER); | ||
driver.get("https://www.saucedemo.com"); | ||
|
||
driver.findElement(By.cssSelector("[data-test='username']")).sendKeys("standard_user"); | ||
driver.findElement(By.cssSelector("[data-test='password']")).sendKeys("secret_sauce"); | ||
driver.findElement(By.cssSelector("[data-test='login-button']")).click(); | ||
|
||
// Should see product catalog | ||
Serenity.reportThat("The inventory page should be displayed with the correct title", | ||
() -> assertThat(inventoryPage.getHeading()).isEqualToIgnoringCase("Products") | ||
); | ||
|
||
assertThat(driver.findElement(By.cssSelector(".title")).getText()) | ||
.isEqualToIgnoringCase("Products"); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.