Skip to content
Merged
Changes from 19 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,158 @@
import { featureFlagIntercept } from "../../../../support/Objects/FeatureFlags";
import {
entityExplorer,
agHelper,
} from "../../../../support/Objects/ObjectsCore";

const commonlocators = require("../../../../locators/commonlocators.json");

// Taken from here appsmith/app/client/src/constants/WidgetConstants.tsx
const MAX_BUILDING_BLOCKS_TO_DISPLAY = 9;
Comment thread
rahulbarwal marked this conversation as resolved.
Outdated

describe(
"Building blocks explorer tests",
{
tags: ["@tag.IDE", "@tag.Widget"],
},
() => {
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[] = [];
cy.wrap($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) => {
cy.wrap($widgetTag)
.find(entityExplorer._widgetCardTitle)
.each(($widgetName) => {
const value = $widgetName.text();
widgetsInThisTag.push(value);
});
});

if (widgetsInThisTag.length > MAX_BUILDING_BLOCKS_TO_DISPLAY) {
cy.get(entityExplorer._widgetSeeMoreButton).should("be.visible");
}
Comment on lines +36 to +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address the variable scope issue to prevent potential test failures.

The variable widgetsInThisTag is defined outside the .each() block but is used inside it, which might lead to incorrect behavior due to asynchronous execution. Consider defining it inside the .each() block or using a different approach to ensure correct behavior.

});

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
cy.get(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
cy.get(entityExplorer._widgetSeeMoreButton).should("not.exist");
} else {
// If 9 or more widgets, ensure the 'See More' button exists
cy.get(entityExplorer._widgetSeeMoreButton).should("exist");
}
Comment on lines +56 to +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to remove redundant conditions.

The conditions in lines 73 and 77 are redundant since they are mutually exclusive and handled in the same .then() block. Consider simplifying the logic to enhance readability and maintainability.

});
});

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)
.each(($widgetTag) => {
cy.wrap($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");
} else {
// Click the "See More" button for each widget tag
cy.get(entityExplorer._widgetTagsList).each(($widgetTag) => {
cy.wrap($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)
.each(($widgetTag) => {
cy.wrap($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.greaterThan(
widgetsInThisTag.length,
);
});

// Click the same "See More" button again to simulate "See Less"
cy.get(entityExplorer._widgetTagsList).each(($widgetTag) => {
cy.wrap($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[] = [];
cy.get(entityExplorer._widgetTagBuildingBlocks)
.each(($widgetTag) => {
cy.wrap($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,
);
});
});
});
},
);