Skip to content

Commit

Permalink
updating locators
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitakinger committed Feb 7, 2025
1 parent 5c13d0e commit 345fd93
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
10 changes: 8 additions & 2 deletions app/client/cypress/support/Objects/CommonLocators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class CommonLocators {
_entityNameEditing = (entityNameinLeftSidebar: string) =>
"//span[text()='" +
entityNameinLeftSidebar +
"']/parent::div[contains(@class, 't--entity-name editing')]/input";
"']/parent::span[contains(@class, 't--entity-name editing')]/input";
_jsToggle = (controlToToggle: string) =>
`.t--property-control-${controlToToggle} .t--js-toggle, [data-guided-tour-iid='${controlToToggle}']`;
_buttonByText = (btnVisibleText: string) =>
Expand Down Expand Up @@ -334,9 +334,14 @@ export class CommonLocators {
_exitFullScreen = ".application-demo-new-dashboard-control-exit-fullscreen";
_menuItem = ".bp3-menu-item";
_slashCommandHintText = ".slash-command-hint-text";
_selectionItem = ".rc-select-selection-item";
errorPageTitle = ".t--error-page-title";
errorPageDescription = ".t--error-page-description";
_moduleInstanceEntity = (module: string) =>
`[data-testid=t--entity-item-${module}1]`;
_codeEditor = "[data-testid=code-editor-target]";
_selectionItem = ".rc-select-selection-item";
_moduleInputEntity = (inputName: string) =>
`[data-testid=t--module-instance-input-field-wrapper-${inputName}]`;
_selectClearButton_testId = "selectbutton.btn.cancel";
_selectClearButton_dataTestId = `[data-testid="${this._selectClearButton_testId}"]`;
_saveDatasource = `[data-testid='t--store-as-datasource']`;
Expand All @@ -347,6 +352,7 @@ export class CommonLocators {
_showBoundary = ".show-boundary";
_entityItem = "[data-testid='t--entity-item-Api1']";
_rowData = "[data-colindex='0'][data-rowindex='0']";
_visualNonIdeaState = ".bp3-non-ideal-state";
_editorTab = ".editor-tab";
_entityTestId = (entity: string) =>
`[data-testid="t--entity-item-${entity}"]`;
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/support/Pages/EditorNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export enum EditorViewMode {
}

const pagePaneListItemSelector = (name: string) =>
"//div[contains(@class, 't--entity-name')][text()='" + name + "']";
"//span[contains(@class, 't--entity-name')][text()='" + name + "']";

export const PageLeftPane = new LeftPane(
pagePaneListItemSelector,
Expand Down
5 changes: 1 addition & 4 deletions app/client/cypress/support/Pages/EntityExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ export class EntityExplorer {
"//div[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 +
"']";

private _visibleTextSpan = (spanText: string) =>
"//span[text()='" + spanText + "']";
Expand All @@ -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";
_entityName = ".t--entity-name";

public ActionContextMenuByEntityName({
Expand Down
8 changes: 3 additions & 5 deletions app/client/cypress/support/Pages/IDE/LeftPane.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { ObjectsRegistry } from "../../Objects/Registry";
import { PagePaneSegment } from "../EditorNavigation";
import AddView from "./AddView";
import FileTabs from "./FileTabs";
import ListView from "./ListView";

export class LeftPane {
Expand All @@ -11,9 +9,7 @@ export class LeftPane {
locators = {
segment: (name: string) => "//span[text()='" + name + "']/ancestor::div",
expandCollapseArrow: (name: string) =>
"//div[text()='" +
name +
"']/ancestor::div/span[contains(@class, 't--entity-collapse-toggle')]",
`//span[contains(@class, 't--entity-name')][text()="${name}"]/ancestor::div//*[@data-testid="t--entity-collapse-toggle"]`,
activeItemSelector: "",
selector: "",
};
Expand Down Expand Up @@ -83,13 +79,15 @@ export class LeftPane {
.then((state) => {
const closed = state === "arrow-right-s-line";
const opened = state === "arrow-down-s-line";

if ((expand && closed) || (!expand && opened)) {
ObjectsRegistry.AggregateHelper.GetNClick(
this.locators.expandCollapseArrow(itemName),
);
}
});
}

public selectedItem(
exists?: "exist" | "not.exist" | "noVerify",
): Cypress.Chainable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const EditableEntityName = (props: EditableEntityNameProps) => {
>
<Styled.Text
aria-invalid={Boolean(validationError)}
className="t--entity-name"
className="t--entity-name editing"
data-isediting={inEditMode}
data-isfixedwidth={isFixedWidth}
inputProps={inputProps}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export function EntityListTree(props: EntityListTreeProps) {
{item.children && item.children.length ? (
<CollapseWrapper
data-itemid={item.id}
data-testid="entity-item-expand-icon"
data-testid="t--entity-collapse-toggle"
id={
item.isExpanded ? "arrow-down-s-line" : "arrow-right-s-line"
}
onClick={handleOnExpandClick}
>
<Icon
Expand Down

0 comments on commit 345fd93

Please sign in to comment.