Skip to content
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
3d10db4
remove testid from ForkTemplate modal
jacquesikot Jan 10, 2024
be509fd
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Jan 11, 2024
5f53f7d
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Jan 12, 2024
4e84de9
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Jan 15, 2024
d34ab5d
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Jan 17, 2024
6c76fc0
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Jan 23, 2024
fbf2da8
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Jan 25, 2024
1435ce3
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Jan 25, 2024
4b77394
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Jan 29, 2024
b348574
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Feb 6, 2024
bc4cafb
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Feb 15, 2024
6e9baea
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Mar 17, 2024
1dd0e9a
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Apr 4, 2024
8cfa49c
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Apr 16, 2024
e8d2ef0
add 4 cypress test cases for building blocks
jacquesikot Apr 18, 2024
813c3b4
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Apr 23, 2024
6c10107
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Apr 24, 2024
38eb5ac
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Apr 29, 2024
922e49e
create base PR
jacquesikot Apr 29, 2024
df26919
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot Apr 30, 2024
cc3da8a
push changes to rahul
jacquesikot Apr 30, 2024
0ce8f9b
added test case for drag and drop BB on canvas
jacquesikot May 1, 2024
8ad615e
add new test tag
jacquesikot May 1, 2024
5d92b68
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot May 1, 2024
60a0982
remove assert
jacquesikot May 1, 2024
3364deb
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot May 9, 2024
b33c48b
setup changes for dropping block
jacquesikot May 10, 2024
0d68b72
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot May 12, 2024
7aca7b9
add test for droppin and failing blocks
jacquesikot May 12, 2024
a0d47c8
update sample block to view data
jacquesikot May 12, 2024
b6b81df
fix before each issue
jacquesikot May 13, 2024
029e189
remove test for dailing /blobk api
jacquesikot May 13, 2024
6ce3de9
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot May 13, 2024
c05dcbb
fix tests on release
jacquesikot May 13, 2024
9575d97
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot May 14, 2024
d679225
allow first building block to be dropped in test
jacquesikot May 15, 2024
ae4ae11
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot May 15, 2024
0d7683d
add and remove skeleton widget with no reflow base
jacquesikot May 15, 2024
b9b2b61
Revert "add and remove skeleton widget with no reflow base"
jacquesikot May 15, 2024
791f542
revert changes
jacquesikot May 15, 2024
f1f27d3
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
jacquesikot May 17, 2024
2b8f502
fix .each redundancy
jacquesikot May 17, 2024
0a9bd72
exculde for airgap and extract bb selector to testId
jacquesikot May 17, 2024
f99d714
remove var
jacquesikot May 17, 2024
ea02ee1
remove testid
jacquesikot May 17, 2024
07eaa5e
remove focued test
jacquesikot May 17, 2024
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
@@ -0,0 +1,250 @@
import { initialEntityCountForExplorerTag } from "../../../../../src/constants/WidgetConstants";
import { featureFlagIntercept } from "../../../../support/Objects/FeatureFlags";
import {
entityExplorer,
agHelper,
} from "../../../../support/Objects/ObjectsCore";
import { PageLeftPane } from "../../../../support/Pages/EditorNavigation";
import explorerLocators from "../../../../locators/explorerlocators.json";

const MAX_BUILDING_BLOCKS_TO_DISPLAY = initialEntityCountForExplorerTag[
"Building Blocks"
] as number;

