-
Notifications
You must be signed in to change notification settings - Fork 4.6k
chore: Activating the feature flag in cypress for using Entity Item component from ADS templates #39093
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
chore: Activating the feature flag in cypress for using Entity Item component from ADS templates #39093
Changes from 33 commits
1682ff2
75b36b7
304b6d7
e068b56
edbba40
5c13d0e
345fd93
a5b55a1
a4551fa
e320299
672e056
bdc0de9
0182006
e864601
500002f
675a44e
dc62804
29ad43c
f1452fb
7e84052
521dc3e
73bfc57
76f393a
8acb96f
78fbcc4
9bacf69
33461e2
69c15bc
7aa10e2
2b591c2
239a945
4e1852e
6d6a15a
a4eefd0
6c232ca
0c51244
531a76d
9473f99
bfa6253
3a8c91b
e299af4
d88dfd7
13814dc
ea1bd3e
b02398b
5a90ebc
dc24d29
2d726be
29711d5
69a3ddc
dabfa7d
e35c689
b74ccf9
0e996ab
d9e3bad
6344db4
042daf7
77f4b13
627aafd
6eefeb4
b39b620
f086dc2
88cb2f7
3ea586c
eb9a9d2
8908314
2435fd1
c19af30
c1a36af
22d8d6b
43e0b73
94f0fc5
0183f03
68579f6
08bb0b9
8a4a200
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -52,13 +52,9 @@ export class EntityExplorer { | |||||||||||||||||||||||||
| private assertHelper = ObjectsRegistry.AssertHelper; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| public _contextMenu = (entityNameinLeftSidebar: string) => | ||||||||||||||||||||||||||
| "//div[text()='" + | ||||||||||||||||||||||||||
| "//span[text()='" + | ||||||||||||||||||||||||||
| entityNameinLeftSidebar + | ||||||||||||||||||||||||||
| "']/ancestor::div[1]/following-sibling::div//button[contains(@class, 'entity-context-menu')]"; | ||||||||||||||||||||||||||
| _entityNameInExplorer = (entityNameinLeftSidebar: string) => | ||||||||||||||||||||||||||
| "//div[contains(@class, 't--entity-explorer')]//div[contains(@class, 't--entity-name')][text()='" + | ||||||||||||||||||||||||||
| entityNameinLeftSidebar + | ||||||||||||||||||||||||||
| "']"; | ||||||||||||||||||||||||||
| "']/parent::div/following-sibling::div//button"; | ||||||||||||||||||||||||||
|
Comment on lines
54
to
+57
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Update selector to use data- attribute.* The selector uses XPath with hardcoded HTML tags. This is fragile and may break if the UI structure changes. Replace the XPath selector with a data-* attribute: - "//span[text()='" +
- entityNameinLeftSidebar +
- "']/parent::div/following-sibling::div//button";
+ `[data-cy="entity-context-menu-${entityNameinLeftSidebar}"]`;📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| private _visibleTextSpan = (spanText: string) => | ||||||||||||||||||||||||||
| "//span[text()='" + spanText + "']"; | ||||||||||||||||||||||||||
|
|
@@ -72,6 +68,7 @@ export class EntityExplorer { | |||||||||||||||||||||||||
| _widgetTagSuggestedWidgets = ".widget-tag-collapsible-suggested"; | ||||||||||||||||||||||||||
| _widgetTagBuildingBlocks = ".widget-tag-collapsible-building-blocks"; | ||||||||||||||||||||||||||
| _widgetSeeMoreButton = "[data-testid='t--explorer-ui-entity-tag-see-more']"; | ||||||||||||||||||||||||||
| _entityAddButton = ".t--entity-add-btn"; | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use data-testid for entity add button selector. The selector uses a class which is more brittle than data attributes. Apply this diff: - _entityAddButton = ".t--entity-add-btn";
+ _entityAddButton = "[data-testid='t--entity-add-btn']";📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||
| _entityName = ".t--entity-name"; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| public ActionContextMenuByEntityName({ | ||||||||||||||||||||||||||
|
|
@@ -103,7 +100,7 @@ export class EntityExplorer { | |||||||||||||||||||||||||
| toastToValidate: toastToValidate, | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| if (entityType === EntityItems.Page) { | ||||||||||||||||||||||||||
| if (entityType === EntityItems.Page && action !== "Rename") { | ||||||||||||||||||||||||||
| PageList.HideList(); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
@@ -121,16 +118,18 @@ export class EntityExplorer { | |||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| public ValidateDuplicateMessageToolTip(tooltipText: string) { | ||||||||||||||||||||||||||
| this.agHelper.AssertTooltip(tooltipText.concat(" is already being used.")); | ||||||||||||||||||||||||||
| this.agHelper.AssertTooltip( | ||||||||||||||||||||||||||
| tooltipText.concat(" is already being used or is a restricted keyword."), | ||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| public DeleteAllQueriesForDB(dsName: string) { | ||||||||||||||||||||||||||
| AppSidebar.navigate(AppSidebarButton.Editor); | ||||||||||||||||||||||||||
| PageLeftPane.switchSegment(PagePaneSegment.Queries); | ||||||||||||||||||||||||||
| this.agHelper | ||||||||||||||||||||||||||
| .GetElement(this._visibleTextSpan(dsName)) | ||||||||||||||||||||||||||
| .parent() | ||||||||||||||||||||||||||
| .siblings() | ||||||||||||||||||||||||||
| .children() | ||||||||||||||||||||||||||
| .each(($el: any) => { | ||||||||||||||||||||||||||
| cy.wrap($el) | ||||||||||||||||||||||||||
| .find(".t--entity-name") | ||||||||||||||||||||||||||
|
|
@@ -275,8 +274,9 @@ export class EntityExplorer { | |||||||||||||||||||||||||
| action: "Rename", | ||||||||||||||||||||||||||
| entityType, | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
| else cy.xpath(PageLeftPane.listItemSelector(entityName)).dblclick(); | ||||||||||||||||||||||||||
| cy.xpath(this.locator._entityNameEditing(entityName)) | ||||||||||||||||||||||||||
| else cy.get(this.locator._entityTestId(entityName)).dblclick(); | ||||||||||||||||||||||||||
| cy.get(this.locator._entityNameEditing) | ||||||||||||||||||||||||||
| .clear() | ||||||||||||||||||||||||||
| .type(renameVal) | ||||||||||||||||||||||||||
| .wait(500) | ||||||||||||||||||||||||||
| .type("{enter}") | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Use structured assertions instead of plain strings.
Direct string assertions should be replaced with more structured expectations.
📝 Committable suggestion