List of usage examples for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated
public static ExpectedCondition<WebElement> visibilityOfElementLocated(final By locator)
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * Edits a field and checks it's value.//from w ww .ja v a 2 s . com * * @param fieldid {@link String} * @param type {@link FormJSONFieldType} * @param values {@link Map} */ private void checkEditField(final String fieldid, final FormJSONFieldType type, final Map<String, String> values) { clickEditFieldButton(fieldid); getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("fieldeditorform"))); assertFalse(getDriver().findElement(getBy("select", "data-fieldid", "30")).isDisplayed()); for (Map.Entry<String, String> e : values.entrySet()) { By by = By.xpath("//*[self::textarea|self::input|self::select|self::button]" + "[@data-fieldid='" + e.getKey() + "']"); String actual = extractLabelAndValue(findElementBy(by).getAttribute("value")).getLeft(); String expected = extractLabelAndValue(e.getValue()).getLeft(); assertEquals(expected, actual); } }
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * Edits Field./* w w w . j av a 2 s . com*/ * * @param fieldid {@link String} * @param values {@link Map} * @throws InterruptedException InterruptedException */ private void editField(final String fieldid, final Map<String, String> values) throws InterruptedException { clickEditFieldButton(fieldid); getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("fieldeditorform"))); for (Map.Entry<String, String> e : values.entrySet()) { String field = e.getKey(); String value = e.getValue(); By by = By.xpath("//*[self::textarea|self::input|self::select|self::button]" + "[@data-fieldid='" + field + "']"); WebElement element = findElementBy(by); assertTrue(element.isDisplayed()); String tagname = element.getTagName(); switch (tagname) { case "select": Select select = new Select(element); waitUntilSelectOptionsPopulated(select); select.selectByVisibleText(extractLabelAndValue(value).getLeft()); break; case "button": element.click(); break; default: element.clear(); element.sendKeys(value); break; } } //findElementBy(By.className("form-modal-update-button")).click(); click(By.name("_eventId_next")); getWait().until(ExpectedConditions.invisibilityOfElementLocated(By.id("fieldeditorform"))); }
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * testAddWorkflow12().// www. ja v a 2 s . c o m * verify has-error class * * @throws Exception Exception */ @Test public void testAddWorkflow12() throws Exception { // given // when - add step clickAddNewWorkflow(); addBlankForm(); menuDragAndDrop("menu-textbox"); clickEditFieldButton("1"); // then getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("fieldeditorform"))); // when findElementBy(By.id("'FormJSONField'!20")).clear(); //findElementBy(By.className("form-modal-update-button")).click(); click(By.name("_eventId_next")); // then waitUntilClassName(getBy("div", "data-uuid", "20"), "form-group col-xs-12 has-error"); }
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * testAddWorkflow16()./* w ww. j a va 2s .c o m*/ * change workflow name. * * @throws Exception Exception */ @Test public void testAddWorkflow16() throws Exception { // given // when - add step clickAddNewWorkflow(); findElementBy(By.id("tab_s1e1")).click(); getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("fieldeditorform"))); findElementBy(By.name("name")).clear(); findElementBy(By.name("name")).sendKeys("samplewf"); findElementBy(By.name("21")).click(); //findElementBy(By.className("form-modal-update-button")).click(); click(By.name("_eventId_next")); // then getWait().until(ExpectedConditions.invisibilityOfElementLocated(By.id("fieldeditorform"))); assertEquals("samplewf", findElementBy(By.id("tab_s1e1")).getText()); findElementBy(By.id("tab_s1e1")).click(); getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("fieldeditorform"))); assertEquals("samplewf", findElementBy(By.name("name")).getAttribute("value")); assertTrue(findElementBy(By.name("21")).isSelected()); }
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * testAddWorkflow17().//from w w w. jav a2 s . c o m * change form name & step / print steps order. * * @throws Exception Exception */ @Test public void testAddWorkflow17() throws Exception { // given String stepsSel = "#steps_table tbody > tr"; String printstepsSel = "#printsteps_table tbody > tr"; // when - add step clickAddNewWorkflow(); addBlankForm(); findElementBy(By.id("tab_s1e2")).click(); getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("fieldeditorform"))); findElementBy(By.name("name")).sendKeys("samplewf"); //findElementBy(By.className("form-modal-update-button")).click(); click(By.name("_eventId_next")); // then getWait().until(ExpectedConditions.invisibilityOfElementLocated(By.id("fieldeditorform"))); assertTrue(findElementBy(By.id("tab_s1e2")).getText().endsWith("New Formsamplewf")); addBlankForm(); findElementBy(By.id("tab_s1e1")).click(); // then assertRowEquals(findElements(By.cssSelector(stepsSel)), Arrays.asList("Form Name", "New Formsamplewf", "New Form")); assertRowEquals(findElements(By.cssSelector(printstepsSel)), Arrays.asList("Form Name", "New Formsamplewf", "New Form")); // when findElementBy(By.id("stepup_0")).click(); findElementBy(By.id("printstepup_0")).click(); // then assertRowEquals(findElements(By.cssSelector(stepsSel)), Arrays.asList("Form Name", "New Formsamplewf", "New Form")); assertRowEquals(findElements(By.cssSelector(printstepsSel)), Arrays.asList("Form Name", "New Formsamplewf", "New Form")); // when findElementBy(By.id("stepup_1")).click(); findElementBy(By.id("printstepup_1")).click(); // then assertRowEquals(findElements(By.cssSelector(stepsSel)), Arrays.asList("Form Name", "New Form", "New Formsamplewf")); assertRowEquals(findElements(By.cssSelector(printstepsSel)), Arrays.asList("Form Name", "New Form", "New Formsamplewf")); // when findElementBy(By.id("stepdown_0")).click(); findElementBy(By.id("printstepdown_0")).click(); // then assertRowEquals(findElements(By.cssSelector(stepsSel)), Arrays.asList("Form Name", "New Formsamplewf", "New Form")); assertRowEquals(findElements(By.cssSelector(printstepsSel)), Arrays.asList("Form Name", "New Formsamplewf", "New Form")); // when findElementBy(By.id("stepdown_1")).click(); findElementBy(By.id("printstepdown_1")).click(); // then assertRowEquals(findElements(By.cssSelector(stepsSel)), Arrays.asList("Form Name", "New Formsamplewf", "New Form")); assertRowEquals(findElements(By.cssSelector(printstepsSel)), Arrays.asList("Form Name", "New Formsamplewf", "New Form")); }
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * testAddWorkflow19().//from w ww . ja va 2 s .c o m * change section name. * * @throws Exception Exception */ @Test public void testAddWorkflow19() throws Exception { // given // when - add step clickAddNewWorkflow(); addBlankForm(); menuDragAndDrop("menu-textbox"); findElementBy(By.className("button-section-edit")).click(); getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("fieldeditorform"))); findElementBy(By.name("title")).sendKeys("samplesection"); //findElementBy(By.className("form-modal-update-button")).click(); click(By.name("_eventId_next")); // then getWait().until(ExpectedConditions.invisibilityOfElementLocated(By.id("fieldeditorform"))); assertEquals("samplesection", findElementBy(By.className("button-section-edit")).getText().trim()); // when findElementBy(By.className("button-section-edit")).click(); // then getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("fieldeditorform"))); assertEquals("samplesection", findElementBy(By.name("title")).getAttribute("value")); }
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * testAddWorkflow20().//from w w w.j av a 2 s . c o m * set source form * * @throws Exception Exception */ @Test public void testAddWorkflow20() throws Exception { // given FormJSONFieldType typeSelect = FormJSONFieldType.TEXTBOX; ImmutableMap<String, String> values0 = ImmutableMap.of("20", "Sample Label123", "40", "Immediate[immediate]", "25", "Currency"); // when - add step clickAddNewWorkflow(); addBlankForm(); findElementBy(By.id("tab_s1e2")).click(); getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("fieldeditorform"))); findElementBy(getBy("input", "data-fieldid", "20")).sendKeys("samplewf"); //findElementBy(By.className("form-modal-update-button")).click(); click(By.name("_eventId_next")); // then getWait().until(ExpectedConditions.invisibilityOfElementLocated(By.id("fieldeditorform"))); assertTrue(findElementBy(By.id("tab_s1e2")).getText().endsWith("New Formsamplewf")); // when - add field to first form menuDragAndDrop("menu-textbox"); editField("1", values0); // given ImmutableMap<String, String> values1 = ImmutableMap.of("20", "Sample Label", "40", "Immediate[immediate]", "25", "Currency", "81", "New Formsamplewf", "82", "Sample Label123"); addBlankForm(); menuDragAndDrop("menu-textbox"); editField("1", values1); // then checkEditField("1", typeSelect, values1); }
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * testAddWorkflow21().//from w ww . j a va 2s . c o m * remove step * * @throws Exception Exception */ @Test public void testAddWorkflow21() throws Exception { // given // when - add step clickAddNewWorkflow(); addBlankForm(); // then assertTrue(getPageSource().contains("tab_s1e2")); // when - remove step findElementBy(By.id("button-delete-form")).click(); // then getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("modal-delete-form-confirm"))); // when findElementBy(By.id("button-delete-form-confirm")).click(); // then assertFalse(getPageSource().contains("tab_s1e2")); }
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * testAddWorkflow23().//from ww w . ja v a 2 s . c om * add formula and then edit. * * @throws Exception Exception */ @Test public void testAddWorkflow23() throws Exception { // given int step = 2; ImmutableMap<String, String> values0 = ImmutableMap.of("20", "Sample Label123", "40", "Immediate[immediate]", "25", "Currency", "61", "samp"); // when - add step clickAddNewWorkflow(); addNewStep(step++, "samplewf"); menuDragAndDrop("menu-textbox"); editField("1", values0); // given ImmutableMap<String, String> values1 = ImmutableMap.of("20", "Sample Label", "61", "tvariable", "83", "New Formsamplewf", "84", "samp", "85", ""); // when addNewStep(step++, "test"); menuDragAndDrop("menu-formula"); editField("1", values1); // then clickEditFieldButton("1"); getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("fieldeditorform"))); String actual = findElementBy(By.name("78")).getAttribute("value"); assertEquals("'New Formsamplewf'!samp", actual); }
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * Cancel Editor Button.// www. j av a 2 s . c o m * * @throws Exception Exception */ @Test public void testAddWorkflow30() throws Exception { // given // when clickAddNewWorkflow(); click(By.id("button-cancel")); // then getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("form-modal"))); // when click(By.className("form-modal-close-button")); // then getWait().until(ExpectedConditions.invisibilityOfElementLocated(By.id("form-modal"))); // when click(By.id("button-cancel")); // then getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("form-modal"))); // when click(By.className("form-modal-cancel-button")); // then assertEquals(getDefaultHostAndPort() + "/user/dashboard/index", getCurrentUrl()); }