describe(
"Building blocks explorer tests",
{
tags: [
"@tag.IDE",
"@tag.Widget",
"@tag.Templates",
"@tag.excludeForAirgap",
],
},
() => {
it("1. Building blocks tag is visible and open by default", () => {
featureFlagIntercept({ release_drag_drop_building_blocks_enabled: true });
agHelper
.GetElement(`${entityExplorer._widgetTagBuildingBlocks}`)
.each(($widgetTag) => {
const widgetsInThisTag: string[] = [];
agHelper
.GetElement($widgetTag)
.find(entityExplorer._widgetCardTitle)
.each(($widgetName) => {
const value = $widgetName.text();
widgetsInThisTag.push(value);
})
.then(() => {
expect(widgetsInThisTag).to.have.length.gt(1);
});
});
});

it("2. If widgets are more than 9, see more button should be visible", () => {
featureFlagIntercept({ release_drag_drop_building_blocks_enabled: true });
let widgetsInThisTag: string[] = [];

agHelper
.GetElement(`${entityExplorer._widgetTagBuildingBlocks}`)
.each(($widgetTag) => {
agHelper
.GetElement($widgetTag)
.find(entityExplorer._widgetCardTitle)
.each(($widgetName) => {
const value = $widgetName.text();
widgetsInThisTag.push(value);
});
});

if (widgetsInThisTag.length > MAX_BUILDING_BLOCKS_TO_DISPLAY) {
agHelper.AssertElementVisibility(
entityExplorer._widgetSeeMoreButton,
true,
);
}
});

it("3. Should not show the 'See More' button if widgets are less than 9", () => {
featureFlagIntercept({ release_drag_drop_building_blocks_enabled: true });

// Array to store the names of widgets found
const widgetsInThisTag: string[] = [];

// Find and iterate over each widget card title within the specified tag
agHelper
.GetElement(`${entityExplorer._widgetTagBuildingBlocks}`)
.find(entityExplorer._widgetCardTitle)
.each(($widgetName) => {
// Extract the text of each widget title
const value = $widgetName.text().trim();
widgetsInThisTag.push(value);
})
.then(() => {
// After collecting widget names, assert based on the count
if (widgetsInThisTag.length < MAX_BUILDING_BLOCKS_TO_DISPLAY) {
// If less than 9 widgets, ensure the 'See More' button does not exist
agHelper.AssertElementVisibility(
entityExplorer._widgetSeeMoreButton,
false,
);
} else {
// If 9 or more widgets, ensure the 'See More' button exists
agHelper.AssertElementVisibility(
entityExplorer._widgetSeeMoreButton,
true,
);
}
});
});

it("4. Clicking on 'See More' button should show all widgets, and 'See Less' should show max 9 widgets", () => {
featureFlagIntercept({ release_drag_drop_building_blocks_enabled: true });

let widgetsInThisTag: string[] = [];

// Get all building blocks before attempting to click "See More"
// cy.get(entityExplorer._widgetTagBuildingBlocks)
agHelper
.GetElement(`${entityExplorer._widgetTagBuildingBlocks}`)
.each(($widgetTag) => {
agHelper
.GetElement($widgetTag)
.find(entityExplorer._widgetCardTitle)
.each(($widgetName) => {
const value = $widgetName.text().trim();
widgetsInThisTag.push(value);
});
})
.then(() => {
// Check if there are fewer than 9 widgets
if (widgetsInThisTag.length < MAX_BUILDING_BLOCKS_TO_DISPLAY) {
// No need to click "See More" if there are already fewer than 9 widgets
// cy.get(entityExplorer._widgetSeeMoreButton).should("not.exist");
agHelper.AssertElementVisibility(
entityExplorer._widgetSeeMoreButton,
false,
);
} else {
// Click the "See More" button for each widget tag
agHelper
.GetElement(entityExplorer._widgetTagsList)
.each(($widgetTag) => {
agHelper
.GetElement($widgetTag)
.find(entityExplorer._widgetSeeMoreButton)
.should("exist")
.click({ force: true });
});
}

// Get all building blocks after attempting to click "See More"
let widgetsInThisTagAfterSeeMore: string[] = [];
// cy.get(entityExplorer._widgetTagBuildingBlocks)
agHelper
.GetElement(`${entityExplorer._widgetTagBuildingBlocks}`)
.each(($widgetTag) => {
agHelper
.GetElement($widgetTag)
.find(entityExplorer._widgetCardTitle)
.each(($widgetName) => {
const value = $widgetName.text().trim();
widgetsInThisTagAfterSeeMore.push(value);
});
})
.then(() => {
// Assert that the number of widgets after potentially clicking "See More" is correct
expect(widgetsInThisTagAfterSeeMore.length).to.be.at.least(
widgetsInThisTag.length,
);
});

// Click the same "See More" button again to simulate "See Less"
agHelper
.GetElement(entityExplorer._widgetTagsList)
.each(($widgetTag) => {
agHelper
.GetElement($widgetTag)
.find(entityExplorer._widgetSeeMoreButton)
.should("exist") // Check if the button still exists (now interpreted as "See Less")
.click({ force: true });
});

// Get all building blocks after clicking "See Less"
let widgetsInThisTagAfterSeeLess: string[] = [];
agHelper
.GetElement(entityExplorer._widgetTagBuildingBlocks)
.each(($widgetTag) => {
agHelper
.GetElement($widgetTag)
.find(entityExplorer._widgetCardTitle)
.each(($widgetName) => {
const value = $widgetName.text().trim();
widgetsInThisTagAfterSeeLess.push(value);
});
})
.then(() => {
// Assert that the number of widgets after clicking "See Less" is back to original count
expect(widgetsInThisTagAfterSeeLess.length).to.equal(
widgetsInThisTag.length,
);
});
});
});

it("5. Should drag and drop building block on canvas", () => {
featureFlagIntercept({ release_drag_drop_building_blocks_enabled: true });
// primary api call for dropping building blocks on canvas
cy.intercept("POST", "/api/v1/applications/import/partial/block").as(
"blockImport",
);
const x = 600;
const y = 80;
// select the first building block in the list
const selector = ".t--widget-card-draggable-buildingblock";
agHelper.Sleep(500);
agHelper
.GetElement(selector)
.first()
.trigger("dragstart", { force: true })
.trigger("mousemove", x, y, { force: true });

const option = {
eventConstructor: "MouseEvent",
scrollBehavior: false,
} as any;

agHelper
.GetElement(explorerLocators.dropHere)
.trigger("mousemove", x, y, option)
.trigger("mousemove", x, y, option)
.trigger("mouseup", x, y, option);

// check that loading skeleton is present
let buildingBlockName: string; // get the display name of the first building block
agHelper
.GetElement(entityExplorer._widgetTagBuildingBlocks)
.first()
.then(($widgetTag) => {
agHelper
.GetElement($widgetTag)
.find(entityExplorer._widgetCardTitle)
.first()
.then(($widgetName) => {
buildingBlockName = $widgetName.text();
PageLeftPane.assertPresence(
`loading_${buildingBlockName.toLowerCase().replace(/ /g, "_")}`,
);
});
});
cy.wait("@blockImport").then(() => {
cy.assertPageSave();
// check that the widgets are present on the canvas
agHelper.AssertElementVisibility('[data-testid="t--ide-list"]');
agHelper
.GetElement('[data-testid="t--ide-list"] .t--entity-item')
.should("have.length.greaterThan", 0);
});
});
},
);