test: Commands file organised (#12533)
* Commands file seggregated * updated support file * updated common method * updated the support files * Updated imports
This commit is contained in:
parent
5c7a0105de
commit
db2310bef7
|
|
@ -135,7 +135,9 @@ describe("Slug URLs", () => {
|
|||
`/app/${application.slug}/${currentPage.slug}-${currentPage.id}/edit`,
|
||||
);
|
||||
|
||||
cy.visit(`/${application.slug}/${currentPage.slug}-${currentPage.id}/edit`);
|
||||
cy.visit(
|
||||
`/${application.slug}/${currentPage.slug}-${currentPage.id}/edit`,
|
||||
);
|
||||
|
||||
cy.location().should((loc) => {
|
||||
expect(loc.pathname).includes(
|
||||
|
|
|
|||
468
app/client/cypress/support/ApiCommands.js
Normal file
468
app/client/cypress/support/ApiCommands.js
Normal file
|
|
@ -0,0 +1,468 @@
|
|||
/* eslint-disable cypress/no-unnecessary-waiting */
|
||||
/* eslint-disable cypress/no-assigning-return-values */
|
||||
|
||||
require("cy-verify-downloads").addCustomCommand();
|
||||
require("cypress-file-upload");
|
||||
|
||||
const {
|
||||
addMatchImageSnapshotCommand,
|
||||
} = require("cypress-image-snapshot/command");
|
||||
import ApiEditor from "../locators/ApiEditor";
|
||||
const pages = require("../locators/Pages.json");
|
||||
const commonlocators = require("../locators/commonlocators.json");
|
||||
const apiwidget = require("../locators/apiWidgetslocator.json");
|
||||
const explorer = require("../locators/explorerlocators.json");
|
||||
|
||||
export const initLocalstorage = () => {
|
||||
cy.window().then((window) => {
|
||||
window.localStorage.setItem("ShowCommentsButtonToolTip", "");
|
||||
window.localStorage.setItem("updateDismissed", "true");
|
||||
});
|
||||
};
|
||||
|
||||
Cypress.Commands.add("enterDatasourceAndPath", (datasource, path) => {
|
||||
cy.enterDatasource(datasource + path);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("enterDatasource", (datasource) => {
|
||||
cy.get(apiwidget.resourceUrl)
|
||||
.first()
|
||||
.click({ force: true })
|
||||
.type(datasource, { parseSpecialCharSequences: false })
|
||||
.type("{esc}}");
|
||||
});
|
||||
|
||||
Cypress.Commands.add("ResponseStatusCheck", (statusCode) => {
|
||||
cy.xpath(apiwidget.responseStatus).should("be.visible");
|
||||
cy.xpath(apiwidget.responseStatus).contains(statusCode);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("ResponseCheck", () => {
|
||||
//Explicit assert
|
||||
cy.get(apiwidget.responseText).should("be.visible");
|
||||
});
|
||||
|
||||
Cypress.Commands.add("ResponseTextCheck", (textTocheck) => {
|
||||
cy.ResponseCheck();
|
||||
cy.get(apiwidget.responseText).contains(textTocheck);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("NavigateToAPI_Panel", () => {
|
||||
cy.get(pages.addEntityAPI)
|
||||
.last()
|
||||
.should("be.visible")
|
||||
.click({ force: true });
|
||||
cy.get(pages.integrationCreateNew)
|
||||
.should("be.visible")
|
||||
.click({ force: true });
|
||||
cy.get("#loading").should("not.exist");
|
||||
});
|
||||
|
||||
Cypress.Commands.add("CreateAPI", (apiname) => {
|
||||
cy.get(explorer.createNew).click({ force: true });
|
||||
cy.get(explorer.blankAPI).click({ force: true });
|
||||
cy.wait("@createNewApi");
|
||||
cy.get(apiwidget.resourceUrl).should("be.visible");
|
||||
cy.renameWithInPane(apiname);
|
||||
cy.WaitAutoSave();
|
||||
// Added because api name edit takes some time to
|
||||
// reflect in api sidebar after the call passes.
|
||||
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
||||
cy.wait(2000);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("CreateSubsequentAPI", (apiname) => {
|
||||
cy.get(apiwidget.createApiOnSideBar)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.get(apiwidget.resourceUrl).should("be.visible");
|
||||
// cy.get(ApiEditor.nameOfApi)
|
||||
cy.get(apiwidget.apiTxt)
|
||||
.clear()
|
||||
.type(apiname)
|
||||
.should("have.value", apiname);
|
||||
cy.WaitAutoSave();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("EditApiName", (apiname) => {
|
||||
cy.get(apiwidget.ApiName).click({ force: true });
|
||||
cy.get(apiwidget.apiTxt)
|
||||
.clear()
|
||||
.type(apiname, { force: true })
|
||||
.should("have.value", apiname);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("EditApiNameFromExplorer", (apiname) => {
|
||||
/*
|
||||
cy.xpath(apiwidget.popover)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
cy.get(apiwidget.editName).click({ force: true });
|
||||
*/
|
||||
cy.get(explorer.editNameField)
|
||||
.clear()
|
||||
.type(apiname, { force: true })
|
||||
.should("have.value", apiname)
|
||||
.blur();
|
||||
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
||||
cy.wait(3000);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("RunAPI", () => {
|
||||
cy.get(ApiEditor.ApiRunBtn).click({ force: true });
|
||||
cy.wait("@postExecute");
|
||||
});
|
||||
|
||||
Cypress.Commands.add("SaveAndRunAPI", () => {
|
||||
cy.WaitAutoSave();
|
||||
cy.RunAPI();
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
"validateRequest",
|
||||
(apiName, baseurl, path, verb, error = false) => {
|
||||
cy.get(".react-tabs__tab")
|
||||
.contains("Logs")
|
||||
.click();
|
||||
cy.get("[data-cy=t--debugger-search]")
|
||||
.clear()
|
||||
.type(apiName);
|
||||
|
||||
if (!error) {
|
||||
cy.get(".object-key")
|
||||
.last()
|
||||
.contains("request")
|
||||
.click();
|
||||
}
|
||||
cy.get(".string-value").contains(baseurl.concat(path));
|
||||
cy.get(".string-value").contains(verb);
|
||||
cy.get("[data-cy=t--tab-body]")
|
||||
.first()
|
||||
.click({ force: true });
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add(
|
||||
"EnterSourceDetailsWithHeader",
|
||||
(baseUrl, v1method, hKey, hValue) => {
|
||||
cy.enterDatasourceAndPath(baseUrl, v1method);
|
||||
cy.get(apiwidget.headerKey)
|
||||
.first()
|
||||
.click({ force: true })
|
||||
.type(hKey, { parseSpecialCharSequences: true });
|
||||
cy.get(apiwidget.headerValue)
|
||||
.first()
|
||||
.click({ force: true })
|
||||
.type(hValue, { parseSpecialCharSequences: true });
|
||||
cy.WaitAutoSave();
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add("EditSourceDetail", (baseUrl, v1method) => {
|
||||
cy.get(apiwidget.editResourceUrl)
|
||||
.first()
|
||||
.click({ force: true })
|
||||
.clear()
|
||||
.type(`{backspace}${baseUrl}`);
|
||||
cy.xpath(apiwidget.autoSuggest)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.get(ApiEditor.ApiRunBtn).scrollIntoView();
|
||||
cy.get(apiwidget.editResourceUrl)
|
||||
.first()
|
||||
.focus()
|
||||
.type(v1method)
|
||||
.should("have.value", v1method);
|
||||
cy.WaitAutoSave();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("switchToAPIInputTab", () => {
|
||||
cy.get(apiwidget.apiInputTab)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("enterUrl", (apiname, url, value) => {
|
||||
cy.get(url)
|
||||
.first()
|
||||
.type("{{".concat(apiname).concat(value), {
|
||||
force: true,
|
||||
parseSpecialCharSequences: false,
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
"EnterSourceDetailsWithQueryParam",
|
||||
(baseUrl, v1method, hKey, hValue, qKey, qValue) => {
|
||||
cy.enterDatasourceAndPath(baseUrl, v1method);
|
||||
cy.get(apiwidget.headerKey)
|
||||
.first()
|
||||
.click({ force: true })
|
||||
.type(hKey, { parseSpecialCharSequences: true });
|
||||
cy.get(apiwidget.headerValue)
|
||||
.first()
|
||||
.click({ force: true })
|
||||
.type(hValue, { parseSpecialCharSequences: true });
|
||||
cy.get(apiwidget.queryKey)
|
||||
.first()
|
||||
.click({ force: true })
|
||||
.type(qKey, { force: true })
|
||||
.should("have.value", qKey);
|
||||
cy.get(apiwidget.queryValue)
|
||||
.first()
|
||||
.click({ force: true })
|
||||
.type(qValue, { force: true })
|
||||
.should("have.value", qValue);
|
||||
cy.WaitAutoSave();
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add("EnterSourceDetailsWithbody", (baseUrl, v1method) => {
|
||||
cy.enterDatasourceAndPath(baseUrl, v1method);
|
||||
cy.get(apiwidget.addHeader)
|
||||
.first()
|
||||
.click({ first: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("CreationOfUniqueAPIcheck", (apiname) => {
|
||||
cy.get(pages.addEntityAPI).click();
|
||||
cy.get(pages.integrationCreateNew)
|
||||
.should("be.visible")
|
||||
.click({ force: true });
|
||||
cy.get(apiwidget.createapi).click({ force: true });
|
||||
cy.wait("@createNewApi");
|
||||
// cy.wait("@getUser");
|
||||
cy.get(apiwidget.resourceUrl).should("be.visible");
|
||||
cy.get(apiwidget.ApiName).click({ force: true });
|
||||
cy.get(apiwidget.apiTxt)
|
||||
.clear()
|
||||
.focus()
|
||||
.type(apiname, { force: true, delay: 500 })
|
||||
.should("have.value", apiname);
|
||||
cy.get(".t--action-name-edit-error").should(($x) => {
|
||||
expect($x).contain(
|
||||
apiname.concat(" is already being used or is a restricted keyword."),
|
||||
);
|
||||
});
|
||||
cy.get(apiwidget.apiTxt).blur();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("MoveAPIToHome", () => {
|
||||
cy.xpath(apiwidget.popover)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
cy.get(apiwidget.copyTo).click({ force: true });
|
||||
cy.get(apiwidget.home).click({ force: true });
|
||||
cy.wait("@createNewApi").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
201,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("MoveAPIToPage", (pageName) => {
|
||||
cy.xpath(apiwidget.popover)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
cy.get(apiwidget.moveTo).click({ force: true });
|
||||
cy.get(apiwidget.page)
|
||||
.contains(pageName)
|
||||
.click({ force: true });
|
||||
cy.wait("@moveAction").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("copyEntityToPage", (pageName) => {
|
||||
cy.xpath(apiwidget.popover)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
cy.get(apiwidget.copyTo).click({ force: true });
|
||||
cy.get(apiwidget.page)
|
||||
.contains(pageName)
|
||||
.click({ force: true });
|
||||
cy.wait("@createNewApi").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
201,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("CopyAPIToHome", () => {
|
||||
cy.xpath(apiwidget.popover)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
cy.get(apiwidget.copyTo).click({ force: true });
|
||||
cy.get(apiwidget.home).click({ force: true });
|
||||
cy.wait("@createNewApi").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
201,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("RenameEntity", (value, selectFirst) => {
|
||||
if (selectFirst) {
|
||||
cy.xpath(apiwidget.popover)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
} else {
|
||||
cy.xpath(apiwidget.popover)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
}
|
||||
|
||||
cy.get(apiwidget.renameEntity).click({ force: true });
|
||||
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
||||
cy.wait(2000);
|
||||
cy.get(explorer.editEntity)
|
||||
.last()
|
||||
.type(value, { force: true });
|
||||
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
||||
cy.wait(3000);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("CreateApiAndValidateUniqueEntityName", (apiname) => {
|
||||
cy.get(apiwidget.createapi).click({ force: true });
|
||||
cy.wait("@createNewApi");
|
||||
cy.get(apiwidget.resourceUrl).should("be.visible");
|
||||
cy.get(apiwidget.ApiName).click({ force: true });
|
||||
cy.get(apiwidget.apiTxt)
|
||||
.clear()
|
||||
.type(apiname, { force: true })
|
||||
.should("have.value", apiname);
|
||||
cy.get(".t--action-name-edit-error").should(($x) => {
|
||||
expect($x).contain(
|
||||
apiname.concat(" is already being used or is a restricted keyword."),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("validateMessage", (value) => {
|
||||
cy.get(".bp3-popover-content").should(($x) => {
|
||||
expect($x).contain(value.concat(" is already being used."));
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
"VerifyPopOverMessage",
|
||||
(msgAbsenceToVerify, presence = false) => {
|
||||
// Give this element 3 seconds to appear
|
||||
let shouldCondition = "not.exist";
|
||||
if (presence) shouldCondition = "exist";
|
||||
cy.xpath(
|
||||
"//div[@class='bp3-popover-content'][contains(text(),'" +
|
||||
msgAbsenceToVerify +
|
||||
"')]",
|
||||
{ timeout: 3000 },
|
||||
).should(shouldCondition);
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add("DeleteAPIFromSideBar", () => {
|
||||
cy.deleteEntity();
|
||||
cy.wait("@deleteAction").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("DeleteWidgetFromSideBar", () => {
|
||||
cy.xpath(apiwidget.popover)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
cy.get(apiwidget.delete).click({ force: true });
|
||||
cy.wait("@updateLayout").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("deleteEntity", () => {
|
||||
cy.xpath(apiwidget.popover)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
cy.get(apiwidget.delete).click({ force: true });
|
||||
cy.get(apiwidget.deleteConfirm).click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("deleteEntityWithoutConfirmation", () => {
|
||||
cy.xpath(apiwidget.popover)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
cy.get(apiwidget.delete).click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("DeleteAPI", () => {
|
||||
cy.get(ApiEditor.ApiActionMenu).click({ multiple: true });
|
||||
cy.get(apiwidget.deleteAPI)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.get(apiwidget.deleteAPI)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.wait("@deleteAction").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("NavigateToApiEditor", () => {
|
||||
cy.get(explorer.addEntityAPI).click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("testCreateApiButton", () => {
|
||||
cy.get(ApiEditor.createBlankApiCard).click({ force: true });
|
||||
cy.wait("@createNewApi").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
201,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("createAndFillApi", (url, parameters) => {
|
||||
cy.NavigateToApiEditor();
|
||||
cy.get(pages.integrationCreateNew)
|
||||
.should("be.visible")
|
||||
.click({ force: true });
|
||||
cy.testCreateApiButton();
|
||||
cy.get("@createNewApi").then((response) => {
|
||||
cy.get(ApiEditor.ApiNameField).should("be.visible");
|
||||
expect(response.response.body.responseMeta.success).to.eq(true);
|
||||
cy.get(ApiEditor.ApiNameField)
|
||||
.click()
|
||||
.invoke("text")
|
||||
.then((text) => {
|
||||
const someText = text;
|
||||
expect(someText).to.equal(response.response.body.data.name);
|
||||
});
|
||||
});
|
||||
cy.get(apiwidget.editResourceUrl)
|
||||
.first()
|
||||
.click({ force: true })
|
||||
.type(
|
||||
url + parameters,
|
||||
{ parseSpecialCharSequences: false },
|
||||
{ force: true },
|
||||
);
|
||||
cy.WaitAutoSave();
|
||||
cy.get(ApiEditor.formActionButtons).should("be.visible");
|
||||
cy.get(ApiEditor.ApiRunBtn).should("not.be.disabled");
|
||||
});
|
||||
|
||||
Cypress.Commands.add("callApi", (apiname) => {
|
||||
cy.get(commonlocators.callApi)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.get(commonlocators.singleSelectMenuItem)
|
||||
.contains("Execute a query")
|
||||
.click({ force: true });
|
||||
cy.get(commonlocators.selectMenuItem)
|
||||
.contains(apiname)
|
||||
.click({ force: true });
|
||||
});
|
||||
304
app/client/cypress/support/OrgCommands.js
Normal file
304
app/client/cypress/support/OrgCommands.js
Normal file
|
|
@ -0,0 +1,304 @@
|
|||
/* eslint-disable cypress/no-unnecessary-waiting */
|
||||
/* eslint-disable cypress/no-assigning-return-values */
|
||||
/* Contains all methods related to Organisation features*/
|
||||
|
||||
require("cy-verify-downloads").addCustomCommand();
|
||||
require("cypress-file-upload");
|
||||
|
||||
const {
|
||||
addMatchImageSnapshotCommand,
|
||||
} = require("cypress-image-snapshot/command");
|
||||
import homePage from "../locators/HomePage";
|
||||
const generatePage = require("../locators/GeneratePage.json");
|
||||
|
||||
export const initLocalstorage = () => {
|
||||
cy.window().then((window) => {
|
||||
window.localStorage.setItem("ShowCommentsButtonToolTip", "");
|
||||
window.localStorage.setItem("updateDismissed", "true");
|
||||
});
|
||||
};
|
||||
|
||||
Cypress.Commands.add("createOrg", () => {
|
||||
cy.get(homePage.createOrg)
|
||||
.should("be.visible")
|
||||
.first()
|
||||
.click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("renameOrg", (orgName, newOrgName) => {
|
||||
cy.contains(orgName)
|
||||
.closest(homePage.orgCompleteSection)
|
||||
.find(homePage.orgNamePopover)
|
||||
.find(homePage.optionsIcon)
|
||||
.click({ force: true });
|
||||
cy.get(homePage.renameOrgInput)
|
||||
.should("be.visible")
|
||||
.type(newOrgName.concat("{enter}"));
|
||||
cy.wait(3000);
|
||||
//cy.get(commonlocators.homeIcon).click({ force: true });
|
||||
cy.wait("@updateOrganization").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
cy.contains(newOrgName);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("navigateToOrgSettings", (orgName) => {
|
||||
cy.get(homePage.orgList.concat(orgName).concat(")"))
|
||||
.scrollIntoView()
|
||||
.should("be.visible");
|
||||
cy.get(homePage.orgList.concat(orgName).concat(")"))
|
||||
.closest(homePage.orgCompleteSection)
|
||||
.find(homePage.orgNamePopover)
|
||||
.find(homePage.optionsIcon)
|
||||
.click({ force: true });
|
||||
cy.xpath(homePage.MemberSettings).click({ force: true });
|
||||
cy.wait("@getMembers").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
cy.get(homePage.inviteUserMembersPage).should("be.visible");
|
||||
});
|
||||
|
||||
Cypress.Commands.add("openOrgOptionsPopup", (orgName) => {
|
||||
cy.get(homePage.orgList.concat(orgName).concat(")"))
|
||||
.scrollIntoView()
|
||||
.should("be.visible");
|
||||
cy.get(homePage.orgList.concat(orgName).concat(")"))
|
||||
.closest(homePage.orgCompleteSection)
|
||||
.find(homePage.orgNamePopover)
|
||||
.find(homePage.optionsIcon)
|
||||
.click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("inviteUserForOrg", (orgName, email, role) => {
|
||||
cy.stubPostHeaderReq();
|
||||
cy.get(homePage.orgList.concat(orgName).concat(")"))
|
||||
.scrollIntoView()
|
||||
.should("be.visible");
|
||||
cy.get(homePage.orgList.concat(orgName).concat(homePage.shareOrg))
|
||||
.first()
|
||||
.should("be.visible")
|
||||
.click({ force: true });
|
||||
cy.xpath(homePage.email)
|
||||
.click({ force: true })
|
||||
.type(email);
|
||||
cy.xpath(homePage.selectRole).click({ force: true });
|
||||
cy.wait(500);
|
||||
cy.xpath(role).click({ force: true });
|
||||
cy.xpath(homePage.inviteBtn).click({ force: true });
|
||||
cy.wait("@mockPostInvite")
|
||||
.its("request.headers")
|
||||
.should("have.property", "origin", "Cypress");
|
||||
cy.contains(email, { matchCase: false });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("CheckShareIcon", (orgName, count) => {
|
||||
cy.get(homePage.orgList.concat(orgName).concat(")"))
|
||||
.scrollIntoView()
|
||||
.should("be.visible");
|
||||
cy.get(
|
||||
homePage.orgList.concat(orgName).concat(") .org-share-user-icons"),
|
||||
).should("have.length", count);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("shareApp", (email, role) => {
|
||||
cy.stubPostHeaderReq();
|
||||
cy.xpath(homePage.email)
|
||||
.click({ force: true })
|
||||
.type(email);
|
||||
cy.xpath(homePage.selectRole).click({ force: true });
|
||||
cy.xpath(role).click({ force: true });
|
||||
cy.xpath(homePage.inviteBtn).click({ force: true });
|
||||
cy.wait("@mockPostInvite")
|
||||
.its("request.headers")
|
||||
.should("have.property", "origin", "Cypress");
|
||||
cy.contains(email, { matchCase: false });
|
||||
cy.get(homePage.closeBtn).click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("shareAndPublic", (email, role) => {
|
||||
cy.stubPostHeaderReq();
|
||||
cy.xpath(homePage.email)
|
||||
.click({ force: true })
|
||||
.type(email);
|
||||
cy.xpath(homePage.selectRole).click({ force: true });
|
||||
cy.xpath(role).click({ force: true });
|
||||
cy.xpath(homePage.inviteBtn).click({ force: true });
|
||||
cy.wait("@mockPostInvite")
|
||||
.its("request.headers")
|
||||
.should("have.property", "origin", "Cypress");
|
||||
cy.contains(email, { matchCase: false });
|
||||
cy.enablePublicAccess();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("enablePublicAccess", () => {
|
||||
cy.get(homePage.enablePublicAccess).click();
|
||||
cy.wait("@changeAccess").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
cy.get(homePage.closeBtn).click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("deleteUserFromOrg", (orgName) => {
|
||||
cy.get(homePage.orgList.concat(orgName).concat(")"))
|
||||
.scrollIntoView()
|
||||
.should("be.visible");
|
||||
cy.get(homePage.orgList.concat(orgName).concat(")"))
|
||||
.closest(homePage.orgCompleteSection)
|
||||
.find(homePage.orgNamePopover)
|
||||
.find(homePage.optionsIcon)
|
||||
.click({ force: true });
|
||||
cy.xpath(homePage.MemberSettings).click({ force: true });
|
||||
cy.wait("@getRoles").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
cy.get(homePage.DeleteBtn)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
cy.get(homePage.leaveOrgConfirmModal).should("be.visible");
|
||||
cy.get(homePage.leaveOrgConfirmButton).click({ force: true });
|
||||
cy.xpath(homePage.appHome)
|
||||
.first()
|
||||
.should("be.visible")
|
||||
.click();
|
||||
cy.wait("@applications").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("updateUserRoleForOrg", (orgName, email, role) => {
|
||||
cy.stubPostHeaderReq();
|
||||
cy.get(homePage.orgList.concat(orgName).concat(")"))
|
||||
.scrollIntoView()
|
||||
.should("be.visible");
|
||||
cy.get(homePage.orgList.concat(orgName).concat(")"))
|
||||
.closest(homePage.orgCompleteSection)
|
||||
.find(homePage.orgNamePopover)
|
||||
.find(homePage.optionsIcon)
|
||||
.click({ force: true });
|
||||
cy.xpath(homePage.MemberSettings).click({ force: true });
|
||||
cy.wait("@getMembers").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
cy.get(homePage.inviteUserMembersPage).click({ force: true });
|
||||
cy.xpath(homePage.email)
|
||||
.click({ force: true })
|
||||
.type(email);
|
||||
cy.xpath(homePage.selectRole).click({ force: true });
|
||||
cy.xpath(role).click({ force: true });
|
||||
cy.xpath(homePage.inviteBtn).click({ force: true });
|
||||
cy.wait("@mockPostInvite")
|
||||
.its("request.headers")
|
||||
.should("have.property", "origin", "Cypress");
|
||||
cy.contains(email, { matchCase: false });
|
||||
cy.get(".bp3-icon-small-cross").click({ force: true });
|
||||
cy.xpath(homePage.appHome)
|
||||
.first()
|
||||
.should("be.visible")
|
||||
.click();
|
||||
cy.wait("@applications").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("launchApp", () => {
|
||||
cy.get(homePage.appView)
|
||||
.should("be.visible")
|
||||
.first()
|
||||
.click();
|
||||
cy.get("#loading").should("not.exist");
|
||||
cy.wait("@getPagesForViewApp").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("AppSetupForRename", () => {
|
||||
cy.get(homePage.applicationName).then(($appName) => {
|
||||
if (!$appName.hasClass(homePage.editingAppName)) {
|
||||
cy.get(homePage.applicationName).click({ force: true });
|
||||
cy.get(homePage.portalMenuItem)
|
||||
.contains("Edit Name", { matchCase: false })
|
||||
.click({ force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("CreateAppForOrg", (orgName, appname) => {
|
||||
cy.get(homePage.orgList.concat(orgName).concat(homePage.createAppFrOrg))
|
||||
.scrollIntoView()
|
||||
.should("be.visible")
|
||||
.click({ force: true });
|
||||
cy.wait("@createNewApplication").then((xhr) => {
|
||||
const response = xhr.response;
|
||||
expect(response.body.responseMeta.status).to.eq(201);
|
||||
localStorage.setItem("applicationId", response.body.data.id);
|
||||
cy.wrap(response.body.data.id).as("currentApplicationId");
|
||||
});
|
||||
|
||||
cy.get("#loading").should("not.exist");
|
||||
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
||||
cy.wait(2000);
|
||||
|
||||
cy.AppSetupForRename();
|
||||
cy.get(homePage.applicationName).type(appname + "{enter}");
|
||||
|
||||
cy.get(generatePage.buildFromScratchActionCard).click();
|
||||
|
||||
cy.wait("@updateApplication").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("CreateAppInFirstListedOrg", (appname) => {
|
||||
let applicationId;
|
||||
cy.get(homePage.createNew)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.wait("@createNewApplication").then((xhr) => {
|
||||
const response = xhr.response;
|
||||
expect(response.body.responseMeta.status).to.eq(201);
|
||||
applicationId = response.body.data.id;
|
||||
localStorage.setItem("applicationId", applicationId);
|
||||
});
|
||||
cy.get("#loading").should("not.exist");
|
||||
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
||||
cy.wait(2000);
|
||||
cy.AppSetupForRename();
|
||||
cy.get(homePage.applicationName).type(appname + "{enter}");
|
||||
cy.wait("@updateApplication").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
|
||||
cy.waitUntil(() => cy.get(generatePage.buildFromScratchActionCard), {
|
||||
errorMsg: "Build app from scratch not visible even aft 80 secs",
|
||||
timeout: 20000,
|
||||
interval: 1000,
|
||||
}).then(($ele) => cy.wrap($ele).should("be.visible"));
|
||||
|
||||
cy.get(generatePage.buildFromScratchActionCard).click();
|
||||
|
||||
/* The server created app always has an old dsl so the layout will migrate
|
||||
* To avoid race conditions between that update layout and this one
|
||||
* we wait for that to finish before updating layout here
|
||||
*/
|
||||
cy.wait("@updateLayout");
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
384
app/client/cypress/support/dataSourceCommands.js
Normal file
384
app/client/cypress/support/dataSourceCommands.js
Normal file
|
|
@ -0,0 +1,384 @@
|
|||
/* eslint-disable cypress/no-unnecessary-waiting */
|
||||
/* eslint-disable cypress/no-assigning-return-values */
|
||||
|
||||
require("cy-verify-downloads").addCustomCommand();
|
||||
require("cypress-file-upload");
|
||||
|
||||
const {
|
||||
addMatchImageSnapshotCommand,
|
||||
} = require("cypress-image-snapshot/command");
|
||||
const pages = require("../locators/Pages.json");
|
||||
const datasourceEditor = require("../locators/DatasourcesEditor.json");
|
||||
const datasourceFormData = require("../fixtures/datasources.json");
|
||||
const explorer = require("../locators/explorerlocators.json");
|
||||
|
||||
export const initLocalstorage = () => {
|
||||
cy.window().then((window) => {
|
||||
window.localStorage.setItem("ShowCommentsButtonToolTip", "");
|
||||
window.localStorage.setItem("updateDismissed", "true");
|
||||
});
|
||||
};
|
||||
|
||||
Cypress.Commands.add("firestoreDatasourceForm", () => {
|
||||
cy.get(datasourceEditor.datasourceConfigUrl).type(
|
||||
datasourceFormData["database-url"],
|
||||
);
|
||||
cy.get(datasourceEditor.projectID).type(datasourceFormData["projectID"]);
|
||||
cy.get(datasourceEditor.serviceAccCredential)
|
||||
.clear()
|
||||
.type(datasourceFormData["serviceAccCredentials"]);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("amazonDatasourceForm", () => {
|
||||
cy.get(datasourceEditor.projectID).type(datasourceFormData["access_key"]);
|
||||
cy.get(datasourceEditor.serviceAccCredential)
|
||||
.clear()
|
||||
.type(datasourceFormData["secret_key"]);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("testSaveDeleteDatasource", () => {
|
||||
// Instead of deleting the last datasource on the active datasources list,
|
||||
// we delete the datasource that was just created (identified by its title)
|
||||
cy.get(datasourceEditor.datasourceTitle)
|
||||
.invoke("text")
|
||||
.then((datasourceTitle) => {
|
||||
// test datasource
|
||||
cy.get(".t--test-datasource").click();
|
||||
cy.wait("@testDatasource");
|
||||
// .should("have.nested.property", "response.body.data.success", true)
|
||||
// .debug();
|
||||
|
||||
// save datasource
|
||||
cy.get(".t--save-datasource").click();
|
||||
cy.wait("@saveDatasource").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
// select datasource to be deleted by datasource title
|
||||
cy.get(`${datasourceEditor.datasourceCard}`)
|
||||
.contains(datasourceTitle)
|
||||
.last()
|
||||
.click();
|
||||
// delete datasource
|
||||
cy.get(".t--delete-datasource").click();
|
||||
cy.get(".t--delete-datasource")
|
||||
.contains("Are you sure?")
|
||||
.click();
|
||||
cy.wait("@deleteDatasource").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("NavigateToDatasourceEditor", () => {
|
||||
cy.get(explorer.addDBQueryEntity)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
cy.get(pages.integrationCreateNew)
|
||||
.should("be.visible")
|
||||
.click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("testDatasource", (expectedRes = true) => {
|
||||
cy.get(".t--test-datasource").click({ force: true });
|
||||
cy.wait("@testDatasource").should(
|
||||
"have.nested.property",
|
||||
"response.body.data.success",
|
||||
expectedRes,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("saveDatasource", () => {
|
||||
cy.get(".t--save-datasource").click({ force: true });
|
||||
cy.wait("@saveDatasource")
|
||||
.then((xhr) => {
|
||||
cy.log(JSON.stringify(xhr.response.body));
|
||||
})
|
||||
.should("have.nested.property", "response.body.responseMeta.status", 200);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("testSaveDatasource", (expectedRes = true) => {
|
||||
cy.testDatasource(expectedRes);
|
||||
cy.saveDatasource();
|
||||
// cy.get(datasourceEditor.datasourceCard)
|
||||
// .last()
|
||||
// .click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
"fillMongoDatasourceForm",
|
||||
(shouldAddTrailingSpaces = false) => {
|
||||
const hostAddress = shouldAddTrailingSpaces
|
||||
? datasourceFormData["mongo-host"] + " "
|
||||
: datasourceFormData["mongo-host"];
|
||||
// const databaseName = shouldAddTrailingSpaces
|
||||
// ? datasourceFormData["mongo-databaseName"] + " "
|
||||
// : datasourceFormData["mongo-databaseName"];
|
||||
cy.get(datasourceEditor["host"]).type(hostAddress);
|
||||
cy.get(datasourceEditor.port).type(datasourceFormData["mongo-port"]);
|
||||
//cy.get(datasourceEditor["port"]).type(datasourceFormData["mongo-port"]);
|
||||
//cy.get(datasourceEditor["selConnectionType"]).click();
|
||||
//cy.contains(datasourceFormData["connection-type"]).click();
|
||||
//cy.get(datasourceEditor["defaultDatabaseName"]).type(databaseName);//is optional hence removing
|
||||
cy.get(datasourceEditor.sectionAuthentication).click();
|
||||
cy.get(datasourceEditor["databaseName"])
|
||||
.clear()
|
||||
.type(datasourceFormData["mongo-databaseName"]);
|
||||
// cy.get(datasourceEditor["username"]).type(
|
||||
// datasourceFormData["mongo-username"],
|
||||
// );
|
||||
// cy.get(datasourceEditor["password"]).type(
|
||||
// datasourceFormData["mongo-password"],
|
||||
// );
|
||||
// cy.get(datasourceEditor["authenticationAuthtype"]).click();
|
||||
// cy.contains(datasourceFormData["mongo-authenticationAuthtype"]).click({
|
||||
// force: true,
|
||||
// });
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add(
|
||||
"fillPostgresDatasourceForm",
|
||||
(shouldAddTrailingSpaces = false) => {
|
||||
const hostAddress = shouldAddTrailingSpaces
|
||||
? datasourceFormData["postgres-host"] + " "
|
||||
: datasourceFormData["postgres-host"];
|
||||
const databaseName = shouldAddTrailingSpaces
|
||||
? datasourceFormData["postgres-databaseName"] + " "
|
||||
: datasourceFormData["postgres-databaseName"];
|
||||
|
||||
cy.get(datasourceEditor.host).type(hostAddress);
|
||||
cy.get(datasourceEditor.port).type(datasourceFormData["postgres-port"]);
|
||||
cy.get(datasourceEditor.databaseName)
|
||||
.clear()
|
||||
.type(databaseName);
|
||||
cy.get(datasourceEditor.sectionAuthentication).click();
|
||||
cy.get(datasourceEditor.username).type(
|
||||
datasourceFormData["postgres-username"],
|
||||
);
|
||||
cy.get(datasourceEditor.password).type(
|
||||
datasourceFormData["postgres-password"],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add(
|
||||
"fillMySQLDatasourceForm",
|
||||
(shouldAddTrailingSpaces = false) => {
|
||||
const hostAddress = shouldAddTrailingSpaces
|
||||
? datasourceFormData["mysql-host"] + " "
|
||||
: datasourceFormData["mysql-host"];
|
||||
const databaseName = shouldAddTrailingSpaces
|
||||
? datasourceFormData["mysql-databaseName"] + " "
|
||||
: datasourceFormData["mysql-databaseName"];
|
||||
|
||||
cy.get(datasourceEditor.host).type(hostAddress);
|
||||
cy.get(datasourceEditor.port).type(datasourceFormData["mysql-port"]);
|
||||
cy.get(datasourceEditor.databaseName)
|
||||
.clear()
|
||||
.type(databaseName);
|
||||
|
||||
cy.get(datasourceEditor.sectionAuthentication).click();
|
||||
cy.get(datasourceEditor.username).type(
|
||||
datasourceFormData["mysql-username"],
|
||||
);
|
||||
cy.get(datasourceEditor.password).type(
|
||||
datasourceFormData["mysql-password"],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add(
|
||||
"fillMsSQLDatasourceForm",
|
||||
(shouldAddTrailingSpaces = false) => {
|
||||
const hostAddress = shouldAddTrailingSpaces
|
||||
? datasourceFormData["mssql-host"] + " "
|
||||
: datasourceFormData["mssql-host"];
|
||||
const databaseName = shouldAddTrailingSpaces
|
||||
? datasourceFormData["mssql-databaseName"] + " "
|
||||
: datasourceFormData["mssql-databaseName"];
|
||||
|
||||
cy.get(datasourceEditor.host).type(hostAddress);
|
||||
cy.get(datasourceEditor.port).type(datasourceFormData["mssql-port"]);
|
||||
cy.get(datasourceEditor.databaseName)
|
||||
.clear()
|
||||
.type(databaseName);
|
||||
|
||||
cy.get(datasourceEditor.sectionAuthentication).click();
|
||||
cy.get(datasourceEditor.username).type(
|
||||
datasourceFormData["mssql-username"],
|
||||
);
|
||||
cy.get(datasourceEditor.password).type(
|
||||
datasourceFormData["mssql-password"],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add(
|
||||
"fillArangoDBDatasourceForm",
|
||||
(shouldAddTrailingSpaces = false) => {
|
||||
const hostAddress = shouldAddTrailingSpaces
|
||||
? datasourceFormData["arango-host"] + " "
|
||||
: datasourceFormData["arango-host"];
|
||||
const databaseName = shouldAddTrailingSpaces
|
||||
? datasourceFormData["arango-databaseName"] + " "
|
||||
: datasourceFormData["arango-databaseName"];
|
||||
|
||||
cy.get(datasourceEditor.host).type(hostAddress);
|
||||
cy.get(datasourceEditor.port).type(datasourceFormData["arango-port"]);
|
||||
cy.get(datasourceEditor.databaseName)
|
||||
.clear()
|
||||
.type(databaseName);
|
||||
|
||||
cy.get(datasourceEditor.sectionAuthentication).click();
|
||||
cy.get(datasourceEditor.username).type(
|
||||
datasourceFormData["arango-username"],
|
||||
);
|
||||
cy.get(datasourceEditor.password).type(
|
||||
datasourceFormData["arango-password"],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add(
|
||||
"fillRedshiftDatasourceForm",
|
||||
(shouldAddTrailingSpaces = false) => {
|
||||
const hostAddress = shouldAddTrailingSpaces
|
||||
? datasourceFormData["redshift-host"] + " "
|
||||
: datasourceFormData["redshift-host"];
|
||||
const databaseName = shouldAddTrailingSpaces
|
||||
? datasourceFormData["redshift-databaseName"] + " "
|
||||
: datasourceFormData["redshift-databaseName"];
|
||||
|
||||
cy.get(datasourceEditor.host).type(hostAddress);
|
||||
cy.get(datasourceEditor.port).type(datasourceFormData["redshift-port"]);
|
||||
cy.get(datasourceEditor.databaseName)
|
||||
.clear()
|
||||
.type(databaseName);
|
||||
|
||||
cy.get(datasourceEditor.sectionAuthentication).click();
|
||||
cy.get(datasourceEditor.username).type(
|
||||
datasourceFormData["redshift-username"],
|
||||
);
|
||||
cy.get(datasourceEditor.password).type(
|
||||
datasourceFormData["redshift-password"],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add(
|
||||
"fillUsersMockDatasourceForm",
|
||||
(shouldAddTrailingSpaces = false) => {
|
||||
const userMockDatabaseName = shouldAddTrailingSpaces
|
||||
? `${datasourceFormData["mockDatabaseName"] + " "}`
|
||||
: datasourceFormData["mockDatabaseName"];
|
||||
|
||||
const userMockHostAddress = shouldAddTrailingSpaces
|
||||
? `${datasourceFormData["mockHostAddress"] + " "}`
|
||||
: datasourceFormData["mockHostAddress"];
|
||||
|
||||
const userMockDatabaseUsername = shouldAddTrailingSpaces
|
||||
? `${datasourceFormData["mockDatabaseUsername"] + " "}`
|
||||
: datasourceFormData["mockDatabaseUsername"];
|
||||
|
||||
cy.get(datasourceEditor["host"])
|
||||
.clear()
|
||||
.type(userMockHostAddress);
|
||||
|
||||
cy.get(datasourceEditor["databaseName"])
|
||||
.clear()
|
||||
.type(userMockDatabaseName);
|
||||
|
||||
cy.get(datasourceEditor["sectionAuthentication"]).click();
|
||||
|
||||
cy.get(datasourceEditor["password"])
|
||||
.clear()
|
||||
.type(datasourceFormData["mockDatabasePassword"]);
|
||||
|
||||
cy.get(datasourceEditor["username"])
|
||||
.clear()
|
||||
.type(userMockDatabaseUsername);
|
||||
},
|
||||
);
|
||||
Cypress.Commands.add(
|
||||
"fillSMTPDatasourceForm",
|
||||
(shouldAddTrailingSpaces = false) => {
|
||||
const hostAddress = shouldAddTrailingSpaces
|
||||
? datasourceFormData["smtp-host"] + " "
|
||||
: datasourceFormData["smtp-host"];
|
||||
cy.get(datasourceEditor.host).type(hostAddress);
|
||||
cy.get(datasourceEditor.port).type(datasourceFormData["smtp-port"]);
|
||||
cy.get(datasourceEditor.sectionAuthentication).click();
|
||||
cy.get(datasourceEditor.username).type(datasourceFormData["smtp-username"]);
|
||||
cy.get(datasourceEditor.password).type(datasourceFormData["smtp-password"]);
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add("createPostgresDatasource", () => {
|
||||
cy.NavigateToDatasourceEditor();
|
||||
cy.get(datasourceEditor.PostgreSQL).click();
|
||||
//cy.getPluginFormsAndCreateDatasource();
|
||||
cy.fillPostgresDatasourceForm();
|
||||
cy.testSaveDatasource();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("deleteDatasource", (datasourceName) => {
|
||||
cy.NavigateToQueryEditor();
|
||||
cy.get(pages.integrationActiveTab)
|
||||
.should("be.visible")
|
||||
.click({ force: true });
|
||||
cy.contains(".t--datasource-name", datasourceName).click();
|
||||
cy.get(".t--delete-datasource").click();
|
||||
cy.get(".t--delete-datasource")
|
||||
.contains("Are you sure?")
|
||||
.click();
|
||||
cy.wait("@deleteDatasource").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("renameDatasource", (datasourceName) => {
|
||||
cy.get(".t--edit-datasource-name").click();
|
||||
cy.get(".t--edit-datasource-name input")
|
||||
.clear()
|
||||
.type(datasourceName, { force: true })
|
||||
.should("have.value", datasourceName)
|
||||
.blur();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("fillAmazonS3DatasourceForm", () => {
|
||||
cy.get(datasourceEditor.projectID)
|
||||
.clear()
|
||||
.type(Cypress.env("S3_ACCESS_KEY"));
|
||||
cy.get(datasourceEditor.serviceAccCredential)
|
||||
.clear()
|
||||
.type(Cypress.env("S3_SECRET_KEY"));
|
||||
});
|
||||
|
||||
Cypress.Commands.add("createAmazonS3Datasource", () => {
|
||||
cy.NavigateToDatasourceEditor();
|
||||
cy.get(datasourceEditor.AmazonS3).click();
|
||||
cy.fillAmazonS3DatasourceForm();
|
||||
cy.testSaveDatasource();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("fillMongoDatasourceFormWithURI", () => {
|
||||
cy.xpath(datasourceEditor["mongoUriDropdown"])
|
||||
.click()
|
||||
.wait(500);
|
||||
cy.xpath(datasourceEditor["mongoUriYes"])
|
||||
.click()
|
||||
.wait(500);
|
||||
cy.xpath(datasourceEditor["mongoUriInput"]).type(
|
||||
datasourceFormData["mongo-uri"],
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("ReconnectDatasource", (datasource) => {
|
||||
cy.xpath(`//span[text()='${datasource}']`).click();
|
||||
});
|
||||
336
app/client/cypress/support/gitSync.js
Normal file
336
app/client/cypress/support/gitSync.js
Normal file
|
|
@ -0,0 +1,336 @@
|
|||
/* eslint-disable cypress/no-unnecessary-waiting */
|
||||
/* eslint-disable cypress/no-assigning-return-values */
|
||||
|
||||
require("cy-verify-downloads").addCustomCommand();
|
||||
require("cypress-file-upload");
|
||||
|
||||
const {
|
||||
addMatchImageSnapshotCommand,
|
||||
} = require("cypress-image-snapshot/command");
|
||||
import gitSyncLocators from "../locators/gitSyncLocators";
|
||||
import homePage from "../locators/HomePage";
|
||||
const commonLocators = require("../locators/commonlocators.json");
|
||||
|
||||
const GITHUB_API_BASE = "https://api.github.com";
|
||||
|
||||
Cypress.Commands.add("revokeAccessGit", (appName) => {
|
||||
cy.xpath("//span[text()= `${appName}`]")
|
||||
.parent()
|
||||
.next()
|
||||
.click();
|
||||
cy.get(gitSyncLocators.disconnectAppNameInput).type(appName);
|
||||
cy.get(gitSyncLocators.disconnectButton).click();
|
||||
cy.route("POST", "api/v1/git/disconnect/*").as("disconnect");
|
||||
cy.get(gitSyncLocators.disconnectButton).click();
|
||||
cy.wait("@disconnect").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
cy.window()
|
||||
.its("store")
|
||||
.invoke("getState")
|
||||
.then((state) => {
|
||||
const { id, name } = state.ui.gitSync.disconnectingGitApp;
|
||||
expect(name).to.eq("");
|
||||
expect(id).to.eq("");
|
||||
});
|
||||
});
|
||||
Cypress.Commands.add(
|
||||
"connectToGitRepo",
|
||||
(repo, shouldCommit = true, assertConnectFailure) => {
|
||||
const testEmail = "test@test.com";
|
||||
const testUsername = "testusername";
|
||||
const owner = Cypress.env("TEST_GITHUB_USER_NAME");
|
||||
|
||||
let generatedKey;
|
||||
// open gitSync modal
|
||||
cy.get(homePage.deployPopupOptionTrigger).click();
|
||||
cy.get(homePage.connectToGitBtn).click({ force: true });
|
||||
|
||||
cy.intercept(
|
||||
{
|
||||
url: "api/v1/git/connect/*",
|
||||
hostname: window.location.host,
|
||||
},
|
||||
(req) => {
|
||||
req.headers["origin"] = "Cypress";
|
||||
},
|
||||
);
|
||||
cy.intercept("POST", "/api/v1/applications/ssh-keypair/*").as(
|
||||
`generateKey-${repo}`,
|
||||
);
|
||||
cy.get(gitSyncLocators.gitRepoInput).type(
|
||||
`git@github.com:${owner}/${repo}.git`,
|
||||
);
|
||||
cy.get(gitSyncLocators.generateDeployKeyBtn).click();
|
||||
cy.wait(`@generateKey-${repo}`).then((result) => {
|
||||
generatedKey = result.response.body.data.publicKey;
|
||||
generatedKey = generatedKey.slice(0, generatedKey.length - 1);
|
||||
// fetch the generated key and post to the github repo
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${GITHUB_API_BASE}/repos/${Cypress.env(
|
||||
"TEST_GITHUB_USER_NAME",
|
||||
)}/${repo}/keys`,
|
||||
headers: {
|
||||
Authorization: `token ${Cypress.env("GITHUB_PERSONAL_ACCESS_TOKEN")}`,
|
||||
},
|
||||
body: {
|
||||
title: "key0",
|
||||
key: generatedKey,
|
||||
},
|
||||
});
|
||||
|
||||
cy.get(gitSyncLocators.useGlobalGitConfig).click();
|
||||
|
||||
cy.get(gitSyncLocators.gitConfigNameInput).type(
|
||||
`{selectall}${testUsername}`,
|
||||
);
|
||||
cy.get(gitSyncLocators.gitConfigEmailInput).type(
|
||||
`{selectall}${testEmail}`,
|
||||
);
|
||||
// click on the connect button and verify
|
||||
cy.get(gitSyncLocators.connectSubmitBtn).click();
|
||||
|
||||
if (!assertConnectFailure) {
|
||||
// check for connect success
|
||||
cy.wait("@connectGitRepo").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
|
||||
// click commit button
|
||||
if (shouldCommit) {
|
||||
cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit");
|
||||
cy.get(gitSyncLocators.commitButton).click();
|
||||
// check for commit success
|
||||
cy.wait("@commit").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
201,
|
||||
);
|
||||
|
||||
cy.get(gitSyncLocators.closeGitSyncModal).click();
|
||||
}
|
||||
} else {
|
||||
cy.wait("@connectGitRepo").then((interception) => {
|
||||
const status = interception.response.body.responseMeta.status;
|
||||
expect(status).to.be.gte(400);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add("createGitBranch", (branch) => {
|
||||
cy.get(gitSyncLocators.branchButton).click({ force: true });
|
||||
cy.get(gitSyncLocators.branchSearchInput).type(`{selectall}${branch}{enter}`);
|
||||
// increasing timeout to reduce flakyness
|
||||
cy.get(".bp3-spinner", { timeout: 30000 }).should("exist");
|
||||
cy.get(".bp3-spinner", { timeout: 30000 }).should("not.exist");
|
||||
});
|
||||
|
||||
Cypress.Commands.add("switchGitBranch", (branch, expectError) => {
|
||||
cy.get(gitSyncLocators.branchButton).click({ force: true });
|
||||
cy.get(gitSyncLocators.branchSearchInput).type(`{selectall}${branch}`);
|
||||
cy.get(gitSyncLocators.branchListItem)
|
||||
.contains(branch)
|
||||
.click();
|
||||
if (!expectError) {
|
||||
// increasing timeout to reduce flakyness
|
||||
cy.get(".bp3-spinner", { timeout: 30000 }).should("exist");
|
||||
cy.get(".bp3-spinner", { timeout: 30000 }).should("not.exist");
|
||||
}
|
||||
});
|
||||
|
||||
Cypress.Commands.add("createTestGithubRepo", (repo, privateFlag = false) => {
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${GITHUB_API_BASE}/user/repos`,
|
||||
headers: {
|
||||
Authorization: `token ${Cypress.env("GITHUB_PERSONAL_ACCESS_TOKEN")}`,
|
||||
},
|
||||
body: {
|
||||
name: repo,
|
||||
private: privateFlag,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("mergeViaGithubApi", ({ base, head, repo }) => {
|
||||
const owner = Cypress.env("TEST_GITHUB_USER_NAME");
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${GITHUB_API_BASE}/repos/${owner}/${repo}/merges`,
|
||||
headers: {
|
||||
Authorization: `token ${Cypress.env("GITHUB_PERSONAL_ACCESS_TOKEN")}`,
|
||||
},
|
||||
body: {
|
||||
base,
|
||||
head,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("deleteTestGithubRepo", (repo) => {
|
||||
cy.request({
|
||||
method: "DELETE",
|
||||
url: `${GITHUB_API_BASE}/repos/${Cypress.env(
|
||||
"TEST_GITHUB_USER_NAME",
|
||||
)}/${repo}`,
|
||||
headers: {
|
||||
Authorization: `token ${Cypress.env("GITHUB_PERSONAL_ACCESS_TOKEN")}`,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
"renameBranchViaGithubApi",
|
||||
(repo, currentName, newName) => {
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${GITHUB_API_BASE}/repos/${Cypress.env(
|
||||
"TEST_GITHUB_USER_NAME",
|
||||
)}/${repo}/branches/${currentName}/rename`,
|
||||
headers: {
|
||||
Authorization: `token ${Cypress.env("GITHUB_PERSONAL_ACCESS_TOKEN")}`,
|
||||
},
|
||||
body: {
|
||||
new_name: newName,
|
||||
},
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add("commitAndPush", (assertFailure) => {
|
||||
cy.get(homePage.publishButton).click();
|
||||
cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit");
|
||||
cy.get(gitSyncLocators.commitButton).click();
|
||||
|
||||
if (!assertFailure) {
|
||||
// check for commit success
|
||||
cy.wait("@commit").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
201,
|
||||
);
|
||||
} else {
|
||||
cy.wait("@commit").then((interception) => {
|
||||
const status = interception.response.body.responseMeta.status;
|
||||
expect(status).to.be.gte(400);
|
||||
});
|
||||
}
|
||||
|
||||
cy.get(gitSyncLocators.closeGitSyncModal).click();
|
||||
});
|
||||
|
||||
// todo rishabh s: refactor
|
||||
Cypress.Commands.add(
|
||||
"createAppAndConnectGit",
|
||||
(appname, shouldConnect = true, assertConnectFailure) => {
|
||||
cy.get(homePage.homeIcon).click({ force: true });
|
||||
cy.get(homePage.createNew)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.wait("@createNewApplication").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
201,
|
||||
);
|
||||
cy.get("#loading").should("not.exist");
|
||||
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
||||
cy.wait(2000);
|
||||
|
||||
cy.AppSetupForRename();
|
||||
cy.get(homePage.applicationName).type(appname + "{enter}");
|
||||
cy.wait("@updateApplication").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
|
||||
cy.createTestGithubRepo(appname, true);
|
||||
cy.connectToGitRepo(appname, false, assertConnectFailure);
|
||||
cy.get(gitSyncLocators.closeGitSyncModal).click({ force: true });
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add("merge", (destinationBranch) => {
|
||||
cy.get(gitSyncLocators.bottomBarMergeButton).click();
|
||||
cy.get(gitSyncLocators.mergeBranchDropdownDestination).click();
|
||||
cy.get(commonLocators.dropdownmenu)
|
||||
.contains(destinationBranch)
|
||||
.click();
|
||||
cy.contains(Cypress.env("MESSAGES").NO_MERGE_CONFLICT());
|
||||
cy.get(gitSyncLocators.mergeCTA).click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
"importAppFromGit",
|
||||
(repo, shouldCommit = true, assertConnectFailure) => {
|
||||
const testEmail = "test@test.com";
|
||||
const testUsername = "testusername";
|
||||
const owner = Cypress.env("TEST_GITHUB_USER_NAME");
|
||||
|
||||
let generatedKey;
|
||||
cy.intercept(
|
||||
{
|
||||
url: "api/v1/git/connect/*",
|
||||
hostname: window.location.host,
|
||||
},
|
||||
(req) => {
|
||||
req.headers["origin"] = "Cypress";
|
||||
},
|
||||
);
|
||||
cy.intercept("GET", "api/v1/git/import/keys").as(`generateKey-${repo}`);
|
||||
cy.get(gitSyncLocators.gitRepoInput).type(
|
||||
`git@github.com:${owner}/${repo}.git`,
|
||||
);
|
||||
cy.get(gitSyncLocators.generateDeployKeyBtn).click();
|
||||
cy.wait(`@generateKey-${repo}`).then((result) => {
|
||||
generatedKey = result.response.body.data.publicKey;
|
||||
generatedKey = generatedKey.slice(0, generatedKey.length - 1);
|
||||
// fetch the generated key and post to the github repo
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${GITHUB_API_BASE}/repos/${Cypress.env(
|
||||
"TEST_GITHUB_USER_NAME",
|
||||
)}/${repo}/keys`,
|
||||
headers: {
|
||||
Authorization: `token ${Cypress.env("GITHUB_PERSONAL_ACCESS_TOKEN")}`,
|
||||
},
|
||||
body: {
|
||||
title: "key0",
|
||||
key: generatedKey,
|
||||
},
|
||||
});
|
||||
|
||||
cy.get(gitSyncLocators.useGlobalGitConfig).click();
|
||||
|
||||
cy.get(gitSyncLocators.gitConfigNameInput).type(
|
||||
`{selectall}${testUsername}`,
|
||||
);
|
||||
cy.get(gitSyncLocators.gitConfigEmailInput).type(
|
||||
`{selectall}${testEmail}`,
|
||||
);
|
||||
// click on the connect button and verify
|
||||
cy.get(gitSyncLocators.connectSubmitBtn).click();
|
||||
|
||||
if (!assertConnectFailure) {
|
||||
// check for connect success
|
||||
cy.wait("@importFromGit").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
201,
|
||||
);
|
||||
} else {
|
||||
cy.wait("@importFromGit").then((interception) => {
|
||||
const status = interception.response.body.responseMeta.status;
|
||||
expect(status).to.be.gte(400);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
|
|
@ -15,26 +15,28 @@
|
|||
/// <reference types="Cypress" />
|
||||
|
||||
import "cypress-real-events/support";
|
||||
import "cypress-xpath";
|
||||
import "cypress-wait-until";
|
||||
/// <reference types="cypress-xpath" />
|
||||
|
||||
let appName;
|
||||
let applicationId;
|
||||
|
||||
import "cypress-xpath";
|
||||
import * as MESSAGES from "../../../client/src/ce/constants/messages.ts";
|
||||
import "./ApiCommands";
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import "./commands";
|
||||
import { initLocalstorage } from "./commands";
|
||||
import "./dataSourceCommands";
|
||||
import "./gitSync";
|
||||
import { initLocalstorageRegistry } from "./Objects/Registry";
|
||||
import * as MESSAGES from "../../../client/src/ce/constants/messages.ts";
|
||||
import "./OrgCommands";
|
||||
import "./queryCommands";
|
||||
import "./widgetCommands";
|
||||
/// <reference types="cypress-xpath" />
|
||||
|
||||
Cypress.on("uncaught:exception", (err, runnable) => {
|
||||
Cypress.on("uncaught:exception", () => {
|
||||
// returning false here prevents Cypress from
|
||||
// failing the test
|
||||
return false;
|
||||
});
|
||||
|
||||
Cypress.on("fail", (error, runnable) => {
|
||||
Cypress.on("fail", (error) => {
|
||||
throw error; // throw error to have test still fail
|
||||
});
|
||||
|
||||
|
|
|
|||
191
app/client/cypress/support/queryCommands.js
Normal file
191
app/client/cypress/support/queryCommands.js
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
/* eslint-disable cypress/no-unnecessary-waiting */
|
||||
/* eslint-disable cypress/no-assigning-return-values */
|
||||
|
||||
require("cy-verify-downloads").addCustomCommand();
|
||||
require("cypress-file-upload");
|
||||
|
||||
const {
|
||||
addMatchImageSnapshotCommand,
|
||||
} = require("cypress-image-snapshot/command");
|
||||
const datasourceEditor = require("../locators/DatasourcesEditor.json");
|
||||
const datasourceFormData = require("../fixtures/datasources.json");
|
||||
const commonlocators = require("../locators/commonlocators.json");
|
||||
const queryEditor = require("../locators/QueryEditor.json");
|
||||
const widgetsPage = require("../locators/Widgets.json");
|
||||
const apiwidget = require("../locators/apiWidgetslocator.json");
|
||||
const explorer = require("../locators/explorerlocators.json");
|
||||
const datasource = require("../locators/DatasourcesEditor.json");
|
||||
const queryLocators = require("../locators/QueryEditor.json");
|
||||
|
||||
export const initLocalstorage = () => {
|
||||
cy.window().then((window) => {
|
||||
window.localStorage.setItem("ShowCommentsButtonToolTip", "");
|
||||
window.localStorage.setItem("updateDismissed", "true");
|
||||
});
|
||||
};
|
||||
|
||||
Cypress.Commands.add("NavigateToQueryEditor", () => {
|
||||
cy.get(explorer.addDBQueryEntity)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("NavigateToQueriesInExplorer", () => {
|
||||
cy.get(explorer.entityQuery).click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("NavigateToActiveDSQueryPane", (datasourceName) => {
|
||||
cy.NavigateToQueryEditor();
|
||||
cy.NavigateToActiveTab();
|
||||
|
||||
cy.get(datasource.datasourceCard)
|
||||
.contains(datasourceName)
|
||||
.scrollIntoView()
|
||||
.should("be.visible")
|
||||
.closest(datasource.datasourceCard)
|
||||
.within(() => {
|
||||
cy.get(queryLocators.createQuery).click({ force: true });
|
||||
})
|
||||
.wait(2000); //for the specified page to load
|
||||
});
|
||||
|
||||
Cypress.Commands.add("NavigateToDSGeneratePage", (datasourceName) => {
|
||||
cy.NavigateToQueryEditor();
|
||||
cy.NavigateToActiveTab();
|
||||
|
||||
cy.get(datasource.datasourceCard)
|
||||
.contains(datasourceName)
|
||||
.scrollIntoView()
|
||||
.should("be.visible")
|
||||
.closest(datasource.datasourceCard)
|
||||
.within(() => {
|
||||
cy.get(datasource.datasourceCardGeneratePageBtn).click();
|
||||
})
|
||||
.wait(2000); //for the specified page to load
|
||||
});
|
||||
|
||||
Cypress.Commands.add("ClickGotIt", () => {
|
||||
cy.get("span:contains('GOT IT')").click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("fillGoogleSheetsDatasourceForm", () => {
|
||||
cy.get(datasourceEditor["scope"]).click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("fillAuthenticatedAPIForm", () => {
|
||||
const URL = datasourceFormData["authenticatedApiUrl"];
|
||||
cy.get(datasourceEditor.url).type(URL);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("runQuery", (expectedRes = true) => {
|
||||
cy.onlyQueryRun();
|
||||
cy.wait("@postExecute").should(
|
||||
"have.nested.property",
|
||||
"response.body.data.isExecutionSuccess",
|
||||
expectedRes,
|
||||
);
|
||||
|
||||
// cy.wait("@postExecute").should(
|
||||
// "have.nested.property",
|
||||
// "response.body.responseMeta.status",
|
||||
// 200,
|
||||
// );
|
||||
});
|
||||
|
||||
Cypress.Commands.add("onlyQueryRun", () => {
|
||||
cy.xpath(queryEditor.runQuery)
|
||||
.last()
|
||||
.click({ force: true })
|
||||
.wait(1000);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("hoverAndClick", () => {
|
||||
cy.xpath(apiwidget.popover)
|
||||
.last()
|
||||
.should("be.hidden")
|
||||
.invoke("show")
|
||||
.click({ force: true });
|
||||
cy.xpath(apiwidget.popover)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("hoverAndClickParticularIndex", (index) => {
|
||||
cy.xpath(apiwidget.popover)
|
||||
.eq(index)
|
||||
.should("be.hidden")
|
||||
.invoke("show")
|
||||
.click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("deleteQuery", () => {
|
||||
cy.hoverAndClick();
|
||||
cy.get(apiwidget.delete).click({ force: true });
|
||||
cy.get(apiwidget.deleteConfirm).click({ force: true });
|
||||
cy.wait("@deleteAction").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("deleteQueryUsingContext", () => {
|
||||
cy.get(queryEditor.queryMoreAction)
|
||||
.first()
|
||||
.click();
|
||||
cy.get(queryEditor.deleteUsingContext).click();
|
||||
cy.get(queryEditor.deleteUsingContext)
|
||||
.contains("Are you sure?")
|
||||
.click();
|
||||
cy.wait("@deleteAction").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("runAndDeleteQuery", () => {
|
||||
cy.runQuery();
|
||||
cy.deleteQueryUsingContext();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("executeDbQuery", (queryName) => {
|
||||
cy.get(widgetsPage.buttonOnClick)
|
||||
.get(commonlocators.dropdownSelectButton)
|
||||
.click({ force: true })
|
||||
.get("ul.bp3-menu")
|
||||
.children()
|
||||
.contains("Execute a query")
|
||||
.click({ force: true })
|
||||
.get("ul.bp3-menu")
|
||||
.children()
|
||||
.contains(queryName)
|
||||
.click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("CreateMockQuery", (queryName) => {
|
||||
// cy.get(queryEditor.addNewQueryBtn).click({ force: true });
|
||||
// cy.get(queryEditor.createQuery)
|
||||
// .first()
|
||||
// .click({ force: true });
|
||||
cy.get(queryEditor.queryNameField).type(queryName + "{enter}", {
|
||||
force: true,
|
||||
});
|
||||
cy.assertPageSave();
|
||||
cy.get(queryEditor.templateMenu + " div")
|
||||
.contains("Select")
|
||||
.click({ force: true });
|
||||
cy.runQuery();
|
||||
// cy.wait(3000);
|
||||
// cy.get(queryEditor.runQuery)
|
||||
// .click({force: true});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("ValidateQueryParams", (param) => {
|
||||
cy.xpath(apiwidget.paramsTab)
|
||||
.should("be.visible")
|
||||
.click({ force: true });
|
||||
|
||||
cy.validateCodeEditorContent(apiwidget.paramKey, param.key);
|
||||
cy.validateCodeEditorContent(apiwidget.paramValue, param.value);
|
||||
});
|
||||
1114
app/client/cypress/support/widgetCommands.js
Normal file
1114
app/client/cypress/support/widgetCommands.js
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user