mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-25 16:45:48 +00:00
Fixed code formatting
This commit is contained in:
parent
1f56baddab
commit
3e9cdaad38
6 changed files with 26 additions and 15 deletions
14
ASSIGNMENT.md
Normal file
14
ASSIGNMENT.md
Normal 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.
|
|
@ -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
|
cd spring-petclinic
|
||||||
./mvnw package
|
./mvnw package
|
||||||
java -jar target/*.jar
|
java -jar target/*.jar
|
||||||
|
|
|
@ -11,24 +11,20 @@ import org.openqa.selenium.chrome.ChromeOptions;
|
||||||
import io.github.bonigarcia.wdm.WebDriverManager;
|
import io.github.bonigarcia.wdm.WebDriverManager;
|
||||||
|
|
||||||
public class Browser {
|
public class Browser {
|
||||||
|
|
||||||
public final static WebDriver webDriver = createDriver();
|
public final static WebDriver webDriver = createDriver();
|
||||||
|
|
||||||
private static WebDriver createDriver() {
|
private static WebDriver createDriver() {
|
||||||
setupDriver();
|
setupDriver();
|
||||||
ChromeDriver chromeDriver = new ChromeDriver(
|
ChromeDriver chromeDriver = new ChromeDriver(new ChromeDriverService.Builder().withSilent(true).build(),
|
||||||
new ChromeDriverService.Builder().withSilent(true).build(),
|
chromeOptions());
|
||||||
chromeOptions()
|
|
||||||
);
|
|
||||||
chromeDriver.manage().window().setSize(new Dimension(1024, 768));
|
chromeDriver.manage().window().setSize(new Dimension(1024, 768));
|
||||||
chromeDriver.manage().timeouts().implicitlyWait(0L, TimeUnit.SECONDS);
|
chromeDriver.manage().timeouts().implicitlyWait(0L, TimeUnit.SECONDS);
|
||||||
return chromeDriver;
|
return chromeDriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setupDriver() {
|
private static void setupDriver() {
|
||||||
WebDriverManager
|
WebDriverManager.chromedriver().timeout(60).setup();
|
||||||
.chromedriver()
|
|
||||||
.timeout(60)
|
|
||||||
.setup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ChromeOptions chromeOptions() {
|
private static ChromeOptions chromeOptions() {
|
||||||
|
@ -40,4 +36,5 @@ public class Browser {
|
||||||
chromeOptions.addArguments("--disable-browser-side-navigation");
|
chromeOptions.addArguments("--disable-browser-side-navigation");
|
||||||
return chromeOptions;
|
return chromeOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,9 @@ import org.junit.runner.RunWith;
|
||||||
import io.cucumber.junit.Cucumber;
|
import io.cucumber.junit.Cucumber;
|
||||||
import io.cucumber.junit.CucumberOptions;
|
import io.cucumber.junit.CucumberOptions;
|
||||||
|
|
||||||
|
|
||||||
@RunWith(Cucumber.class)
|
@RunWith(Cucumber.class)
|
||||||
@CucumberOptions(
|
@CucumberOptions(plugin = { "pretty", "html:target/cucumber-html-report" },
|
||||||
plugin = { "pretty", "html:target/cucumber-html-report" },
|
glue = { "org.springframework.samples.petclinic.integration" }, features = "classpath:scenarios")
|
||||||
glue = { "org.springframework.samples.petclinic.integration" },
|
|
||||||
features = "classpath:scenarios"
|
|
||||||
)
|
|
||||||
public class CucumberRunner {
|
public class CucumberRunner {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,4 +7,5 @@ import io.cucumber.spring.CucumberContextConfiguration;
|
||||||
@CucumberContextConfiguration
|
@CucumberContextConfiguration
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
|
||||||
public class SpringIntegrationTest {
|
public class SpringIntegrationTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import io.cucumber.java.en.Then;
|
||||||
import io.cucumber.java.en.When;
|
import io.cucumber.java.en.When;
|
||||||
|
|
||||||
public class StepDefinition extends SpringIntegrationTest {
|
public class StepDefinition extends SpringIntegrationTest {
|
||||||
|
|
||||||
private final WebDriver webDriver = Browser.webDriver;
|
private final WebDriver webDriver = Browser.webDriver;
|
||||||
|
|
||||||
@Given("^I go to the main page$")
|
@Given("^I go to the main page$")
|
||||||
|
@ -48,4 +49,5 @@ public class StepDefinition extends SpringIntegrationTest {
|
||||||
WebElement webElement = webDriver.findElement(elementSelector);
|
WebElement webElement = webDriver.findElement(elementSelector);
|
||||||
webElement.submit();
|
webElement.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue