Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -105,6 +105,7 @@ const DisplayPreferences = ({
onChange={(e) => handleDisplaySettingChange('showInAssetSummary', e.target.checked)}
isDisabled={formValues?.settings?.isHidden}
labelHoverText="If enabled, this property will appear in asset sidebar"
data-testid="structured-props-show-in-asset-summary-switch"
/>
</StyledFormItem>
{formValues?.settings?.showInAssetSummary && (
Expand All @@ -120,6 +121,7 @@ const DisplayPreferences = ({
handleDisplaySettingChange('hideInAssetSummaryWhenEmpty', isChecked)
}
justifyContent="flex-start"
dataTestId="structured-props-hide-in-asset-summary-when-empty-checkbox"
shouldHandleLabelClicks
/>
</CheckboxContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,39 @@ const showStructuredPropertyInColumnsTable = (prop) => {
cy.waitTextVisible(updateToastMessage);
};

const showStructuredPropertyInAssetSummaryTab = (prop) => {
cy.get('[data-testid="structured-props-table"]').contains(prop.name).click();
cy.get(
'[data-testid="structured-props-show-in-asset-summary-switch"]',
).click();
cy.get('[data-testid="structured-props-create-update-button"]').click();
cy.waitTextVisible(updateToastMessage);
};

const hideStructuredPropertyInAssetSummaryTabWhenEmpty = (prop) => {
cy.getWithTestId("structured-props-table").contains(prop.name).click();
cy.getWithTestId(
"structured-props-hide-in-asset-summary-when-empty-checkbox",
).click({ force: true });
cy.getWithTestId("structured-props-create-update-button").click();
cy.waitTextVisible(updateToastMessage);
};

const openEntityAssetSummaryTab = () => {
cy.get('[id="entity-sidebar-tabs-tab-Summary"]').then(($el) => {
const isSelected = $el.attr("aria-selected") === "true";
if (!isSelected) cy.wrap($el).click();
});
};

const ensureStructuredPropertyIsAvailableInAssetSummaryTab = (prop) => {
cy.get('[id="entity-profile-v2-sidebar"]').should("contain", prop.name);
};

const ensureStructuredPropertyIsNotAvailableInAssetSummaryTab = (prop) => {
cy.get('[id="entity-profile-v2-sidebar"]').should("not.contain", prop.name);
};

const addStructuredPropertyToField = (prop) => {
cy.goToDataset(datasetUrn, datasetName);
cy.contains(fieldName);
Expand Down Expand Up @@ -253,4 +286,58 @@ describe("Verify manage structured properties functionalities", () => {
goToStructuredProperties();
deleteStructuredProperty(fieldStructuredProperty);
});

it("Verify property is available in asset summary tab when empty", () => {
const property = {
...structuredProperty,
name: "Property-showInSummaryTab",
};

createStructuredProperty(property);
showStructuredPropertyInAssetSummaryTab(property);
cy.goToDataset(datasetUrn, datasetName);

openEntityAssetSummaryTab();
ensureStructuredPropertyIsAvailableInAssetSummaryTab(property);

goToStructuredProperties();
deleteStructuredProperty(property);
});

it("Verify property is not available in asset summary tab when it's empty", () => {
const property = {
...structuredProperty,
name: "Property-hideInSummaryTabWithoutValue",
};
createStructuredProperty(property);
showStructuredPropertyInAssetSummaryTab(property);
goToStructuredProperties();
hideStructuredPropertyInAssetSummaryTabWhenEmpty(property);
cy.goToDataset(datasetUrn, datasetName);

openEntityAssetSummaryTab();
ensureStructuredPropertyIsNotAvailableInAssetSummaryTab(property);

goToStructuredProperties();
deleteStructuredProperty(property);
});

it("Verify property is available in asset summary tab when it isn't empty", () => {
const property = {
...structuredProperty,
name: "Property-hideInSummaryTabWhenEmptyWithValue",
};
createStructuredProperty(property);
showStructuredPropertyInAssetSummaryTab(property);
goToStructuredProperties();
hideStructuredPropertyInAssetSummaryTabWhenEmpty(property);
cy.goToDataset(datasetUrn, datasetName);
addStructuredPropertyToEntity(property);

openEntityAssetSummaryTab();
ensureStructuredPropertyIsAvailableInAssetSummaryTab(property);

goToStructuredProperties();
deleteStructuredProperty(property);
});
});
Loading