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" />
|
2020-04-02 04:47:48 +00:00
|
|
|
require("cypress-xpath");
|
2021-11-18 10:22:04 +00:00
|
|
|
import "cypress-real-events/support";
|
2020-05-01 07:48:33 +00:00
|
|
|
let pageid;
|
2020-05-05 09:08:31 +00:00
|
|
|
let appId;
|
2020-03-20 14:21:24 +00:00
|
|
|
|
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";
|
2021-11-17 15:28:23 +00:00
|
|
|
import * as MESSAGES from "../../../client/src/constants/messages.ts";
|
2020-06-17 10:47:01 +00:00
|
|
|
|
|
|
|
|
Cypress.on("uncaught:exception", (err, runnable) => {
|
|
|
|
|
// returning false here prevents Cypress from
|
|
|
|
|
// failing the test
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
2020-07-24 04:31:39 +00:00
|
|
|
Cypress.on("fail", (error, runnable) => {
|
|
|
|
|
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-07-02 06:04:36 +00:00
|
|
|
initLocalstorage();
|
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-07-02 06:04:36 +00:00
|
|
|
|
2021-11-16 10:23:05 +00:00
|
|
|
cy.visit("/setup/welcome");
|
|
|
|
|
cy.wait("@getUser");
|
|
|
|
|
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() {
|
|
|
|
|
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");
|
2021-11-17 15:45:48 +00:00
|
|
|
cy.wait("@getUser");
|
|
|
|
|
cy.wait(3000);
|
2021-11-17 10:10:57 +00:00
|
|
|
cy.get(".t--applications-container .createnew").should("be.visible");
|
|
|
|
|
cy.get(".t--applications-container .createnew").should("be.enabled");
|
2021-01-04 10:22:22 +00:00
|
|
|
cy.generateUUID().then((id) => {
|
2020-05-05 09:08:31 +00:00
|
|
|
appId = id;
|
2021-02-04 11:31:32 +00:00
|
|
|
cy.CreateAppInFirstListedOrg(id);
|
2020-05-20 11:04:39 +00:00
|
|
|
localStorage.setItem("AppName", appId);
|
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();
|
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
|
|
|
});
|