Added testcases for lesson plan / solutions for lesson with stages.

This commit is contained in:
Nanne Baars 2016-09-12 21:54:05 +02:00
parent 7fa63cec81
commit 2027a0ae7d

View File

@ -130,7 +130,7 @@ public class WebGoatIT implements SauceOnDemandSessionIdProvider {
// windows 7, Chrome 45 // windows 7, Chrome 45
browsers.add(new String[]{"Windows 7", "45", "chrome", null, null}); browsers.add(new String[]{"Windows 7", "45", "chrome", null, null});
/*
// windows 10, Chrome 46 // windows 10, Chrome 46
browsers.add(new String[]{"Windows 10", "46", "chrome", null, null}); browsers.add(new String[]{"Windows 10", "46", "chrome", null, null});
@ -139,7 +139,7 @@ public class WebGoatIT implements SauceOnDemandSessionIdProvider {
// Linux, Firefox 37 // Linux, Firefox 37
browsers.add(new String[]{"Linux", "37", "firefox", null, null}); browsers.add(new String[]{"Linux", "37", "firefox", null, null});
*/
// windows 7, IE 9 // windows 7, IE 9
//browsers.add(new String[]{"Windows 7", "9", "internet explorer", null, null}); //browsers.add(new String[]{"Windows 7", "9", "internet explorer", null, null});
@ -351,6 +351,43 @@ public class WebGoatIT implements SauceOnDemandSessionIdProvider {
}); });
} }
@Test
public void testSqlInjectionLabLessonPlanShouldBePresent() throws IOException {
doLoginWebgoatUser();
driver.get(baseWebGoatUrl + "/start.mvc#attack/1537271095/200");
driver.get(baseWebGoatUrl + "/service/restartlesson.mvc");
driver.get(baseWebGoatUrl + "/start.mvc#attack/1537271095/200");
FluentWait<WebDriver> wait = new WebDriverWait(driver, 15); // wait for a maximum of 15 seconds
wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("lesson-title"), "LAB: SQL Injection"));
assertFalse(driver.getPageSource().contains("Lesson Plan Title: How to Perform a SQL Injection"));
WebElement user = driver.findElement(By.id("show-plan-button"));
user.click();
wait = new WebDriverWait(driver, 15); // wait for a maximum of 15 seconds
wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("lesson-plan-content"), "Lesson Plan Title: How to Perform a SQL Injection"));
}
@Test
public void testSqlInjectionLabLessonSolutionAreNotAvailable() throws IOException {
doLoginWebgoatUser();
driver.get(baseWebGoatUrl + "/start.mvc#attack/1537271095/200");
driver.get(baseWebGoatUrl + "/service/restartlesson.mvc");
driver.get(baseWebGoatUrl + "/start.mvc#attack/1537271095/200");
FluentWait<WebDriver> wait = new WebDriverWait(driver, 15); // wait for a maximum of 15 seconds
wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("lesson-title"), "LAB: SQL Injection"));
WebElement user = driver.findElement(By.id("show-solution-button"));
user.click();
assertTrue(driver.getPageSource().contains("Could not find the solution file"));
}
@Test @Test
public void testLogoutMvc() { public void testLogoutMvc() {