Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Expand Up @@ -22,8 +22,7 @@ describe(
PageLeftPane.switchSegment(PagePaneSegment.UI);
PageLeftPane.assertPresence("Table1");
PageLeftPane.switchSegment(PagePaneSegment.Queries);
cy.RenameEntity(apiName);
cy.validateMessage(apiName);
cy.CreationOfUniqueAPIcheck(apiName);
});
},
);
21 changes: 9 additions & 12 deletions app/client/cypress/support/ApiCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require("cy-verify-downloads").addCustomCommand();
require("cypress-file-upload");
import ApiEditor from "../locators/ApiEditor";

const apiwidget = require("../locators/apiWidgetslocator.json");
const explorer = require("../locators/explorerlocators.json");
import { ObjectsRegistry } from "./Objects/Registry";
Expand Down Expand Up @@ -114,12 +115,10 @@ Cypress.Commands.add("CreationOfUniqueAPIcheck", (apiname) => {
cy.wait("@createNewApi");
// cy.wait("@getUser");
cy.get(apiwidget.resourceUrl).should("be.visible");
agHelper.RenameQuery(apiname);
cy.get(".ads-v2-tooltip .ads-v2-text").should(($x) => {
expect($x).contain(
apiname.concat(" is already being used or is a restricted keyword."),
);
});
agHelper.RenameQuery(
apiname,
apiname.concat(" is already being used or is a restricted keyword."),
);
});

Cypress.Commands.add("RenameEntity", (value, selectFirst) => {
Expand All @@ -138,12 +137,10 @@ Cypress.Commands.add("CreateApiAndValidateUniqueEntityName", (apiname) => {
agHelper.GetNClick(apiwidget.createapi);
cy.wait("@createNewApi");
cy.get(apiwidget.resourceUrl).should("be.visible");
agHelper.RenameQuery(apiname);
cy.get(".ads-v2-tooltip .ads-v2-text").should(($x) => {
expect($x).contain(
apiname.concat(" is already being used or is a restricted keyword."),
);
});
agHelper.RenameQuery(
apiname,
apiname.concat(" is already being used or is a restricted keyword."),
);
});

Cypress.Commands.add("validateMessage", (value) => {
Expand Down
23 changes: 18 additions & 5 deletions app/client/cypress/support/Pages/AggregateHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ interface DeleteParams {
entityType?: EntityItemsType;
toastToValidate?: string;
}

interface SubActionParams {
subAction: string;
index?: number;
force?: boolean;
toastToValidate?: string;
}

interface SelectAndValidateParams {
clickOptions?: Partial<ClickOptions>;
widgetName: string;
Expand All @@ -33,6 +35,7 @@ interface SelectAndValidateParams {
}

let LOCAL_STORAGE_MEMORY: any = {};

export interface IEnterValue {
propFieldName: string;
directInput: boolean;
Expand All @@ -53,12 +56,15 @@ export class AggregateHelper {
public get isMac() {
return Cypress.platform === "darwin";
}

private selectLine = `${
this.isMac ? "{cmd}{shift}{leftArrow}" : "{shift}{home}"
}`;

public get removeLine() {
return "{backspace}";
}

public _modifierKey = `${this.isMac ? "meta" : "ctrl"}`;
private selectAll = `${this.isMac ? "{cmd}{a}" : "{ctrl}{a}"}`;
private lazyCodeEditorFallback = ".t--lazyCodeEditor-fallback";
Expand Down Expand Up @@ -226,6 +232,7 @@ export class AggregateHelper {
textInputLocator: string;
renameVal: string;
dblClick?: boolean;
willFailError?: string;
}) {
const { dblClick = false, nameLocator, renameVal, textInputLocator } = args;

Expand All @@ -240,11 +247,15 @@ export class AggregateHelper {
cy.get(textInputLocator)
.clear({ force: true })
.type(renameVal, { force: true, delay: 0 })
.should("have.value", renameVal)
.blur();

this.PressEnter();
.should("have.value", renameVal);

if (args.willFailError) {
this.AssertContains(args.willFailError, "exist", ".ads-v2-tooltip");
cy.get(textInputLocator).blur();
} else {
cy.get(textInputLocator).blur();
this.PressEnter();
}
this.Sleep();
}

Expand All @@ -257,12 +268,13 @@ export class AggregateHelper {
this.AssertElementVisibility(this.locator._editIcon);
}

public RenameQuery(renameVal: string) {
public RenameQuery(renameVal: string, willFailError?: string) {
this.rename({
nameLocator: this.locator._queryName,
textInputLocator: this.locator._queryNameTxt,
renameVal,
dblClick: true,
willFailError,
});
}

Expand Down Expand Up @@ -937,6 +949,7 @@ export class AggregateHelper {
this.TypeText(selector, totype, index);
}
}

public ClickNClear(selector: string, force = false, index = 0) {
this.GetNClick(selector, index, force);
this.ClearTextField(selector, force, index);
Expand Down