Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SITES-22027] Issue with Image Component Get caption from DAM field persistence #2757

Merged
merged 8 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
$cqFileUpload.on("click", "[coral-fileupload-clear]", function() {
altTuple.reset();
captionTuple.reset();
captionTuple.hideCheckbox(true);
altTuple.hideCheckbox(true);
});
$cqFileUpload.on("coral-fileupload:fileadded", function() {
if (isDecorative) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@
$cqFileUpload.on("click", "[coral-fileupload-clear]", function() {
altTuple.reset();
captionTuple.reset();
captionTuple.hideCheckbox(true);
altTuple.hideCheckbox(true);
});
$cqFileUpload.on("coral-fileupload:fileadded", function() {
if (isDecorative) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
public class ImageEditDialog extends Dialog {

private static String fileUpload = "coral-fileupload[name='./file']";

private static String clearButton = "button[class='cq-FileUpload-clear _coral-Button _coral-Button--primary _coral-Button--quiet']";
private static String imageInSidePanel = "coral-card.cq-draggable[data-path=\"%s\"]";
private static String altText = "input[name='./alt']";
private static String linkUrl = "[name='./linkURL']";
Expand Down Expand Up @@ -78,6 +80,13 @@ public void setTitle(String value) {
content().find(title).sendKeys(value);
}

public void clickClearButton() {
final WebDriver webDriver = WebDriverRunner.getWebDriver();
new WebDriverWait(webDriver, RequestConstants.DURATION_TIMEOUT)
.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(String.format("%s coral-dialog-header", this.getCssSelector()))));
content().find(clearButton).click();
}

public void checkCaptionAsPopUp() {
CoralCheckbox checkbox = new CoralCheckbox(popUpTitle);
checkbox.click();
Expand Down Expand Up @@ -146,6 +155,16 @@ public boolean isAltFromDAM() {
return checkbox.isChecked();
}

public boolean isTitleFromDAMVisible() {
CoralCheckbox checkbox = new CoralCheckbox(titleValueFromDAM);
return checkbox.isVisible();
}

public boolean isAltFromDAMVisible() {
CoralCheckbox checkbox = new CoralCheckbox(altValueFromDAM);
return checkbox.isVisible();
}

public boolean isPopUpTitle() {
CoralCheckbox checkbox = new CoralCheckbox(popUpTitle);
return checkbox.isChecked();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,17 @@ public void testSmartCropOnNGDMImageV3(String cropName) throws TimeoutException,
assertTrue(image.isImagePresentWithSmartCrop(cropName),"NGDM image should be rendered with a smartcrop");
}

public void testClearAssetInputGetDamInfoCheckboxesNotVisible() throws InterruptedException, TimeoutException {
Commons.openSidePanel();
dragImage();
ImageEditDialog editDialog = image.getEditDialog();
assertTrue(editDialog.isTitleFromDAMVisible());
assertTrue(editDialog.isAltFromDAMVisible());
editDialog.clickClearButton();
assertFalse(editDialog.isTitleFromDAMVisible());
assertFalse(editDialog.isAltFromDAMVisible());
}

// ----------------------------------------------------------
// private stuff
// ----------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,10 @@ public void testSetAssetWithoutDescriptionAsDecorative() throws TimeoutException
imageTests.testSetAssetWithoutDescriptionAsDecorative(false);
}

@Test
@DisplayName("Test: clear asset input field, get Dam info checkboxes become invisible")
public void testClearAssetInputGetDamInfoCheckboxesNotVisible() throws InterruptedException, TimeoutException {
imageTests.testClearAssetInputGetDamInfoCheckboxesNotVisible();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,10 @@
public void testSetAssetWithoutDescriptionAsDecorative() throws TimeoutException, InterruptedException {
imageTests.testSetAssetWithoutDescriptionAsDecorative(true);
}

@Test
@DisplayName("Test: clear asset input field, get Dam info checkboxes become invisible")
public void testClearAssetInputGetDamInfoCheckboxesNotVisible() throws InterruptedException, TimeoutException {
Fixed Show fixed Hide fixed
imageTests.testClearAssetInputGetDamInfoCheckboxesNotVisible();
}
}
Loading