Skip to content

Commit 7224c97

Browse files
Merge pull request #156 from layer5labs/CodeAhmedJamil-patch-1
Fix snapshot crashing at removing elements
2 parents 08ad872 + da6018f commit 7224c97

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

cypress-action/cypress/e2e/e2e/loadDesign.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,22 @@ const removeWidgets = () => {
7070
"kanvas-bottom-dock",
7171
"left-navigation-bar",
7272
"top-navigation-bar",
73+
"hide-from-design-snapshot",
7374
];
7475

75-
ids.forEach((className) => {
76-
try {
77-
cy.get(`#${className}`).invoke("remove");
78-
} catch (error) {
79-
console.log(`Error removing ${className}`);
80-
}
76+
ids.forEach((id) => {
77+
cy.get(`#${id}`, { timeout: 0 }).then(($el) => {
78+
if ($el.length) {
79+
$el.remove();
80+
}
81+
}).catch(() => {
82+
// Element not found, do nothing
83+
console.log(`Element #${id} not found`);
84+
});
8185
});
8286
};
8387

88+
8489
["light", "dark"].forEach((theme) => {
8590
InfraShot(theme);
8691
});

0 commit comments

Comments
 (0)