Fixed code formatting

This commit is contained in:
Adam Klinkosz 2021-04-15 17:59:55 +02:00
parent 1f56baddab
commit 3e9cdaad38
6 changed files with 26 additions and 15 deletions

14
ASSIGNMENT.md Normal file
View file

@ -0,0 +1,14 @@
# QA Assignment
## Finding owners
The scenarios for this feature are incomplete or even naive. Please cover more cases in more reliable way.
## Adding owners
Open `src/test/resources/scenarios/AddOwners.feature` and follow instructions given in the comments.
## Bonus tasks
1. The browser is not closing after all tests were run. Fix it.
2. There is something wrong with the way the HTML elements are selected.
Prepare a suggestion of how to improve it or even implement such a change.
3.

View file

@ -8,7 +8,7 @@ Petclinic is a [Spring Boot](https://spring.io/guides/gs/spring-boot) applicatio
```
git clone https://github.com/spring-projects/spring-petclinic.git
git clone https://github.com/cleankod/spring-petclinic
cd spring-petclinic
./mvnw package
java -jar target/*.jar

View file

@ -11,24 +11,20 @@ import org.openqa.selenium.chrome.ChromeOptions;
import io.github.bonigarcia.wdm.WebDriverManager;
public class Browser {
public final static WebDriver webDriver = createDriver();
private static WebDriver createDriver() {
setupDriver();
ChromeDriver chromeDriver = new ChromeDriver(
new ChromeDriverService.Builder().withSilent(true).build(),
chromeOptions()
);
ChromeDriver chromeDriver = new ChromeDriver(new ChromeDriverService.Builder().withSilent(true).build(),
chromeOptions());
chromeDriver.manage().window().setSize(new Dimension(1024, 768));
chromeDriver.manage().timeouts().implicitlyWait(0L, TimeUnit.SECONDS);
return chromeDriver;
}
private static void setupDriver() {
WebDriverManager
.chromedriver()
.timeout(60)
.setup();
WebDriverManager.chromedriver().timeout(60).setup();
}
private static ChromeOptions chromeOptions() {
@ -40,4 +36,5 @@ public class Browser {
chromeOptions.addArguments("--disable-browser-side-navigation");
return chromeOptions;
}
}

View file

@ -5,12 +5,9 @@ import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(
plugin = { "pretty", "html:target/cucumber-html-report" },
glue = { "org.springframework.samples.petclinic.integration" },
features = "classpath:scenarios"
)
@CucumberOptions(plugin = { "pretty", "html:target/cucumber-html-report" },
glue = { "org.springframework.samples.petclinic.integration" }, features = "classpath:scenarios")
public class CucumberRunner {
}

View file

@ -7,4 +7,5 @@ import io.cucumber.spring.CucumberContextConfiguration;
@CucumberContextConfiguration
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class SpringIntegrationTest {
}

View file

@ -12,6 +12,7 @@ import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
public class StepDefinition extends SpringIntegrationTest {
private final WebDriver webDriver = Browser.webDriver;
@Given("^I go to the main page$")
@ -48,4 +49,5 @@ public class StepDefinition extends SpringIntegrationTest {
WebElement webElement = webDriver.findElement(elementSelector);
webElement.submit();
}
}