test: removing unused commands from Commands file (#33617)
RCA: There are many unused commands within commands.js file Solution: Checked the commands in both CE and EE repository and we are removing those commands whcih are not used in any tests as part of cleanup activity /ok-to-test tags="@tag.All" <!-- This is an auto-generated comment: Cypress test results --> > [!WARNING] > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9177375213> > Commit: 925d75886a1d3db4bd9f065ab13dd88c56808c8a > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9177375213&attempt=1" target="_blank">Click here!</a> > It seems like **no tests ran** 😔. We are not able to recognize it, please check workflow <a href="https://github.com/appsmithorg/appsmith/actions/runs/9177375213" target="_blank">here.</a> <!-- end of auto-generated comment: Cypress test results -->
This commit is contained in:
parent
b831a3943b
commit
03f45ec81d
|
|
@ -107,56 +107,6 @@ export const addIndexedDBKey = (key, value) => {
|
||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
|
|
||||||
Cypress.Commands.add(
|
|
||||||
"dragTo",
|
|
||||||
{ prevSubject: "element" },
|
|
||||||
(subject, targetEl) => {
|
|
||||||
cy.wrap(subject).trigger("dragstart");
|
|
||||||
cy.get(targetEl).trigger("drop");
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Cypress.Commands.add("downloadData", (filetype) => {
|
|
||||||
cy.get(publishWidgetspage.downloadBtn).click({ force: true });
|
|
||||||
|
|
||||||
cy.get(publishWidgetspage.downloadOption)
|
|
||||||
.contains(filetype)
|
|
||||||
.click({ force: true });
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("validateDownload", (fileName) => {
|
|
||||||
// const downloadedFilename = Cypress.config("downloadsFolder")
|
|
||||||
// .concat("/")
|
|
||||||
// .concat(fileName);
|
|
||||||
// cy.readFile(downloadedFilename, "binary", {
|
|
||||||
// timeout: 15000,
|
|
||||||
// }).should((buffer) => expect(buffer.length).to.be.gt(100));
|
|
||||||
|
|
||||||
let downloadsFolder = Cypress.config("downloadsFolder");
|
|
||||||
cy.log("downloadsFolder is:" + downloadsFolder);
|
|
||||||
cy.readFile(path.join(downloadsFolder, fileName)).should("exist");
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add(
|
|
||||||
"AddFilterWithOperator",
|
|
||||||
(operator, option, condition, value) => {
|
|
||||||
cy.get(publishWidgetspage.addFilter).click();
|
|
||||||
cy.get(publishWidgetspage.operatorsDropdown).click({ force: true });
|
|
||||||
cy.get(publishWidgetspage.attributeValue)
|
|
||||||
.contains(operator)
|
|
||||||
.click({ force: true });
|
|
||||||
cy.get(publishWidgetspage.attributesDropdown).last().click({ force: true });
|
|
||||||
cy.get(publishWidgetspage.attributeValue)
|
|
||||||
.contains(option)
|
|
||||||
.click({ force: true });
|
|
||||||
cy.get(publishWidgetspage.conditionDropdown).last().click({ force: true });
|
|
||||||
cy.get(publishWidgetspage.attributeValue)
|
|
||||||
.contains(condition)
|
|
||||||
.click({ force: true });
|
|
||||||
cy.get(publishWidgetspage.inputValue).last().type(value);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Cypress.Commands.add("stubPostHeaderReq", () => {
|
Cypress.Commands.add("stubPostHeaderReq", () => {
|
||||||
cy.intercept("POST", "/api/v1/users/invite", (req) => {
|
cy.intercept("POST", "/api/v1/users/invite", (req) => {
|
||||||
req.headers["origin"] = "Cypress";
|
req.headers["origin"] = "Cypress";
|
||||||
|
|
@ -166,50 +116,6 @@ Cypress.Commands.add("stubPostHeaderReq", () => {
|
||||||
}).as("mockPostAppInvite");
|
}).as("mockPostAppInvite");
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add(
|
|
||||||
"addOAuth2AuthorizationCodeDetails",
|
|
||||||
(accessTokenUrl, clientId, clientSecret, authURL) => {
|
|
||||||
cy.get(datasource.authType).click();
|
|
||||||
cy.get(datasource.OAuth2).click();
|
|
||||||
cy.get(datasource.grantType).click();
|
|
||||||
cy.get(datasource.authorizationCode).click();
|
|
||||||
cy.get(datasource.accessTokenUrl).type(accessTokenUrl);
|
|
||||||
cy.get(datasource.clienID).type(clientId);
|
|
||||||
cy.get(datasource.clientSecret).type(clientSecret);
|
|
||||||
cy.get(datasource.authorizationURL).type(authURL);
|
|
||||||
cy.xpath('//input[contains(@value,"api/v1/datasources/authorize")]')
|
|
||||||
.first()
|
|
||||||
.invoke("attr", "value")
|
|
||||||
.then((text) => {
|
|
||||||
const firstTxt = text;
|
|
||||||
cy.log("date time : ", firstTxt);
|
|
||||||
const expectedvalue = Cypress.config().baseUrl.concat(
|
|
||||||
"api/v1/datasources/authorize",
|
|
||||||
);
|
|
||||||
expect(firstTxt).to.equal(expectedvalue);
|
|
||||||
});
|
|
||||||
cy.testSelfSignedCertificateSettingsInREST(true);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Cypress.Commands.add(
|
|
||||||
"addOAuth2ClientCredentialsDetails",
|
|
||||||
(accessTokenUrl, clientId, clientSecret, scope) => {
|
|
||||||
cy.get(datasource.authType).click();
|
|
||||||
cy.get(datasource.OAuth2).click();
|
|
||||||
cy.xpath("//span[text()='Client Credentials']").should("be.visible");
|
|
||||||
cy.get(datasource.accessTokenUrl).type(accessTokenUrl);
|
|
||||||
cy.get(datasource.clienID).type(clientId);
|
|
||||||
cy.get(datasource.clientSecret).type(clientSecret);
|
|
||||||
cy.get(datasource.scope).type(scope);
|
|
||||||
cy.get(datasource.clientAuthentication).should("be.visible");
|
|
||||||
cy.xpath("//span[text()='Send client credentials in body']").should(
|
|
||||||
"be.visible",
|
|
||||||
);
|
|
||||||
cy.testSelfSignedCertificateSettingsInREST(true);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Cypress.Commands.add("testSelfSignedCertificateSettingsInREST", (isOAuth2) => {
|
Cypress.Commands.add("testSelfSignedCertificateSettingsInREST", (isOAuth2) => {
|
||||||
cy.get(datasource.useCertInAuth).should("not.exist");
|
cy.get(datasource.useCertInAuth).should("not.exist");
|
||||||
cy.get(datasource.certificateDetails).should("not.exist");
|
cy.get(datasource.certificateDetails).should("not.exist");
|
||||||
|
|
@ -231,29 +137,6 @@ Cypress.Commands.add("addBasicProfileDetails", (username, password) => {
|
||||||
cy.get(datasource.basicPassword).type(password);
|
cy.get(datasource.basicPassword).type(password);
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("DeleteApp", (appName) => {
|
|
||||||
cy.get(commonlocators.homeIcon).click({ force: true });
|
|
||||||
cy.wait("@applications").should(
|
|
||||||
"have.nested.property",
|
|
||||||
"response.body.responseMeta.status",
|
|
||||||
200,
|
|
||||||
);
|
|
||||||
cy.wait("@workspaces").should(
|
|
||||||
"have.nested.property",
|
|
||||||
"response.body.responseMeta.status",
|
|
||||||
200,
|
|
||||||
);
|
|
||||||
cy.get('button span[icon="chevron-down"]').should("be.visible");
|
|
||||||
cy.get(homePage.searchInput).clear().type(appName, { force: true });
|
|
||||||
cy.get(homePage.applicationCard).trigger("mouseover");
|
|
||||||
cy.get("[data-testid=t--application-card-context-menu]")
|
|
||||||
.should("have.length", 1)
|
|
||||||
.first()
|
|
||||||
.click({ force: true });
|
|
||||||
cy.get(homePage.deleteAppConfirm).should("be.visible").click({ force: true });
|
|
||||||
cy.get(homePage.deleteApp).should("be.visible").click({ force: true });
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("GetUrlQueryParams", () => {
|
Cypress.Commands.add("GetUrlQueryParams", () => {
|
||||||
return cy.url().then((url) => {
|
return cy.url().then((url) => {
|
||||||
const arr = url.split("?")[1]?.split("&");
|
const arr = url.split("?")[1]?.split("&");
|
||||||
|
|
@ -298,35 +181,6 @@ Cypress.Commands.add("LogintoApp", (uname, pword) => {
|
||||||
initLocalstorage();
|
initLocalstorage();
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("LogintoAppTestUser", (uname, pword) => {
|
|
||||||
cy.LogOutUser();
|
|
||||||
cy.LoginUser(uname, pword);
|
|
||||||
initLocalstorage();
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("Signup", (uname, pword) => {
|
|
||||||
homePageTS.InvokeDispatchOnStore();
|
|
||||||
cy.wait("@postLogout");
|
|
||||||
cy.visit("/user/signup", { timeout: 60000 });
|
|
||||||
cy.wait("@getConsolidatedData")
|
|
||||||
.its("response.body.responseMeta.status")
|
|
||||||
.should("eq", 200);
|
|
||||||
agHelper.WaitUntilEleAppear(signupPage.username);
|
|
||||||
cy.get(signupPage.username).type(uname);
|
|
||||||
cy.get(signupPage.password).type(pword);
|
|
||||||
agHelper.GetNClick(signupPage.submitBtn);
|
|
||||||
agHelper.GetElement("body").then(($body) => {
|
|
||||||
if ($body.find(signupPage.proficiencyGroupButton).length > 0) {
|
|
||||||
cy.get(signupPage.proficiencyGroupButton).first().click();
|
|
||||||
cy.get(signupPage.useCaseGroupButton).first().click();
|
|
||||||
cy.get(signupPage.getStartedSubmit).click({ force: true });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
cy.wait("@getConsolidatedData");
|
|
||||||
cy.wait(3000);
|
|
||||||
initLocalstorage();
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("LoginFromAPI", (uname, pword) => {
|
Cypress.Commands.add("LoginFromAPI", (uname, pword) => {
|
||||||
let baseURL = Cypress.config().baseUrl;
|
let baseURL = Cypress.config().baseUrl;
|
||||||
baseURL = baseURL.endsWith("/") ? baseURL.slice(0, -1) : baseURL;
|
baseURL = baseURL.endsWith("/") ? baseURL.slice(0, -1) : baseURL;
|
||||||
|
|
@ -375,19 +229,6 @@ Cypress.Commands.add("LoginFromAPI", (uname, pword) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("DeleteApp", (appName) => {
|
|
||||||
cy.get(commonlocators.homeIcon).click({ force: true });
|
|
||||||
cy.get(homePage.searchInput).type(appName);
|
|
||||||
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
||||||
cy.wait(2000);
|
|
||||||
cy.get(homePage.applicationCard).first().trigger("mouseover");
|
|
||||||
cy.get("[data-testid=t--application-card-context-menu]")
|
|
||||||
.first()
|
|
||||||
.click({ force: true });
|
|
||||||
cy.get(homePage.deleteAppConfirm).should("be.visible").click({ force: true });
|
|
||||||
cy.get(homePage.deleteApp).contains("Are you sure?").click({ force: true });
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("LogOut", (toCheckgetPluginForm = true) => {
|
Cypress.Commands.add("LogOut", (toCheckgetPluginForm = true) => {
|
||||||
agHelper.WaitUntilAllToastsDisappear();
|
agHelper.WaitUntilAllToastsDisappear();
|
||||||
//Since these are coming in every self-hosted 1st time login, commenting for CI runs
|
//Since these are coming in every self-hosted 1st time login, commenting for CI runs
|
||||||
|
|
@ -447,27 +288,6 @@ Cypress.Commands.add("ClearSearch", () => {
|
||||||
cy.get(commonlocators.entityExplorersearch).clear({ force: true });
|
cy.get(commonlocators.entityExplorersearch).clear({ force: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add(
|
|
||||||
"paste",
|
|
||||||
{
|
|
||||||
prevSubject: true,
|
|
||||||
element: true,
|
|
||||||
},
|
|
||||||
($element, text) => {
|
|
||||||
const subString = text.slice(0, -1);
|
|
||||||
const lastChar = text.slice(-1);
|
|
||||||
|
|
||||||
cy.get(commonlocators.entityExplorersearch)
|
|
||||||
.clear({ force: true })
|
|
||||||
.click({ force: true })
|
|
||||||
.then(() => {
|
|
||||||
$element.text(subString);
|
|
||||||
$element.val(subString);
|
|
||||||
cy.get($element).type(lastChar);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Cypress.Commands.add("clickTest", (testbutton) => {
|
Cypress.Commands.add("clickTest", (testbutton) => {
|
||||||
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
||||||
cy.wait(2000);
|
cy.wait(2000);
|
||||||
|
|
@ -627,42 +447,6 @@ Cypress.Commands.add("togglebar", (value) => {
|
||||||
cy.get(value).check({ force: true }).should("be.checked");
|
cy.get(value).check({ force: true }).should("be.checked");
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("radiovalue", (value, value2) => {
|
|
||||||
cy.get(value).click().clear().type(value2);
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("optionValue", (value, value2) => {
|
|
||||||
cy.get(value).click().clear().type(value2);
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("typeIntoDraftEditor", (selector, text) => {
|
|
||||||
cy.get(selector).then((input) => {
|
|
||||||
var textarea = input.get(0);
|
|
||||||
textarea.dispatchEvent(new Event("focus"));
|
|
||||||
|
|
||||||
var textEvent = document.createEvent("TextEvent");
|
|
||||||
textEvent.initTextEvent("textInput", true, true, null, text);
|
|
||||||
textarea.dispatchEvent(textEvent);
|
|
||||||
|
|
||||||
textarea.dispatchEvent(new Event("blur"));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("getPluginFormsAndCreateDatasource", () => {
|
|
||||||
/*
|
|
||||||
cy.wait("@getPluginForm").should(
|
|
||||||
"have.nested.property",
|
|
||||||
"response.body.responseMeta.status",
|
|
||||||
200,
|
|
||||||
);
|
|
||||||
cy.wait("@saveDatasource").should(
|
|
||||||
"have.nested.property",
|
|
||||||
"response.body.responseMeta.status",
|
|
||||||
201,
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("NavigateToJSEditor", () => {
|
Cypress.Commands.add("NavigateToJSEditor", () => {
|
||||||
PageLeftPane.switchSegment(PagePaneSegment.JS);
|
PageLeftPane.switchSegment(PagePaneSegment.JS);
|
||||||
PageLeftPane.switchToAddNew();
|
PageLeftPane.switchToAddNew();
|
||||||
|
|
@ -684,33 +468,6 @@ Cypress.Commands.add("selectAction", (option) => {
|
||||||
.click({ force: true });
|
.click({ force: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("deleteActionAndConfirm", () => {
|
|
||||||
cy.selectAction("Delete");
|
|
||||||
cy.selectAction("Are you sure?");
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("deleteJSObject", () => {
|
|
||||||
cy.hoverAndClick();
|
|
||||||
cy.get(jsEditorLocators.delete).click({ force: true });
|
|
||||||
cy.get(jsEditorLocators.deleteConfirm).click({ force: true });
|
|
||||||
cy.wait("@deleteJSCollection").should(
|
|
||||||
"have.nested.property",
|
|
||||||
"response.body.responseMeta.status",
|
|
||||||
200,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("deleteDataSource", () => {
|
|
||||||
cy.hoverAndClick();
|
|
||||||
cy.get(apiwidget.delete).click({ force: true });
|
|
||||||
cy.get(apiwidget.deleteConfirm).click({ force: true });
|
|
||||||
cy.wait("@deleteDatasource").should(
|
|
||||||
"have.nested.property",
|
|
||||||
"response.body.responseMeta.status",
|
|
||||||
200,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("dragAndDropToCanvas", (widgetType, { x, y }) => {
|
Cypress.Commands.add("dragAndDropToCanvas", (widgetType, { x, y }) => {
|
||||||
PageLeftPane.switchSegment(PagePaneSegment.UI);
|
PageLeftPane.switchSegment(PagePaneSegment.UI);
|
||||||
PageLeftPane.switchToAddNew();
|
PageLeftPane.switchToAddNew();
|
||||||
|
|
@ -837,16 +594,6 @@ Cypress.Commands.add("setDate", (date, dateFormate) => {
|
||||||
cy.get(sel).click();
|
cy.get(sel).click();
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("pageNo", (index) => {
|
|
||||||
cy.get(".page-item").first().click({ force: true });
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("pageNoValidate", (index) => {
|
|
||||||
const data = '.e-numericcontainer a[index="' + index + '"]';
|
|
||||||
const pageVal = cy.get(data);
|
|
||||||
return pageVal;
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("validateDisableWidget", (widgetCss, disableCss) => {
|
Cypress.Commands.add("validateDisableWidget", (widgetCss, disableCss) => {
|
||||||
cy.get(widgetCss + disableCss).should("exist");
|
cy.get(widgetCss + disableCss).should("exist");
|
||||||
});
|
});
|
||||||
|
|
@ -1120,38 +867,6 @@ Cypress.Commands.add("NavigateToPaginationTab", () => {
|
||||||
agHelper.GetNClick(ApiEditor.apiPaginationTab);
|
agHelper.GetNClick(ApiEditor.apiPaginationTab);
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("ValidateTableData", (value) => {
|
|
||||||
// cy.isSelectRow(0);
|
|
||||||
cy.readTabledata("0", "0").then((tabData) => {
|
|
||||||
const tableData = tabData;
|
|
||||||
expect(tableData).to.equal(value.toString());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("ValidateTableV2Data", (value) => {
|
|
||||||
// cy.isSelectRow(0);
|
|
||||||
cy.readTableV2data("0", "0").then((tabData) => {
|
|
||||||
const tableData = tabData;
|
|
||||||
expect(tableData).to.equal(value.toString());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("ValidatePublishTableData", (value) => {
|
|
||||||
cy.isSelectRow(0);
|
|
||||||
cy.readTabledataPublish("0", "0").then((tabData) => {
|
|
||||||
const tableData = tabData;
|
|
||||||
expect(tableData).to.equal(value);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("ValidatePublishTableV2Data", (value) => {
|
|
||||||
cy.isSelectRow(0);
|
|
||||||
cy.readTableV2dataPublish("0", "0").then((tabData) => {
|
|
||||||
const tableData = tabData;
|
|
||||||
expect(tableData).to.equal(value);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("ValidatePaginateResponseUrlData", (runTestCss) => {
|
Cypress.Commands.add("ValidatePaginateResponseUrlData", (runTestCss) => {
|
||||||
EditorNavigation.SelectEntityByName("Api2", EntityType.Api);
|
EditorNavigation.SelectEntityByName("Api2", EntityType.Api);
|
||||||
cy.wait(3000);
|
cy.wait(3000);
|
||||||
|
|
@ -1204,22 +919,6 @@ Cypress.Commands.add("ValidatePaginateResponseUrlDataV2", (runTestCss) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("ValidatePaginationInputData", (valueToTest) => {
|
|
||||||
cy.isSelectRow(0);
|
|
||||||
cy.readTabledataPublish("0", "5").then((tabData) => {
|
|
||||||
const tableData = tabData;
|
|
||||||
expect(`\"${tableData}\"`).to.equal(valueToTest);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("ValidatePaginationInputDataV2", (valueToTest) => {
|
|
||||||
cy.isSelectRow(0);
|
|
||||||
cy.readTableV2dataPublish("0", "5").then((tabData) => {
|
|
||||||
const tableData = tabData;
|
|
||||||
expect(`\"${tableData}\"`).to.equal(valueToTest);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("CheckForPageSaveError", () => {
|
Cypress.Commands.add("CheckForPageSaveError", () => {
|
||||||
// Wait for "saving" status to disappear
|
// Wait for "saving" status to disappear
|
||||||
cy.get(commonlocators.statusSaving, {
|
cy.get(commonlocators.statusSaving, {
|
||||||
|
|
@ -1252,29 +951,6 @@ Cypress.Commands.add(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
Cypress.Commands.add("updateMapType", (mapType) => {
|
|
||||||
// Command to change the map chart type if the property pane of the map chart widget is opened.
|
|
||||||
cy.get(viewWidgetsPage.mapType).last().click({ force: true });
|
|
||||||
cy.get(commonlocators.dropdownmenu)
|
|
||||||
.children()
|
|
||||||
.contains(mapType)
|
|
||||||
.click({ force: true });
|
|
||||||
|
|
||||||
cy.get(viewWidgetsPage.mapType).should("have.text", mapType);
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("createJSObject", (JSCode) => {
|
|
||||||
cy.NavigateToJSEditor();
|
|
||||||
cy.wait(1000);
|
|
||||||
cy.get(".CodeMirror textarea")
|
|
||||||
.first()
|
|
||||||
.focus()
|
|
||||||
.type("{downarrow}{downarrow}{downarrow}{downarrow} ")
|
|
||||||
.type(JSCode);
|
|
||||||
cy.wait(1000);
|
|
||||||
cy.get(jsEditorLocators.runButton).first().click();
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("createSuperUser", () => {
|
Cypress.Commands.add("createSuperUser", () => {
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
cy.get(welcomePage.firstName).should("be.visible");
|
cy.get(welcomePage.firstName).should("be.visible");
|
||||||
|
|
@ -1353,59 +1029,6 @@ Cypress.Commands.add("SignupFromAPI", (uname, pword) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("startInterceptRoutesForMySQL", () => {
|
|
||||||
//All stubbing - updating app id to current app id for Delete app by api call to be successfull:
|
|
||||||
|
|
||||||
cy.replaceApplicationIdForInterceptPages(
|
|
||||||
"cypress/fixtures/mySQL_PUT_replaceLayoutWithCRUD.json",
|
|
||||||
);
|
|
||||||
|
|
||||||
cy.intercept("POST", "/api/v1/datasources/test", {
|
|
||||||
fixture: "testAction.json",
|
|
||||||
}).as("testDatasource");
|
|
||||||
cy.intercept("GET", "/api/v1/datasources/*/structure?ignoreCache=*", {
|
|
||||||
fixture: "mySQL_GET_selectTableDropdown.json",
|
|
||||||
}).as("getDatasourceStructure");
|
|
||||||
cy.intercept("PUT", "/api/v1/pages/crud-page/*", {
|
|
||||||
fixture: "mySQL_PUT_replaceLayoutWithCRUD.json",
|
|
||||||
}).as("replaceLayoutWithCRUDPage");
|
|
||||||
cy.intercept("GET", "/api/v1/actions*", {
|
|
||||||
fixture: "mySQL_GET_Actions.json",
|
|
||||||
}).as("getActions");
|
|
||||||
cy.intercept("POST", "/api/v1/actions/execute", {
|
|
||||||
fixture: "mySQL_POST_Execute.json",
|
|
||||||
}).as("postExecute");
|
|
||||||
cy.intercept("POST", "/api/v1/pages/crud-page", {
|
|
||||||
fixture: "mySQL_PUT_replaceLayoutWithCRUD.json",
|
|
||||||
}).as("replaceLayoutWithCRUDPage");
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("startInterceptRoutesForMongo", () => {
|
|
||||||
//All stubbing
|
|
||||||
cy.replaceApplicationIdForInterceptPages(
|
|
||||||
"cypress/fixtures/mongo_PUT_replaceLayoutWithCRUD.json",
|
|
||||||
);
|
|
||||||
|
|
||||||
cy.intercept("POST", "/api/v1/datasources/test", {
|
|
||||||
fixture: "testAction.json",
|
|
||||||
}).as("testDatasource");
|
|
||||||
cy.intercept("GET", "/api/v1/datasources/*/structure?ignoreCache=*", {
|
|
||||||
fixture: "mongo_GET_selectTableDropdown.json",
|
|
||||||
}).as("getDatasourceStructure");
|
|
||||||
cy.intercept("PUT", "/api/v1/pages/crud-page/*", {
|
|
||||||
fixture: "mongo_PUT_replaceLayoutWithCRUD.json",
|
|
||||||
}).as("replaceLayoutWithCRUDPage");
|
|
||||||
cy.intercept("GET", "/api/v1/actions*", {
|
|
||||||
fixture: "mongo_GET_Actions.json",
|
|
||||||
}).as("getActions");
|
|
||||||
cy.intercept("POST", "/api/v1/actions/execute", {
|
|
||||||
fixture: "mongo_POST_Actions.json",
|
|
||||||
}).as("postExecute");
|
|
||||||
cy.intercept("POST", "/api/v1/pages/crud-page", {
|
|
||||||
fixture: "mongo_PUT_replaceLayoutWithCRUD.json",
|
|
||||||
}).as("post_replaceLayoutCRUDStub");
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("startInterceptRoutesForS3", () => {
|
Cypress.Commands.add("startInterceptRoutesForS3", () => {
|
||||||
cy.intercept("POST", "/api/v1/datasources/test").as("testDatasource");
|
cy.intercept("POST", "/api/v1/datasources/test").as("testDatasource");
|
||||||
cy.intercept("PUT", "/api/v1/datasources/datasource-query/*").as(
|
cy.intercept("PUT", "/api/v1/datasources/datasource-query/*").as(
|
||||||
|
|
@ -1420,43 +1043,6 @@ Cypress.Commands.add("startInterceptRoutesForS3", () => {
|
||||||
cy.intercept("POST", "/api/v1/actions/execute").as("post_Execute");
|
cy.intercept("POST", "/api/v1/actions/execute").as("post_Execute");
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("replaceApplicationIdForInterceptPages", (fixtureFile) => {
|
|
||||||
let currentAppId, currentURL;
|
|
||||||
cy.readFile(fixtureFile, (err, data) => {
|
|
||||||
if (err) {
|
|
||||||
return console.error(err);
|
|
||||||
}
|
|
||||||
}).then((data) => {
|
|
||||||
cy.url().then((url) => {
|
|
||||||
currentURL = url;
|
|
||||||
const myRegexp = /applications(.*)/;
|
|
||||||
const match = myRegexp.exec(currentURL);
|
|
||||||
cy.log(currentURL + "currentURL from intercept is");
|
|
||||||
currentAppId = match ? match[1].split("/")[1] : null;
|
|
||||||
data.data.page.applicationId = currentAppId;
|
|
||||||
cy.writeFile(fixtureFile, JSON.stringify(data));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add(
|
|
||||||
"paste",
|
|
||||||
{ prevSubject: true },
|
|
||||||
(selector, pastePayload) => {
|
|
||||||
cy.wrap(selector).then(($destination) => {
|
|
||||||
const pasteEvent = Object.assign(
|
|
||||||
new Event("paste", { bubbles: true, cancelable: true }),
|
|
||||||
{
|
|
||||||
clipboardData: {
|
|
||||||
getData: () => pastePayload,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
);
|
|
||||||
$destination[0].dispatchEvent(pasteEvent);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// the way we target form controls from now on has to change
|
// the way we target form controls from now on has to change
|
||||||
// we would be getting the form controls by their class names and not their xpaths.
|
// we would be getting the form controls by their class names and not their xpaths.
|
||||||
// the xpath method is flaky and highly subjected to change.
|
// the xpath method is flaky and highly subjected to change.
|
||||||
|
|
@ -1483,25 +1069,6 @@ Cypress.Commands.add(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
Cypress.Commands.add("checkCodeInputValue", (selector) => {
|
|
||||||
let inputVal = "";
|
|
||||||
cy.get(selector).then(($field) => {
|
|
||||||
cy.wrap($field)
|
|
||||||
.find(".CodeMirror-code span")
|
|
||||||
.first()
|
|
||||||
.invoke("text")
|
|
||||||
.then((text1) => {
|
|
||||||
inputVal = text1;
|
|
||||||
cy.log("checkCodeInputValue is:::: " + inputVal);
|
|
||||||
// const input = ins[0].CodeMirror;
|
|
||||||
// inputVal = input.getValue();
|
|
||||||
});
|
|
||||||
|
|
||||||
// to be chained with another cy command.
|
|
||||||
return cy.wrap(inputVal);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("clickButton", (btnVisibleText, toForceClick = true) => {
|
Cypress.Commands.add("clickButton", (btnVisibleText, toForceClick = true) => {
|
||||||
cy.xpath("//span[text()='" + btnVisibleText + "']/ancestor::button")
|
cy.xpath("//span[text()='" + btnVisibleText + "']/ancestor::button")
|
||||||
.first()
|
.first()
|
||||||
|
|
@ -1509,66 +1076,6 @@ Cypress.Commands.add("clickButton", (btnVisibleText, toForceClick = true) => {
|
||||||
.click({ force: toForceClick });
|
.click({ force: toForceClick });
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add(
|
|
||||||
"actionContextMenuByEntityName",
|
|
||||||
(entityNameinLeftSidebar, action = "Delete", subAction) => {
|
|
||||||
cy.wait(2000);
|
|
||||||
// cy.get(
|
|
||||||
// commonlocators.entitySearchResult
|
|
||||||
// .concat(entityNameinLeftSidebar)
|
|
||||||
// .concat("')"),
|
|
||||||
// )
|
|
||||||
// .parents(commonlocators.entityItem)
|
|
||||||
// .first()
|
|
||||||
// .trigger("mouseover")
|
|
||||||
// .find(commonlocators.entityContextMenu)
|
|
||||||
// .last()
|
|
||||||
// .click({ force: true });
|
|
||||||
|
|
||||||
cy.xpath(
|
|
||||||
"//div[text()='" +
|
|
||||||
entityNameinLeftSidebar +
|
|
||||||
"']/ancestor::div[1]/following-sibling::div//div[contains(@class, 'entity-context-menu-icon')]",
|
|
||||||
)
|
|
||||||
.last()
|
|
||||||
.click({ force: true });
|
|
||||||
|
|
||||||
cy.xpath(
|
|
||||||
"//div[text()='" +
|
|
||||||
action +
|
|
||||||
"']/ancestor::a[contains(@class, 'single-select')]",
|
|
||||||
)
|
|
||||||
.click({ force: true })
|
|
||||||
.wait(500);
|
|
||||||
|
|
||||||
if (subAction) {
|
|
||||||
cy.xpath(
|
|
||||||
"//div[text()='" +
|
|
||||||
subAction +
|
|
||||||
"']/parent::a[contains(@class, 'single-select')]",
|
|
||||||
)
|
|
||||||
.click({ force: true })
|
|
||||||
.wait(500);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action === "Delete")
|
|
||||||
cy.xpath("//div[text()='" + entityNameinLeftSidebar + "']").should(
|
|
||||||
"not.exist",
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Cypress.Commands.add("selectEntityByName", (entityNameinLeftSidebar) => {
|
|
||||||
cy.xpath(
|
|
||||||
"//div[contains(@class, 't--entity-name')][text()='" +
|
|
||||||
entityNameinLeftSidebar +
|
|
||||||
"']",
|
|
||||||
)
|
|
||||||
.last()
|
|
||||||
.click({ force: true })
|
|
||||||
.wait(2000);
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
"EvaluatFieldValue",
|
"EvaluatFieldValue",
|
||||||
(fieldName = "", currentValue = "") => {
|
(fieldName = "", currentValue = "") => {
|
||||||
|
|
@ -1634,15 +1141,6 @@ cy.all = function (...commands) {
|
||||||
return p;
|
return p;
|
||||||
};
|
};
|
||||||
|
|
||||||
Cypress.Commands.add("renameWithInPane", (renameVal) => {
|
|
||||||
cy.get(apiwidget.ApiName).click({ force: true });
|
|
||||||
cy.get(apiwidget.apiTxt)
|
|
||||||
.clear()
|
|
||||||
.type(renameVal, { force: true })
|
|
||||||
.should("have.value", renameVal)
|
|
||||||
.blur();
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("getEntityName", () => {
|
Cypress.Commands.add("getEntityName", () => {
|
||||||
let entityName = cy.get(apiwidget.ApiName).invoke("text");
|
let entityName = cy.get(apiwidget.ApiName).invoke("text");
|
||||||
return entityName;
|
return entityName;
|
||||||
|
|
@ -1676,19 +1174,6 @@ Cypress.Commands.add("setQueryTimeout", (timeout) => {
|
||||||
cy.xpath(queryLocators.query).click();
|
cy.xpath(queryLocators.query).click();
|
||||||
});
|
});
|
||||||
|
|
||||||
//Usage: If in need to type {enter} {esc} etc then .text('sometext').type('{enter}')
|
|
||||||
Cypress.Commands.add("text", { prevSubject: true }, (subject, text) => {
|
|
||||||
subject.val(text);
|
|
||||||
return cy.wrap(subject);
|
|
||||||
});
|
|
||||||
|
|
||||||
//Not Used!
|
|
||||||
Cypress.Commands.add("VerifyNoDataDisplayAbsence", () => {
|
|
||||||
cy.xpath("//div[text()='No data to display']", { timeout: 0 }).should(
|
|
||||||
"not.exist",
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Cypress.Commands.add('isNotInViewport', element => {
|
// Cypress.Commands.add('isNotInViewport', element => {
|
||||||
// cy.xpath(element).then($el => {
|
// cy.xpath(element).then($el => {
|
||||||
// const bottom = Cypress.$(cy.state('window')).height()
|
// const bottom = Cypress.$(cy.state('window')).height()
|
||||||
|
|
@ -1701,19 +1186,6 @@ Cypress.Commands.add("VerifyNoDataDisplayAbsence", () => {
|
||||||
// })
|
// })
|
||||||
// })
|
// })
|
||||||
|
|
||||||
Cypress.Commands.add("isNotInViewport", (element) => {
|
|
||||||
cy.xpath(element).should(($el) => {
|
|
||||||
const bottom = Cypress.$(cy.state("window")).height();
|
|
||||||
const right = Cypress.$(cy.state("window")).width();
|
|
||||||
const rect = $el[0].getBoundingClientRect();
|
|
||||||
|
|
||||||
expect(rect).to.satisfy(
|
|
||||||
(rect) =>
|
|
||||||
rect.top < 0 || rect.top > bottom || rect.left < 0 || rect.left > right,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("isInViewport", (element) => {
|
Cypress.Commands.add("isInViewport", (element) => {
|
||||||
cy.xpath(element)
|
cy.xpath(element)
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
|
|
@ -1732,10 +1204,6 @@ Cypress.Commands.add("validateEvaluatedValue", (value) => {
|
||||||
cy.get(".t-property-evaluated-value").should("contain", value);
|
cy.get(".t-property-evaluated-value").should("contain", value);
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("CheckAndUnfoldEntityItem", (item) => {
|
|
||||||
PageLeftPane.expandCollapseItem(item);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Cypress.Commands.overwrite("type", (originalFn, element, text, options) => {
|
// Cypress.Commands.overwrite("type", (originalFn, element, text, options) => {
|
||||||
// const clearedText = '{selectall}{backspace}'+`${text}`;
|
// const clearedText = '{selectall}{backspace}'+`${text}`;
|
||||||
// return originalFn(element, clearedText, options);
|
// return originalFn(element, clearedText, options);
|
||||||
|
|
@ -1810,18 +1278,6 @@ Cypress.Commands.add("checkLabelForWidget", (options) => {
|
||||||
});
|
});
|
||||||
let LOCAL_STORAGE_MEMORY = {};
|
let LOCAL_STORAGE_MEMORY = {};
|
||||||
|
|
||||||
Cypress.Commands.add("saveLocalStorageCache", () => {
|
|
||||||
Object.keys(localStorage).forEach((key) => {
|
|
||||||
LOCAL_STORAGE_MEMORY[key] = localStorage[key];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("restoreLocalStorageCache", () => {
|
|
||||||
Object.keys(LOCAL_STORAGE_MEMORY).forEach((key) => {
|
|
||||||
localStorage.setItem(key, LOCAL_STORAGE_MEMORY[key]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("StopContainer", (path, containerName) => {
|
Cypress.Commands.add("StopContainer", (path, containerName) => {
|
||||||
cy.request({
|
cy.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
|
@ -1835,31 +1291,6 @@ Cypress.Commands.add("StopContainer", (path, containerName) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("StopAllContainer", (path) => {
|
|
||||||
cy.request({
|
|
||||||
method: "GET",
|
|
||||||
url: path,
|
|
||||||
qs: {
|
|
||||||
cmd: "docker kill $(docker ps -q)",
|
|
||||||
},
|
|
||||||
}).then((res) => {
|
|
||||||
expect(res.status).equal(200);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("StartContainer", (path, containerName) => {
|
|
||||||
cy.request({
|
|
||||||
method: "GET",
|
|
||||||
url: path,
|
|
||||||
qs: {
|
|
||||||
cmd: "docker restart " + containerName,
|
|
||||||
},
|
|
||||||
}).then((res) => {
|
|
||||||
cy.log(res.body.stdout, res.body.stderr);
|
|
||||||
expect(res.status).equal(200);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
"StartNewContainer",
|
"StartNewContainer",
|
||||||
(url, path, version, containerName) => {
|
(url, path, version, containerName) => {
|
||||||
|
|
@ -1901,19 +1332,6 @@ Cypress.Commands.add("GetPath", (path, containerName) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("GetCWD", (path) => {
|
|
||||||
cy.request({
|
|
||||||
method: "GET",
|
|
||||||
url: path,
|
|
||||||
qs: {
|
|
||||||
cmd: "pwd",
|
|
||||||
},
|
|
||||||
}).then((res) => {
|
|
||||||
cy.log(res.body.stdout);
|
|
||||||
expect(res.status).equal(200);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("GetAndVerifyLogs", (path, containerName) => {
|
Cypress.Commands.add("GetAndVerifyLogs", (path, containerName) => {
|
||||||
cy.request({
|
cy.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
|
@ -1927,53 +1345,6 @@ Cypress.Commands.add("GetAndVerifyLogs", (path, containerName) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add(
|
|
||||||
"typeTab",
|
|
||||||
{ prevSubject: "element" },
|
|
||||||
(subject, shiftKey, ctrlKey) => {
|
|
||||||
cy.wrap(subject).trigger("keydown", {
|
|
||||||
keyCode: 9,
|
|
||||||
which: 9,
|
|
||||||
shiftKey: shiftKey,
|
|
||||||
ctrlKey: ctrlKey,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Cypress.Commands.add(`verifyCallCount`, (alias, expectedNumberOfCalls) => {
|
|
||||||
cy.wait(alias);
|
|
||||||
cy.get(`${alias}.all`).should("have.length", expectedNumberOfCalls);
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add(
|
|
||||||
"RenameWidgetFromPropertyPane",
|
|
||||||
(widgetType, oldName, newName) => {
|
|
||||||
cy.openPropertyPaneByWidgetName(oldName, widgetType);
|
|
||||||
cy.get(".t--property-pane-title").click({ force: true });
|
|
||||||
cy.get(".t--property-pane-title")
|
|
||||||
.type(newName, { delay: 300 })
|
|
||||||
.type("{enter}");
|
|
||||||
cy.wait("@updateWidgetName").should(
|
|
||||||
"have.nested.property",
|
|
||||||
"response.body.responseMeta.status",
|
|
||||||
200,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Cypress.Commands.add("execute", (url, command) => {
|
|
||||||
cy.request({
|
|
||||||
method: "GET",
|
|
||||||
url: url,
|
|
||||||
qs: {
|
|
||||||
cmd: command,
|
|
||||||
},
|
|
||||||
}).then((res) => {
|
|
||||||
cy.log(res.body.stdout, res.body.error);
|
|
||||||
expect(res.status).equal(200);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("forceVisit", (url) => {
|
Cypress.Commands.add("forceVisit", (url) => {
|
||||||
cy.window().then((win) => {
|
cy.window().then((win) => {
|
||||||
return win.open(url, "_self");
|
return win.open(url, "_self");
|
||||||
|
|
@ -1997,15 +1368,6 @@ Cypress.Commands.add("SelectDropDown", (dropdownOption) => {
|
||||||
.wait(1000);
|
.wait(1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("RemoveMultiSelectItems", (dropdownOptions) => {
|
|
||||||
dropdownOptions.forEach(($each) => {
|
|
||||||
cy.get(`.rc-select-selection-overflow-item [title=${$each}] .remove-icon`)
|
|
||||||
.eq(0)
|
|
||||||
.click({ force: true })
|
|
||||||
.wait(1000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add("RemoveAllSelections", () => {
|
Cypress.Commands.add("RemoveAllSelections", () => {
|
||||||
cy.get(`.rc-select-selection-overflow-item .remove-icon`).each(($each) => {
|
cy.get(`.rc-select-selection-overflow-item .remove-icon`).each(($each) => {
|
||||||
cy.wrap($each).click({ force: true }).wait(1000);
|
cy.wrap($each).click({ force: true }).wait(1000);
|
||||||
|
|
@ -2082,19 +1444,6 @@ Cypress.Commands.add("stubCustomerPortalPage", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* @param testID
|
|
||||||
* @returns
|
|
||||||
*
|
|
||||||
* This function act as a data-testid selector. In
|
|
||||||
* any case it is decided to rename the data-testid,
|
|
||||||
* it's thing single function that needs to be updated.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
Cypress.Commands.add("selectByTestId", (testId) => {
|
|
||||||
return cy.get(`[data-testid="${testId}"]`);
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tooltipSelector
|
* @param tooltipSelector
|
||||||
* @param expectedText
|
* @param expectedText
|
||||||
|
|
@ -2108,3 +1457,21 @@ Cypress.Commands.add(
|
||||||
cy.get(tooltipSelector).should("be.visible").and("contain", expectedText);
|
cy.get(tooltipSelector).should("be.visible").and("contain", expectedText);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Cypress.Commands.add(
|
||||||
|
"paste",
|
||||||
|
{ prevSubject: true },
|
||||||
|
(selector, pastePayload) => {
|
||||||
|
cy.wrap(selector).then(($destination) => {
|
||||||
|
const pasteEvent = Object.assign(
|
||||||
|
new Event("paste", { bubbles: true, cancelable: true }),
|
||||||
|
{
|
||||||
|
clipboardData: {
|
||||||
|
getData: () => pastePayload,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
$destination[0].dispatchEvent(pasteEvent);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user