Merge pull request #10059 from ToolJet/test/pltform-cypress-fix

Modified failing platform cypress test cases
This commit is contained in:
Adish M 2024-06-13 11:59:38 +05:30 committed by GitHub
commit 82043e7a9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 67 additions and 67 deletions

View file

@ -71,13 +71,13 @@ describe("App Version Functionality", () => {
cy.openApp()
cy.get('[data-cy="widget-list-box-table"]').should("be.visible");
cy.dragAndDropWidget("Toggle Switch", 50, 50);
verifyComponent("toggleswitch1");
cy.dragAndDropWidget("Text", 50, 50);
verifyComponent("text1");
navigateToCreateNewVersionModal((currentVersion = "v1"));
createNewVersion((newVersion = ["v2"]), (versionFrom = "v1"));
verifyComponent("toggleswitch1");
deleteComponentAndVerify("toggleswitch1");
verifyComponent("text1");
deleteComponentAndVerify("text1");
cy.dragAndDropWidget(buttonText.defaultWidgetText);
verifyComponent("button1");
@ -87,7 +87,7 @@ describe("App Version Functionality", () => {
navigateToCreateNewVersionModal((currentVersion = "v3"));
createNewVersion((newVersion = ["v4"]), (versionFrom = "v1"));
verifyComponent("toggleswitch1");
verifyComponent("text1");
editVersionAndVerify(
(currentVersion = "v4"),

View file

@ -12,9 +12,13 @@ describe("Manage SSO for multi workspace", () => {
beforeEach(() => {
cy.defaultWorkspaceLogin();
SSO.deleteOrganisationSSO("My workspace", ["google", "git"]);
SSO.resetDomain();
});
after(() => {
cy.defaultWorkspaceLogin();
SSO.resetDomain();
});
it("Should verify General settings page elements", () => {
SSO.resetDomain();
SSO.setSignupStatus(false);
SSO.defaultSSO(true);

View file

@ -290,54 +290,38 @@ describe("Workspace constants", () => {
cy.apiCreateApp(data.appName);
cy.getCookie("tj_auth_token").then((cookie) => {
const headers = {
"Tj-Workspace-Id": Cypress.env("workspaceId"),
Cookie: `tj_auth_token=${cookie.value}`,
};
cy.request({
method: "GET",
url: `http://localhost:3000/api/app-environments/versions?app_id=${Cypress.env(
"appId"
)}`,
headers: headers,
}).then((response) => {
const appVersions = response.body.appVersions;
const appVersionId = appVersions[0].id;
createDataQuery(
appVersionId,
data.restapilink,
data.restapiHeaderKey,
data.restapiHeaderValue
);
});
});
cy.wait(1000);
createDataQuery(
data.appName,
data.restapilink,
data.restapiHeaderKey,
data.restapiHeaderValue
);
cy.openApp();
cy.get(".custom-toggle-switch>.switch>").eq(3).click();
cy.waitForAutoSave();
cy.dragAndDropWidget("Text", 550, 650);
cy.dragAndDropWidget("Text Input", 550, 650);
editAndVerifyWidgetName(data.widgetName, []);
cy.waitForAutoSave();
cy.get(
'[data-cy="textcomponenttextinput-input-field"]'
'[data-cy="default-value-input-field"]'
).clearAndTypeOnCodeMirror(`{{queries.restapi1.data.message`);
cy.forceClickOnCanvas();
cy.waitForAutoSave();
cy.get(dataSourceSelector.queryCreateAndRunButton).click();
cy.get(
commonWidgetSelector.draggableWidget(data.widgetName)
).verifyVisibleElement("have.text", "Production environment testing");
).verifyVisibleElement("have.value", "Production environment testing");
cy.openInCurrentTab(commonWidgetSelector.previewButton);
cy.wait(4000);
cy.get(
commonWidgetSelector.draggableWidget(data.widgetName)
).verifyVisibleElement("have.text", "Production environment testing");
).verifyVisibleElement("have.value", "Production environment testing");
});
it("should verify the constants resolving in datasource connection form", () => {
data.ds = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");

View file

@ -143,10 +143,6 @@ describe("Bulk user upload", () => {
});
cy.get(usersSelector.buttonUploadUsers).click();
cy.wait(10000);
cy.get(".go2072408551")
.should("be.visible")
.and("have.text", "250 users are being added");
cy.wait(1000);
common.searchUser("test12@gmail.com");
cy.contains("td", "test12@gmail.com")
.parent()

View file

@ -159,36 +159,52 @@ export const selectDatasource = (datasourceName) => {
cy.get(`[data-cy="${cyParamName(datasourceName)}-button"]`).click();
};
export const createDataQuery = (versionId, url, key, value) => {
cy.getCookie("tj_auth_token").then((cookie) => {
const headers = {
"Tj-Workspace-Id": Cypress.env("workspaceId"),
Cookie: `tj_auth_token=${cookie.value}`,
};
cy.request({
method: "POST",
url: "http://localhost:3000/api/data_queries",
headers: headers,
body: {
app_id: Cypress.env("appId"),
app_version_id: versionId,
name: "restapi1",
kind: "restapi",
options: {
method: "get",
url: `{{constants.${url}}}`,
url_params: [["", ""]],
headers: [[`{{constants.${key}}}`, `{{constants.${value}}}`]],
body: [["", ""]],
json_body: null,
body_toggle: false,
transformationLanguage: "javascript",
enableTransformation: false,
},
data_source_id: null,
},
}).then((response) => {
expect(response.status).to.equal(201);
export const createDataQuery = (appName, url, key, value) => {
let appId, versionId;
cy.task("updateId", {
dbconfig: Cypress.env("app_db"),
sql: `select id from apps where name='${appName}';`,
}).then((resp) => {
appId = resp.rows[0].id;
cy.task("updateId", {
dbconfig: Cypress.env("app_db"),
sql: `select id from app_versions where app_id='${appId}';`,
}).then((resp) => {
versionId = resp.rows[0].id;
cy.getCookie("tj_auth_token").then((cookie) => {
const headers = {
"Tj-Workspace-Id": Cypress.env("workspaceId"),
Cookie: `tj_auth_token=${cookie.value}`,
};
cy.request({
method: "POST",
url: "http://localhost:3000/api/data_queries",
headers: headers,
body: {
app_id: appId,
app_version_id: versionId,
name: "restapi1",
kind: "restapi",
options: {
method: "get",
url: `{{constants.${url}}}`,
url_params: [["", ""]],
headers: [[`{{constants.${key}}}`, `{{constants.${value}}}`]],
body: [["", ""]],
json_body: null,
body_toggle: false,
transformationLanguage: "javascript",
enableTransformation: false,
},
data_source_id: null,
},
}).then((response) => {
expect(response.status).to.equal(201);
});
});
});
});
};