2019-12-12 07:50:53 +00:00
|
|
|
// ***********************************************************
|
|
|
|
|
// 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
|
|
|
|
|
// ***********************************************************
|
2021-11-17 10:10:57 +00:00
|
|
|
/// <reference types="Cypress" />
|
2022-01-28 11:10:05 +00:00
|
|
|
|
2021-11-18 10:22:04 +00:00
|
|
|
import "cypress-real-events/support";
|
2022-02-24 03:11:35 +00:00
|
|
|
import "cypress-wait-until";
|
2022-04-11 03:30:37 +00:00
|
|
|
import "cypress-xpath";
|
|
|
|
|
import * as MESSAGES from "../../../client/src/ce/constants/messages.ts";
|
|
|
|
|
import "./ApiCommands";
|
2019-12-12 07:50:53 +00:00
|
|
|
// Import commands.js using ES2015 syntax:
|
2020-03-27 09:02:11 +00:00
|
|
|
import "./commands";
|
2021-07-02 06:04:36 +00:00
|
|
|
import { initLocalstorage } from "./commands";
|
2022-04-11 03:30:37 +00:00
|
|
|
import "./dataSourceCommands";
|
|
|
|
|
import "./gitSync";
|
2022-04-03 16:43:20 +00:00
|
|
|
import { initLocalstorageRegistry } from "./Objects/Registry";
|
2022-06-15 15:37:41 +00:00
|
|
|
import "./WorkspaceCommands";
|
2022-04-11 03:30:37 +00:00
|
|
|
import "./queryCommands";
|
|
|
|
|
import "./widgetCommands";
|
2022-05-11 06:13:28 +00:00
|
|
|
import "./themeCommands";
|
2022-04-21 06:14:02 +00:00
|
|
|
import "./AdminSettingsCommands";
|
2022-04-11 03:30:37 +00:00
|
|
|
/// <reference types="cypress-xpath" />
|
2020-06-17 10:47:01 +00:00
|
|
|
|
2022-04-11 03:30:37 +00:00
|
|
|
Cypress.on("uncaught:exception", () => {
|
2020-06-17 10:47:01 +00:00
|
|
|
// returning false here prevents Cypress from
|
|
|
|
|
// failing the test
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
2022-04-11 03:30:37 +00:00
|
|
|
Cypress.on("fail", (error) => {
|
2020-07-24 04:31:39 +00:00
|
|
|
throw error; // throw error to have test still fail
|
|
|
|
|
});
|
|
|
|
|
|
2021-11-17 15:28:23 +00:00
|
|
|
Cypress.env("MESSAGES", MESSAGES);
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
before(function() {
|
2021-12-10 07:23:12 +00:00
|
|
|
//console.warn = () => {};
|
2021-07-02 06:04:36 +00:00
|
|
|
initLocalstorage();
|
2022-04-03 16:43:20 +00:00
|
|
|
initLocalstorageRegistry();
|
2020-05-27 11:21:11 +00:00
|
|
|
cy.startServerAndRoutes();
|
2021-01-04 10:22:22 +00:00
|
|
|
// Clear indexedDB
|
|
|
|
|
cy.window().then((window) => {
|
|
|
|
|
window.indexedDB.deleteDatabase("Appsmith");
|
|
|
|
|
});
|
2021-11-16 10:23:05 +00:00
|
|
|
cy.visit("/setup/welcome");
|
2022-04-03 16:43:20 +00:00
|
|
|
cy.wait("@getMe");
|
|
|
|
|
cy.wait(2000);
|
2021-11-16 10:23:05 +00:00
|
|
|
cy.url().then((url) => {
|
|
|
|
|
if (url.indexOf("setup/welcome") > -1) {
|
|
|
|
|
cy.createSuperUser();
|
|
|
|
|
cy.LogOut();
|
|
|
|
|
cy.SignupFromAPI(
|
|
|
|
|
Cypress.env("TESTUSERNAME1"),
|
|
|
|
|
Cypress.env("TESTPASSWORD1"),
|
|
|
|
|
);
|
|
|
|
|
cy.LogOut();
|
|
|
|
|
cy.SignupFromAPI(
|
|
|
|
|
Cypress.env("TESTUSERNAME2"),
|
|
|
|
|
Cypress.env("TESTPASSWORD2"),
|
|
|
|
|
);
|
|
|
|
|
cy.LogOut();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
2021-10-29 09:10:30 +00:00
|
|
|
|
2021-11-16 10:23:05 +00:00
|
|
|
before(function() {
|
2021-12-10 07:23:12 +00:00
|
|
|
//console.warn = () => {};
|
2021-11-16 10:23:05 +00:00
|
|
|
Cypress.Cookies.preserveOnce("SESSION", "remember_token");
|
2020-07-16 05:50:46 +00:00
|
|
|
const username = Cypress.env("USERNAME");
|
|
|
|
|
const password = Cypress.env("PASSWORD");
|
|
|
|
|
cy.LoginFromAPI(username, password);
|
2020-06-17 10:47:01 +00:00
|
|
|
cy.visit("/applications");
|
2022-04-03 16:43:20 +00:00
|
|
|
cy.wait("@getMe");
|
2021-11-17 15:45:48 +00:00
|
|
|
cy.wait(3000);
|
2022-06-23 15:13:15 +00:00
|
|
|
cy.get(".t--applications-container .createnew")
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.should("be.enabled");
|
2021-01-04 10:22:22 +00:00
|
|
|
cy.generateUUID().then((id) => {
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.CreateAppInFirstListedWorkspace(id);
|
2022-03-25 10:43:26 +00:00
|
|
|
localStorage.setItem("AppName", id);
|
2020-05-05 09:08:31 +00:00
|
|
|
});
|
2020-05-12 13:47:13 +00:00
|
|
|
|
2020-05-08 09:01:11 +00:00
|
|
|
cy.fixture("example").then(function(data) {
|
|
|
|
|
this.data = data;
|
|
|
|
|
});
|
2020-05-11 10:38:49 +00:00
|
|
|
});
|
2020-05-08 09:01:11 +00:00
|
|
|
|
2020-05-11 10:38:49 +00:00
|
|
|
beforeEach(function() {
|
2021-07-02 06:04:36 +00:00
|
|
|
initLocalstorage();
|
2021-11-16 10:23:05 +00:00
|
|
|
Cypress.Cookies.preserveOnce("SESSION", "remember_token");
|
2020-05-27 11:21:11 +00:00
|
|
|
cy.startServerAndRoutes();
|
2022-03-11 15:47:42 +00:00
|
|
|
//-- Delete local storage data of entity explorer
|
|
|
|
|
cy.DeleteEntityStateLocalStorage();
|
2020-05-11 10:38:49 +00:00
|
|
|
});
|
2019-12-12 07:50:53 +00:00
|
|
|
|
2020-05-11 10:38:49 +00:00
|
|
|
after(function() {
|
2020-05-12 04:35:21 +00:00
|
|
|
//-- Deleting the application by Api---//
|
|
|
|
|
cy.DeleteAppByApi();
|
2020-05-19 06:13:15 +00:00
|
|
|
//-- LogOut Application---//
|
|
|
|
|
cy.LogOut();
|
2020-03-27 09:02:11 +00:00
|
|
|
});
|