From f65d045fa484de676f9846e47ad3b5bafbc5bbab Mon Sep 17 00:00:00 2001 From: "volodymyr.vashchuk" Date: Thu, 10 Oct 2019 13:59:37 +0200 Subject: [PATCH 1/9] Fix handling of Textfield to enable configuration for the Content Fragment component --- .../component/dialog/dialogfields/DefaultTextfield.java | 9 ++++++--- .../aem/core/component/dialog/dialogfields/Locators.java | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java index 3446548a..d82ef90b 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java @@ -24,18 +24,21 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; +import com.cognifide.qa.bb.qualifier.CurrentScope; import com.cognifide.qa.bb.qualifier.PageObject; +import com.google.inject.Inject; /** * Default implementation of {@link Textfield} */ -@PageObject(css = Locators.FIELD_WRAPPER_CSS) +@PageObject(css = Locators.TEXTFIELD_CSS) public class DefaultTextfield implements Textfield { - @FindBy(css = ".coral3-Textfield:not([type='hidden']") + @Inject + @CurrentScope private WebElement input; - @FindBy(css = Locators.LABEL_CSS) + @FindBy(css = Locators.ALTERNATE_LABEL_XPATH) private List label; @Override diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java index cdf0185e..7fa22df1 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java @@ -33,4 +33,5 @@ private Locators() { public static final String MULTIFIELD_CSS = "coral-multifield"; public static final String AUTOCOMPLETE_CSS = "foundation-autocomplete"; public static final String ALTERNATE_LABEL_XPATH = "../label"; + public static final String TEXTFIELD_CSS = ".coral3-Textfield:not([type='hidden'])"; } From 1a594fb7a7600d10a792c7676dd1041037764e68 Mon Sep 17 00:00:00 2001 From: "volodymyr.vashchuk" Date: Thu, 10 Oct 2019 18:43:52 +0200 Subject: [PATCH 2/9] Fix an error in the DefaultTextfield Fix DefaultSelect to enable BB the configuration of the Content Fragment component --- .../dialog/dialogfields/DefaultSelect.java | 13 ++++++++++--- .../dialog/dialogfields/DefaultTextfield.java | 2 +- .../component/dialog/dialogfields/Locators.java | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java index 13095689..a0448ebd 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java @@ -26,22 +26,29 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; +import com.cognifide.qa.bb.qualifier.CurrentScope; import com.cognifide.qa.bb.qualifier.PageObject; +import com.cognifide.qa.bb.wait.BobcatWait; +import com.google.inject.Inject; /** * Default implementation of {@link Select} */ -@PageObject(xpath = "//coral-select/..") +@PageObject(css = Locators.SELECT_CSS) public class DefaultSelect implements Select { private static final String SELECT_OPTIONS_CSS = ".coral3-SelectList-item"; - @FindBy(css = ".coral3-Select") + @Inject + @CurrentScope private WebElement selectField; - @FindBy(css = Locators.LABEL_CSS) + @FindBy(xpath = Locators.ALTERNATE_LABEL_XPATH) private List label; + @Inject + private BobcatWait wait; + @Override public void setValue(Object value) { selectField.click(); diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java index d82ef90b..69d28ae2 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java @@ -38,7 +38,7 @@ public class DefaultTextfield implements Textfield { @CurrentScope private WebElement input; - @FindBy(css = Locators.ALTERNATE_LABEL_XPATH) + @FindBy(xpath = Locators.ALTERNATE_LABEL_XPATH) private List label; @Override diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java index 7fa22df1..115edfb4 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java @@ -34,4 +34,5 @@ private Locators() { public static final String AUTOCOMPLETE_CSS = "foundation-autocomplete"; public static final String ALTERNATE_LABEL_XPATH = "../label"; public static final String TEXTFIELD_CSS = ".coral3-Textfield:not([type='hidden'])"; + public static final String SELECT_CSS = ".coral3-Select"; } From 2f0ea6a76785456fddb04708aac253c74036b7cc Mon Sep 17 00:00:00 2001 From: "volodymyr.vashchuk" Date: Mon, 14 Oct 2019 09:39:23 +0200 Subject: [PATCH 3/9] Add NumberInput dialog field Add ContentFragmentPathBrowser dialog field --- .../ContentFragmentPathBrowserImpl.java | 70 +++++++++++++++++++ .../dialogfields/DefaultNumberInput.java | 51 ++++++++++++++ .../dialogfields/DefaultPathBrowser.java | 5 +- .../component/dialog/dialogfields/Fields.java | 2 + .../dialog/dialogfields/Locators.java | 1 + .../modules/fields/DialogFieldsModule.java | 6 ++ .../modules/fields/FieldsRegistryModule.java | 6 ++ .../ContentFragmentPathBrowser.java | 29 ++++++++ .../dialog/dialogfields/NumberInput.java | 29 ++++++++ 9 files changed, 197 insertions(+), 2 deletions(-) create mode 100644 bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowserImpl.java create mode 100644 bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java create mode 100644 bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowser.java create mode 100644 bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/NumberInput.java diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowserImpl.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowserImpl.java new file mode 100644 index 00000000..a111f332 --- /dev/null +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowserImpl.java @@ -0,0 +1,70 @@ +/*- + * #%L + * Bobcat + * %% + * Copyright (C) 2016 Cognifide Ltd. + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ +package com.cognifide.qa.bb.aem.core.component.dialog.dialogfields; + +import static org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable; + +import java.util.List; + +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +import com.cognifide.qa.bb.qualifier.Global; +import com.cognifide.qa.bb.qualifier.PageObject; +import com.cognifide.qa.bb.wait.BobcatWait; +import com.google.inject.Inject; + +/** + * Default implementation of {@link PathBrowser} + */ +@PageObject(css = Locators.AUTOCOMPLETE_CSS) +public class ContentFragmentPathBrowserImpl implements ContentFragmentPathBrowser { + + @FindBy(css = ".coral3-Textfield") + private WebElement input; + + @FindBy(xpath = Locators.ALTERNATE_LABEL_XPATH) + private List label; + + @FindBy(css = ".foundation-picker-buttonlist.coral3-Overlay.is-open") + private WebElement firstResult; + + @Global + @FindBy(css = "coral3-Dialog--warning is-open .coral3-Button--primary") + private WebElement warningConfirmation; + + @Inject + private BobcatWait bobcatWait; + + @Override + public void setValue(Object value) { + input.clear(); + input.sendKeys(String.valueOf(value)); + bobcatWait.until(elementToBeClickable(firstResult)); + input.sendKeys(Keys.ENTER); + bobcatWait.until(elementToBeClickable(warningConfirmation)).click(); + } + + @Override + public String getLabel() { + return label.isEmpty() ? "" : label.get(0).getText(); + } +} diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java new file mode 100644 index 00000000..d2f040c2 --- /dev/null +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java @@ -0,0 +1,51 @@ +/*- + * #%L + * Bobcat + * %% + * Copyright (C) 2016 Cognifide Ltd. + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ +package com.cognifide.qa.bb.aem.core.component.dialog.dialogfields; + +import java.util.List; + +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +import com.cognifide.qa.bb.qualifier.PageObject; + +/** + * Default implementation of {@link NumberInput} + */ +@PageObject(css = Locators.NUMBERINPUT_CSS) +public class DefaultNumberInput implements NumberInput { + + @FindBy(css = "input") + private WebElement input; + + @FindBy(xpath = Locators.ALTERNATE_LABEL_XPATH) + private List label; + + @Override + public void setValue(Object value) { + input.clear(); + input.sendKeys(String.valueOf(value)); + } + + @Override + public String getLabel() { + return label.isEmpty() ? "" : label.get(0).getText(); + } +} diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultPathBrowser.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultPathBrowser.java index 114f6b21..4299f11a 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultPathBrowser.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultPathBrowser.java @@ -23,6 +23,7 @@ import java.util.List; +import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; @@ -52,8 +53,8 @@ public class DefaultPathBrowser implements PathBrowser { public void setValue(Object value) { input.clear(); input.sendKeys(String.valueOf(value)); - - bobcatWait.until(elementToBeClickable(firstResult)).click(); + bobcatWait.until(elementToBeClickable(firstResult)); + input.sendKeys(Keys.ENTER); } @Override diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Fields.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Fields.java index 6733678c..425984ec 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Fields.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Fields.java @@ -34,6 +34,8 @@ public class Fields { public static final String RADIO_GROUP = "RADIO_GROUP"; public static final String RICHTEXT = "RICHTEXT"; public static final String TAGBROWSER = "TAGBROWSER"; + public static final String NUMBER_INPUT = "NUMBER_INPUT"; + public static final String CONTENT_FRAGMENT_PATHBROWSER = "CONTENT_FRAGMENT_PATHBROWSER"; private Fields() { //empty diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java index 115edfb4..0da6d33a 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java @@ -35,4 +35,5 @@ private Locators() { public static final String ALTERNATE_LABEL_XPATH = "../label"; public static final String TEXTFIELD_CSS = ".coral3-Textfield:not([type='hidden'])"; public static final String SELECT_CSS = ".coral3-Select"; + public static final String NUMBERINPUT_CSS = "coral-numberinput"; } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/DialogFieldsModule.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/DialogFieldsModule.java index a5327686..fbb9425b 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/DialogFieldsModule.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/DialogFieldsModule.java @@ -23,10 +23,13 @@ import org.slf4j.LoggerFactory; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.Checkbox; +import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.ContentFragmentPathBrowser; +import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.ContentFragmentPathBrowserImpl; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultCheckbox; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultImage; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultMultifield; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultMultifieldItem; +import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultNumberInput; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultPathBrowser; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultRadioGroup; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultRichText; @@ -35,6 +38,7 @@ import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.Image; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.Multifield; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.MultifieldItem; +import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.NumberInput; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.PathBrowser; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.RadioGroup; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.RichText; @@ -62,6 +66,8 @@ protected void configure() { bind(RichText.class).to(DefaultRichText.class); bind(Select.class).to(DefaultSelect.class); bind(Textfield.class).to(DefaultTextfield.class); + bind(NumberInput.class).to(DefaultNumberInput.class); + bind(ContentFragmentPathBrowser.class).to(ContentFragmentPathBrowserImpl.class); install(new FieldsRegistryModule()); } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/FieldsRegistryModule.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/FieldsRegistryModule.java index 15c7d12b..40867b37 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/FieldsRegistryModule.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/FieldsRegistryModule.java @@ -22,10 +22,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.ContentFragmentPathBrowserImpl; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultCheckbox; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultImage; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultMultifield; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultMultifieldItem; +import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultNumberInput; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultPathBrowser; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultRadioGroup; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultRichText; @@ -62,12 +64,16 @@ protected void configure() { registerField(fieldsBinder, Fields.MULTIFIELD_ITEM, DefaultMultifieldItem.class); registerField(fieldsBinder, Fields.RADIO_GROUP, DefaultRadioGroup.class); registerField(fieldsBinder, Fields.TAGBROWSER, DefaultTagBrowser.class); + registerField(fieldsBinder, Fields.NUMBER_INPUT, DefaultNumberInput.class); registerField(fieldsBinder, Fields.RICHTEXT, DefaultRichText.class); registerField(fieldsBinder, Options.RTE_OPTIONS, RteOption.class); registerField(fieldsBinder, Options.RTE_OPTIONS_HYPERLINK, Hyperlink.class); registerField(fieldsBinder, Options.RTE_OPTIONS_LISTS, Lists.class); registerField(fieldsBinder, Options.RTE_OPTIONS_PARAGRAPH_FORMATS, ParagraphFormats.class); + + registerField(fieldsBinder, Fields.CONTENT_FRAGMENT_PATHBROWSER, + ContentFragmentPathBrowserImpl.class); } private void registerField(MapBinder binder, String name, diff --git a/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowser.java b/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowser.java new file mode 100644 index 00000000..ca347521 --- /dev/null +++ b/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowser.java @@ -0,0 +1,29 @@ +/*- + * #%L + * Bobcat + * %% + * Copyright (C) 2019 Cognifide Ltd. + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ +package com.cognifide.qa.bb.aem.core.component.dialog.dialogfields; + +import com.cognifide.qa.bb.qualifier.PageObjectInterface; + +/** + * This class represents path browser dialog field. + */ +@PageObjectInterface +public interface ContentFragmentPathBrowser extends DialogField { +} diff --git a/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/NumberInput.java b/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/NumberInput.java new file mode 100644 index 00000000..57dd58b1 --- /dev/null +++ b/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/NumberInput.java @@ -0,0 +1,29 @@ +/*- + * #%L + * Bobcat + * %% + * Copyright (C) 2019 Cognifide Ltd. + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ +package com.cognifide.qa.bb.aem.core.component.dialog.dialogfields; + +import com.cognifide.qa.bb.qualifier.PageObjectInterface; + +/** + * This class represents single line number input dialog field. + */ +@PageObjectInterface +public interface NumberInput extends DialogField { +} From a0a8c3d8a4934a8de3abdc2c09b42f652b51f837 Mon Sep 17 00:00:00 2001 From: "volodymyr.vashchuk" Date: Mon, 14 Oct 2019 12:49:43 +0200 Subject: [PATCH 4/9] Fix handling the content fragment warning dialog --- .../ContentFragmentPathBrowserImpl.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowserImpl.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowserImpl.java index a111f332..2d26b62f 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowserImpl.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowserImpl.java @@ -19,9 +19,12 @@ */ package com.cognifide.qa.bb.aem.core.component.dialog.dialogfields; -import static org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable; +import static org.openqa.selenium.support.ui.ExpectedConditions.*; import java.util.List; +import java.util.NoSuchElementException; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; @@ -30,6 +33,7 @@ import com.cognifide.qa.bb.qualifier.Global; import com.cognifide.qa.bb.qualifier.PageObject; import com.cognifide.qa.bb.wait.BobcatWait; +import com.cognifide.qa.bb.wait.TimingsBuilder; import com.google.inject.Inject; /** @@ -48,7 +52,7 @@ public class ContentFragmentPathBrowserImpl implements ContentFragmentPathBrowse private WebElement firstResult; @Global - @FindBy(css = "coral3-Dialog--warning is-open .coral3-Button--primary") + @FindBy(css = ".coral3-Dialog--warning.is-open .coral3-Button--primary") private WebElement warningConfirmation; @Inject @@ -60,7 +64,17 @@ public void setValue(Object value) { input.sendKeys(String.valueOf(value)); bobcatWait.until(elementToBeClickable(firstResult)); input.sendKeys(Keys.ENTER); - bobcatWait.until(elementToBeClickable(warningConfirmation)).click(); + + // Branching logic in tests is not OK, it's true. But this part handles an unpredictable part of + // the application. Sometimes a warning dialog appears and it needs to be handled. + if (bobcatWait + .tweak(new TimingsBuilder().explicitTimeout(1).build()) + .ignoring(Stream.of(NoSuchElementException.class).collect(Collectors.toList())) + .isConditionMet(elementToBeClickable(warningConfirmation))) { + warningConfirmation.click(); + bobcatWait.tweak(new TimingsBuilder().explicitTimeout(1).build()) + .isConditionMet(not(elementToBeClickable(warningConfirmation))); + } } @Override From 0f9e02e5864f73d4288e1384553b62bbdcc0b8fa Mon Sep 17 00:00:00 2001 From: "volodymyr.vashchuk" Date: Tue, 15 Oct 2019 11:28:03 +0200 Subject: [PATCH 5/9] Fix most issues mentioned in CR --- ...pl.java => DefaultContentFragmentPathBrowser.java} | 11 +++++------ .../dialog/dialogfields/DefaultMultifield.java | 2 +- .../dialog/dialogfields/DefaultNumberInput.java | 2 +- .../component/dialog/dialogfields/DefaultSelect.java | 6 +----- .../dialog/dialogfields/DefaultTextfield.java | 2 +- .../core/component/dialog/dialogfields/Locators.java | 4 ---- .../aem/core/modules/fields/DialogFieldsModule.java | 4 ++-- .../aem/core/modules/fields/FieldsRegistryModule.java | 4 ++-- 8 files changed, 13 insertions(+), 22 deletions(-) rename bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/{ContentFragmentPathBrowserImpl.java => DefaultContentFragmentPathBrowser.java} (89%) diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowserImpl.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java similarity index 89% rename from bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowserImpl.java rename to bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java index 2d26b62f..2bab5327 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/ContentFragmentPathBrowserImpl.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java @@ -19,12 +19,11 @@ */ package com.cognifide.qa.bb.aem.core.component.dialog.dialogfields; -import static org.openqa.selenium.support.ui.ExpectedConditions.*; +import static org.openqa.selenium.support.ui.ExpectedConditions.not; +import static org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable; import java.util.List; import java.util.NoSuchElementException; -import java.util.stream.Collectors; -import java.util.stream.Stream; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; @@ -37,10 +36,10 @@ import com.google.inject.Inject; /** - * Default implementation of {@link PathBrowser} + * Default implementation of {@link ContentFragmentPathBrowser} */ @PageObject(css = Locators.AUTOCOMPLETE_CSS) -public class ContentFragmentPathBrowserImpl implements ContentFragmentPathBrowser { +public class DefaultContentFragmentPathBrowser implements ContentFragmentPathBrowser { @FindBy(css = ".coral3-Textfield") private WebElement input; @@ -69,7 +68,7 @@ public void setValue(Object value) { // the application. Sometimes a warning dialog appears and it needs to be handled. if (bobcatWait .tweak(new TimingsBuilder().explicitTimeout(1).build()) - .ignoring(Stream.of(NoSuchElementException.class).collect(Collectors.toList())) + .ignoring(NoSuchElementException.class) .isConditionMet(elementToBeClickable(warningConfirmation))) { warningConfirmation.click(); bobcatWait.tweak(new TimingsBuilder().explicitTimeout(1).build()) diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifield.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifield.java index ab34e781..1378e52a 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifield.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifield.java @@ -36,7 +36,7 @@ /** * Default implementation of {@link Multifield} */ -@PageObject(css = Locators.MULTIFIELD_CSS) +@PageObject(css = "coral-multifield") public class DefaultMultifield implements Multifield { @FindBy(css = "button[coral-multifield-add]") diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java index d2f040c2..2992e064 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java @@ -29,7 +29,7 @@ /** * Default implementation of {@link NumberInput} */ -@PageObject(css = Locators.NUMBERINPUT_CSS) +@PageObject(css = "coral-numberinput") public class DefaultNumberInput implements NumberInput { @FindBy(css = "input") diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java index a0448ebd..adfa7c54 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java @@ -28,13 +28,12 @@ import com.cognifide.qa.bb.qualifier.CurrentScope; import com.cognifide.qa.bb.qualifier.PageObject; -import com.cognifide.qa.bb.wait.BobcatWait; import com.google.inject.Inject; /** * Default implementation of {@link Select} */ -@PageObject(css = Locators.SELECT_CSS) +@PageObject(css = ".coral3-Select") public class DefaultSelect implements Select { private static final String SELECT_OPTIONS_CSS = ".coral3-SelectList-item"; @@ -46,9 +45,6 @@ public class DefaultSelect implements Select { @FindBy(xpath = Locators.ALTERNATE_LABEL_XPATH) private List label; - @Inject - private BobcatWait wait; - @Override public void setValue(Object value) { selectField.click(); diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java index 69d28ae2..ca081274 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java @@ -31,7 +31,7 @@ /** * Default implementation of {@link Textfield} */ -@PageObject(css = Locators.TEXTFIELD_CSS) +@PageObject(css = ".coral3-Textfield:not([type='hidden'])") public class DefaultTextfield implements Textfield { @Inject diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java index 0da6d33a..95ddac8a 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java @@ -30,10 +30,6 @@ private Locators() { public static final String FIELD_WRAPPER_CSS = ".coral-Form-fieldwrapper"; public static final String LABEL_CSS = ".coral-Form-fieldlabel"; - public static final String MULTIFIELD_CSS = "coral-multifield"; public static final String AUTOCOMPLETE_CSS = "foundation-autocomplete"; public static final String ALTERNATE_LABEL_XPATH = "../label"; - public static final String TEXTFIELD_CSS = ".coral3-Textfield:not([type='hidden'])"; - public static final String SELECT_CSS = ".coral3-Select"; - public static final String NUMBERINPUT_CSS = "coral-numberinput"; } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/DialogFieldsModule.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/DialogFieldsModule.java index fbb9425b..a4ef88e1 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/DialogFieldsModule.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/DialogFieldsModule.java @@ -24,7 +24,7 @@ import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.Checkbox; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.ContentFragmentPathBrowser; -import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.ContentFragmentPathBrowserImpl; +import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultContentFragmentPathBrowser; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultCheckbox; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultImage; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultMultifield; @@ -67,7 +67,7 @@ protected void configure() { bind(Select.class).to(DefaultSelect.class); bind(Textfield.class).to(DefaultTextfield.class); bind(NumberInput.class).to(DefaultNumberInput.class); - bind(ContentFragmentPathBrowser.class).to(ContentFragmentPathBrowserImpl.class); + bind(ContentFragmentPathBrowser.class).to(DefaultContentFragmentPathBrowser.class); install(new FieldsRegistryModule()); } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/FieldsRegistryModule.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/FieldsRegistryModule.java index 40867b37..af4bff69 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/FieldsRegistryModule.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/modules/fields/FieldsRegistryModule.java @@ -22,7 +22,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.ContentFragmentPathBrowserImpl; +import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultContentFragmentPathBrowser; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultCheckbox; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultImage; import com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.DefaultMultifield; @@ -73,7 +73,7 @@ protected void configure() { registerField(fieldsBinder, Options.RTE_OPTIONS_PARAGRAPH_FORMATS, ParagraphFormats.class); registerField(fieldsBinder, Fields.CONTENT_FRAGMENT_PATHBROWSER, - ContentFragmentPathBrowserImpl.class); + DefaultContentFragmentPathBrowser.class); } private void registerField(MapBinder binder, String name, From a09cf0573c9a82af616398451a2d5dce0c09116d Mon Sep 17 00:00:00 2001 From: "volodymyr.vashchuk" Date: Tue, 15 Oct 2019 11:49:18 +0200 Subject: [PATCH 6/9] Fix the last of the issues mentioned in the CR --- .../dialog/DefaultDialogFieldRetriever.java | 2 +- .../DefaultContentFragmentPathBrowser.java | 16 +++++++++------- .../component/dialog/dialogfields/Locators.java | 1 - 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/DefaultDialogFieldRetriever.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/DefaultDialogFieldRetriever.java index a834c61b..2ba7d70f 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/DefaultDialogFieldRetriever.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/DefaultDialogFieldRetriever.java @@ -82,7 +82,7 @@ public DialogField getDialogField(WebElement parentElement, String type) { private List getFieldElements(WebElement parentElement, String type) { By selector = getSelectorFromClass(getClassForType(type), pageObjectInjector.getOriginalInjector()) - .orElse(By.cssSelector(Locators.FIELD_WRAPPER_CSS)); + .orElse(By.cssSelector(".coral-Form-fieldwrapper")); return parentElement.findElements(selector); } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java index 2bab5327..81745a91 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java @@ -63,9 +63,16 @@ public void setValue(Object value) { input.sendKeys(String.valueOf(value)); bobcatWait.until(elementToBeClickable(firstResult)); input.sendKeys(Keys.ENTER); + closeWarningDialogIfRequired(); + } + + @Override + public String getLabel() { + return label.isEmpty() ? "" : label.get(0).getText(); + } - // Branching logic in tests is not OK, it's true. But this part handles an unpredictable part of - // the application. Sometimes a warning dialog appears and it needs to be handled. + // The warning dialog doesn't always appear, so it's handled within an if-clause + private void closeWarningDialogIfRequired() { if (bobcatWait .tweak(new TimingsBuilder().explicitTimeout(1).build()) .ignoring(NoSuchElementException.class) @@ -75,9 +82,4 @@ public void setValue(Object value) { .isConditionMet(not(elementToBeClickable(warningConfirmation))); } } - - @Override - public String getLabel() { - return label.isEmpty() ? "" : label.get(0).getText(); - } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java index 95ddac8a..0743d4e2 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Locators.java @@ -28,7 +28,6 @@ private Locators() { //util } - public static final String FIELD_WRAPPER_CSS = ".coral-Form-fieldwrapper"; public static final String LABEL_CSS = ".coral-Form-fieldlabel"; public static final String AUTOCOMPLETE_CSS = "foundation-autocomplete"; public static final String ALTERNATE_LABEL_XPATH = "../label"; From 713f680e3290caba6d001110190d3e271d3dcd76 Mon Sep 17 00:00:00 2001 From: "volodymyr.vashchuk" Date: Mon, 21 Oct 2019 16:18:38 +0200 Subject: [PATCH 7/9] Add optional clearing of dialog fields during authoring --- .../component/dialog/ConfigDialogImpl.java | 21 ++++++++++++------- .../dialog/dialogfields/Checkbox.java | 9 ++++++-- .../component/dialog/dialogfields/Image.java | 5 +++++ .../dialog/dialogfields/Multifield.java | 11 +++++++--- .../dialog/dialogfields/MultifieldItem.java | 4 ++++ .../dialog/dialogfields/PathBrowser.java | 4 ++++ .../dialog/dialogfields/RadioGroup.java | 4 ++++ .../dialog/dialogfields/RichText.java | 14 +++++++++---- .../component/dialog/dialogfields/Select.java | 7 +++++++ .../dialog/dialogfields/Textfield.java | 5 +++++ .../dialog/dialogfields/text/FontFormat.java | 5 +++++ .../dialogfields/text/JustifyDialogPanel.java | 5 +++++ .../dialogfields/text/ListDialogPanel.java | 5 +++++ .../component/dialog/ConfigDialogImpl.java | 21 ++++++++++++------- .../dialog/dialogfields/DefaultCheckbox.java | 4 ++++ .../DefaultContentFragmentPathBrowser.java | 5 +++++ .../dialog/dialogfields/DefaultImage.java | 5 +++++ .../dialogfields/DefaultMultifield.java | 11 +++++++--- .../dialogfields/DefaultMultifieldItem.java | 5 +++++ .../dialogfields/DefaultNumberInput.java | 5 +++++ .../dialogfields/DefaultPathBrowser.java | 5 +++++ .../dialogfields/DefaultRadioGroup.java | 5 +++++ .../dialog/dialogfields/DefaultRichText.java | 5 +++++ .../dialog/dialogfields/DefaultSelect.java | 5 +++++ .../dialogfields/DefaultTagBrowser.java | 5 +++++ .../dialog/dialogfields/DefaultTextfield.java | 5 +++++ .../dialog/dialogfields/rte/Hyperlink.java | 5 +++++ .../dialog/dialogfields/rte/Lists.java | 5 +++++ .../dialogfields/rte/ParagraphFormats.java | 5 +++++ .../dialog/dialogfields/rte/RteOption.java | 5 +++++ .../component/configuration/FieldConfig.java | 12 ++++++++++- .../dialog/dialogfields/DialogField.java | 6 ++++++ 32 files changed, 194 insertions(+), 29 deletions(-) diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/ConfigDialogImpl.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/ConfigDialogImpl.java index 17bfde85..927349f9 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/ConfigDialogImpl.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/ConfigDialogImpl.java @@ -137,8 +137,8 @@ public void configureWith(ComponentConfiguration config) { /** * Method used to access DialogField for further configuration. * - * @param label Label of element to access - * @param tab Name of a tab that element is placed on + * @param label Label of element to access + * @param tab Name of a tab that element is placed on * @param fieldType Type of field we would like to access * @return DialogField with our field */ @@ -153,9 +153,9 @@ public DialogField getFieldOnTab(String label, String tab, String fieldType) { /** * Method used to configure a field on a dialog. * - * @param label Label of field to configure + * @param label Label of field to configure * @param fieldType Type of field to configure - * @param value Value that field will be filled with + * @param value Value that field will be filled with * @return ConfigDialog this instance */ @Override @@ -167,7 +167,7 @@ public ConfigDialog setField(String label, String fieldType, Object value) { /** * Method can be used to access a field on currently opened tab * - * @param label Field's label to access + * @param label Field's label to access * @param fieldType Type of field to access * @return DialogField with our field */ @@ -204,9 +204,14 @@ private void configure(ComponentConfiguration config) { private void setFields(List value) { WebElement parent = determineParentScope(); - value.forEach(fieldConfig -> dialogConfigurer - .getDialogField(parent, fieldConfig.getLabel(), fieldConfig.getType()) - .setValue(fieldConfig.getValue())); + value.forEach(fieldConfig -> { + DialogField field = dialogConfigurer + .getDialogField(parent, fieldConfig.getLabel(), fieldConfig.getType()); + if (fieldConfig.getClear()) { + field.clearField(); + } + field.setValue(fieldConfig.getValue()); + }); } private WebElement determineParentScope() { diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Checkbox.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Checkbox.java index 9ec15c71..97f829aa 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Checkbox.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Checkbox.java @@ -20,6 +20,7 @@ package com.cognifide.qa.bb.aem.core.component.dialog.dialogfields; import com.cognifide.qa.bb.qualifier.PageObject; + import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; @@ -40,15 +41,19 @@ public void select() { } /** - * Performs click action on the checkbox if passed param is 'true' string. + * Sets the checkbox's state with a click according to the passed boolean value. * * @param value string boolean representation */ @Override public void setValue(Object value) { - if (Boolean.valueOf(String.valueOf(value))) { + if (Boolean.valueOf(String.valueOf(value)) != checkboxElement.isSelected()) { select(); } } + @Override + public void clearField() { + } + } diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Image.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Image.java index d9c3a55d..89b407f5 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Image.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Image.java @@ -29,6 +29,7 @@ import com.cognifide.qa.bb.qualifier.PageObject; import com.cognifide.qa.bb.scope.frame.FramePath; import com.google.inject.Inject; + import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; @@ -61,4 +62,8 @@ public void setValue(Object value) { draggable.dropTo(droppable); } + @Override + public void clearField() { + } + } diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Multifield.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Multifield.java index a8406ca3..c7c89da9 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Multifield.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Multifield.java @@ -56,14 +56,19 @@ public void setValue(Object value) { mapper.convertValue(value, new TypeReference>() { }); - items.forEach(MultifieldItem::deleteItem); - - cfg.forEach(entry -> addField()); + while(items.size() < cfg.size()) { + addField(); + } Iterator itemsIterator = items.iterator(); cfg.forEach(entry -> itemsIterator.next().setValue(entry)); } + @Override + public void clearField() { + items.forEach(MultifieldItem::deleteItem); + } + /** * Returns MultifieldItem at declared index position * diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/MultifieldItem.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/MultifieldItem.java index f1adddf9..5b31774a 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/MultifieldItem.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/MultifieldItem.java @@ -51,6 +51,10 @@ public void setValue(Object value) { entry.getItem().forEach(this::setFieldInMultifield); } + @Override + public void clearField() { + } + /** * Deletes this item */ diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/PathBrowser.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/PathBrowser.java index e017c54d..72b4a79e 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/PathBrowser.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/PathBrowser.java @@ -69,4 +69,8 @@ public void setValue(Object value) { currentScope.findElement(By.className("coral-Form-fieldlabel")).click(); } + @Override + public void clearField() { + } + } diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RadioGroup.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RadioGroup.java index 7593619a..7a0aaf23 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RadioGroup.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RadioGroup.java @@ -44,4 +44,8 @@ public void setValue(Object value) { radioLabel.findElement(By.xpath(".//..")).click(); } + @Override + public void clearField() { + } + } diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RichText.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RichText.java index 76b07410..0e9effad 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RichText.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RichText.java @@ -25,8 +25,10 @@ import com.cognifide.qa.bb.qualifier.PageObject; import com.google.inject.Inject; + import java.util.Arrays; import java.util.List; + import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.FindBy; @@ -52,13 +54,13 @@ public class RichText implements DialogField { public void setValue(Object value) { String text = (String) value; actions.keyDown(input, CONTROL) // - .sendKeys("a") // - .keyUp(CONTROL) // - .sendKeys(BACK_SPACE); + .sendKeys("a") // + .keyUp(CONTROL) // + .sendKeys(BACK_SPACE); List textDividedByLines = Arrays.asList(text.split("\\\\n")); for (int i = 0; i < textDividedByLines.size(); i++) { - if(i!=0) { + if (i != 0) { actions.sendKeys(RETURN); } actions.sendKeys(textDividedByLines.get(i).trim()); @@ -66,4 +68,8 @@ public void setValue(Object value) { actions.perform(); } + @Override + public void clearField() { + } + } diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Select.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Select.java index a1f4a8fd..96d12dfe 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Select.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Select.java @@ -20,7 +20,9 @@ package com.cognifide.qa.bb.aem.core.component.dialog.dialogfields; import com.cognifide.qa.bb.qualifier.PageObject; + import java.util.List; + import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; @@ -52,4 +54,9 @@ public void setValue(Object value) { String.format("Option with text %s not found", value.toString()))).click(); } + @Override + public void clearField() { + + } + } diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Textfield.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Textfield.java index 1065ad54..068a1739 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Textfield.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Textfield.java @@ -20,6 +20,7 @@ package com.cognifide.qa.bb.aem.core.component.dialog.dialogfields; import com.cognifide.qa.bb.qualifier.PageObject; + import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; @@ -43,4 +44,8 @@ public void setValue(Object value) { input.sendKeys(String.valueOf(value)); } + @Override + public void clearField() { + } + } diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/FontFormat.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/FontFormat.java index 4ee10332..0ec84cfd 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/FontFormat.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/FontFormat.java @@ -64,6 +64,11 @@ public void setValue(Object value) { } } + @Override + public void clearField() { + + } + private void clickFormatButton(WebElement button) { controlToolbar.selectText(); bobcatWait.until(input -> button.isEnabled()); diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/JustifyDialogPanel.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/JustifyDialogPanel.java index 37d0f81a..ab23603c 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/JustifyDialogPanel.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/JustifyDialogPanel.java @@ -71,6 +71,11 @@ public void setValue(Object value) { } } + @Override + public void clearField() { + + } + private void openJustifyPopover() { controlToolbar.selectText(); bobcatWait.until(input -> controlToolbar.getToggleJustifyButton().isEnabled()); diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/ListDialogPanel.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/ListDialogPanel.java index 0c6015e4..8755d44b 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/ListDialogPanel.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/ListDialogPanel.java @@ -77,6 +77,11 @@ public void setValue(Object value) { } } + @Override + public void clearField() { + + } + private void openListPopover() { controlToolbar.selectText(); bobcatWait.until((ExpectedCondition) input -> controlToolbar. diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/ConfigDialogImpl.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/ConfigDialogImpl.java index a2059f0d..82c5e7b0 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/ConfigDialogImpl.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/ConfigDialogImpl.java @@ -139,8 +139,8 @@ public void configureWith(ComponentConfiguration config) { /** * Method used to access DialogField for further configuration. * - * @param label Label of element to access - * @param tab Name of a tab that element is placed on + * @param label Label of element to access + * @param tab Name of a tab that element is placed on * @param fieldType Type of field we would like to access * @return DialogField with our field */ @@ -153,9 +153,9 @@ public DialogField getFieldOnTab(String label, String tab, String fieldType) { /** * Method used to configure a field on a dialog. * - * @param label Label of field to configure + * @param label Label of field to configure * @param fieldType Type of field to configure - * @param value Value that field will be filled with + * @param value Value that field will be filled with * @return ConfigDialog this instance */ @Override @@ -167,7 +167,7 @@ public ConfigDialog setField(String label, String fieldType, Object value) { /** * Method can be used to access a field on currently opened tab * - * @param label Field's label to access + * @param label Field's label to access * @param fieldType Type of field to access * @return DialogField with our field */ @@ -205,9 +205,14 @@ private void configure(ComponentConfiguration config) { private void setFields(List value) { WebElement parent = determineParentScope(); - value.forEach(fieldConfig -> dialogConfigurer - .getDialogField(parent, fieldConfig.getLabel(), fieldConfig.getType()) - .setValue(fieldConfig.getValue())); + value.forEach(fieldConfig -> { + DialogField field = dialogConfigurer + .getDialogField(parent, fieldConfig.getLabel(), fieldConfig.getType()); + if (fieldConfig.getClear()) { + field.clearField(); + } + field.setValue(fieldConfig.getValue()); + }); } private WebElement determineParentScope() { diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultCheckbox.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultCheckbox.java index 213a6f6e..1c838d27 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultCheckbox.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultCheckbox.java @@ -54,4 +54,8 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } + + @Override + public void clearField() { + } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java index 81745a91..5562868d 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java @@ -71,6 +71,11 @@ public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } + @Override + public void clearField() { + + } + // The warning dialog doesn't always appear, so it's handled within an if-clause private void closeWarningDialogIfRequired() { if (bobcatWait diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultImage.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultImage.java index 9ff63a4a..961e4793 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultImage.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultImage.java @@ -66,4 +66,9 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } + + @Override + public void clearField() { + + } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifield.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifield.java index 1378e52a..7bee99bc 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifield.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifield.java @@ -55,9 +55,9 @@ public void setValue(Object value) { mapper.convertValue(value, new TypeReference>() { }); - items.forEach(MultifieldItem::deleteItem); - - cfg.forEach(entry -> addField()); + while(items.size() < cfg.size()) { + addField(); + } Iterator itemsIterator = items.iterator(); cfg.forEach(entry -> itemsIterator.next().setValue(entry)); @@ -68,6 +68,11 @@ public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } + @Override + public void clearField() { + items.forEach(MultifieldItem::deleteItem); + } + @Override public MultifieldItem getItemAtIndex(int index) { int itemsSize = items.size(); diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifieldItem.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifieldItem.java index c2752dfa..a7c7fc41 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifieldItem.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifieldItem.java @@ -70,4 +70,9 @@ private void setFieldInMultifield(FieldConfig fieldConfig) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } + + @Override + public void clearField() { + + } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java index 2992e064..8dab4c62 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java @@ -48,4 +48,9 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } + + @Override + public void clearField() { + + } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultPathBrowser.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultPathBrowser.java index 4299f11a..7df77d98 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultPathBrowser.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultPathBrowser.java @@ -61,4 +61,9 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } + + @Override + public void clearField() { + + } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRadioGroup.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRadioGroup.java index 8b5276a3..51738b0b 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRadioGroup.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRadioGroup.java @@ -51,4 +51,9 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } + + @Override + public void clearField() { + + } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRichText.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRichText.java index c5552bf3..ed592a08 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRichText.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRichText.java @@ -68,4 +68,9 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } + + @Override + public void clearField() { + + } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java index adfa7c54..3206063b 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java @@ -61,4 +61,9 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } + + @Override + public void clearField() { + + } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTagBrowser.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTagBrowser.java index 7c90d68c..543d226f 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTagBrowser.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTagBrowser.java @@ -72,4 +72,9 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } + + @Override + public void clearField() { + + } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java index ca081274..549c632a 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java @@ -51,4 +51,9 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } + + @Override + public void clearField() { + + } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Hyperlink.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Hyperlink.java index ae938cc1..d47d8c39 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Hyperlink.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Hyperlink.java @@ -83,6 +83,11 @@ public void setValue(Object value) { hyperlinkPopover.confirm(); } + @Override + public void clearField() { + + } + @SuppressWarnings("UnstableApiUsage") @VisibleForTesting protected Map parseValue(String value) { diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Lists.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Lists.java index 7abcfa56..984922f9 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Lists.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Lists.java @@ -72,4 +72,9 @@ public void setValue(Object value) { "Following option not found in Lists popover: " + option)) .click(); } + + @Override + public void clearField() { + + } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/ParagraphFormats.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/ParagraphFormats.java index 2f6719aa..1bf7d291 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/ParagraphFormats.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/ParagraphFormats.java @@ -67,4 +67,9 @@ public void setValue(Object value) { "Following option not found in Paragraph Formats popover: " + option)) .click(); } + + @Override + public void clearField() { + + } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/RteOption.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/RteOption.java index 99341bc4..3d7dd148 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/RteOption.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/RteOption.java @@ -62,4 +62,9 @@ public void setValue(Object value) { "Could not find the requested button on the toolbar: " + option)) .click(); } + + @Override + public void clearField() { + + } } diff --git a/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/configuration/FieldConfig.java b/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/configuration/FieldConfig.java index 991a4c1a..1c300e6c 100644 --- a/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/configuration/FieldConfig.java +++ b/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/configuration/FieldConfig.java @@ -30,6 +30,8 @@ public class FieldConfig { private Object value; + private boolean clear = false; + /** * @return Label of the field. */ @@ -51,11 +53,19 @@ public Object getValue() { return value; } + /** + * @return Whether the field should be cleared before the value is set + */ + public boolean getClear() { + return clear; + } + @Override public String toString() { return "field:\n" + "\tlabel='" + label + "'\n" + "\ttype='" + type + "'\n" + - "\tvalue=" + value + "'\n"; + "\tvalue=" + value + "'\n" + + "\tclear='" + clear + "'\n"; } } diff --git a/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DialogField.java b/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DialogField.java index 72a0bc46..92639877 100644 --- a/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DialogField.java +++ b/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DialogField.java @@ -36,6 +36,7 @@ */ @PageObjectInterface public interface DialogField { + /** * Sets component value. * @@ -49,4 +50,9 @@ public interface DialogField { default String getLabel() { return null; } + + /** + * Clears field input. + */ + void clearField(); } From 0b2c4359180cfe4e4bf0cc9467a7022fd9cf9c29 Mon Sep 17 00:00:00 2001 From: "volodymyr.vashchuk" Date: Tue, 22 Oct 2019 14:48:22 +0200 Subject: [PATCH 8/9] Change the clear() method in DialogField interface to default --- .../bb/aem/core/component/dialog/dialogfields/Checkbox.java | 5 ----- .../qa/bb/aem/core/component/dialog/dialogfields/Image.java | 5 ----- .../core/component/dialog/dialogfields/MultifieldItem.java | 4 ---- .../aem/core/component/dialog/dialogfields/PathBrowser.java | 5 ----- .../aem/core/component/dialog/dialogfields/RadioGroup.java | 5 ----- .../bb/aem/core/component/dialog/dialogfields/RichText.java | 5 ----- .../bb/aem/core/component/dialog/dialogfields/Select.java | 6 ------ .../aem/core/component/dialog/dialogfields/Textfield.java | 5 ----- .../core/component/dialog/dialogfields/text/FontFormat.java | 5 ----- .../dialog/dialogfields/text/JustifyDialogPanel.java | 5 ----- .../component/dialog/dialogfields/text/ListDialogPanel.java | 5 ----- .../core/component/dialog/dialogfields/DefaultCheckbox.java | 4 ---- .../dialogfields/DefaultContentFragmentPathBrowser.java | 5 ----- .../core/component/dialog/dialogfields/DefaultImage.java | 5 ----- .../dialog/dialogfields/DefaultMultifieldItem.java | 5 ----- .../component/dialog/dialogfields/DefaultNumberInput.java | 5 ----- .../component/dialog/dialogfields/DefaultPathBrowser.java | 5 ----- .../component/dialog/dialogfields/DefaultRadioGroup.java | 5 ----- .../core/component/dialog/dialogfields/DefaultRichText.java | 5 ----- .../core/component/dialog/dialogfields/DefaultSelect.java | 5 ----- .../component/dialog/dialogfields/DefaultTagBrowser.java | 5 ----- .../component/dialog/dialogfields/DefaultTextfield.java | 5 ----- .../core/component/dialog/dialogfields/rte/Hyperlink.java | 5 ----- .../aem/core/component/dialog/dialogfields/rte/Lists.java | 5 ----- .../component/dialog/dialogfields/rte/ParagraphFormats.java | 5 ----- .../core/component/dialog/dialogfields/rte/RteOption.java | 5 ----- .../aem/core/component/dialog/dialogfields/DialogField.java | 3 ++- 27 files changed, 2 insertions(+), 130 deletions(-) diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Checkbox.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Checkbox.java index 97f829aa..97bfc845 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Checkbox.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Checkbox.java @@ -51,9 +51,4 @@ public void setValue(Object value) { select(); } } - - @Override - public void clearField() { - } - } diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Image.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Image.java index 89b407f5..a26ff6cd 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Image.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Image.java @@ -61,9 +61,4 @@ public void setValue(Object value) { Droppable droppable = dragAndDropFactory.createDroppable(dropArea, FramePath.parsePath("/")); draggable.dropTo(droppable); } - - @Override - public void clearField() { - } - } diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/MultifieldItem.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/MultifieldItem.java index 5b31774a..f1adddf9 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/MultifieldItem.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/MultifieldItem.java @@ -51,10 +51,6 @@ public void setValue(Object value) { entry.getItem().forEach(this::setFieldInMultifield); } - @Override - public void clearField() { - } - /** * Deletes this item */ diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/PathBrowser.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/PathBrowser.java index 72b4a79e..d7583257 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/PathBrowser.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/PathBrowser.java @@ -68,9 +68,4 @@ public void setValue(Object value) { By.cssSelector(".foundation-picker-buttonlist.coral3-Overlay.is-open"))); currentScope.findElement(By.className("coral-Form-fieldlabel")).click(); } - - @Override - public void clearField() { - } - } diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RadioGroup.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RadioGroup.java index 7a0aaf23..b24d6872 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RadioGroup.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RadioGroup.java @@ -43,9 +43,4 @@ public void setValue(Object value) { () -> new IllegalStateException("Provided option is not present in the group")); radioLabel.findElement(By.xpath(".//..")).click(); } - - @Override - public void clearField() { - } - } diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RichText.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RichText.java index 0e9effad..aa5265b4 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RichText.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/RichText.java @@ -67,9 +67,4 @@ public void setValue(Object value) { } actions.perform(); } - - @Override - public void clearField() { - } - } diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Select.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Select.java index 96d12dfe..935c3996 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Select.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Select.java @@ -53,10 +53,4 @@ public void setValue(Object value) { .orElseThrow(() -> new NoSuchElementException( String.format("Option with text %s not found", value.toString()))).click(); } - - @Override - public void clearField() { - - } - } diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Textfield.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Textfield.java index 068a1739..ed3db90a 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Textfield.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/Textfield.java @@ -43,9 +43,4 @@ public void setValue(Object value) { input.clear(); input.sendKeys(String.valueOf(value)); } - - @Override - public void clearField() { - } - } diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/FontFormat.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/FontFormat.java index 0ec84cfd..4ee10332 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/FontFormat.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/FontFormat.java @@ -64,11 +64,6 @@ public void setValue(Object value) { } } - @Override - public void clearField() { - - } - private void clickFormatButton(WebElement button) { controlToolbar.selectText(); bobcatWait.until(input -> button.isEnabled()); diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/JustifyDialogPanel.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/JustifyDialogPanel.java index ab23603c..37d0f81a 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/JustifyDialogPanel.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/JustifyDialogPanel.java @@ -71,11 +71,6 @@ public void setValue(Object value) { } } - @Override - public void clearField() { - - } - private void openJustifyPopover() { controlToolbar.selectText(); bobcatWait.until(input -> controlToolbar.getToggleJustifyButton().isEnabled()); diff --git a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/ListDialogPanel.java b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/ListDialogPanel.java index 8755d44b..0c6015e4 100644 --- a/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/ListDialogPanel.java +++ b/bb-aem-64/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/text/ListDialogPanel.java @@ -77,11 +77,6 @@ public void setValue(Object value) { } } - @Override - public void clearField() { - - } - private void openListPopover() { controlToolbar.selectText(); bobcatWait.until((ExpectedCondition) input -> controlToolbar. diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultCheckbox.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultCheckbox.java index 1c838d27..213a6f6e 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultCheckbox.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultCheckbox.java @@ -54,8 +54,4 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } - - @Override - public void clearField() { - } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java index 5562868d..81745a91 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultContentFragmentPathBrowser.java @@ -71,11 +71,6 @@ public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } - @Override - public void clearField() { - - } - // The warning dialog doesn't always appear, so it's handled within an if-clause private void closeWarningDialogIfRequired() { if (bobcatWait diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultImage.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultImage.java index 961e4793..9ff63a4a 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultImage.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultImage.java @@ -66,9 +66,4 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } - - @Override - public void clearField() { - - } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifieldItem.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifieldItem.java index a7c7fc41..c2752dfa 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifieldItem.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultMultifieldItem.java @@ -70,9 +70,4 @@ private void setFieldInMultifield(FieldConfig fieldConfig) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } - - @Override - public void clearField() { - - } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java index 8dab4c62..2992e064 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultNumberInput.java @@ -48,9 +48,4 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } - - @Override - public void clearField() { - - } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultPathBrowser.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultPathBrowser.java index 7df77d98..4299f11a 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultPathBrowser.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultPathBrowser.java @@ -61,9 +61,4 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } - - @Override - public void clearField() { - - } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRadioGroup.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRadioGroup.java index 51738b0b..8b5276a3 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRadioGroup.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRadioGroup.java @@ -51,9 +51,4 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } - - @Override - public void clearField() { - - } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRichText.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRichText.java index ed592a08..c5552bf3 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRichText.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultRichText.java @@ -68,9 +68,4 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } - - @Override - public void clearField() { - - } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java index 3206063b..adfa7c54 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultSelect.java @@ -61,9 +61,4 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } - - @Override - public void clearField() { - - } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTagBrowser.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTagBrowser.java index 543d226f..7c90d68c 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTagBrowser.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTagBrowser.java @@ -72,9 +72,4 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } - - @Override - public void clearField() { - - } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java index 549c632a..ca081274 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DefaultTextfield.java @@ -51,9 +51,4 @@ public void setValue(Object value) { public String getLabel() { return label.isEmpty() ? "" : label.get(0).getText(); } - - @Override - public void clearField() { - - } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Hyperlink.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Hyperlink.java index d47d8c39..ae938cc1 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Hyperlink.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Hyperlink.java @@ -83,11 +83,6 @@ public void setValue(Object value) { hyperlinkPopover.confirm(); } - @Override - public void clearField() { - - } - @SuppressWarnings("UnstableApiUsage") @VisibleForTesting protected Map parseValue(String value) { diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Lists.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Lists.java index 984922f9..7abcfa56 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Lists.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/Lists.java @@ -72,9 +72,4 @@ public void setValue(Object value) { "Following option not found in Lists popover: " + option)) .click(); } - - @Override - public void clearField() { - - } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/ParagraphFormats.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/ParagraphFormats.java index 1bf7d291..2f6719aa 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/ParagraphFormats.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/ParagraphFormats.java @@ -67,9 +67,4 @@ public void setValue(Object value) { "Following option not found in Paragraph Formats popover: " + option)) .click(); } - - @Override - public void clearField() { - - } } diff --git a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/RteOption.java b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/RteOption.java index 3d7dd148..99341bc4 100644 --- a/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/RteOption.java +++ b/bb-aem-65/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/rte/RteOption.java @@ -62,9 +62,4 @@ public void setValue(Object value) { "Could not find the requested button on the toolbar: " + option)) .click(); } - - @Override - public void clearField() { - - } } diff --git a/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DialogField.java b/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DialogField.java index 92639877..73078edf 100644 --- a/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DialogField.java +++ b/bb-aem-core/src/main/java/com/cognifide/qa/bb/aem/core/component/dialog/dialogfields/DialogField.java @@ -54,5 +54,6 @@ default String getLabel() { /** * Clears field input. */ - void clearField(); + default void clearField() { + } } From 1fbaaec04f8b6865253354b141193199ec9ac5dc Mon Sep 17 00:00:00 2001 From: "volodymyr.vashchuk" Date: Tue, 22 Oct 2019 14:52:33 +0200 Subject: [PATCH 9/9] Add documentation for the "clear" feature --- docs/_docs/modules/aem/componentconfiguration.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/_docs/modules/aem/componentconfiguration.md b/docs/_docs/modules/aem/componentconfiguration.md index ddecfd55..fdd99f92 100644 --- a/docs/_docs/modules/aem/componentconfiguration.md +++ b/docs/_docs/modules/aem/componentconfiguration.md @@ -96,6 +96,7 @@ Properties: - label - select dialog field with this label. If there is no label the fields will be selected in order. - type - type of dialog field. All available OOB fields are displayed in section below - value - what value should be set +- clear - true/false, currently viable only for Multifields, you decide if the field's state should be set to a blank before entering the new value. This translates to deleting all existing items in a Multifield before adding any new ones. ### Components without tabs in the dialog @@ -127,6 +128,7 @@ This example shows how we can fill multifield dialog fields: Properties: - label: Option Entries type: MULTIFIELD + clear: false value: - item: - label: Active