test: Cypress - Flaky test fix (#23917)

## Description

**Fixed below flaky tests**

- Button_Text_WithRecaptcha_spec.js
- Fork_Template_Existing_app_spec.js
- Listv2_BasicServerSideData_spec.js

## Type of change

- Flaky test fix

## How Has This Been Tested?
- Cypress test runs

## Checklist:
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
This commit is contained in:
Vijetha-Kaja 2023-06-02 17:15:21 +05:30 committed by GitHub
parent eac743ff6d
commit 1f94651784
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 109 additions and 155 deletions

View File

@ -30,7 +30,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
job: [0, 1, 2, 3, 4] job: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]
# Service containers to run with this job. Required for running tests # Service containers to run with this job. Required for running tests
services: services:

View File

@ -22,10 +22,7 @@ describe("Shopping cart App", function () {
}); });
it("1. Create MongoDB datasource and add Insert, Find, Update and Delete queries", function () { it("1. Create MongoDB datasource and add Insert, Find, Update and Delete queries", function () {
cy.NavigateToDatasourceEditor(); _.dataSources.CreateDataSource("Mongo");
cy.get(datasource.MongoDB).click();
cy.fillMongoDatasourceForm();
cy.testSaveDatasource();
cy.get("@saveDatasource").then((httpResponse) => { cy.get("@saveDatasource").then((httpResponse) => {
datasourceName = httpResponse.response.body.data.name; datasourceName = httpResponse.response.body.data.name;
}); });
@ -125,27 +122,29 @@ describe("Shopping cart App", function () {
_.deployMode.DeployApp(appPage.bookname); _.deployMode.DeployApp(appPage.bookname);
}); });
it.skip("2. Perform CRUD operations and validate data", function () { it("2. Perform CRUD operations and validate data", function () {
// Adding the books to the Add cart form // Adding the books to the Add cart form
_.agHelper.GetNClick(appPage.bookname);
//Wait for element to be in DOM
_.agHelper.Sleep(3000);
_.agHelper.UpdateInput(appPage.bookname, "Atomic habits", true); _.agHelper.UpdateInput(appPage.bookname, "Atomic habits", true);
_.agHelper.UpdateInput(appPage.bookgenre, "Self help", true); _.agHelper.UpdateInput(appPage.bookgenre, "Self help", true);
_.agHelper.UpdateInput(appPage.bookprice, 200, true); _.agHelper.UpdateInput(appPage.bookprice, 200, true);
_.agHelper.UpdateInput(appPage.bookquantity, 2, true); _.agHelper.UpdateInput(appPage.bookquantity, 2, true);
cy.get("span:contains('Submit')").closest("div").eq(1).click(); _.agHelper.GetNClick(appPage.addButton, 0, true);
cy.assertPageSave(); cy.wait("@postExecute");
cy.wait(8000); cy.wait(3000);
_.agHelper.UpdateInput(appPage.bookname, "A man called ove", true); _.agHelper.UpdateInput(appPage.bookname, "A man called ove", true);
_.agHelper.UpdateInput(appPage.bookgenre, "Fiction", true); _.agHelper.UpdateInput(appPage.bookgenre, "Fiction", true);
_.agHelper.UpdateInput(appPage.bookprice, 100, true); _.agHelper.UpdateInput(appPage.bookprice, 100, true);
_.agHelper.UpdateInput(appPage.bookquantity, 1, true); _.agHelper.UpdateInput(appPage.bookquantity, 1, true);
cy.get("span:contains('Submit')").closest("div").eq(1).click(); _.agHelper.GetNClick(appPage.addButton, 0, true);
cy.assertPageSave();
cy.wait("@postExecute"); cy.wait("@postExecute");
// Deleting the book from the cart // Deleting the book from the cart
cy.get(".tableWrap") cy.get(".tableWrap")
.children() .children()
.within(() => { .within(() => {
cy.get("span:contains('Delete')").closest("div").eq(1).click(); _.agHelper.GetNClick(appPage.deleteButton, 1, false);
cy.wait("@postExecute"); cy.wait("@postExecute");
cy.wait(5000); cy.wait(5000);
@ -156,14 +155,19 @@ describe("Shopping cart App", function () {
}); });
// Updating the book quantity from edit cart // Updating the book quantity from edit cart
_.agHelper.UpdateInput(appPage.editbookquantity, 3, true); _.agHelper.UpdateInput(appPage.editbookquantity, 3, true);
cy.get("span:contains('Submit')").closest("div").eq(0).click(); _.agHelper.GetNClick(appPage.editButton, 0, true);
cy.assertPageSave(); _.agHelper.AssertAutoSave();
cy.wait(5000); _.agHelper.ValidateNetworkExecutionSuccess("@postExecute");
cy.get("@postExecute.last")
.its("response.body")
.then((user) => {
expect(user.data.body[0].quantity).to.equal("3");
});
// validating updated value in the cart // validating updated value in the cart
cy.get(".selected-row").children().eq(3).should("have.text", "3"); cy.get(".selected-row").children().eq(3).should("have.text", "3");
}); });
it.skip("3. Connect the appplication to git and validate data in deploy mode and edit mode", function () { it("3. Connect the appplication to git and validate data in deploy mode and edit mode", function () {
cy.get(".t--back-to-editor").click(); cy.get(".t--back-to-editor").click();
_.gitSync.CreateNConnectToGit(repoName); _.gitSync.CreateNConnectToGit(repoName);
cy.get("@gitRepoName").then((repName) => { cy.get("@gitRepoName").then((repName) => {
@ -185,6 +189,6 @@ describe("Shopping cart App", function () {
after(() => { after(() => {
//clean up //clean up
// _.gitSync.DeleteTestGithubRepo(repoName); _.gitSync.DeleteTestGithubRepo(repoName);
}); });
}); });

View File

@ -1,25 +1,20 @@
const queryLocators = require("../../../../locators/QueryEditor.json"); const queryLocators = require("../../../../locators/QueryEditor.json");
const datasource = require("../../../../locators/DatasourcesEditor.json"); const datasource = require("../../../../locators/DatasourcesEditor.json");
import { ObjectsRegistry } from "../../../../support/Objects/Registry"; import * as _ from "../../../../support/Objects/ObjectsCore";
const locator = ObjectsRegistry.CommonLocators;
let datasourceName; let datasourceName;
describe("SQL Autocompletion", function () { describe("SQL Autocompletion", function () {
it("Shows autocompletion hints", function () { it("Shows autocompletion hints", function () {
cy.NavigateToDatasourceEditor(); _.dataSources.CreateDataSource("Postgres");
cy.get(datasource.PostgreSQL).click({ force: true });
cy.fillPostgresDatasourceForm();
cy.generateUUID().then((uid) => { cy.generateUUID().then((uid) => {
datasourceName = `Postgres CRUD ds ${uid}`; datasourceName = `Postgres CRUD ds ${uid}`;
cy.renameDatasource(datasourceName); cy.renameDatasource(datasourceName);
cy.testSaveDatasource();
cy.NavigateToActiveDSQueryPane(datasourceName); cy.NavigateToActiveDSQueryPane(datasourceName);
}); });
cy.get(queryLocators.templateMenu).click({ force: true }); cy.get(queryLocators.templateMenu).click({ force: true });
cy.get(".CodeMirror textarea").focus().type("S"); cy.get(".CodeMirror textarea").focus().type("S");
cy.get(locator._hints).should("exist"); cy.get(_.locators._hints).should("exist");
cy.deleteQueryUsingContext(); cy.deleteQueryUsingContext();
}); });
}); });

View File

@ -98,10 +98,20 @@ describe(
_.agHelper.SelectDropdownList("Google reCAPTCHA version", "reCAPTCHA v3"); _.agHelper.SelectDropdownList("Google reCAPTCHA version", "reCAPTCHA v3");
_.agHelper.ClickButton("Submit"); _.agHelper.ClickButton("Submit");
_.agHelper.Sleep(); _.agHelper.Sleep();
_.agHelper.AssertElementAbsence( cy.get("body").then(($ele) => {
_.locators._specificToast("Google Re-Captcha token generation failed!"), if (
5000, $ele.find(
); _.locators._specificToast(
"Google Re-Captcha token generation failed!",
),
).length ||
$ele
.find(_.locators._widgetInCanvas("textwidget") + " span")
.text() == ""
) {
_.agHelper.ClickButton("Submit");
}
});
_.agHelper _.agHelper
.GetText(_.locators._widgetInCanvas("textwidget") + " span") .GetText(_.locators._widgetInCanvas("textwidget") + " span")
.should("not.be.empty"); .should("not.be.empty");

View File

@ -1,5 +1,6 @@
import * as _ from "../../../../support/Objects/ObjectsCore"; import * as _ from "../../../../support/Objects/ObjectsCore";
import { Widgets } from "../../../../support/Pages/DataSources"; import { Widgets } from "../../../../support/Pages/DataSources";
import datasourceFormData from "../../../../fixtures/datasources.json";
import { import {
ERROR_ACTION_EXECUTE_FAIL, ERROR_ACTION_EXECUTE_FAIL,
@ -8,7 +9,7 @@ import {
describe("API Bugs", function () { describe("API Bugs", function () {
it("1. Bug 14037: User gets an error even when table widget is added from the API page successfully", function () { it("1. Bug 14037: User gets an error even when table widget is added from the API page successfully", function () {
_.apiPage.CreateAndFillApi("https://mock-api.appsmith.com/users", "Api1"); _.apiPage.CreateAndFillApi(datasourceFormData.mockApiUrl, "Api1");
_.apiPage.RunAPI(); _.apiPage.RunAPI();
_.dataSources.AddSuggesstedWidget(Widgets.Table); _.dataSources.AddSuggesstedWidget(Widgets.Table);

View File

@ -1,9 +1,7 @@
const queryLocators = require("../../../../locators/QueryEditor.json"); const queryLocators = require("../../../../locators/QueryEditor.json");
const datasource = require("../../../../locators/DatasourcesEditor.json"); const datasource = require("../../../../locators/DatasourcesEditor.json");
const apiwidget = require("../../../../locators/apiWidgetslocator.json"); const apiwidget = require("../../../../locators/apiWidgetslocator.json");
import * as _ from "../../../../support/Objects/ObjectsCore";
import { ObjectsRegistry } from "../../../../support/Objects/Registry";
let ee = ObjectsRegistry.EntityExplorer;
const pageid = "MyPage"; const pageid = "MyPage";
let updatedName; let updatedName;
@ -22,11 +20,8 @@ describe("Entity explorer tests related to copy query", function () {
it("1. Create a query with dataSource in explorer, Create new Page", function () { it("1. Create a query with dataSource in explorer, Create new Page", function () {
cy.Createpage(pageid); cy.Createpage(pageid);
ee.SelectEntityByName("Page1"); _.entityExplorer.SelectEntityByName("Page1");
cy.NavigateToDatasourceEditor(); _.dataSources.CreateDataSource("Postgres");
cy.get(datasource.PostgreSQL).click();
cy.fillPostgresDatasourceForm();
cy.testSaveDatasource();
cy.get("@saveDatasource").then((httpResponse) => { cy.get("@saveDatasource").then((httpResponse) => {
datasourceName = httpResponse.response.body.data.name; datasourceName = httpResponse.response.body.data.name;
@ -47,8 +42,8 @@ describe("Entity explorer tests related to copy query", function () {
cy.get(".t--action-name-edit-field").click({ force: true }); cy.get(".t--action-name-edit-field").click({ force: true });
cy.get("@saveDatasource").then((httpResponse) => { cy.get("@saveDatasource").then((httpResponse) => {
datasourceName = httpResponse.response.body.data.name; datasourceName = httpResponse.response.body.data.name;
ee.ExpandCollapseEntity("Queries/JS"); _.entityExplorer.ExpandCollapseEntity("Queries/JS");
ee.ActionContextMenuByEntityName("Query1", "Show bindings"); _.entityExplorer.ActionContextMenuByEntityName("Query1", "Show bindings");
cy.get(apiwidget.propertyList).then(function ($lis) { cy.get(apiwidget.propertyList).then(function ($lis) {
expect($lis).to.have.length(5); expect($lis).to.have.length(5);
expect($lis.eq(0)).to.contain("{{Query1.isLoading}}"); expect($lis.eq(0)).to.contain("{{Query1.isLoading}}");
@ -61,12 +56,16 @@ describe("Entity explorer tests related to copy query", function () {
}); });
it("2. Copy query in explorer to new page & verify Bindings are copied too", function () { it("2. Copy query in explorer to new page & verify Bindings are copied too", function () {
ee.SelectEntityByName("Query1", "Queries/JS"); _.entityExplorer.SelectEntityByName("Query1", "Queries/JS");
ee.ActionContextMenuByEntityName("Query1", "Copy to page", pageid); _.entityExplorer.ActionContextMenuByEntityName(
ee.ExpandCollapseEntity("Queries/JS"); "Query1",
ee.SelectEntityByName("Query1"); "Copy to page",
pageid,
);
_.entityExplorer.ExpandCollapseEntity("Queries/JS");
_.entityExplorer.SelectEntityByName("Query1");
cy.runQuery(); cy.runQuery();
ee.ActionContextMenuByEntityName("Query1", "Show bindings"); _.entityExplorer.ActionContextMenuByEntityName("Query1", "Show bindings");
cy.get(apiwidget.propertyList).then(function ($lis) { cy.get(apiwidget.propertyList).then(function ($lis) {
expect($lis.eq(0)).to.contain("{{Query1.isLoading}}"); expect($lis.eq(0)).to.contain("{{Query1.isLoading}}");
expect($lis.eq(1)).to.contain("{{Query1.data}}"); expect($lis.eq(1)).to.contain("{{Query1.data}}");
@ -77,18 +76,22 @@ describe("Entity explorer tests related to copy query", function () {
}); });
it("3. Rename datasource in explorer, Delete query and try to Delete datasource", function () { it("3. Rename datasource in explorer, Delete query and try to Delete datasource", function () {
ee.SelectEntityByName("Page1"); _.entityExplorer.SelectEntityByName("Page1");
cy.generateUUID().then((uid) => { cy.generateUUID().then((uid) => {
updatedName = uid; updatedName = uid;
cy.log("complete uid :" + updatedName); cy.log("complete uid :" + updatedName);
updatedName = uid.replace(/-/g, "_").slice(1, 15); updatedName = uid.replace(/-/g, "_").slice(1, 15);
cy.log("sliced id :" + updatedName); cy.log("sliced id :" + updatedName);
ee.ExpandCollapseEntity("Queries/JS"); _.entityExplorer.ExpandCollapseEntity("Queries/JS");
ee.ExpandCollapseEntity("Datasources"); _.entityExplorer.ExpandCollapseEntity("Datasources");
ee.RenameEntityFromExplorer(datasourceName, updatedName); _.entityExplorer.RenameEntityFromExplorer(datasourceName, updatedName);
//cy.EditEntityNameByDoubleClick(datasourceName, updatedName); //cy.EditEntityNameByDoubleClick(datasourceName, updatedName);
cy.wait(1000); cy.wait(1000);
ee.ActionContextMenuByEntityName(updatedName, "Delete", "Are you sure?"); _.entityExplorer.ActionContextMenuByEntityName(
updatedName,
"Delete",
"Are you sure?",
);
cy.wait(1000); cy.wait(1000);
//This is check to make sure if a datasource is active 409 //This is check to make sure if a datasource is active 409
cy.wait("@deleteDatasource").should( cy.wait("@deleteDatasource").should(
@ -97,7 +100,11 @@ describe("Entity explorer tests related to copy query", function () {
409, 409,
); );
}); });
ee.SelectEntityByName("Query1", "Queries/JS"); _.entityExplorer.SelectEntityByName("Query1", "Queries/JS");
ee.ActionContextMenuByEntityName("Query1", "Delete", "Are you sure?"); _.entityExplorer.ActionContextMenuByEntityName(
"Query1",
"Delete",
"Are you sure?",
);
}); });
}); });

View File

@ -125,12 +125,10 @@ describe("1. CommandClickNavigation", function () {
_.agHelper.Sleep(); _.agHelper.Sleep();
cy.get(`[${NAVIGATION_ATTRIBUTE}="JSObject1.myFun1"]`).click( cy.get(`[${NAVIGATION_ATTRIBUTE}="JSObject1.myFun1"]`).click({
{ cmdKey: true,
ctrlKey: true, force: true,
}, });
{ force: true },
);
cy.assertCursorOnCodeInput(".js-editor", { ch: 1, line: 3 }); cy.assertCursorOnCodeInput(".js-editor", { ch: 1, line: 3 });
_.agHelper.Sleep(); _.agHelper.Sleep();

View File

@ -11,7 +11,7 @@ describe("Undo/Redo functionality", function () {
let postgresDatasourceName; let postgresDatasourceName;
it("1. Checks undo/redo in datasource forms", () => { it("1. Checks undo/redo in datasource forms", () => {
cy.NavigateToDatasourceEditor(); _.dataSources.NavigateToDSCreateNew();
cy.get(datasource.PostgreSQL).click({ force: true }); cy.get(datasource.PostgreSQL).click({ force: true });
cy.generateUUID().then((uid) => { cy.generateUUID().then((uid) => {
postgresDatasourceName = uid; postgresDatasourceName = uid;

View File

@ -35,6 +35,9 @@ describe(
.scrollIntoView() .scrollIntoView()
.wait(500) .wait(500)
.click(); .click();
_.agHelper.WaitUntilEleDisappear(
"//*[text()='Loading template details']",
);
cy.wait(1000); cy.wait(1000);
_.agHelper.CheckForErrorToast( _.agHelper.CheckForErrorToast(
"Internal server error while processing request", "Internal server error while processing request",

View File

@ -1,3 +1,5 @@
import * as _ from "../../../../support/Objects/ObjectsCore";
describe("Visual tests for datasources", () => { describe("Visual tests for datasources", () => {
// for any changes in UI, update the screenshot in snapshot folder, to do so: // for any changes in UI, update the screenshot in snapshot folder, to do so:
// 1. Delete the required screenshot which you want to update. // 1. Delete the required screenshot which you want to update.
@ -11,8 +13,7 @@ describe("Visual tests for datasources", () => {
const newWorkspaceName = interception.response.body.data.name; const newWorkspaceName = interception.response.body.data.name;
cy.CreateAppForWorkspace(newWorkspaceName, newWorkspaceName); cy.CreateAppForWorkspace(newWorkspaceName, newWorkspaceName);
}); });
cy.NavigateToDatasourceEditor(); _.dataSources.NavigateToActiveTab();
cy.NavigateToActiveTab();
cy.get(".t--integrationsHomePage").matchImageSnapshot( cy.get(".t--integrationsHomePage").matchImageSnapshot(
"emptydatasourcepage", "emptydatasourcepage",
); );

View File

@ -1,7 +1,9 @@
const dsl = require("../../../../../fixtures/ChartLoadingDsl.json"); const dsl = require("../../../../../fixtures/ChartLoadingDsl.json");
const datasource = require("../../../../../locators/DatasourcesEditor.json"); const datasource = require("../../../../../locators/DatasourcesEditor.json");
const queryLocators = require("../../../../../locators/QueryEditor.json"); const queryLocators = require("../../../../../locators/QueryEditor.json");
import * as _ from "../../../../../support/Objects/ObjectsCore";
let dsname;
describe("Chart Widget Skeleton Loading Functionality", function () { describe("Chart Widget Skeleton Loading Functionality", function () {
before(() => { before(() => {
cy.addDsl(dsl); cy.addDsl(dsl);
@ -30,32 +32,12 @@ describe("Chart Widget Skeleton Loading Functionality", function () {
//Step1 //Step1
cy.wait(2000); cy.wait(2000);
cy.NavigateToDatasourceEditor(); _.dataSources.CreateMockDB("Users").then((dbName) => {
_.dataSources.CreateQueryFromActiveTab(dbName, false);
//Step2 _.agHelper.GetNClick(_.dataSources._templateMenuOption("Select"));
cy.get(datasource.mockUserDatabase).click(); _.dataSources.ToggleUsePreparedStatement(false);
//Step3 & 4
cy.get(`${datasource.datasourceCard}`)
.filter(":contains('Users')")
.last()
.within(() => {
cy.get(`${datasource.createQuery}`).click({ force: true });
}); });
//Step5.1: Click the editing field
cy.get(".t--action-name-edit-field").click({ force: true });
//Step5.2: Click the editing field
cy.get(queryLocators.queryNameField).type("Query1");
// switching off Use Prepared Statement toggle
cy.get(queryLocators.switch).last().click({ force: true });
//Step 6.1: Click on Write query area
cy.get(queryLocators.templateMenu).click();
cy.xpath(queryLocators.query).click({ force: true });
// Step6.2: writing query to get the schema // Step6.2: writing query to get the schema
cy.get(".CodeMirror textarea") cy.get(".CodeMirror textarea")
.first() .first()
@ -124,11 +106,7 @@ describe("Chart Widget Skeleton Loading Functionality", function () {
"1. Test case while reloading and on submission - airgap", "1. Test case while reloading and on submission - airgap",
function () { function () {
cy.wait(2000); cy.wait(2000);
cy.NavigateToDatasourceEditor(); _.dataSources.CreateDataSource("Postgres");
cy.get(datasource.PostgreSQL).click();
cy.fillPostgresDatasourceForm();
cy.testSaveDatasource();
cy.get("@saveDatasource").then((httpResponse) => { cy.get("@saveDatasource").then((httpResponse) => {
dsname = httpResponse.response.body.data.name; dsname = httpResponse.response.body.data.name;
}); });

View File

@ -4,7 +4,7 @@ const commonlocators = require("../../../../../locators/commonlocators.json");
const datasource = require("../../../../../locators/DatasourcesEditor.json"); const datasource = require("../../../../../locators/DatasourcesEditor.json");
const queryLocators = require("../../../../../locators/QueryEditor.json"); const queryLocators = require("../../../../../locators/QueryEditor.json");
import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; import * as _ from "../../../../../support/Objects/ObjectsCore";
const listData = [ const listData = [
{ {
@ -85,19 +85,17 @@ const listData = [
}, },
]; ];
let agHelper = ObjectsRegistry.AggregateHelper;
describe("List widget V2 page number and page size", () => { describe("List widget V2 page number and page size", () => {
before(() => { before(() => {
cy.addDsl(dsl); cy.addDsl(dsl);
}); });
beforeEach(() => { beforeEach(() => {
agHelper.RestoreLocalStorageCache(); _.agHelper.RestoreLocalStorageCache();
}); });
afterEach(() => { afterEach(() => {
agHelper.SaveLocalStorageCache(); _.agHelper.SaveLocalStorageCache();
}); });
it("1. List widget V2 with client side pagination", () => { it("1. List widget V2 with client side pagination", () => {
@ -164,32 +162,11 @@ describe("List widget V2 page number and page size", () => {
cy.addDsl(dslWithServerSide); cy.addDsl(dslWithServerSide);
// Open Datasource editor // Open Datasource editor
cy.wait(2000); cy.wait(2000);
cy.NavigateToDatasourceEditor(); _.dataSources.CreateMockDB("Users").then((dbName) => {
_.dataSources.CreateQueryFromActiveTab(dbName, false);
// Click on sample(mock) user database. _.agHelper.GetNClick(_.dataSources._templateMenuOption("Select"));
cy.get(datasource.mockUserDatabase).click(); _.dataSources.ToggleUsePreparedStatement(false);
// Choose the first data source which consists of users keyword & Click on the "New query +"" button
cy.get(`${datasource.datasourceCard}`)
.filter(":contains('Users')")
.first()
.within(() => {
cy.get(`${datasource.createQuery}`).click({ force: true });
}); });
// Click the editing field
cy.get(".t--action-name-edit-field").click({ force: true });
// Click the editing field
cy.get(queryLocators.queryNameField).type("Query1");
// switching off Use Prepared Statement toggle
cy.get(queryLocators.switch).last().click({ force: true });
//.1: Click on Write query area
cy.get(queryLocators.templateMenu).click();
cy.xpath(queryLocators.query).click({ force: true });
// writing query to get the schema // writing query to get the schema
cy.get(".CodeMirror textarea") cy.get(".CodeMirror textarea")
.first() .first()
@ -232,12 +209,7 @@ describe("List widget V2 page number and page size", () => {
cy.addDsl(dslWithServerSide); cy.addDsl(dslWithServerSide);
// Open Datasource editor // Open Datasource editor
cy.wait(2000); cy.wait(2000);
cy.NavigateToDatasourceEditor(); _.dataSources.CreateDataSource("Postgres");
cy.get(datasource.PostgreSQL).click();
cy.fillPostgresDatasourceForm();
cy.testSaveDatasource();
cy.wait(1000);
cy.get(datasource.createQuery).click(); cy.get(datasource.createQuery).click();
// Click the editing field // Click the editing field

View File

@ -395,11 +395,7 @@ describe("List widget v2 - Basic server side data tests", () => {
"airgap", "airgap",
"6. no of items rendered should be equal to page size - airgap", "6. no of items rendered should be equal to page size - airgap",
() => { () => {
cy.NavigateToDatasourceEditor(); _.dataSources.CreateDataSource("Postgres");
cy.get(datasource.PostgreSQL).click();
cy.fillPostgresDatasourceForm();
cy.testSaveDatasource();
cy.wait(1000); cy.wait(1000);
cy.get(datasource.createQuery).click(); cy.get(datasource.createQuery).click();
// Click the editing field // Click the editing field

View File

@ -54,11 +54,8 @@ describe("Cyclic Dependency Informational Error Messages", function () {
"airgap", "airgap",
"1. Create Users Sample DB Query & Simulate cyclic depedency - airgap", "1. Create Users Sample DB Query & Simulate cyclic depedency - airgap",
() => { () => {
//Step1 : Create Users DB //Step1 : Create postgres DB
cy.NavigateToDatasourceEditor(); _.dataSources.CreateDataSource("Postgres");
cy.get(datasource.PostgreSQL).click();
cy.fillPostgresDatasourceForm();
cy.testSaveDatasource();
cy.get("@saveDatasource").then((httpResponse) => { cy.get("@saveDatasource").then((httpResponse) => {
dsname = httpResponse.response.body.data.name; dsname = httpResponse.response.body.data.name;
}); });

View File

@ -372,17 +372,12 @@ describe("Validate Mongo query commands", function () {
"response.body.responseMeta.status", "response.body.responseMeta.status",
201, 201,
); );
cy.NavigateToDatasourceEditor(); _.dataSources.CreateDataSource("Mongo");
cy.get(datasource.MongoDB).click({ force: true });
cy.fillMongoDatasourceForm();
cy.CheckAndUnfoldEntityItem("Datasources");
cy.generateUUID().then((uid) => { cy.generateUUID().then((uid) => {
datasourceName = `Mongo Documents ${uid}`; datasourceName = `Mongo Documents ${uid}`;
cy.renameDatasource(datasourceName); cy.renameDatasource(datasourceName);
cy.wrap(datasourceName).as("dSName"); cy.wrap(datasourceName).as("dSName");
}); });
cy.testSaveDatasource();
//Insert documents //Insert documents
cy.get("@dSName").then((dbName) => { cy.get("@dSName").then((dbName) => {

View File

@ -1,7 +1,5 @@
const datasource = require("../../../locators/DatasourcesEditor.json"); const datasource = require("../../../locators/DatasourcesEditor.json");
import { ObjectsRegistry } from "../../../support/Objects/Registry"; import * as _ from "../../../support/Objects/ObjectsCore";
let dataSource = ObjectsRegistry.DataSources;
let datasourceName; let datasourceName;
describe("Postgres datasource test cases", function () { describe("Postgres datasource test cases", function () {
@ -10,13 +8,10 @@ describe("Postgres datasource test cases", function () {
}); });
it("1. Create, test, save then delete a postgres datasource", function () { it("1. Create, test, save then delete a postgres datasource", function () {
cy.NavigateToDatasourceEditor(); _.dataSources.CreateDataSource("Postgres");
cy.get(datasource.PostgreSQL).click({ force: true });
cy.fillPostgresDatasourceForm();
cy.testSaveDatasource();
cy.get("@saveDatasource").then((httpResponse) => { cy.get("@saveDatasource").then((httpResponse) => {
datasourceName = JSON.stringify(httpResponse.response.body.data.name); datasourceName = JSON.stringify(httpResponse.response.body.data.name);
dataSource.DeleteDatasouceFromActiveTab( _.dataSources.DeleteDatasouceFromActiveTab(
datasourceName.replace(/['"]+/g, ""), datasourceName.replace(/['"]+/g, ""),
); );
}); });

View File

@ -205,7 +205,7 @@
], ],
"leftColumn": 22, "leftColumn": 22,
"dynamicBindingPathList": [], "dynamicBindingPathList": [],
"text": "Submit", "text": "Edit",
"key": "kjr7tyw06m", "key": "kjr7tyw06m",
"rightColumn": 40, "rightColumn": 40,
"isDefaultClickDisabled": true, "isDefaultClickDisabled": true,
@ -750,7 +750,7 @@
], ],
"leftColumn": 23, "leftColumn": 23,
"dynamicBindingPathList": [], "dynamicBindingPathList": [],
"text": "Submit", "text": "Add",
"key": "kjr7tyw06m", "key": "kjr7tyw06m",
"rightColumn": 39, "rightColumn": 39,
"isDefaultClickDisabled": true, "isDefaultClickDisabled": true,

View File

@ -21,5 +21,7 @@
"bookquantity": "(//div[@class='bp3-input-group'])[8]", "bookquantity": "(//div[@class='bp3-input-group'])[8]",
"addtoCart": "//span[@class='bp3-button-text' and text()='Submit']", "addtoCart": "//span[@class='bp3-button-text' and text()='Submit']",
"deletefromCart": "//span[@class='bp3-button-text' and text()='Delete']", "deletefromCart": "//span[@class='bp3-button-text' and text()='Delete']",
"editbookquantity": "(//div[@class='bp3-input-group'])[4]" "editbookquantity": "(//div[@class='bp3-input-group'])[4]",
"addButton":"//span[text()='Add']/parent::button",
"editButton":"//span[text()='Edit']/parent::button"
} }