## Description
- **This PR flaky fixes below specs:**
- GenerateCRUD/MySQL2_Spec.ts script fix
- ServerSide/ApiTests/API_All_Verb_spec.js
- Regression/Apps/PromisesApp_spec.js
- TableV2_Property_ToggleJs_With_Binding_spec.js
- GSheet cases failures due to EditApponHover method fix
- Radio/Radio2_spec.ts, using `GetHeight` instead of
`GetWidgetCSSHeight`
- Select/Select3_Spec.ts
- Widgets/Text/Text_new_feature_spec.js
- Binding/API_with_List_Widget_spec.js
- Workspace/LoginFromUIApp_spec.js - removed redundant code
- QueryPane/DSDocs_Spec.ts
- ServerSide/QueryPane/GoogleSheets_spec.ts
- TableV2/Date_column_editing_1_spec.ts
- Git/ExistingApps/v1.9.24/DSCrudAndBindings_Spec.ts - script flow
corrected
- ServerSide/QueryPane/Mongo_Spec.js
- **Added validation for form plugin response data, which addresses the
Empty toast issue**
- **Below specs are fixed for new appName localStorage changes:**
- /SettingsPane/PageSettings_spec.ts
- BugTests/Moment_Spec.ts
- /Fork/ForkAppWithMultipleDS_Spec.ts
- Fork/ForkApplicationWithinAppEditor_spec.ts
- Fork/ForkApplication_spec.ts
- /ClientSide/OtherUIFeatures/Analytics_spec.js
- OtherUIFeatures/ApplicationURL_spec.js
- OtherUIFeatures/ExportApplication_spec.js - Duplicate case removed
- OtherUIFeatures/UpdateApplication_spec.js
- VisualTests/JSEditorIndent_spec.js
- Workspace/WorkspaceImportApplication_spec.js
- **Improvemnets:**
- deployMode.StubWindowNAssert() improved to validate `getPluginForm`
instead of `getWorkspace`
- agHelper.AddDsl() improved, removed wait times
- appSettings.CheckUrl() - appName url updated
- assertHelper.AssertDocumentReady() -removed wait times
- assertHelper.AssertNetworkResponseData() - added for `getPluginForm`
validation for Page loads
- deployMode.DeployApp() -removed wait times
- homePage.CreateNewWorkspace() - improved to set localStorage for
workspaceName, workspaceId & create new workspace without new name
- homePage.CreateNewApplication() - - improved to set localStorage for
appName
- jsEditor.NavigateToNewJSEditor() - improved to remove tooltip
- cy.CreateAppInFirstListedWorkspace() - improved to set localStorage
for appName, removed waitTimes, Removed rename of every app for every
spec, calling AssertNetworkResponseData(getPluginForm)
- cy.DeleteWorkspaceByApi() added
- e2e.js - removed guid generation for first app, added
cy.DeleteWorkspaceByApi() in after()
#### Type of change
- Script fix (non-breaking change which fixes an issue)
## Testing
#### How Has This Been Tested?
- [X] Cypress CI runs
## Checklist:
#### QA activity:
- [X] Added `Test Plan Approved` label after Cypress tests were reviewed
194 lines
5.9 KiB
JavaScript
194 lines
5.9 KiB
JavaScript
// ***********************************************************
|
|
// This example support/index.js is processed and
|
|
// loaded automatically before your test files.
|
|
//
|
|
// This is a great place to put global configuration and
|
|
// behavior that modifies Cypress.
|
|
//
|
|
// You can change the location of this file or turn off
|
|
// automatically serving support files with the
|
|
// 'supportFile' configuration option.
|
|
//
|
|
// You can read more here:
|
|
// https://on.cypress.io/configuration
|
|
// ***********************************************************
|
|
/// <reference types="Cypress" />
|
|
/// <reference types='cypress-tags' />
|
|
import "cypress-real-events/support";
|
|
import "cypress-wait-until";
|
|
import "cypress-network-idle";
|
|
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, addIndexedDBKey } from "./commands";
|
|
import "./dataSourceCommands";
|
|
import "./gitSync";
|
|
import { initLocalstorageRegistry } from "./Objects/Registry";
|
|
import RapidMode from "./RapidMode.ts";
|
|
import "cypress-mochawesome-reporter/register";
|
|
import installLogsCollector from "cypress-terminal-report/src/installLogsCollector";
|
|
|
|
import "./WorkspaceCommands";
|
|
import "./queryCommands";
|
|
import "./widgetCommands";
|
|
import "./themeCommands";
|
|
import "./AdminSettingsCommands";
|
|
import "cypress-plugin-tab";
|
|
import {
|
|
FEATURE_WALKTHROUGH_INDEX_KEY,
|
|
WALKTHROUGH_TEST_PAGE,
|
|
} from "./Constants.js";
|
|
/// <reference types="cypress-xpath" />
|
|
|
|
installLogsCollector();
|
|
|
|
Cypress.on("uncaught:exception", (error) => {
|
|
//cy.log(error.message);
|
|
return false; // returning false here prevents Cypress from failing the test
|
|
});
|
|
|
|
Cypress.on("fail", (error) => {
|
|
cy.log(error.message);
|
|
throw error; // throw error to have test fail
|
|
});
|
|
|
|
Cypress.env("MESSAGES", MESSAGES);
|
|
let dataSet; // Declare a variable to hold the test data
|
|
|
|
before(function () {
|
|
if (RapidMode.config.enabled) {
|
|
cy.startServerAndRoutes();
|
|
cy.getCookie("SESSION").then((cookie) => {
|
|
if (!cookie) {
|
|
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
|
|
}
|
|
});
|
|
|
|
//Cypress.Cookies.preserveOnce("SESSION", "remember_token");
|
|
if (!RapidMode.config.usesDSL) {
|
|
cy.visit(RapidMode.url());
|
|
cy.wait("@getWorkspace");
|
|
}
|
|
}
|
|
});
|
|
|
|
before(function () {
|
|
if (RapidMode.config.enabled) {
|
|
return;
|
|
}
|
|
//console.warn = () => {}; //to remove all warnings in cypress console
|
|
initLocalstorage();
|
|
initLocalstorageRegistry();
|
|
cy.startServerAndRoutes();
|
|
// Clear indexedDB
|
|
cy.window().then((window) => {
|
|
window.indexedDB.deleteDatabase("Appsmith");
|
|
});
|
|
cy.visit("/setup/welcome", { timeout: 60000 });
|
|
cy.wait("@getMe");
|
|
cy.wait(2000);
|
|
cy.url().then((url) => {
|
|
if (url.indexOf("setup/welcome") > -1) {
|
|
cy.createSuperUser();
|
|
cy.SignupFromAPI(
|
|
Cypress.env("TESTUSERNAME1"),
|
|
Cypress.env("TESTPASSWORD1"),
|
|
);
|
|
cy.LogOut();
|
|
cy.SignupFromAPI(
|
|
Cypress.env("TESTUSERNAME2"),
|
|
Cypress.env("TESTPASSWORD2"),
|
|
);
|
|
cy.LogOut();
|
|
cy.SignupFromAPI(
|
|
Cypress.env("TESTUSERNAME3"),
|
|
Cypress.env("TESTPASSWORD3"),
|
|
);
|
|
cy.LogOut();
|
|
cy.SignupFromAPI(
|
|
Cypress.env("TESTUSERNAME4"),
|
|
Cypress.env("TESTPASSWORD4"),
|
|
);
|
|
cy.LogOut();
|
|
}
|
|
});
|
|
|
|
if (!Cypress.currentTest.titlePath[0].includes(WALKTHROUGH_TEST_PAGE)) {
|
|
// Adding key FEATURE_WALKTHROUGH (which is used to check if the walkthrough is already shown to the user or not) for non walkthrough cypress tests (to not show walkthrough)
|
|
addIndexedDBKey(FEATURE_WALKTHROUGH_INDEX_KEY, {
|
|
ab_ds_binding_enabled: true,
|
|
ab_ds_schema_enabled: true,
|
|
binding_widget: true,
|
|
});
|
|
}
|
|
|
|
//console.warn = () => {};
|
|
//Cypress.Cookies.preserveOnce("SESSION", "remember_token");
|
|
const username = Cypress.env("USERNAME");
|
|
const password = Cypress.env("PASSWORD");
|
|
cy.LoginFromAPI(username, password);
|
|
cy.wait(3000);
|
|
cy.get(".t--applications-container .createnew")
|
|
.should("be.visible")
|
|
.should("be.enabled");
|
|
cy.CreateAppInFirstListedWorkspace(); //Creating new workspace and app
|
|
cy.fixture("TestDataSet1").then(function (data) {
|
|
this.dataSet = data;
|
|
});
|
|
});
|
|
|
|
// before(function () {
|
|
// if (RapidMode.config.enabled) {
|
|
// return;
|
|
// }
|
|
// // //console.warn = () => {};
|
|
// // //Cypress.Cookies.preserveOnce("SESSION", "remember_token");
|
|
// // const username = Cypress.env("USERNAME");
|
|
// // const password = Cypress.env("PASSWORD");
|
|
// // cy.LoginFromAPI(username, password);
|
|
// // cy.wait(3000);
|
|
// // cy.get(".t--applications-container .createnew")
|
|
// // .should("be.visible")
|
|
// // .should("be.enabled");
|
|
// // cy.generateUUID().then((id) => {
|
|
// // cy.CreateAppInFirstListedWorkspace(id);
|
|
// // localStorage.setItem("AppName", id);
|
|
// // });
|
|
|
|
// // cy.fixture("TestDataSet1").then(function (data) {
|
|
// // this.dataSet = data;
|
|
// // });
|
|
// });
|
|
|
|
beforeEach(function () {
|
|
//cy.window().then((win) => (win.onbeforeunload = undefined));
|
|
if (!navigator.userAgent.includes("Cypress")) {
|
|
window.addEventListener("beforeunload", this.beforeunloadFunction);
|
|
}
|
|
initLocalstorage();
|
|
//Cypress.Cookies.preserveOnce("SESSION", "remember_token");
|
|
cy.startServerAndRoutes();
|
|
//-- Delete local storage data of entity explorer
|
|
cy.DeleteEntityStateLocalStorage();
|
|
cy.intercept("api/v1/admin/env", (req) => {
|
|
req.headers["origin"] = Cypress.config("baseUrl");
|
|
});
|
|
});
|
|
|
|
after(function () {
|
|
if (RapidMode.config.enabled) {
|
|
return;
|
|
}
|
|
//-- Deleting the application by Api---//
|
|
cy.DeleteAppByApi();
|
|
cy.DeleteWorkspaceByApi();
|
|
//-- LogOut Application---//
|
|
cy.LogOut();
|
|
// Commenting until Upgrade Appsmith cases are fixed
|
|
// const tedUrl = "http://localhost:5001/v1/parent/cmd";
|
|
// cy.log("Start the appsmith container");
|
|
// cy.StartContainer(tedUrl, "appsmith"); // start the old container
|
|
});
|