@Test(groups = "web") public void testListDefaultGroupsValidationUser() throws IOException { tester.clickLinkWithText(getProperty("action.logout")); if (!personDao.usernameExists("*****@*****.**")) { Person person = TestUtils.createPersonForTesting("*****@*****.**", Util.ROLE_USER); person.setConfirmed(true); personDao.create(person); } tester.setTextField("userName", "*****@*****.**"); tester.setTextField("password", "stebjan"); tester.clickButtonWithText(getProperty("action.login")); tester.assertTextPresent(getProperty("action.logout")); tester.clickLinkWithText(getProperty("menuItem.lists")); tester.assertTextPresent(getProperty("pageTitle.listOfDefinitions")); tester.assertLinkPresentWithText(getProperty("menuItem.hardwareDefinitions")); tester.clickLinkWithText(getProperty("menuItem.hardwareDefinitions")); tester.assertSelectOptionNotPresent("groups", "Default hardware"); tester.clickLinkWithText(getProperty("menuItem.optionalParametersForPeople")); tester.assertSelectOptionNotPresent("groups", "Default optional parameters"); tester.clickLinkWithText(getProperty("menuItem.optionalParametersForExperiments")); tester.assertSelectOptionNotPresent("groups", "Default optional parameters"); tester.clickLinkWithText(getProperty("menuItem.fileMetadataDefinitions")); tester.assertSelectOptionNotPresent("groups", "Default metadata parameters"); tester.clickLinkWithText(getProperty("menuItem.weatherDefinitions")); tester.assertSelectOptionNotPresent("groups", "Default weather"); tester.clickLinkWithText(getProperty("action.logout")); }
@Test(groups = "web") public void testListDefaultGroupsValidationAdmin() throws IOException { tester.clickLinkWithText(getProperty("menuItem.lists")); tester.assertTextPresent(getProperty("pageTitle.listOfDefinitions")); tester.assertLinkPresentWithText(getProperty("menuItem.hardwareDefinitions")); tester.clickLinkWithText(getProperty("menuItem.hardwareDefinitions")); tester.assertSelectOptionPresent("groups", "Default hardware"); tester.clickLinkWithText(getProperty("menuItem.optionalParametersForPeople")); tester.assertSelectOptionPresent("groups", "Default optional parameters"); tester.clickLinkWithText(getProperty("menuItem.optionalParametersForExperiments")); tester.assertSelectOptionPresent("groups", "Default optional parameters"); tester.clickLinkWithText(getProperty("menuItem.fileMetadataDefinitions")); tester.assertSelectOptionPresent("groups", "Default metadata parameters"); tester.clickLinkWithText(getProperty("menuItem.weatherDefinitions")); tester.assertSelectOptionPresent("groups", "Default weather"); tester.clickLinkWithText( getProperty("menuItem.artifactDefinitions")); // Artifact do not have the Default group tester.assertSelectOptionNotPresent("groups", "Default artifact"); tester.clickLinkWithText(getProperty("action.logout")); }
@Test(groups = "web") public void testUnsuccessfulLogin() throws IOException { tester.assertTitleEquals("Home Page"); tester.setTextField("userName", "*****@*****.**"); tester.setTextField("password", "xxx"); tester.clickButtonWithText(getProperty("action.login")); tester.assertTextPresent("User cannot be log in"); }
@Test(groups = "web") public void testEmptyFieldsLogin() throws IOException { tester.assertTitleEquals("Home Page"); tester.setTextField("userName", ""); tester.setTextField("password", ""); tester.clickButtonWithText(getProperty("action.login")); tester.assertTextPresent("Field 'userName' is required"); tester.assertTextPresent("Field 'password' is required"); }
@Test(groups = "web") public void testListLeftMenu() throws IOException { tester.clickLinkWithText(getProperty("menuItem.lists")); tester.assertTextPresent(getProperty("pageTitle.listOfDefinitions")); tester.assertLinkPresentWithText(getProperty("menuItem.hardwareDefinitions")); tester.assertLinkPresentWithText(getProperty("menuItem.optionalParametersForPeople")); tester.assertLinkPresentWithText(getProperty("menuItem.optionalParametersForExperiments")); tester.assertLinkPresentWithText(getProperty("menuItem.fileMetadataDefinitions")); tester.assertLinkPresentWithText(getProperty("menuItem.weatherDefinitions")); tester.assertLinkPresentWithText(getProperty("menuItem.artifactDefinitions")); // TODO other definitions (sw, disease, pharmaceuticals, ...) tester.clickLinkWithText(getProperty("action.logout")); }
@BeforeMethod(groups = "web") public void setUp() throws IOException { if (!personDao.usernameExists("*****@*****.**")) { Person person = TestUtils.createPersonForTesting("*****@*****.**", Util.ROLE_ADMIN); person.setConfirmed(true); personDao.create(person); } tester = new WebTester(); // tester.setBaseUrl("http://eeg2.kiv.zcu.cz:8080"); tester.setBaseUrl(url); tester.beginAt("/home-page"); tester.setTextField("userName", "*****@*****.**"); tester.setTextField("password", "stebjan"); tester.clickButtonWithText(getProperty("action.login")); tester.assertTextPresent(getProperty("action.logout")); }