-
-
Notifications
You must be signed in to change notification settings - Fork 513
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
6 changed files
with
190 additions
and
66 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
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
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
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
70 changes: 70 additions & 0 deletions
70
...rc/test/kotlin/net/serenitybdd/screenplay/ensure/WhenUsingSoftFluentAssertionsInJava.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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package net.serenitybdd.screenplay.ensure; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import net.serenitybdd.junit.runners.SerenityRunner; | ||
import net.serenitybdd.screenplay.Actor; | ||
import net.serenitybdd.screenplay.Question; | ||
import net.serenitybdd.screenplay.ensure.web.NamedExpectation; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.TestInstance; | ||
import org.junit.rules.ExpectedException; | ||
import org.junit.runner.RunWith; | ||
|
||
import java.math.BigDecimal; | ||
import java.time.LocalDate; | ||
import java.time.LocalTime; | ||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import java.util.Comparator; | ||
import java.util.List; | ||
|
||
import static org.hamcrest.Matchers.containsString; | ||
|
||
@TestInstance(TestInstance.Lifecycle.PER_CLASS) | ||
@RunWith(SerenityRunner.class) | ||
/** | ||
* Some high level smoke tests | ||
*/ | ||
public class WhenUsingSoftFluentAssertionsInJava { | ||
|
||
Actor aster = Actor.named("Aster"); | ||
|
||
@Before | ||
public void prepareSoftAsserts() { | ||
Ensure.enableSoftAssertions(); | ||
} | ||
|
||
@After | ||
public void reportSoftAsserts() { | ||
Ensure.reportSoftAssertions(); | ||
} | ||
|
||
@Test | ||
public void aTestWithSomeSoftAsserts() { | ||
|
||
int age = 20; | ||
|
||
aster.attemptsTo( | ||
Ensure.that(age).isEqualTo(20) | ||
); | ||
} | ||
|
||
@Test | ||
public void anotherTestWithSomeSoftAsserts() { | ||
Actor aster = Actor.named("Aster"); | ||
|
||
String color = "red"; | ||
|
||
aster.attemptsTo( | ||
Ensure.that(color).startsWith("b"), | ||
Ensure.that(color).endsWith("d"), | ||
Ensure.that(color).hasSize(4) | ||
); | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
.../test/java/net/serenitybdd/screenplay/webtests/WhenSeveralActorsPerformNonWebActions.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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package net.serenitybdd.screenplay.webtests; | ||
|
||
import net.serenitybdd.annotations.Managed; | ||
import net.serenitybdd.annotations.Steps; | ||
import net.serenitybdd.junit.runners.SerenityRunner; | ||
import net.serenitybdd.screenplay.Actor; | ||
import net.serenitybdd.screenplay.Task; | ||
import net.serenitybdd.screenplay.abilities.BrowseTheWeb; | ||
import net.serenitybdd.screenplay.webtests.questions.ProfileQuestion; | ||
import net.serenitybdd.screenplay.webtests.tasks.OpenTheApplication; | ||
import net.serenitybdd.screenplay.webtests.tasks.UpdateHerProfile; | ||
import net.serenitybdd.screenplay.webtests.tasks.ViewMyProfile; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.openqa.selenium.WebDriver; | ||
|
||
import static net.serenitybdd.screenplay.GivenWhenThen.*; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.Matchers.hasProperty; | ||
|
||
@RunWith(SerenityRunner.class) | ||
public class WhenSeveralActorsPerformNonWebActions { | ||
|
||
private Task createANewProfile() { | ||
return Task.where("Create a new profile"); | ||
} | ||
private Task openNewProfile() { | ||
return Task.where("Open profile"); | ||
} | ||
|
||
@Test | ||
public void multipleUsersCanShareTheSameBrowser() { | ||
Actor dana = new Actor("Dana"); | ||
Actor jane = new Actor("Jane"); | ||
|
||
when(dana).attemptsTo(createANewProfile()); | ||
when(jane).attemptsTo(openNewProfile()); | ||
} | ||
|
||
} |