Skip to content

Commit 0862382

Browse files
authored
SITES-19187 - Two methods of placing assets in image component give different results on dialog (#2663)
* ignore freshness for checkbox altValueFromDAM, titleValueFromDAM and displayPopupTitle in Image v2 edit dialog * ignore freshness for checkbox altValueFromDAM in Image v3 edit dialog * updated dependencies for selenium tests to fix failures with chrome versions newer than version 114 * updated selenium tests * ignore the new selenium tests until the necessary releases --------- Co-authored-by: levente <[email protected]>
1 parent 7cf5df5 commit 0862382

File tree

12 files changed

+102
-11
lines changed

12 files changed

+102
-11
lines changed

content/src/content/jcr_root/apps/core/wcm/components/image/v2/image/_cq_dialog/.content.xml

+3
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
165165
checked="${not empty cqDesign.altValueFromDAM ? cqDesign.altValueFromDAM : true}"
166166
fieldDescription="When checked, populate the image's alt attribute with the value of the dc:description metadata in DAM."
167+
forceIgnoreFreshness="true"
167168
name="./altValueFromDAM"
168169
text="Get alternative text from DAM"
169170
uncheckedValue="false"
@@ -185,6 +186,7 @@
185186
sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
186187
checked="${not empty cqDesign.titleValueFromDAM ? cqDesign.titleValueFromDAM : true}"
187188
fieldDescription="When checked, populate the image's caption with the value of the dc:title metadata in DAM."
189+
forceIgnoreFreshness="true"
188190
name="./titleValueFromDAM"
189191
text="Get caption from DAM"
190192
uncheckedValue="false"
@@ -194,6 +196,7 @@
194196
sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
195197
checked="${not empty cqDesign.displayPopupTitle ? cqDesign.displayPopupTitle : true}"
196198
fieldDescription="When checked, the caption won't be displayed below the image, but as a pop-up displayed by some browsers when hovering over the image."
199+
forceIgnoreFreshness="true"
197200
name="./displayPopupTitle"
198201
text="Display caption as pop-up"
199202
uncheckedValue="false"

content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/_cq_dialog/.content.xml

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
9898
checked="${not empty cqDesign.altValueFromDAM ? cqDesign.altValueFromDAM : true}"
9999
fieldDescription="When checked, populate the image's alt attribute with the value of the dc:description metadata in DAM."
100+
forceIgnoreFreshness="true"
100101
name="./altValueFromDAM"
101102
text="Inherit from description of asset"
102103
uncheckedValue="false"

parent/pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@
6464
<mockitio.version>4.8.1</mockitio.version>
6565
<maven.compiler.source>${aem.java.version}</maven.compiler.source>
6666
<maven.compiler.target>${aem.java.version}</maven.compiler.target>
67-
<aem.selenium.base.it.version>0.2.42</aem.selenium.base.it.version>
68-
<selenide.version>6.10.1</selenide.version>
69-
<selenium.version>4.7.1</selenium.version>
67+
<aem.selenium.base.it.version>0.2.46</aem.selenium.base.it.version>
68+
<selenide.version>6.19.1</selenide.version>
69+
<selenium.version>4.13.0</selenium.version>
7070
</properties>
7171

7272
<!-- ======================================================================= -->

testing/it/e2e-selenium-utils/src/main/java/com/adobe/cq/wcm/core/components/it/seljup/util/Commons.java

+12-5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
import java.util.concurrent.TimeoutException;
2727

2828
import com.adobe.cq.testing.selenium.pagewidgets.cq.InsertComponentDialog;
29+
import com.codeborne.selenide.Condition;
30+
import com.codeborne.selenide.DragAndDropOptions;
31+
import com.codeborne.selenide.ElementsCollection;
32+
import com.codeborne.selenide.Selenide;
33+
import com.codeborne.selenide.SelenideElement;
34+
import com.codeborne.selenide.WebDriverRunner;
2935
import org.apache.commons.lang.StringUtils;
3036
import org.apache.commons.lang3.RandomStringUtils;
3137
import org.apache.http.HttpStatus;
@@ -58,11 +64,6 @@
5864
import com.adobe.cq.testing.selenium.utils.TestContentBuilder;
5965
import com.adobe.cq.wcm.core.components.it.seljup.util.constant.RequestConstants;
6066
import com.adobe.cq.wcm.core.components.it.seljup.util.constant.Selectors;
61-
import com.codeborne.selenide.Condition;
62-
import com.codeborne.selenide.ElementsCollection;
63-
import com.codeborne.selenide.Selenide;
64-
import com.codeborne.selenide.SelenideElement;
65-
import com.codeborne.selenide.WebDriverRunner;
6667

6768
import static com.adobe.cq.testing.selenium.Constants.DEFAULT_RETRY_DELAY;
6869
import static com.adobe.cq.testing.selenium.Constants.DEFAULT_SMALL_SIZE;
@@ -922,6 +923,12 @@ public static void makeInlineEditorEditable() {
922923
((JavascriptExecutor) webDriver).executeScript("document.getElementsByName('actionUpdate')[0].style.display='inline'");
923924
}
924925

926+
public static void dragSidePanelImageToComponent(String imagePath, String componentPath) {
927+
SelenideElement image = $(String.format("coral-card.cq-draggable[data-path=\"%s\"]", imagePath));
928+
DragAndDropOptions.DragAndDropTarget.CssSelector targetComp = new DragAndDropOptions.DragAndDropTarget.CssSelector(String.format("[data-type='Editable'][data-path='%s']", componentPath));
929+
image.dragAndDrop(new DragAndDropOptions(targetComp, DragAndDropOptions.DragAndDropMethod.ACTIONS));
930+
}
931+
925932
/**
926933
* Class representing a simple page that can be opened in a Selenium browser.
927934
*/

testing/it/e2e-selenium-utils/src/main/java/com/adobe/cq/wcm/core/components/it/seljup/util/components/image/ImageEditDialog.java

+14
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,18 @@ public void clickLinkTarget() {
133133
checkbox.click();
134134
}
135135

136+
public boolean isTitleFromDAM() {
137+
CoralCheckbox checkbox = new CoralCheckbox(titleValueFromDAM);
138+
return checkbox.isChecked();
139+
}
140+
141+
public boolean isAltFromDAM() {
142+
CoralCheckbox checkbox = new CoralCheckbox(altValueFromDAM);
143+
return checkbox.isChecked();
144+
}
145+
146+
public boolean isPopUpTitle() {
147+
CoralCheckbox checkbox = new CoralCheckbox(popUpTitle);
148+
return checkbox.isChecked();
149+
}
136150
}

