use of teammates.test.pageobjects.AdminSearchPage in project teammates by TEAMMATES.
the class AdminActivityLogPageUiTest method testSanitization.
private void testSanitization() {
______TS("safe against injection from admin search page");
AdminSearchPage searchPageForInjection = logPage.navigateTo(createUrl(Const.ActionURIs.ADMIN_SEARCH_PAGE)).changePageType(AdminSearchPage.class);
String injectedScript = "Test Injected Script<script>alert('This is not good.');</script>";
searchPageForInjection.inputSearchContent(injectedScript);
searchPageForInjection.clickSearchButton();
searchPageForInjection.waitForPageToLoad();
logPage.navigateTo(createUrl(Const.ActionURIs.ADMIN_ACTIVITY_LOG_PAGE));
logPage.waitForPageToLoad();
try {
browser.driver.switchTo().alert();
signalFailureToDetectException("Script managed to get injected");
} catch (NoAlertPresentException e) {
// this is what we expect, since we expect the script injection to fail
}
}
Aggregations