testing/it/e2e-selenium-utils/src/main/java/com/adobe/cq/wcm/core/components/it/seljup/util/components/teaser/v1/TeaserEditDialog.java

+4
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,8 @@ public void checkAltTextFromAssetDescription() {
172172
checkbox.click();
173173
}
174174

175+
public boolean isAltTextFromAssetDescription() {
176+
CoralCheckbox checkbox = new CoralCheckbox(altTextFromAssetDescription);
177+
return checkbox.isChecked();
178+
}
175179
}

testing/it/e2e-selenium/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
<dependency>
262262
<groupId>com.adobe.cq</groupId>
263263
<artifactId>aem-cloud-testing-clients</artifactId>
264-
<version>1.1.0</version>
264+
<version>1.2.3</version>
265265
<exclusions>
266266
<exclusion>
267267
<groupId>com.fasterxml.jackson.core</groupId>

testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/ImageTests.java

+22
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,28 @@ public void testAddImage() throws TimeoutException, InterruptedException {
186186
+ " and title " + originalDamTitle);
187187
}
188188

189+
public void testDragImageToComponent(boolean imageV3) throws TimeoutException, InterruptedException {
190+
Commons.openSidePanel();
191+
Commons.dragSidePanelImageToComponent(testImagePath, compPath);
192+
Commons.closeSidePanel();
193+
194+
ImageEditDialog editDialog = image.getEditDialog();
195+
Commons.openEditDialog(editorPage, compPath);
196+
197+
assertTrue(editDialog.isAltFromDAM());
198+
199+
if (!imageV3) {
200+
assertTrue(editDialog.isTitleFromDAM());
201+
assertTrue(editDialog.isPopUpTitle());
202+
}
203+
204+
Commons.closeConfigureDialog();
205+
Commons.switchContext("ContentFrame");
206+
207+
assertTrue(image.isImagePresentWithAltTextAndTitle(testPage, originalDamDescription, originalDamTitle),
208+
"Image should be present with alt text " + originalDamDescription + " and title " + originalDamTitle);
209+
}
210+
189211
public void testAddAltTextAndTitle() throws TimeoutException, InterruptedException {
190212
Commons.openSidePanel();
191213
dragImage();

testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/v2/ImageIT.java

+10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.concurrent.TimeoutException;
2020

2121
import org.apache.sling.testing.clients.ClientException;
22+
import org.junit.Ignore;
2223
import org.junit.jupiter.api.AfterEach;
2324
import org.junit.jupiter.api.BeforeEach;
2425
import org.junit.jupiter.api.DisplayName;
@@ -56,6 +57,15 @@ public void testAddImage() throws TimeoutException, InterruptedException {
5657
imageTests.testAddImage();
5758
}
5859

60+
@Ignore
61+
@Tag("IgnoreOnSDK")
62+
@Tag("IgnoreOn65")
63+
@Test
64+
@DisplayName("Test: drag image to component")
65+
public void testDragImageToComponent() throws TimeoutException, InterruptedException {
66+
imageTests.testDragImageToComponent(false);
67+
}
68+
5969
/**
6070
* Test: set Alt Text and Title
6171
*/

testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/v3/ImageIT.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package com.adobe.cq.wcm.core.components.it.seljup.tests.image.v3;
1818

1919
import java.util.ArrayList;
20-
import java.util.HashMap;
2120
import java.util.concurrent.TimeoutException;
2221

2322
import org.apache.http.NameValuePair;
@@ -32,7 +31,6 @@
3231
import com.adobe.cq.wcm.core.components.it.seljup.tests.image.ImageTests;
3332
import com.adobe.cq.wcm.core.components.it.seljup.util.Commons;
3433
import com.adobe.cq.wcm.core.components.it.seljup.util.components.image.v2.Image;
35-
import com.google.common.collect.ImmutableMap;
3634

3735
@Tag("group2")
3836
public class ImageIT extends com.adobe.cq.wcm.core.components.it.seljup.tests.image.v2.ImageIT {
@@ -44,6 +42,15 @@ public void setupBeforeEach() throws ClientException {
4442
imageTests.setup(adminClient, contextPath, label, Commons.RT_IMAGE_V3, rootPage, defaultPageTemplate, clientlibs, new Image());
4543
}
4644

45+
@Ignore
46+
@Tag("IgnoreOnSDK")
47+
@Tag("IgnoreOn65")
48+
@Test
49+
@DisplayName("Test: drag image to component")
50+
public void testDragImageToComponent() throws TimeoutException, InterruptedException {
51+
imageTests.testDragImageToComponent(true);
52+
}
53+
4754
/**
4855
* Test: Check image map areas are not rendered
4956
*

testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/teaser/v1/TeaserIT.java

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
public class TeaserIT extends AuthorBaseUITest {
4848
protected static String testAssetsPath = "/content/dam/core-components";
4949
protected static String testImagePath = testAssetsPath + "/core-comp-test-image.jpg";
50+
protected static String testImageAltText = "House on a beach with blue sky";
5051
protected static String preTitle = "Teaser PreTitle";
5152
protected static String title = "Teaser Title";
5253
protected static String description = "Teaser Description";

testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/teaser/v2/TeaserIT.java

+22
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.concurrent.TimeoutException;
2121

2222
import org.apache.sling.testing.clients.ClientException;
23+
import org.junit.Ignore;
2324
import org.junit.jupiter.api.BeforeEach;
2425
import org.junit.jupiter.api.DisplayName;
2526
import org.junit.jupiter.api.Tag;
@@ -512,6 +513,27 @@ public void testInheritImageFromAction_altNotInherited() throws ClientException,
512513
assertTrue(teaser.isImagePresentWithFileName(skiingAssetFormatted),"image should be rendered with file name: " + skiingAssetFormatted);
513514
}
514515

516+
@Ignore
517+
@Tag("IgnoreOnSDK")
518+
@Tag("IgnoreOn65")
519+
@Test
520+
@DisplayName("Test: drag and drop image from side panel to teaser component on a page")
521+
public void testDropImageToTeaser() throws TimeoutException, InterruptedException {
522+
Commons.openSidePanel();
523+
Commons.dragSidePanelImageToComponent(testImagePath, cmpPath);
524+
Commons.closeSidePanel();
525+
526+
com.adobe.cq.wcm.core.components.it.seljup.util.components.teaser.v1.TeaserEditDialog editDialog = teaser.getEditDialog();
527+
Commons.openEditDialog(editorPage, cmpPath);
528+
529+
assertTrue(editDialog.isAltTextFromAssetDescription());
530+
531+
Commons.closeConfigureDialog();
532+
Commons.switchContext("ContentFrame");
533+
534+
assertTrue(teaser.isImagePresentWithAltText(testPage, testImageAltText), "Image should be rendered with alt text: " + testImageAltText);
535+
}
536+
515537
// ----------------------------------------------------------
516538
// private stuff
517539
// ----------------------------------------------------------

0 commit comments

Comments
 (0)