diff --git a/package.json b/package.json index 7da8db506d..6290930269 100644 --- a/package.json +++ b/package.json @@ -51,10 +51,6 @@ "lint:fix:eslint": "eslint --fix packages qa-core", "lint:fix:prettier": "prettier --write \"packages/**/*.{js,ts,svelte}\" && prettier --write \"examples/**/*.{js,ts,svelte}\" && prettier --write \"qa-core/**/*.{js,ts,svelte}\"", "lint:fix": "yarn run lint:fix:prettier && yarn run lint:fix:eslint", - "test:e2e": "lerna run cy:test --stream", - "test:e2e:ci": "lerna run cy:ci --stream", - "test:e2e:ci:record": "lerna run cy:ci:record --stream", - "test:e2e:ci:notify": "lerna run cy:ci:notify", "build:specs": "lerna run specs", "build:docker": "lerna run build:docker && npm run build:docker:proxy && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh $BUDIBASE_RELEASE_VERSION && cd -", "build:docker:pre": "lerna run build && lerna run predocker", @@ -84,4 +80,4 @@ "install:pro": "bash scripts/pro/install.sh", "dep:clean": "yarn clean && yarn bootstrap" } -} +} \ No newline at end of file diff --git a/packages/builder/cypress.json b/packages/builder/cypress.json deleted file mode 100644 index b779794543..0000000000 --- a/packages/builder/cypress.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "baseUrl": "http://localhost:4100", - "video": true, - "projectId": "bmbemn", - "reporter": "cypress-multi-reporters", - "reporterOptions": { - "configFile": "reporterConfig.json" - }, - "env": { - "PORT": "4100", - "WORKER_PORT": "4200", - "JWT_SECRET": "test", - "HOST_IP": "" - } -} \ No newline at end of file diff --git a/packages/builder/cypress/fixtures/apikey.json b/packages/builder/cypress/fixtures/apikey.json deleted file mode 100644 index 1def14ed6c..0000000000 --- a/packages/builder/cypress/fixtures/apikey.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "budibase": "CB373643-3FC4-4902-9E31-449C0ED066B6" -} \ No newline at end of file diff --git a/packages/builder/cypress/fixtures/example.json b/packages/builder/cypress/fixtures/example.json deleted file mode 100644 index da18d9352a..0000000000 --- a/packages/builder/cypress/fixtures/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} \ No newline at end of file diff --git a/packages/builder/cypress/fixtures/exported-app.txt b/packages/builder/cypress/fixtures/exported-app.txt deleted file mode 100644 index 28aeaf958a..0000000000 --- a/packages/builder/cypress/fixtures/exported-app.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"version":"1.2.9","db_type":"http","start_time":"2022-05-12T13:47:50.453Z","db_info":{"db_name":"app_dev_7cae7fa4db8745da848f91430a8211bf","purge_seq":"0-g1AAAABXeJzLYWBgYMpgTmEQTM4vTc5ISXIwNDLXMwBCwxyQVB4LkGRoAFL_gSArkQGP2kSGpHqIoiwAtOgYRA","update_seq":"11-g1AAAACbeJzLYWBgYMpgTmEQTM4vTc5ISXIwNDLXMwBCwxyQVB4LkGRoAFL_gSArgzmRPRcowJ5klmZgaZmKTR8e0xIZkuqhxrBAjEk0NzcwMsSmIQsA89QoWg","sizes":{"file":94626,"external":5665,"active":7627},"props":{},"doc_del_count":0,"doc_count":7,"disk_format_version":8,"compact_running":false,"cluster":{"q":2,"n":1,"w":1,"r":1},"instance_start_time":"0","host":"http://localhost:4005/app_dev_7cae7fa4db8745da848f91430a8211bf/","auto_compaction":false,"adapter":"http"}} -{"docs":[{"_id":"_design/database","_rev":"4-ad6d41ef604ab34da380438c1be89521","views":{"by_link":{"map":"function (doc) {\n // everything in this must remain constant as its going to Pouch, no external variables\n if (doc.type === \"link\") {\n let doc1 = doc.doc1;\n let doc2 = doc.doc2;\n // eslint-disable-next-line no-undef\n emit([doc1.tableId, doc1.rowId], {\n id: doc2.rowId,\n thisId: doc1.rowId,\n fieldName: doc1.fieldName,\n });\n // if linking to same table can't emit twice\n if (doc1.tableId !== doc2.tableId) {\n // eslint-disable-next-line no-undef\n emit([doc2.tableId, doc2.rowId], {\n id: doc1.rowId,\n thisId: doc2.rowId,\n fieldName: doc2.fieldName,\n });\n }\n }\n }"},"screen_routes":{"map":"function(doc) {\n if (doc._id.startsWith(\"screen_\")) {\n emit(doc._id, {\n id: doc._id,\n routing: doc.routing,\n })\n }\n }"}},"indexes":{"rows":{"index":"function (doc) {\n function idx(input, prev) {\n for (let key of Object.keys(input)) {\n let idxKey = prev != null ? `${prev}.${key}` : key;\n idxKey = idxKey.replace(/ /g, \"_\");\n if (Array.isArray(input[key])) {\n for (let val of input[key]) {\n if (typeof val !== \"object\") {\n // eslint-disable-next-line no-undef\n index(idxKey, val, { store: true });\n }\n }\n }\n else if (key === \"_id\" || key === \"_rev\" || input[key] == null) {\n continue;\n }\n if (typeof input[key] === \"string\") {\n // eslint-disable-next-line no-undef\n index(idxKey, input[key].toLowerCase(), { store: true });\n }\n else if (typeof input[key] !== \"object\") {\n // eslint-disable-next-line no-undef\n index(idxKey, input[key], { store: true });\n }\n else {\n idx(input[key], idxKey);\n }\n }\n }\n if (doc._id.startsWith(\"ro_\")) {\n // eslint-disable-next-line no-undef\n index(\"default\", doc._id);\n idx(doc);\n }\n }","analyzer":"keyword"}},"_revisions":{"start":4,"ids":["ad6d41ef604ab34da380438c1be89521","cb47f4fd824d5e096ac8b76117e6f93d","68a9a1d1b01b327676ecbaa4b1e5b8a7","0b24e44a44af45e51e562fd124ce3007"]}},{"_id":"app_metadata","_rev":"2-a4fe55378bfec0fc71e58a1364ac9965","appId":"app_dev_7cae7fa4db8745da848f91430a8211bf","type":"app","version":"1.0.155-alpha.0","componentLibraries":["@budibase/standard-components"],"name":"My app","url":"/my-app","instance":{"_id":"app_dev_7cae7fa4db8745da848f91430a8211bf"},"tenantId":"default","updatedAt":"2022-05-12T13:47:28.756Z","createdAt":"2022-05-12T13:47:26.825Z","status":"development","_revisions":{"start":2,"ids":["a4fe55378bfec0fc71e58a1364ac9965","f0d06bdb6e6ae4781eb5c4aa224002ff"]}},{"_id":"layout_private_master","_rev":"1-c02411b58d697e38763889a375d52159","componentLibraries":["@budibase/standard-components"],"title":"My app","favicon":"./_shared/favicon.png","stylesheets":[],"name":"Navigation Layout","props":{"_id":"4f569166-a4f3-47ea-a09e-6d218c75586f","_instanceName":"Navigation Layout","_component":"@budibase/standard-components/layout","_children":[{"_id":"7fcf11e4-6f5b-4085-8e0d-9f3d44c98967","_component":"@budibase/standard-components/screenslot","_instanceName":"Screen slot","_styles":{"normal":{"flex":"1 1 auto","display":"flex","flex-direction":"column","justify-content":"flex-start","align-items":"stretch"},"hover":{},"active":{},"selected":{}},"_children":[]}],"_styles":{"active":{},"hover":{},"normal":{},"selected":{}},"title":"My app","navigation":"Top","width":"Large","links":[{"text":"Home","url":"/"}]}},{"_id":"layout_public_master","_rev":"1-d6bce47046d4d0de4f19a6ff95064109","componentLibraries":["@budibase/standard-components"],"title":"My app","favicon":"./_shared/favicon.png","stylesheets":[],"name":"Empty Layout","props":{"_id":"3723ffa1-f9e0-4c05-8013-98195c788ed6","_instanceName":"Empty Layout","_component":"@budibase/standard-components/layout","_children":[{"_id":"7fcf11e4-6f5b-4085-8e0d-9f3d44c98967","_component":"@budibase/standard-components/screenslot","_instanceName":"Screen slot","_styles":{"normal":{"flex":"1 1 auto","display":"flex","flex-direction":"column","justify-content":"flex-start","align-items":"stretch"},"hover":{},"active":{},"selected":{}},"_children":[]}],"_styles":{"active":{},"hover":{},"normal":{},"selected":{}},"navigation":"None","width":"Large","links":[{"text":"Home","url":"/"}]}},{"_id":"screen_b19c454fa5ae41ab874a8860623ab37c","_rev":"1-02dddd460ad14de50dc885aa362452c6","layoutId":"layout_private_master","props":{"_id":"c87457efbc05a43f39064d9dacc9d4b67","_component":"@budibase/standard-components/container","_styles":{"normal":{},"hover":{},"active":{},"selected":{}},"_children":[],"_instanceName":"New Screen","direction":"column","hAlign":"stretch","vAlign":"top","size":"grow","gap":"M"},"routing":{"route":"/home","roleId":"BASIC","roldId":"BASIC"},"name":"screen-id"},{"_id":"ta_users","_rev":"1-30a4344f056c24cf776d5736eb3c7ed5","type":"table","views":{},"name":"Users","schema":{"email":{"type":"string","constraints":{"type":"string","email":true,"length":{"maximum":""},"presence":true},"fieldName":"email","name":"email"},"firstName":{"name":"firstName","fieldName":"firstName","type":"string","constraints":{"type":"string","presence":false}},"lastName":{"name":"lastName","fieldName":"lastName","type":"string","constraints":{"type":"string","presence":false}},"roleId":{"fieldName":"roleId","name":"roleId","type":"options","constraints":{"type":"string","presence":false,"inclusion":["ADMIN","POWER","BASIC","PUBLIC"]}},"status":{"fieldName":"status","name":"status","type":"options","constraints":{"type":"string","presence":false,"inclusion":["active","inactive"]}}},"primaryDisplay":"email"}]} -{"seq":"11-g1AAAACbeJzLYWBgYMpgTmEQTM4vTc5ISXIwNDLXMwBCwxyQVCJDUv3___-zMpgTWXKBAuxJiebmBkaG2DTgMSaPBUgyNACp_1DT2CGmmaUZWFqmYtOXBQAWQiha"} diff --git a/packages/builder/cypress/fixtures/profile.json b/packages/builder/cypress/fixtures/profile.json deleted file mode 100644 index b6c355ca5c..0000000000 --- a/packages/builder/cypress/fixtures/profile.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "id": 8739, - "name": "Jane", - "email": "jane@example.com" -} \ No newline at end of file diff --git a/packages/builder/cypress/fixtures/users.json b/packages/builder/cypress/fixtures/users.json deleted file mode 100644 index f82fc8dfb2..0000000000 --- a/packages/builder/cypress/fixtures/users.json +++ /dev/null @@ -1,232 +0,0 @@ -[ - { - "id": 1, - "name": "Leanne Graham", - "username": "Bret", - "email": "Sincere@april.biz", - "address": { - "street": "Kulas Light", - "suite": "Apt. 556", - "city": "Gwenborough", - "zipcode": "92998-3874", - "geo": { - "lat": "-37.3159", - "lng": "81.1496" - } - }, - "phone": "1-770-736-8031 x56442", - "website": "hildegard.org", - "company": { - "name": "Romaguera-Crona", - "catchPhrase": "Multi-layered client-server neural-net", - "bs": "harness real-time e-markets" - } - }, - { - "id": 2, - "name": "Ervin Howell", - "username": "Antonette", - "email": "Shanna@melissa.tv", - "address": { - "street": "Victor Plains", - "suite": "Suite 879", - "city": "Wisokyburgh", - "zipcode": "90566-7771", - "geo": { - "lat": "-43.9509", - "lng": "-34.4618" - } - }, - "phone": "010-692-6593 x09125", - "website": "anastasia.net", - "company": { - "name": "Deckow-Crist", - "catchPhrase": "Proactive didactic contingency", - "bs": "synergize scalable supply-chains" - } - }, - { - "id": 3, - "name": "Clementine Bauch", - "username": "Samantha", - "email": "Nathan@yesenia.net", - "address": { - "street": "Douglas Extension", - "suite": "Suite 847", - "city": "McKenziehaven", - "zipcode": "59590-4157", - "geo": { - "lat": "-68.6102", - "lng": "-47.0653" - } - }, - "phone": "1-463-123-4447", - "website": "ramiro.info", - "company": { - "name": "Romaguera-Jacobson", - "catchPhrase": "Face to face bifurcated interface", - "bs": "e-enable strategic applications" - } - }, - { - "id": 4, - "name": "Patricia Lebsack", - "username": "Karianne", - "email": "Julianne.OConner@kory.org", - "address": { - "street": "Hoeger Mall", - "suite": "Apt. 692", - "city": "South Elvis", - "zipcode": "53919-4257", - "geo": { - "lat": "29.4572", - "lng": "-164.2990" - } - }, - "phone": "493-170-9623 x156", - "website": "kale.biz", - "company": { - "name": "Robel-Corkery", - "catchPhrase": "Multi-tiered zero tolerance productivity", - "bs": "transition cutting-edge web services" - } - }, - { - "id": 5, - "name": "Chelsey Dietrich", - "username": "Kamren", - "email": "Lucio_Hettinger@annie.ca", - "address": { - "street": "Skiles Walks", - "suite": "Suite 351", - "city": "Roscoeview", - "zipcode": "33263", - "geo": { - "lat": "-31.8129", - "lng": "62.5342" - } - }, - "phone": "(254)954-1289", - "website": "demarco.info", - "company": { - "name": "Keebler LLC", - "catchPhrase": "User-centric fault-tolerant solution", - "bs": "revolutionize end-to-end systems" - } - }, - { - "id": 6, - "name": "Mrs. Dennis Schulist", - "username": "Leopoldo_Corkery", - "email": "Karley_Dach@jasper.info", - "address": { - "street": "Norberto Crossing", - "suite": "Apt. 950", - "city": "South Christy", - "zipcode": "23505-1337", - "geo": { - "lat": "-71.4197", - "lng": "71.7478" - } - }, - "phone": "1-477-935-8478 x6430", - "website": "ola.org", - "company": { - "name": "Considine-Lockman", - "catchPhrase": "Synchronised bottom-line interface", - "bs": "e-enable innovative applications" - } - }, - { - "id": 7, - "name": "Kurtis Weissnat", - "username": "Elwyn.Skiles", - "email": "Telly.Hoeger@billy.biz", - "address": { - "street": "Rex Trail", - "suite": "Suite 280", - "city": "Howemouth", - "zipcode": "58804-1099", - "geo": { - "lat": "24.8918", - "lng": "21.8984" - } - }, - "phone": "210.067.6132", - "website": "elvis.io", - "company": { - "name": "Johns Group", - "catchPhrase": "Configurable multimedia task-force", - "bs": "generate enterprise e-tailers" - } - }, - { - "id": 8, - "name": "Nicholas Runolfsdottir V", - "username": "Maxime_Nienow", - "email": "Sherwood@rosamond.me", - "address": { - "street": "Ellsworth Summit", - "suite": "Suite 729", - "city": "Aliyaview", - "zipcode": "45169", - "geo": { - "lat": "-14.3990", - "lng": "-120.7677" - } - }, - "phone": "586.493.6943 x140", - "website": "jacynthe.com", - "company": { - "name": "Abernathy Group", - "catchPhrase": "Implemented secondary concept", - "bs": "e-enable extensible e-tailers" - } - }, - { - "id": 9, - "name": "Glenna Reichert", - "username": "Delphine", - "email": "Chaim_McDermott@dana.io", - "address": { - "street": "Dayna Park", - "suite": "Suite 449", - "city": "Bartholomebury", - "zipcode": "76495-3109", - "geo": { - "lat": "24.6463", - "lng": "-168.8889" - } - }, - "phone": "(775)976-6794 x41206", - "website": "conrad.com", - "company": { - "name": "Yost and Sons", - "catchPhrase": "Switchable contextually-based project", - "bs": "aggregate real-time technologies" - } - }, - { - "id": 10, - "name": "Clementina DuBuque", - "username": "Moriah.Stanton", - "email": "Rey.Padberg@karina.biz", - "address": { - "street": "Kattie Turnpike", - "suite": "Suite 198", - "city": "Lebsackbury", - "zipcode": "31428-2261", - "geo": { - "lat": "-38.2386", - "lng": "57.2232" - } - }, - "phone": "024-648-3804", - "website": "ambrose.net", - "company": { - "name": "Hoeger LLC", - "catchPhrase": "Centralized empowering task-force", - "bs": "target end-to-end tables" - } - } -] \ No newline at end of file diff --git a/packages/builder/cypress/integration/addMultiOptionDatatype.spec.js b/packages/builder/cypress/integration/addMultiOptionDatatype.spec.js deleted file mode 100644 index f844402958..0000000000 --- a/packages/builder/cypress/integration/addMultiOptionDatatype.spec.js +++ /dev/null @@ -1,45 +0,0 @@ -import filterTests from "../support/filterTests" -const interact = require('../support/interact') - -filterTests(['all'], () => { - xcontext("Add Multi-Option Datatype", () => { - before(() => { - cy.login() - cy.createTestApp() - }) - - it("should create a new table, with data", () => { - cy.createTable("Multi Data") - cy.addColumn("Multi Data", "Test Data", "Multi-select", "1\n2\n3\n4\n5") - cy.addRowMultiValue(["1", "2", "3", "4", "5"]) - }) - - it("should add form with multi select picker, containing 5 options", () => { - cy.navigateToFrontend() - // Add data provider - cy.searchAndAddComponent("Data Provider") - cy.get(interact.DATASOURCE_PROP_CONTROL).click() - cy.get(interact.DROPDOWN).contains("Multi Data").click() - // Add Form with schema to match table - cy.searchAndAddComponent("Form") - cy.get(interact.DATASOURCE_PROP_CONTROL).click() - cy.get(interact.DROPDOWN).contains("Multi Data").click() - // Add multi-select picker to form - cy.searchAndAddComponent("Multi-select Picker").then(componentId => { - cy.get(interact.DATASOURCE_FIELD_CONTROL).type("Test Data").type("{enter}") - cy.wait(1000) - cy.getComponent(componentId).contains("Choose some options").click() - // Check picker has 5 items - cy.getComponent(componentId).find("li").should("have.length", 5) - // Select all items - for (let i = 1; i < 6; i++) { - cy.getComponent(componentId).find("li").contains(i).click() - } - // Check items have been selected - cy.getComponent(componentId) - .find(interact.SPECTRUM_PICKER_LABEL) - .contains("(5)") - }) - }) - }) -}) diff --git a/packages/builder/cypress/integration/addRadioButtons.spec.js b/packages/builder/cypress/integration/addRadioButtons.spec.js deleted file mode 100644 index 3e344c3656..0000000000 --- a/packages/builder/cypress/integration/addRadioButtons.spec.js +++ /dev/null @@ -1,43 +0,0 @@ -import filterTests from "../support/filterTests" -const interact = require('../support/interact') - -filterTests(['all'], () => { - xcontext("Add Radio Buttons", () => { - before(() => { - cy.login() - cy.createTestApp() - }) - - it("should add Radio Buttons options picker on form, add data, and confirm", () => { - cy.navigateToFrontend() - cy.searchAndAddComponent("Form") - cy.searchAndAddComponent("Options Picker").then((componentId) => { - // Provide field setting - cy.get(interact.DATASOURCE_FIELD_CONTROL).type("1") - // Open dropdown and select Radio buttons - cy.get(interact.OPTION_TYPE_PROP_CONTROL).click().then(() => { - cy.get(interact.SPECTRUM_POPOVER).contains('Radio buttons') - .click() - }) - const radioButtonsTotal = 3 - // Add values and confirm total - addRadioButtonData(radioButtonsTotal) - cy.getComponent(componentId).find('[type="radio"]') - .should('have.length', radioButtonsTotal) - }) - }) - - const addRadioButtonData = (totalRadioButtons) => { - cy.get(interact.OPTION_SOURCE_PROP_CONROL).click().then(() => { - cy.get(interact.SPECTRUM_POPOVER).contains('Custom') - .click() - .wait(1000) - }) - cy.addCustomSourceOptions(totalRadioButtons) - } - - after(() => { - cy.deleteAllApps() - }) - }) -}) diff --git a/packages/builder/cypress/integration/adminAndManagement/accountPortals.spec.js b/packages/builder/cypress/integration/adminAndManagement/accountPortals.spec.js deleted file mode 100644 index d9eb5a9f25..0000000000 --- a/packages/builder/cypress/integration/adminAndManagement/accountPortals.spec.js +++ /dev/null @@ -1,116 +0,0 @@ -import filterTests from "../../support/filterTests" -const interact = require('../../support/interact') - -filterTests(["smoke", "all"], () => { - xcontext("Account Portals", () => { - - const bbUserEmail = "bbuser@test.com" - - before(() => { - cy.login() - cy.deleteApp("Cypress Tests") - cy.createApp("Cypress Tests", false) - - // Create new user - cy.wait(500) - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - cy.createUser(bbUserEmail) - cy.contains("bbuser").click() - cy.wait(500) - - // Reset password - cy.get(".title").within(() => { - cy.get(interact.SPECTRUM_ICON).click({ force: true }) - }) - cy.get(interact.SPECTRUM_MENU).within(() => { - cy.get(interact.SPECTRUM_MENU_ITEM).contains("Force password reset").click({ force: true }) - }) - - cy.get(interact.SPECTRUM_DIALOG_GRID) - .find(interact.SPECTRUM_TEXTFIELD_INPUT).invoke('val').as('pwd') - - cy.get(interact.SPECTRUM_BUTTON).contains("Reset password").click({ force: true }) - - // Login as new user and set password - cy.logOut() - cy.get('@pwd').then((pwd) => { - cy.login(bbUserEmail, pwd) - }) - - for (let i = 0; i < 2; i++) { - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).eq(i).type("test") - } - cy.get(interact.SPECTRUM_BUTTON).contains("Reset your password").click({ force: true }) - //cy.logoutNoAppGrid() - }) - - xit("should verify Standard Portal", () => { - // Development access should be disabled (Admin access is already disabled) - cy.login() - cy.setUserRole("bbuser", "App User") - bbUserLogin() - - // Verify Standard Portal - cy.get(interact.SPECTRUM_SIDENAV).should('not.exist') // No config sections - cy.get(interact.CREATE_APP_BUTTON).should('not.exist') // No create app button - cy.get(".app").should('not.exist') // No apps -> no roles assigned to user - cy.get(interact.CONTAINER).should('contain', bbUserEmail) // Message containing users email - - cy.logoutNoAppGrid() - }) - - xit("should verify Admin Portal", () => { - cy.login() - // Configure user role - cy.setUserRole("bbuser", "Admin") - bbUserLogin() - - // Verify available options for Admin portal - cy.get(interact.SPECTRUM_SIDENAV) - .should('contain', 'Apps') - //.and('contain', 'Usage') - .and('contain', 'Users') - .and('contain', 'Auth') - .and('contain', 'Email') - .and('contain', 'Organisation') - .and('contain', 'Theming') - .and('contain', 'Update') - //.and('contain', 'Upgrade') - - cy.logOut() - }) - - xit("should verify Development Portal", () => { - // Only Development access should be enabled - cy.login() - cy.setUserRole("bbuser", "Developer") - bbUserLogin() - - // Verify available options for Admin portal - cy.get(interact.SPECTRUM_SIDENAV) - .should('contain', 'Apps') - //.and('contain', 'Usage') - .and('not.contain', 'Users') - .and('not.contain', 'Auth') - .and('not.contain', 'Email') - .and('not.contain', 'Organisation') - .and('contain', 'Theming') - .and('not.contain', 'Update') - .and('not.contain', 'Upgrade') - - cy.logOut() - }) - - const bbUserLogin = () => { - // Login as bbuser - cy.logOut() - cy.login(bbUserEmail, "test") - } - - after(() => { - cy.login() - // Delete BB user - cy.deleteUser(bbUserEmail) - }) - }) -}) diff --git a/packages/builder/cypress/integration/adminAndManagement/authentication.spec.js b/packages/builder/cypress/integration/adminAndManagement/authentication.spec.js deleted file mode 100644 index 140dfb9ff8..0000000000 --- a/packages/builder/cypress/integration/adminAndManagement/authentication.spec.js +++ /dev/null @@ -1,178 +0,0 @@ -import filterTests from "../../support/filterTests" -// const interact = require("../support/interact") - -filterTests(["smoke", "all"], () => { - xcontext("Auth Configuration", () => { - before(() => { - cy.login() - }) - - after(() => { - cy.get(".spectrum-SideNav li").contains("Auth").click() - cy.location().should(loc => { - expect(loc.pathname).to.eq("/builder/portal/manage/auth") - }) - - cy.get("[data-cy=new-scope-input]").clear() - - cy.get("div.content").scrollTo("bottom") - cy.get("[data-cy=oidc-active]").click() - - cy.get("[data-cy=oidc-active]").should('not.be.checked') - - cy.intercept("POST", "/api/global/configs").as("updateAuth") - cy.get("button[data-cy=oidc-save]").contains("Save").click({ force: true }) - cy.wait("@updateAuth") - cy.get("@updateAuth").its("response.statusCode").should("eq", 200) - - cy.get(".spectrum-Toast-content") - .contains("Settings saved") - .should("be.visible") - }) - - it("Should allow updating of the OIDC config", () => { - cy.get(".spectrum-SideNav li").contains("Auth").click() - cy.location().should(loc => { - expect(loc.pathname).to.eq("/builder/portal/manage/auth") - }) - cy.get("div.content").scrollTo("bottom") - cy.get(".spectrum-Toast .spectrum-ClearButton").click() - - cy.get("input[data-cy=configUrl]").type("http://budi-auth.com/v2") - cy.get("input[data-cy=clientID]").type("34ac6a13-f24a-4b52-c70d-fa544ffd11b2") - cy.get("input[data-cy=clientSecret]").type("12A8Q~4nS_DWhOOJ2vWIRsNyDVsdtXPD.Zxa9df_") - - cy.get("button[data-cy=oidc-save]").should("not.be.disabled"); - - cy.intercept("POST", "/api/global/configs").as("updateAuth") - cy.get("button[data-cy=oidc-save]").contains("Save").click({ force: true }) - cy.wait("@updateAuth") - cy.get("@updateAuth").its("response.statusCode").should("eq", 200) - - cy.get(".spectrum-Toast-content") - .contains("Settings saved") - .should("be.visible") - }) - - it("Should display default scopes in advanced config.", () => { - cy.get(".spectrum-SideNav li").contains("Auth").click() - cy.location().should(loc => { - expect(loc.pathname).to.eq("/builder/portal/manage/auth") - }) - cy.get("div.content").scrollTo("bottom") - - cy.get(".spectrum-Tags").find(".spectrum-Tags-item").its("length").should("eq", 4) - - cy.get(".spectrum-Tags-item").contains("openid") - cy.get(".spectrum-Tags-item").contains("openid").find(".spectrum-ClearButton").should("not.exist") - - cy.get(".spectrum-Tags-item").contains("offline_access") - cy.get(".spectrum-Tags-item").contains("email") - cy.get(".spectrum-Tags-item").contains("profile") - }) - - it("Add a new scopes", () => { - cy.get(".spectrum-SideNav li").contains("Auth").click() - cy.location().should(loc => { - expect(loc.pathname).to.eq("/builder/portal/manage/auth") - }) - cy.get("div.content").scrollTo("bottom") - - cy.get("[data-cy=new-scope-input]").type("Sample{enter}") - cy.get(".spectrum-Tags").find(".spectrum-Tags-item").its("length").should("eq", 5) - cy.get(".spectrum-Tags-item").contains("Sample") - - cy.get(".auth-form input.spectrum-Textfield-input").type("Another ") - cy.get(".spectrum-Tags").find(".spectrum-Tags-item").its("length").should("eq", 6) - cy.get(".spectrum-Tags-item").contains("Another") - - cy.get("button[data-cy=oidc-save]").should("not.be.disabled"); - - cy.intercept("POST", "/api/global/configs").as("updateAuth") - cy.get("button[data-cy=oidc-save]").contains("Save").click({ force: true }) - cy.wait("@updateAuth") - cy.get("@updateAuth").its("response.statusCode").should("eq", 200) - - cy.reload() - - cy.get("div.content").scrollTo("bottom") - - cy.get(".spectrum-Tags-item").contains("openid") - cy.get(".spectrum-Tags-item").contains("offline_access") - cy.get(".spectrum-Tags-item").contains("email") - cy.get(".spectrum-Tags-item").contains("profile") - cy.get(".spectrum-Tags-item").contains("Sample") - cy.get(".spectrum-Tags-item").contains("Another") - }) - - it("Should allow the removal of auth scopes", () => { - cy.get(".spectrum-SideNav li").contains("Auth").click() - cy.location().should(loc => { - expect(loc.pathname).to.eq("/builder/portal/manage/auth") - }) - cy.get("div.content").scrollTo("bottom") - - cy.get(".spectrum-Tags-item").contains("offline_access").parent().find(".spectrum-ClearButton").click() - cy.get(".spectrum-Tags-item").contains("profile").parent().find(".spectrum-ClearButton").click() - - cy.get(".spectrum-Tags").find(".spectrum-Tags-item").its("length").should("eq", 4) - - cy.get(".spectrum-Tags-item").contains("offline_access").should("not.exist") - cy.get(".spectrum-Tags-item").contains("profile").should("not.exist") - - cy.get("button[data-cy=oidc-save]").should("not.be.disabled"); - - cy.intercept("POST", "/api/global/configs").as("updateAuth") - cy.get("button[data-cy=oidc-save]").contains("Save").click({ force: true }) - cy.wait("@updateAuth") - cy.get("@updateAuth").its("response.statusCode").should("eq", 200) - - cy.get(".spectrum-Toast-content") - .contains("Settings saved") - .should("be.visible") - - cy.reload() - - cy.get(".spectrum-Tags").find(".spectrum-Tags-item").its("length").should("eq", 4) - - cy.get(".spectrum-Tags-item").contains("offline_access").should("not.exist") - cy.get(".spectrum-Tags-item").contains("profile").should("not.exist") - }) - - it("Should allow auth scopes to be reset to the core defaults.", () => { - cy.get(".spectrum-SideNav li").contains("Auth").click() - - cy.get("div.content").scrollTo("bottom") - - cy.get("[data-cy=restore-oidc-default-scopes]").click({ force: true }) - - cy.get(".spectrum-Tags").find(".spectrum-Tags-item").its("length").should("eq", 4) - - cy.get(".spectrum-Tags-item").contains("openid") - cy.get(".spectrum-Tags-item").contains("offline_access") - cy.get(".spectrum-Tags-item").contains("email") - cy.get(".spectrum-Tags-item").contains("profile") - }) - - it("Should not allow invalid characters in the auth scopes", () => { - cy.get("[data-cy=new-scope-input]").type("thisIsInvalid\\{enter}") - cy.get(".spectrum-Form-itemField .error").contains("Auth scopes cannot contain spaces, double quotes or backslashes") - cy.get(".spectrum-Tags").find(".spectrum-Tags-item").its("length").should("eq", 4) - - cy.get("[data-cy=new-scope-input]").clear() - - cy.get("[data-cy=new-scope-input]").type("alsoInvalid\"{enter}") - cy.get(".spectrum-Form-itemField .error").contains("Auth scopes cannot contain spaces, double quotes or backslashes") - cy.get(".spectrum-Tags").find(".spectrum-Tags-item").its("length").should("eq", 4) - - cy.get("[data-cy=new-scope-input]").clear() - }) - - it("Should not allow duplicate auth scopes", () => { - cy.get("[data-cy=new-scope-input]").type("offline_access{enter}") - cy.get(".spectrum-Form-itemField .error").contains("Auth scope already exists") - cy.get(".spectrum-Tags").find(".spectrum-Tags-item").its("length").should("eq", 4) - }) - - }) -}) \ No newline at end of file diff --git a/packages/builder/cypress/integration/adminAndManagement/userManagement.spec.js b/packages/builder/cypress/integration/adminAndManagement/userManagement.spec.js deleted file mode 100644 index 3d3f5d3956..0000000000 --- a/packages/builder/cypress/integration/adminAndManagement/userManagement.spec.js +++ /dev/null @@ -1,238 +0,0 @@ -import filterTests from "../../support/filterTests" -const interact = require('../../support/interact') - -filterTests(["smoke", "all"], () => { - xcontext("User Management", () => { - before(() => { - cy.login() - cy.deleteApp("Cypress Tests") - cy.createApp("Cypress Tests", false) - }) - - xit("should create a user via basic onboarding", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000}) - cy.createUser("bbuser@test.com") - cy.get(interact.SPECTRUM_TABLE).should("contain", "bbuser") - }) - - xit("should confirm App User role for a New User", () => { - cy.contains("bbuser").click() - cy.get(".spectrum-Form-itemField").eq(3).should('contain', 'App User') - - // User should not have app access - cy.get(".spectrum-Heading").contains("Apps").parent().within(() => { - cy.get(interact.LIST_ITEMS, { timeout: 500 }).should("contain", "This user has access to no apps") - }) - }) - - if (Cypress.env("TEST_ENV")) { - xit("should assign role types", () => { - // 3 apps minimum required - to assign an app to each role type - cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) - .its("body") - .then(val => { - if (val.length < 3) { - for (let i = 1; i < 3; i++) { - const uuid = () => Cypress._.random(0, 1e6) - const name = uuid() - if(i < 1){ - cy.createApp(name, false) - } else { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000}) - cy.wait(1000) - cy.get(interact.CREATE_APP_BUTTON, { timeout: 2000 }).click({ force: true }) - cy.createAppFromScratch(name) - } - } - } - }) - // Navigate back to the user - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000}) - cy.get(interact.SPECTRUM_SIDENAV).contains("Users").click() - cy.get(interact.SPECTRUM_TABLE, { timeout: 1000 }).contains("bbuser").click() - cy.get(interact.SPECTRUM_HEADING).contains("bbuser", { timeout: 2000}) - for (let i = 0; i < 3; i++) { - cy.get(interact.SPECTRUM_TABLE, { timeout: 3000}) - .eq(1) - .find(interact.SPECTRUM_TABLE_ROW) - .eq(0) - .find(interact.SPECTRUM_TABLE_CELL) - .eq(0) - .click() - cy.get(interact.SPECTRUM_DIALOG_GRID, { timeout: 1000 }) - .contains("Choose an option") - .click() - .then(() => { - if (i == 0) { - cy.get(interact.SPECTRUM_MENU, { timeout: 2000 }).contains("Admin").click({ force: true }) - } - else if (i == 1) { - cy.get(interact.SPECTRUM_MENU, { timeout: 2000 }).contains("Power").click({ force: true }) - } - else if (i == 2) { - cy.get(interact.SPECTRUM_MENU, { timeout: 2000 }).contains("Basic").click({ force: true }) - } - cy.get(interact.SPECTRUM_BUTTON, { timeout: 2000 }) - .contains("Update role") - .click({ force: true }) - }) - cy.reload() - cy.wait(1000) - } - // Confirm roles exist within Configure roles table - cy.get(interact.SPECTRUM_TABLE, { timeout: 20000 }) - .eq(0) - .within(assginedRoles => { - expect(assginedRoles).to.contain("Admin") - expect(assginedRoles).to.contain("Power") - expect(assginedRoles).to.contain("Basic") - }) - }) - - xit("should unassign role types", () => { - // Set each app within Configure roles table to 'No Access' - cy.get(interact.SPECTRUM_TABLE) - .eq(0) - .find(interact.SPECTRUM_TABLE_ROW) - .its("length") - .then(len => { - for (let i = 0; i < len; i++) { - cy.get(interact.SPECTRUM_TABLE) - .eq(0) - .find(interact.SPECTRUM_TABLE_ROW) - .eq(0) - .find(interact.SPECTRUM_TABLE_CELL) - .eq(0) - .click() - .then(() => { - cy.get(interact.SPECTRUM_PICKER).eq(1).click({ force: true }) - cy.get(interact.SPECTRUM_POPOVER, { timeout: 500 }).contains("No Access").click() - }) - cy.get(interact.SPECTRUM_BUTTON) - .contains("Update role") - .click({ force: true }) - } - }) - // Confirm Configure roles table no longer has any apps in it - cy.get(interact.SPECTRUM_TABLE, { timeout: 1000 }).eq(0).contains("No rows found") - }) - } - - xit("should enable Developer access and verify application access", () => { - // Enable Developer access - cy.get(interact.FIELD) - .eq(4) - .within(() => { - cy.get(interact.SPECTRUM_SWITCH_INPUT).click({ force: true }) - }) - // No Access table should now be empty - cy.get(interact.CONTAINER) - .contains("No Access") - .parent() - .within(() => { - cy.get(interact.SPECTRUM_TABLE).contains("No rows found") - }) - - // Each app within Configure roles should have Admin access - cy.get(interact.SPECTRUM_TABLE) - .eq(0) - .find(interact.SPECTRUM_TABLE_ROW) - .its("length") - .then(len => { - for (let i = 0; i < len; i++) { - cy.get(interact.SPECTRUM_TABLE) - .eq(0) - .find(interact.SPECTRUM_TABLE_ROW) - .eq(i) - .contains("Admin") - cy.wait(500) - } - }) - }) - - xit("should disable Developer access and verify application access", () => { - // Disable Developer access - cy.get(interact.FIELD) - .eq(4) - .within(() => { - cy.get(".spectrum-Switch-input").click({ force: true }) - }) - // Configure roles table should now be empty - cy.get(interact.CONTAINER) - .contains("Configure roles") - .parent() - .within(() => { - cy.get(interact.SPECTRUM_TABLE).contains("No rows found") - }) - }) - - xit("Should edit user details within user details page", () => { - // Add First name - cy.get(interact.FIELD, { timeout: 1000 }).eq(1).within(() => { - cy.wait(500) - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT, { timeout: 1000 }).wait(500).clear().click().type("bb") - }) - // Add Last name - cy.get(interact.FIELD, { timeout: 1000 }).eq(2).within(() => { - cy.wait(500) - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT, { timeout: 1000 }).click().wait(500).clear().type("test") - }) - cy.get(interact.FIELD, { timeout: 1000 }).eq(0).click() - // Reload page - cy.reload() - - // Confirm details have been saved - cy.get(interact.FIELD, { timeout: 20000 }).eq(1).within(() => { - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', "bb") - }) - cy.get(interact.FIELD, { timeout: 1000 }).eq(2).within(() => { - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT, { timeout: 1000 }).should('have.value', "test") - }) - }) - - xit("should reset the users password", () => { - cy.get(".title").within(() => { - cy.get(interact.SPECTRUM_ICON).click({ force: true }) - }) - cy.get(interact.SPECTRUM_MENU).within(() => { - cy.get(interact.SPECTRUM_MENU_ITEM).contains("Force password reset").click({ force: true }) - }) - - // Reset password modal - cy.get(interact.SPECTRUM_DIALOG_GRID) - .find(interact.SPECTRUM_TEXTFIELD_INPUT).invoke('val').as('pwd') - cy.get(interact.SPECTRUM_BUTTON).contains("Reset password").click({ force: true }) - cy.get(interact.SPECTRUM_BUTTON).contains("Reset password").should('not.exist') - - // Logout, then login with new password - cy.logOut() - cy.get('@pwd').then((pwd) => { - cy.login("bbuser@test.com", pwd) - }) - - // Reset password screen - for (let i = 0; i < 2; i++) { - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).eq(i).type("test") - } - cy.get(interact.SPECTRUM_BUTTON).contains("Reset your password").click({ force: true }) - - // Confirm user logged in afer password change - cy.login("bbuser@test.com", "test") - cy.get(".avatar > .icon").click({ force: true }) - - cy.get(".spectrum-Menu-item").contains("Update user information").click({ force: true }) - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT) - .eq(0) - .invoke('val').should('eq', 'bbuser@test.com') - - // Logout and login as previous user - cy.logoutNoAppGrid() - cy.login() - }) - - xit("should delete a user", () => { - cy.deleteUser("bbuser@test.com") - cy.get(interact.SPECTRUM_TABLE, { timeout: 4000 }).should("not.have.text", "bbuser") - }) - }) -}) diff --git a/packages/builder/cypress/integration/adminAndManagement/userSettings.spec.js b/packages/builder/cypress/integration/adminAndManagement/userSettings.spec.js deleted file mode 100644 index 18362031c9..0000000000 --- a/packages/builder/cypress/integration/adminAndManagement/userSettings.spec.js +++ /dev/null @@ -1,114 +0,0 @@ -import filterTests from "../../support/filterTests" -const interact = require('../../support/interact') - -filterTests(["smoke", "all"], () => { - context("User Settings Menu", () => { - - before(() => { - cy.login() - }) - - it("should update user information via user settings menu", () => { - const fname = "test" - const lname = "user" - - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.updateUserInformation(fname, lname) - - // Go to user info and confirm name update - cy.contains("Users").click() - cy.contains("test@test.com").click() - - cy.get(interact.FIELD, { timeout: 1000 }).eq(1).within(() => { - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', fname) - }) - cy.get(interact.FIELD).eq(2).within(() => { - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', lname) - }) - }) - - xit("should allow copying of the users API key", () => { - cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true }) - cy.get(interact.SPECTRUM_MENU_ITEM).contains("View API key").click({ force: true }) - cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => { - cy.get(interact.SPECTRUM_ICON).click({ force: true }) - }) - // There may be timing issues with this on the smoke build - cy.wait(500) - cy.get(".spectrum-Toast-content") - .contains("URL copied to clipboard") - .should("be.visible") - }) - - it("should allow API key regeneration", () => { - cy.get(".user-dropdown .icon", { timeout: 2000 }).click({ force: true }) - cy.get(interact.SPECTRUM_MENU_ITEM).contains("View API key").click({ force: true }) - cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => { - cy.get(interact.SPECTRUM_ICON).click({ force: true }) - }) - // Get initial API key value - cy.get(interact.SPECTRUM_DIALOG_CONTENT) - .find(interact.SPECTRUM_TEXTFIELD_INPUT).invoke('val').as('keyOne') - - // Click re-generate key button - cy.get("button").contains("Regenerate key").click({ force: true }) - - // Verify API key was changed - cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => { - cy.get('@keyOne').then((keyOne) => { - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).invoke('val').should('not.eq', keyOne) - }) - }) - cy.closeModal() - }) - - it("should update password", () => { - // Access Update password modal - cy.get(".user-dropdown .icon", { timeout: 2000 }).click({ force: true }) - cy.get(interact.SPECTRUM_MENU_ITEM).contains("Update password").click({ force: true }) - - // Enter new password and update - cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => { - for (let i = 0; i < 2; i++) { - // password set to 'newpwd' - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).eq(i).type("newpwd") - } - cy.get("button").contains("Update password").click({ force: true }) - }) - - // Logout & in with new password - //cy.logOut() - cy.login("test@test.com", "newpwd") - }) - - xit("should open and close developer mode", () => { - cy.get(".user-dropdown .icon", { timeout: 2000 }).click({ force: true }) - - // Close developer mode & verify - cy.get(interact.SPECTRUM_MENU_ITEM).contains("Close developer mode").click({ force: true }) - cy.get(interact.SPECTRUM_SIDENAV).should('not.exist') // No config sections - cy.get(interact.CREATE_APP_BUTTON).should('not.exist') // No create app button - cy.get(".app").should('not.exist') // At least one app should be available - - // Open developer mode & verify - cy.get(".avatar > .icon").click({ force: true }) - cy.get(interact.SPECTRUM_MENU_ITEM).contains("Open developer mode").click({ force: true }) - cy.get(".app-table").should('exist') // config sections available - cy.get(interact.CREATE_APP_BUTTON).should('exist') // create app button available - }) - - after(() => { - // Change password back to original value - cy.get(".user-dropdown .icon", { timeout: 2000 }).click({ force: true }) - cy.get(interact.SPECTRUM_MENU_ITEM).contains("Update password").click({ force: true }) - cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => { - for (let i = 0; i < 2; i++) { - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).eq(i).type("test") - } - cy.get("button").contains("Update password").click({ force: true }) - }) - // Remove users name - cy.updateUserInformation() - }) - }) -}) diff --git a/packages/builder/cypress/integration/appOverview.spec.js b/packages/builder/cypress/integration/appOverview.spec.js deleted file mode 100644 index 60d0f2a06d..0000000000 --- a/packages/builder/cypress/integration/appOverview.spec.js +++ /dev/null @@ -1,442 +0,0 @@ -import filterTests from "../support/filterTests" -import clientPackage from "@budibase/client/package.json" - -filterTests(["all"], () => { - xcontext("Application Overview screen", () => { - before(() => { - cy.login() - cy.deleteAllApps() - cy.createApp("Cypress Tests") - }) - - xit("Should be accessible from the applications list", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .title") - .eq(0) - .invoke("attr", "data-cy") - .then($dataCy => { - const dataCy = $dataCy - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .click({ force: true }) - - cy.location().should(loc => { - expect(loc.pathname).to.eq("/builder/portal/overview/" + dataCy) - }) - }) - }) - - // Find a more suitable place for this. - xit("Should allow unlocking in the app list", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - - cy.get(".appTable .lock-status").eq(0).contains("Locked by you").click() - - cy.unlockApp({ owned: true }) - - cy.get(".appTable").should("exist") - cy.get(".lock-status").should("not.be.visible") - }) - - xit("Should allow unlocking in the app overview screen", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - - cy.get(".appTable .app-row-actions button") - .contains("Edit") - .eq(0) - .click({ force: true }) - cy.wait(1000) - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.get(".lock-status").eq(0).contains("Locked by you").click() - - cy.unlockApp({ owned: true }) - - cy.get(".lock-status").should("not.be.visible") - }) - - xit("Should reflect the deploy state of an app that hasn't been published.", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.get(".header-right button.spectrum-Button[data-cy='view-app']").should( - "be.disabled" - ) - - cy.get(".spectrum-Tabs-item.is-selected").contains("Overview") - cy.get(".overview-tab").should("be.visible") - - cy.get(".overview-tab [data-cy='app-status']").within(() => { - cy.get(".status-display").contains("Unpublished") - cy.get(".status-display .icon svg[aria-label='GlobeStrike']").should( - "exist" - ) - cy.get(".status-text").contains("-") - }) - }) - - xit("Should reflect the app deployment state", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - cy.get(".appTable .app-row-actions button") - .contains("Edit") - .eq(0) - .click({ force: true }) - - cy.wait(500) - cy.get(".toprightnav button.spectrum-Button", { timeout: 2000 }) - .contains("Publish") - .click({ force: true }) - cy.get(".spectrum-Modal [data-cy='deploy-app-modal']") - .should("be.visible") - .within(() => { - cy.get(".spectrum-Button").contains("Publish").click({ force: true }) - cy.wait(1000) - }) - - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.get(".header-right button.spectrum-Button[data-cy='view-app']").should( - "not.be.disabled" - ) - - cy.get(".overview-tab [data-cy='app-status']").within(() => { - cy.get(".status-display").contains("Published") - cy.get(".status-display .icon svg[aria-label='GlobeCheck']").should( - "exist" - ) - cy.get(".status-text").contains("Last published a few seconds ago") - }) - }) - - xit("Should reflect an application that has been unpublished", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-row-actions button") - .contains("Edit") - .eq(0) - .click({ force: true }) - - cy.get(".deployment-top-nav svg[aria-label='Globe']").click({ - force: true, - }) - - cy.get("[data-cy='publish-popover-menu']").should("be.visible") - cy.get( - "[data-cy='publish-popover-menu'] [data-cy='publish-popover-action']" - ).click({ force: true }) - - cy.get("[data-cy='unpublish-modal']") - .should("be.visible") - .within(() => { - cy.get(".confirm-wrap button").click({ force: true }) - }) - - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.wait(1000) - cy.get(".appTable .app-row-actions button", { timeout: 10000 }) - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.get(".overview-tab [data-cy='app-status']").within(() => { - cy.get(".status-display").contains("Unpublished") - cy.get(".status-display .icon svg[aria-label='GlobeStrike']").should( - "exist" - ) - cy.get(".status-text").contains("Last published a few seconds ago") - }) - }) - - xit("Should allow the editing of the application icon and colour", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.get(".edit-hover", { timeout: 1000 }).eq(0).click({ force: true }) - // Select random icon - cy.wait(400) - cy.get(".grid").within(() => { - cy.get(".icon-item") - .eq(Math.floor(Math.random() * 23) + 1) - .click() - }) - // Select random colour - cy.get(".fill").click() - cy.get(".colors").within(() => { - cy.get(".color") - .eq(Math.floor(Math.random() * 33) + 1) - .click() - }) - cy.intercept("**/applications/**").as("iconChange") - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - cy.wait("@iconChange") - cy.get("@iconChange").its("response.statusCode").should("eq", 200) - // Confirm icon has changed from default - // Confirm colour has been applied - cy.get(".spectrum-ActionButton-label").contains("Back").click({ force: true }) - cy.get(".appTable", { timeout: 2000 }).within(() => { - cy.get("[aria-label]") - .eq(0) - .children() - .should("have.attr", "xlink:href") - .and("not.contain", "#spectrum-icon-18-Apps") - cy.get(".title") - .children() - .children() - .should("have.attr", "style") - .and("contains", "color") - }) - }) - - xit("Should reflect the last time the application was edited", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.get(".header-right button").contains("Edit").click({ force: true }) - - cy.navigateToFrontend() - - cy.searchAndAddComponent("Headline").then(componentId => { - cy.getComponent(componentId).should("exist") - }) - - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.get(".overview-tab [data-cy='edited-by']").within(() => { - cy.get(".editor-name").contains("You") - cy.get(".last-edit-text").contains("Last edited a few seconds ago") - }) - }) - - xit("Should reflect application version is up-to-date", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.get(".overview-tab [data-cy='app-version']").within(() => { - cy.get(".version-status").contains("You're running the latest!") - }) - }) - - it("Should navigate to the settings tab when clicking the App Version card header", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.get(".spectrum-Tabs-item.is-selected").contains("Overview") - cy.get(".overview-tab").should("be.visible") - - cy.get(".overview-tab [data-cy='app-version'] .dash-card-header").click({ - force: true, - }) - - cy.get(".spectrum-Tabs-item.is-selected").contains("Settings") - cy.get(".settings-tab").should("be.visible") - cy.get(".overview-tab").should("not.exist") - }) - - it("Should allow the upgrading of an application, if available.", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.wait(500) - - cy.location().then(loc => { - const params = loc.pathname.split("/") - const appId = params[params.length - 1] - cy.log(appId) - //Downgrade the app for the test - cy.alterAppVersion(appId, "0.0.1-alpha.0").then(() => { - cy.reload() - cy.log("Current deployment version: " + clientPackage.version) - - cy.get(".version-status a", { timeout: 5000 }).contains("Update").click() - cy.get(".spectrum-Tabs-item.is-selected").contains("Settings") - - cy.get(".version-section .page-action button") - .contains("Update") - .click({ force: true }) - - cy.intercept("POST", "**/applications/**/client/update").as( - "updateVersion" - ) - cy.get(".spectrum-Modal.is-open button") - .contains("Update") - .click({ force: true }) - - cy.wait("@updateVersion") - .its("response.statusCode") - .should("eq", 200) - .then(() => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.get(".spectrum-Tabs-item") - .contains("Overview") - .click({ force: true }) - cy.get(".overview-tab [data-cy='app-version']").within(() => { - cy.get(".spectrum-Heading").contains(clientPackage.version) - cy.get(".version-status").contains("You're running the latest!") - }) - }) - }) - }) - }) - - xit("Should allow editing of the app details.", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.get(".spectrum-Tabs-item").contains("Settings").click() - cy.get(".spectrum-Tabs-item.is-selected").contains("Settings") - cy.get(".settings-tab").should("be.visible") - - cy.get(".details-section .page-action button") - .contains("Edit") - .click({ force: true }) - cy.updateAppName("sample name") - - //publish and check its disabled - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - cy.wait(500) - cy.get(".appTable .app-row-actions button") - .contains("Edit") - .eq(0) - .click({ force: true }) - - cy.get(".toprightnav button.spectrum-Button") - .contains("Publish") - .click({ force: true }) - cy.get(".spectrum-Modal [data-cy='deploy-app-modal']") - .should("be.visible") - .within(() => { - cy.get(".spectrum-Button").contains("Publish").click({ force: true }) - cy.wait(1000) - }) - - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 10000 }) - cy.get(".appTable .app-row-actions button", { timeout: 5000 }) - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.get(".spectrum-Tabs-item").contains("Settings").click() - cy.get(".spectrum-Tabs-item.is-selected").contains("Settings") - - cy.get(".details-section .page-action .spectrum-Button").scrollIntoView() - cy.get(".details-section .page-action .spectrum-Button", { timeout: 1000 }).should( - "be.disabled" - ) - }) - - xit("Should allow copying of the published application Id", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-row-actions") - .eq(0) - .within(() => { - cy.get(".spectrum-Button").contains("Edit").click({ force: true }) - }) - - cy.publishApp("sample-name") - - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.get(".app-overview-actions-icon > .icon").click({ force: true }) - - cy.get("[data-cy='app-overview-menu-popover']") - .eq(0) - .within(() => { - cy.get(".spectrum-Menu-item") - .contains("Copy App ID") - .click({ force: true }) - }) - - cy.get(".spectrum-Toast-content") - .contains("App ID copied to clipboard.") - .should("be.visible") - }) - - xit("Should allow unpublishing of the application via the Unpublish link", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - - cy.get(`[data-cy="app-status"]`).within(() => { - cy.contains("Unpublish").click({ force: true }) - }) - - cy.get("[data-cy='unpublish-modal']") - .should("be.visible") - .within(() => { - cy.get(".confirm-wrap button").click({ force: true }) - }) - - cy.get(".overview-tab [data-cy='app-status']").within(() => { - cy.get(".status-display").contains("Unpublished") - cy.get(".status-display .icon svg[aria-label='GlobeStrike']") - .should("exist") - }) - }) - - xit("Should allow deleting of the application", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - cy.get(".app-overview-actions-icon > .icon").click({ force: true }) - - cy.get("[data-cy='app-overview-menu-popover']") - .eq(0) - .within(() => { - cy.get(".spectrum-Menu-item") - .contains("Delete") - .click({ force: true }) - cy.wait(500) - }) - - //The test application was renamed earlier in the spec - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get("input").type("sample name") - cy.get(".spectrum-Button--warning").click() - }) - - cy.location().should(loc => { - expect(loc.pathname).to.eq("/builder/portal/apps") - }) - - cy.get(".appTable").should("not.exist") - - cy.get(".welcome .container h1").contains("Let's create your first app!") - }) - - after(() => { - cy.deleteAllApps() - }) - }) -}) diff --git a/packages/builder/cypress/integration/appPublishWorkflow.spec.js b/packages/builder/cypress/integration/appPublishWorkflow.spec.js deleted file mode 100644 index 3376db0b2d..0000000000 --- a/packages/builder/cypress/integration/appPublishWorkflow.spec.js +++ /dev/null @@ -1,108 +0,0 @@ -import filterTests from "../support/filterTests" -import { APP_TABLE_APP_NAME, DEPLOY_SUCCESS_MODAL } from "../support/interact"; -const interact = require('../support/interact') - -filterTests(['all'], () => { - xcontext("Publish Application Workflow", () => { - before(() => { - cy.login() - cy.deleteAllApps() - cy.createApp("Cypress Tests", false) - }) - - xit("Should reflect the unpublished status correctly", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - - cy.get(interact.APP_TABLE_STATUS, { timeout: 3000 }).eq(0) - .within(() => { - cy.contains("Unpublished") - cy.get(interact.GLOBESTRIKE).should("exist") - }) - - cy.get(interact.APP_TABLE_ROW_ACTION).eq(0) - .within(() => { - cy.get(interact.SPECTRUM_BUTTON_TEMPLATE).contains("Edit").click({ force: true }) - }) - - cy.get(interact.DEPLOYMENT_TOP_NAV_GLOBESTRIKE).should("exist") - cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("not.exist") - }) - - xit("Should publish an application and correctly reflect that", () => { - //Assuming the previous test was run and the unpublished app is open in edit mode. - cy.get(interact.TOPRIGHTNAV_BUTTON_SPECTRUM).contains("Publish").click({ force: true }) - - cy.get(interact.DEPLOY_APP_MODAL).should("be.visible") - .within(() => { - cy.get(interact.SPECTRUM_BUTTON).contains("Publish").click({ force: true }) - }); - - //Verify that the app url is presented correctly to the user - cy.get(interact.DEPLOY_SUCCESS_MODAL, { timeout: 1000 }) - .should("be.visible") - .within(() => { - let appUrl = Cypress.config().baseUrl + '/app/cypress-tests' - cy.get(interact.DEPLOY_APP_URL_INPUT).should('have.value', appUrl) - cy.get(interact.SPECTRUM_BUTTON).contains("Done").click({ force: true }) - }) - - cy.visit(`${Cypress.config().baseUrl}/builder`) - - cy.get(interact.APP_TABLE_STATUS, { timeout: 3000 }).eq(0) - .within(() => { - cy.contains("Published") - cy.get(interact.GLOBE).should("exist") - }) - - cy.get(interact.APP_TABLE_ROW_ACTION).eq(0) - .within(() => { - cy.get(interact.SPECTRUM_BUTTON).contains("Manage") - cy.get(interact.SPECTRUM_BUTTON).contains("Edit").click({ force: true }) - }) - - cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("exist").click({ force: true }) - - cy.get(interact.PUBLISH_POPOVER_MENU).should("be.visible") - .within(() => { - cy.get(interact.PUBLISH_POPOVER_ACTION).should("exist") - cy.get("button").contains("View app").should("exist") - cy.get(interact.PUBLISH_POPOVER_MESSAGE).should("have.text", "Last published a few seconds ago") - }) - }) - - xit("Should unpublish an application using the link and reflect the status change", () => { - //Assuming the previous test app exists and is published - - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - - cy.get(interact.APP_TABLE_STATUS).eq(0) - .within(() => { - cy.contains("Published") - cy.get("svg[aria-label='Globe']").should("exist") - }) - - cy.get(interact.APP_TABLE).eq(0) - .within(() => { - cy.get(interact.APP_TABLE_APP_NAME).click({ force: true }) - }) - - cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("exist").click({ force: true }) - - cy.get("[data-cy='publish-popover-menu']") - .within(() => { - cy.get(interact.PUBLISH_POPOVER_ACTION).click({ force: true }) - }) - - cy.get(interact.UNPUBLISH_MODAL).should("be.visible") - .within(() => { - cy.get(interact.CONFIRM_WRAP_BUTTON).click({ force: true } - ) - }) - - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 6000 }) - cy.wait(500) - cy.get(interact.APP_TABLE_STATUS, { timeout: 10000 }).eq(0).contains("Unpublished") - - }) - }) -}) diff --git a/packages/builder/cypress/integration/autoScreensUI.spec.js b/packages/builder/cypress/integration/autoScreensUI.spec.js deleted file mode 100644 index 581e5c431b..0000000000 --- a/packages/builder/cypress/integration/autoScreensUI.spec.js +++ /dev/null @@ -1,101 +0,0 @@ -import filterTests from "../support/filterTests" -const interact = require('../support/interact') - -filterTests(['smoke', 'all'], () => { - xcontext("Auto Screens UI", () => { - before(() => { - cy.login() - cy.deleteAllApps() - }) - - it("should disable the autogenerated screen options if no sources are available", () => { - cy.createApp("First Test App", false) - cy.closeModal(); - - cy.navigateToAutogeneratedModal() - cy.get(interact.CONFIRM_WRAP_SPE_BUTTON).should('be.disabled') - - cy.deleteAllApps() - }); - - it("should not display incompatible sources", () => { - cy.createApp("Test App") - - cy.selectExternalDatasource("REST") - cy.selectExternalDatasource("S3") - cy.get(interact.SPECTRUM_MODAL).within(() => { - cy.get(interact.SPECTRUM_BUTTON).contains("Save and continue to query").click({ force : true }) - }) - - cy.navigateToAutogeneratedModal() - - cy.get(interact.DATA_SOURCE_ENTRY).should('have.length', 1) - cy.get(interact.DATA_SOURCE_ENTRY) - - cy.deleteAllApps() - }); - - it("should generate internal table screens", () => { - cy.createTestApp() - // Create Autogenerated screens from the internal table - cy.createDatasourceScreen(["Cypress Tests"]) - // Confirm screens have been auto generated - cy.get(interact.BODY).should('contain', "cypress-tests") - .and('contain', 'cypress-tests/:id') - .and('contain', 'cypress-tests/new/row') - }) - - it("should generate multiple internal table screens at once", () => { - const initialTable = "Cypress Tests" - const secondTable = "Table Two" - // Create a second internal table - cy.createTable(secondTable) - // Create Autogenerated screens from the internal tables - cy.createDatasourceScreen([initialTable, secondTable]) - // Confirm screens have been auto generated - // Previously generated tables are suffixed with numbers - as expected - cy.wait(1000) - cy.get(interact.BODY).should('contain', 'cypress-tests-2') - .and('contain', 'cypress-tests-2/:id') - .and('contain', 'cypress-tests-2/new/row') - .and('contain', 'table-two') - .and('contain', 'table-two/:id') - .and('contain', 'table-two/new/row') - }) - - it("should generate multiple internal table screens with the same screen access level", () => { - //The tables created in the previous step still exist - cy.createTable("Table Three") - cy.createTable("Table Four") - cy.createDatasourceScreen(["Table Three", "Table Four"], "Admin") - - // Filter screens to Admin - cy.filterScreensAccessLevel('Admin') - - cy.get(interact.BODY).should('contain', 'table-three') - .and('contain', 'table-three/:id') - .and('contain', 'table-three/new/row') - .and('contain', 'table-four') - .and('contain', 'table-four/:id') - .and('contain', 'table-four/new/row') - .and('not.contain', 'table-two') - .and('not.contain', 'cypress-tests') - }) - - if (Cypress.env("TEST_ENV")) { - it("should generate datasource screens", () => { - // Using MySQL datasource for testing this - const datasource = "MySQL" - // Select & configure MySQL datasource - cy.selectExternalDatasource(datasource) - cy.addDatasourceConfig(datasource) - // Create Autogenerated screens from a MySQL table - MySQL contains books table - cy.createDatasourceScreen(["books"]) - - cy.get(interact.BODY).should('contain', 'books') - .and('contain', 'books/:id') - .and('contain', 'books/new/row') - }) - } - }) -}) diff --git a/packages/builder/cypress/integration/createApp.spec.js b/packages/builder/cypress/integration/createApp.spec.js deleted file mode 100644 index 897c7f8b91..0000000000 --- a/packages/builder/cypress/integration/createApp.spec.js +++ /dev/null @@ -1,235 +0,0 @@ -import filterTests from '../support/filterTests' -const interact = require('../support/interact') - -filterTests(['smoke', 'all'], () => { - context("Create an Application", () => { - - before(() => { - cy.login() - cy.deleteAllApps() - }) - - if (!(Cypress.env("TEST_ENV"))) { - it.skip("should show the new user UI/UX", () => { - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/create`, { timeout: 5000 }) //added /portal/apps/create - cy.wait(1000) - cy.get(interact.CREATE_APP_BUTTON, { timeout: 10000 }).contains('Start from scratch').should("exist") - - cy.get(interact.TEMPLATE_CATEGORY_FILTER).should("exist") - cy.get(interact.TEMPLATE_CATEGORY).should("exist") - - cy.get(interact.APP_TABLE).should("not.exist") - }) - } - - xit("should provide filterable templates", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - cy.wait(500) - - cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) - .its("body") - .then(val => { - if (val.length > 0) { - cy.get(interact.SPECTRUM_BUTTON).contains("View Templates").click({ force: true }) - } - }) - - cy.get(interact.TEMPLATE_CATEGORY_FILTER).should("exist") - cy.get(interact.TEMPLATE_CATEGORY).should("exist") - - cy.get(interact.TEMPLATE_CATEGORY_ACTIONGROUP).its('length').should('be.gt', 1) - cy.get(interact.TEMPLATE_CATEGORY_FILTER_ACTIONBUTTON).its('length').should('be.gt', 2) - - cy.get(interact.TEMPLATE_CATEGORY_FILTER_ACTIONBUTTON).eq(1).click() - cy.get(interact.TEMPLATE_CATEGORY_ACTIONGROUP).should('have.length', 1) - - cy.get(interact.TEMPLATE_CATEGORY_FILTER_ACTIONBUTTON).eq(0).click() - cy.get(interact.TEMPLATE_CATEGORY_ACTIONGROUP).its('length').should('be.gt', 1) - }) - - it("should enforce a valid url before submission", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 10000 }) - - // Start create app process. If apps already exist, click second button - cy.wait(1000) - cy.get(interact.CREATE_APP_BUTTON, { timeout: 3000 }).click({ force: true }) - - const appName = "Cypress Tests" - cy.get(interact.SPECTRUM_MODAL).within(() => { - - cy.get(interact.APP_NAME_INPUT).eq(0).should('have.focus') - - //Auto fill - cy.get(interact.APP_NAME_INPUT).eq(0).clear() - cy.get(interact.APP_NAME_INPUT).eq(0).type(appName).should("have.value", appName).blur() - cy.get(interact.APP_NAME_INPUT).eq(1).should("have.value", "/cypress-tests") - cy.get(interact.SPECTRUM_BUTTON_GROUP).contains("Create app").should('not.be.disabled') - - //Empty the app url - disabled create - cy.get(interact.APP_NAME_INPUT).eq(1).clear().blur() - cy.get(interact.SPECTRUM_BUTTON_GROUP).contains("Create app").should('be.disabled') - - //Invalid url - cy.get(interact.APP_NAME_INPUT).eq(1).type("/new app-url").blur() - cy.get(interact.SPECTRUM_BUTTON_GROUP).contains("Create app").should('be.disabled') - - //Specifically alter the url - cy.get(interact.APP_NAME_INPUT).eq(1).clear() - cy.get(interact.APP_NAME_INPUT).eq(1).type("another-app-name").blur() - cy.get(interact.APP_NAME_INPUT).eq(1).should("have.value", "/another-app-name") - cy.get(interact.APP_NAME_INPUT).eq(0).should("have.value", appName) - cy.get(interact.SPECTRUM_BUTTON_GROUP).contains("Create app").should('not.be.disabled') - - }) - }) - - it.skip("should create the first application from scratch", () => { - const appName = "Cypress Tests" - cy.createApp(appName, false) - - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - - cy.applicationInAppTable(appName) - cy.deleteApp(appName) - }) - - it.skip("should create the first application from scratch with a default name", () => { - cy.updateUserInformation("", "") - cy.createApp("", false) - cy.applicationInAppTable("My app") - cy.deleteApp("My app") - }) - - it("should create the first application from scratch, using the users first name as the default app name", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - - cy.updateUserInformation("Ted", "Userman") - - cy.createApp("", false) - cy.applicationInAppTable("Teds app") - cy.deleteApp("Teds app") - - // Accomodate names that end in 'S' - cy.updateUserInformation("Chris", "Userman") - - cy.createApp("", false) - cy.applicationInAppTable("Chris app") - cy.deleteApp("Chris app") - - cy.updateUserInformation("", "") - }) - - it("should create an application from an export", () => { - const exportedApp = 'cypress/fixtures/exported-app.txt' - - cy.importApp(exportedApp, "") - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 2000 }) - cy.applicationInAppTable("My app") - cy.get(".app-table .name").eq(0).click() - cy.closeModal() - cy.get(`[aria-label="ShowMenu"]`).click() - cy.get(".spectrum-Menu").within(() => { - cy.contains("Overview").click() - }) - cy.get(".app-overview-actions-icon").within(() => { - cy.get(".spectrum-Icon").click({ force: true }) - }) - cy.get(".spectrum-Menu").contains("Delete").click({ force: true }) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get("input").type("My app") - }) - cy.get(".spectrum-Button--warning").click() - }) - - it("should create an application from an export, using the users first name as the default app name", () => { - const exportedApp = 'cypress/fixtures/exported-app.txt' - - cy.updateUserInformation("Ted", "Userman") - cy.importApp(exportedApp, "") - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.applicationInAppTable("Teds app") - cy.get(".app-table .name").eq(0).click() - cy.closeModal() - cy.get(`[aria-label="ShowMenu"]`).click() - cy.get(".spectrum-Menu").within(() => { - cy.contains("Overview").click() - }) - cy.get(".app-overview-actions-icon").within(() => { - cy.get(".spectrum-Icon").click({ force: true }) - }) - cy.get(".spectrum-Menu").contains("Delete").click({ force: true }) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get("input").type("Teds app") - }) - cy.get(".spectrum-Button--warning").click() - cy.updateUserInformation("", "") - }) - - xit("should generate the first application from a template", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.wait(500) - - // Navigate to Create new app section if apps already exist - cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) - .its("body") - .then(val => { - if (val.length > 0) { - cy.get(interact.CREATE_APP_BUTTON).click({ force: true }) - } - }) - - cy.get(interact.TEMPLATE_CATEGORY_FILTER).should("exist") - cy.get(interact.TEMPLATE_CATEGORY).should("exist") - - // Select template - cy.get(interact.TEMPLATE_CATEGORY_ACTIONGROUP).eq(0).within(() => { - const card = cy.get('.template-card').eq(0).should("exist"); - const cardOverlay = card.get('.template-thumbnail-action-overlay').should("exist") - cardOverlay.invoke("show") - cardOverlay.get("button").contains("Use template").should("exist").click({ force: true }) - }) - - // CMD Create app from theme card - cy.get(".spectrum-Modal").should('be.visible') - - const templateName = cy.get(".spectrum-Modal .template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = "/" + templateNameText.toLowerCase().replace(/\s+/g, "-") - cy.get(interact.SPECTRUM_MODAL_INPUT).eq(0).should("have.value", templateNameText) - cy.get(interact.SPECTRUM_MODAL_INPUT).eq(1).should("have.value", templateNameParsed) - - cy.get(".spectrum-Modal .spectrum-ButtonGroup").contains("Create app").click() - cy.wait(5000) - - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.wait(2000) - - cy.applicationInAppTable(templateNameText) - cy.deleteApp(templateNameText) - }); - - }) - - it("should display a second application and app filtering", () => { - // Create first app - const appName = "Cypress Tests" - cy.createApp(appName) - - cy.visit(`${Cypress.config().baseUrl}/builder`) - - // Create second app - const secondAppName = "Second App Demo" - cy.createApp(secondAppName) - - cy.visit(`${Cypress.config().baseUrl}/builder`) - - //Both applications should exist and be searchable - cy.searchForApplication(appName) - cy.searchForApplication(secondAppName) - - cy.deleteApp(secondAppName) - }) - - }) -}) diff --git a/packages/builder/cypress/integration/createAutomation.spec.js b/packages/builder/cypress/integration/createAutomation.spec.js deleted file mode 100644 index 6326691d28..0000000000 --- a/packages/builder/cypress/integration/createAutomation.spec.js +++ /dev/null @@ -1,64 +0,0 @@ -import filterTests from "../support/filterTests" -const interact = require('../support/interact') - -filterTests(['smoke', 'all'], () => { - xcontext("Create a automation", () => { - before(() => { - cy.login() - cy.createTestApp() - }) - - xit("should create a automation", () => { - cy.createTestTableWithData() - cy.wait(2000) - cy.contains("Automate").click() - cy.get(interact.SPECTRUM_BUTTON_TEMPLATE).contains("Add automation").click({ force: true }) - cy.get(interact.MODAL_INNER_WRAPPER).within(() => { - cy.get("input").type("Add Row") - cy.contains("Row Created").click({ force: true }) - cy.get(interact.SPECTRUM_BUTTON_CTA, { timeout: 500 }).click() - }) - - // Setup trigger - cy.get(interact.SPECTRUM_PICKER_LABEL).click() - cy.wait(500) - cy.contains("dog").click() - // Create action - cy.get('[aria-label="AddCircle"]', { timeout: 2000 }).click() - cy.get(interact.MODAL_INNER_WRAPPER).within(() => { - cy.wait(1000) - cy.contains("Create Row").trigger('mouseover').click().click() - cy.get(interact.SPECTRUM_BUTTON_CTA).click() - }) - cy.get(interact.SPECTRUM_PICKER_LABEL).eq(1).click() - cy.contains("dog").click() - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT) - .first() - .type("{{ trigger.row.name }}", { parseSpecialCharSequences: false }) - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT) - .eq(1) - .type("11") - cy.contains("Finish and test automation").click() - - cy.get(interact.MODAL_INNER_WRAPPER).within(() => { - cy.get(interact.SPECTRUM_PICKER_LABEL, { timeout: 1000 }).click() - cy.contains("dog").click() - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT, { timeout: 1000 }) - .first() - .type("automationGoodboy") - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT) - .eq(1) - .type("11") - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT) - .eq(2) - .type("123456") - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT) - .eq(3) - .type("123456") - cy.contains("Test").click() - }) - cy.contains("Data").click() - cy.contains("automationGoodboy") - }) - }) -}) diff --git a/packages/builder/cypress/integration/createBinding.spec.js b/packages/builder/cypress/integration/createBinding.spec.js deleted file mode 100644 index 0722d29f1d..0000000000 --- a/packages/builder/cypress/integration/createBinding.spec.js +++ /dev/null @@ -1,66 +0,0 @@ -import filterTests from "../support/filterTests" - -filterTests(['smoke', 'all'], () => { - context("Create Bindings", () => { - before(() => { - cy.login() - cy.createTestApp() - cy.navigateToFrontend() - }) - - it("should add a current user binding", () => { - cy.searchAndAddComponent("Paragraph").then(componentId => { - addSettingBinding("text", ["Current User", "_id"], "Current User._id") - }) - cy.deleteComponentByName("New Paragraph") - }) - - it("should handle an invalid binding", () => { - cy.searchAndAddComponent("Paragraph").then(componentId => { - // Cypress needs to escape curly brackets - cy.get("[data-cy=setting-text] input") - .type("{{}{{}{{} Current User._id {}}{}}") - .blur() - cy.getComponent(componentId).should("have.text", "{{{ [user].[_id] }}") - cy.deleteComponentByName("New Paragraph") - }) - }) - - xit("should add a URL param binding", () => { - const paramName = "foo" - cy.createScreen(`/test/:${paramName}`) - cy.searchAndAddComponent("Paragraph").then(componentId => { - addSettingBinding("text", ["URL", paramName], `URL.${paramName}`) - // The builder preview pages don't have a real URL, so all we can do - // is check that we were able to bind to the property, and that the - // component exists on the page - cy.getComponent(componentId).should("have.text", "New Paragraph") - }) - }) - - it("should add a binding with a handlebars helper", () => { - cy.searchAndAddComponent("Paragraph").then(componentId => { - // Cypress needs to escape curly brackets - cy.get("[data-cy=setting-text] input") - .type("{{}{{} add 1 2 {}}{}}") - .blur() - cy.getComponent(componentId).should("have.text", "3") - }) - }) - }) - - const addSettingBinding = (setting, bindingCategories, bindingText, clickOption = true) => { - cy.get(`[data-cy="setting-${setting}"] [data-cy=text-binding-button]`).click() - cy.get(".category-list li").contains(bindingCategories[0]) - cy.get(".drawer").within(() => { - if (clickOption) { - cy.get(".category-list li").contains(bindingCategories[0]).click() - cy.get("li.binding").contains(bindingCategories[1]).click() - cy.get("textarea").should("have.value", `{{ ${bindingText} }}`) - } else { - cy.get("textarea").type(bindingText) - } - cy.contains("Save").click() - }) - } -}) diff --git a/packages/builder/cypress/integration/createComponents.spec.js b/packages/builder/cypress/integration/createComponents.spec.js deleted file mode 100644 index 7f29466258..0000000000 --- a/packages/builder/cypress/integration/createComponents.spec.js +++ /dev/null @@ -1,275 +0,0 @@ -import filterTests from "../support/filterTests" -const interact = require("../support/interact") - -filterTests(["all"], () => { - xcontext("Create Components", () => { - let headlineId - - before(() => { - cy.login() - cy.createTestApp() - cy.createTable("dog") - cy.addColumn("dog", "name", "Text") - cy.addColumn("dog", "age", "Number") - cy.addColumn("dog", "breed", "Options") - - cy.navigateToFrontend() - cy.wait(1000) //allow the iframe some wiggle room - }) - - //Use the tree to delete a selected component - const deleteSelectedComponent = () => { - cy.get( - ".nav-item.selected .actions > div > .icon" - ).click({ - force: true, - }) - cy.get(".spectrum-Popover.is-open li").contains("Delete").click() - cy.get(".spectrum-Modal button").contains("Delete Component").click({ - force: true, - }) - } - - it("should add a container", () => { - cy.searchAndAddComponent("Container").then(componentId => { - cy.getComponent(componentId).should("exist") - }) - }) - - it("should add a headline", () => { - cy.searchAndAddComponent("Headline").then(componentId => { - headlineId = componentId - cy.getComponent(headlineId).should("exist") - }) - }) - - it("should change the text of the headline", () => { - const text = "Lorem ipsum dolor sit amet." - cy.get("[data-cy=setting-text] input").type(text).blur() - cy.getComponent(headlineId).should("have.text", text) - }) - - it("should change the size of the headline", () => { - cy.get("[data-cy=setting-size]").scrollIntoView().click() - cy.get("[data-cy=setting-size]").within(() => { - cy.get(".spectrum-Form-item li.spectrum-Menu-item") - .contains("3XL") - .click() - }) - - cy.getComponent(headlineId).within(() => { - cy.get(".spectrum-Heading").should("have.css", "font-size", "60px") - }) - }) - - it("should create a form and reset to match schema", () => { - cy.searchAndAddComponent("Form").then(() => { - cy.get("[data-cy=setting-dataSource]").contains("Custom").click() - cy.get(interact.DROPDOWN).contains("dog").click() - cy.wait(500) - cy.searchAndAddComponent("Field Group").then(fieldGroupId => { - cy.contains("Update form fields").click() - cy.get(".spectrum-Modal") - .get(".confirm-wrap .spectrum-Button") - .click() - cy.wait(500) - cy.getComponent(fieldGroupId).within(() => { - cy.contains("name").should("exist") - cy.contains("age").should("exist") - cy.contains("breed").should("exist") - // cy.contains("image").should("exist") - }) - cy.getComponent(fieldGroupId).find("input").should("have.length", 2) - cy.getComponent(fieldGroupId) - .find(interact.SPECTRUM_PICKER) - .should("have.length", 1) - }) - }) - }) - - it("deletes a component", () => { - cy.searchAndAddComponent("Paragraph").then(componentId => { - cy.get("[data-cy=setting-_instanceName] input").type(componentId).blur() - cy.get( - ".nav-item.selected .actions > div > .icon" - ).click({ - force: true, - }) - cy.get(".spectrum-Popover.is-open li").contains("Delete").click() - cy.get(".spectrum-Modal button").contains("Delete Component").click({ - force: true, - }) - cy.getComponent(componentId).should("not.exist") - }) - }) - - it("should clear the iframe place holder when a form field has been set", () => { - cy.searchAndAddComponent("Form").then(formId => { - //For deletion - cy.get("[data-cy=setting-_instanceName] input") - .clear() - .type(formId) - .blur() - cy.get("[data-cy=setting-dataSource]").contains("Custom").click() - cy.get(".dropdown").contains("dog").click() - - const fieldTypeToColumnName = { - "Text Field": "name", - "Number Field": "age", - "Options Picker": "breed", - } - - const componentTypeLabels = Object.keys(fieldTypeToColumnName) - - const testFieldFocusOnCreate = componentLabel => { - cy.log("Adding: " + componentLabel) - return cy.searchAndAddComponent(componentLabel).then(componentId => { - cy.get("[data-cy=setting-field] button.spectrum-Picker").click() - - //Click the first appropriate field. They are filtered by type - cy.get( - "[data-cy=setting-field] .spectrum-Popover.is-open li.spectrum-Menu-item" - ) - .contains(fieldTypeToColumnName[componentLabel]) - .click() - cy.wait(500) - cy.getComponent(componentId) - .find(".component-placeholder") - .should("not.exist") - }) - } - - cy.wait(500) - cy.wrap(componentTypeLabels) - .each(label => { - return testFieldFocusOnCreate(label) - }) - .then(() => { - cy.get(".nav-item") - .contains(formId) - .click({ force: true }) - deleteSelectedComponent() - }) - }) - }) - - it("should populate the provider for charts with a data provider in its path", () => { - cy.searchAndAddComponent("Data Provider").then(providerId => { - //For deletion - cy.get("[data-cy=setting-_instanceName] input") - .clear() - .type(providerId) - .blur() - cy.get("[data-cy=setting-dataSource]") - .contains("Choose an option") - .click() - cy.get(`[data-cy=dataSource-popover-${providerId}] ul li`) - .contains("dog") - .click() - - const chartTypeLabels = [ - "Bar Chart", - "Line Chart", - "Area Chart", - "Pie Chart", - "Donut Chart", - "Candlestick Chart", - ] - - const testFocusOnCreate = chartLabel => { - cy.log("Adding: " + chartLabel) - cy.searchAndAddComponent(chartLabel).then(componentId => { - cy.get( - "[data-cy=dataProvider-prop-control] .spectrum-Picker" - ).should("not.have.class", "is-focused") - - // Pre populated. - cy.get("[data-cy=dataProvider-prop-control] .spectrum-Picker-label") - .contains(providerId) - .should("exist") - }) - } - cy.wait(1000) - cy.wrap(chartTypeLabels) - .each(label => { - return testFocusOnCreate(label) - }) - .then(() => { - cy.get(".nav-item") - .contains(providerId) - .click({ force: true }) - deleteSelectedComponent() - }) - }) - }) - - it("should replace the placeholder when a url is set on an image", () => { - cy.searchAndAddComponent("Image").then(imageId => { - cy.get("[data-cy=setting-_instanceName] input") - .clear() - .type(imageId) - .blur() - //return $("New Data Provider.Rows")[0]["Attachment"][0]["url"] - //No minio, so just enter something local that will not reslove - cy.get("[data-cy=url-prop-control] input[type=text]") - .type("cypress/fixtures/ghost.png") - .blur() - cy.getComponent(imageId) - .find(".component-placeholder") - .should("not.exist") - cy.getComponent(imageId).find(`img[alt=${imageId}]`).should("exist") - cy.get(".nav-item") - .contains(imageId) - .click({ force: true }) - deleteSelectedComponent() - }) - }) - - it("should add a markdown component.", () => { - cy.searchAndAddComponent("Markdown Viewer").then(markdownId => { - cy.get("[data-cy=setting-_instanceName] input") - .clear() - .type(markdownId) - .blur() - cy.get( - "[data-cy=value-prop-control] input[type=text].spectrum-Textfield-input" - ) - .type("# Hi") - .blur() - cy.getComponent(markdownId) - .find(".component-placeholder") - .should("not.exist") - cy.getComponent(markdownId) - .find(".editor-preview-full h1") - .contains("Hi") - cy.get(".nav-item") - .contains(markdownId) - .click({ force: true }) - deleteSelectedComponent() - }) - }) - - it("should direct the user when adding an Icon component.", () => { - cy.searchAndAddComponent("Icon").then(iconId => { - cy.get("[data-cy=setting-_instanceName] input") - .clear() - .type(iconId) - .blur() - cy.get("[data-cy=icon-prop-control] .spectrum-ActionButton").click() - cy.get("[data-cy=icon-popover].spectrum-Popover.is-open").within(() => { - cy.get(".search-input input").type("save").blur() - cy.get(".search-input button").click({ force: true }) - cy.get(".icon-area .icon-container").eq(0).click({ force: true }) - }) - cy.getComponent(iconId) - .find(".component-placeholder") - .should("not.exist") - cy.getComponent(iconId).find("i.ri-save-fill").should("exist") - cy.get(".nav-item") - .contains(iconId) - .click({ force: true }) - deleteSelectedComponent() - }) - }) - }) -}) diff --git a/packages/builder/cypress/integration/createScreen.spec.js b/packages/builder/cypress/integration/createScreen.spec.js deleted file mode 100644 index 09d8485386..0000000000 --- a/packages/builder/cypress/integration/createScreen.spec.js +++ /dev/null @@ -1,54 +0,0 @@ -import filterTests from "../support/filterTests" -const interact = require('../support/interact') - -filterTests(["smoke", "all"], () => { - xcontext("Screen Tests", () => { - before(() => { - cy.login() - cy.createTestApp() - cy.navigateToFrontend() - }) - - it.skip("Should successfully create a screen", () => { - cy.createScreen("test") - cy.get(interact.BODY).within(() => { - cy.contains("/test").should("exist") - }) - }) - - it("Should update the url", () => { - cy.createScreen("test with spaces") - cy.get(interact.BODY).within(() => { - cy.contains("/test-with-spaces").should("exist") - }) - }) - - it.skip("should delete all screens then create first screen via button", () => { - cy.deleteAllScreens() - - cy.contains("Create first screen").click() - cy.get(interact.BODY, { timeout: 2000 }).should('contain', '/home') - }) - - it("Should create and filter screens by access level", () => { - const accessLevels = ["Basic", "Admin", "Public", "Power"] - - for (const access of accessLevels) { - // Create screen with specified access level - cy.createScreen(access, access) - // Filter by access level and confirm screen visible - cy.filterScreensAccessLevel(access) - cy.get(interact.BODY).within(() => { - cy.get(interact.NAV_ITEM).should('contain', access.toLowerCase()) - }) - } - - // Filter by All screens - Confirm all screens visible - cy.filterScreensAccessLevel("All screens") - cy.get(interact.BODY).should('contain', accessLevels[0]) - .and('contain', accessLevels[1]) - .and('contain', accessLevels[2]) - .and('contain', accessLevels[3]) - }) - }) -}) diff --git a/packages/builder/cypress/integration/createTable.spec.js b/packages/builder/cypress/integration/createTable.spec.js deleted file mode 100644 index 1c3e69a36b..0000000000 --- a/packages/builder/cypress/integration/createTable.spec.js +++ /dev/null @@ -1,112 +0,0 @@ -import filterTests from "../support/filterTests" -const interact = require('../support/interact') - -filterTests(["smoke", "all"], () => { - xcontext("Create a Table", () => { - before(() => { - cy.login() - cy.createTestApp() - }) - - it("should create a new Table", () => { - cy.createTable("dog") - // Check if Table exists - cy.get(interact.TABLE_TITLE_H1, { timeout: 1000 }).should("have.text", "dog") - }) - - it("adds a new column to the table", () => { - cy.addColumn("dog", "name", "Text") - cy.contains("name").should("be.visible") - }) - - it("creates a row in the table", () => { - cy.addRow(["Rover"]) - cy.contains("Rover").should("be.visible") - }) - - it("updates a column on the table", () => { - cy.get(interact.TABLE_TITLE).click() - cy.get(interact.SPECTRUM_TABLE_EDIT).click() - cy.get(interact.MODAL_INNER_WRAPPER).within(() => { - - cy.get("input").eq(0).type("updated", { force: true }) - // Unset table display column - cy.get(interact.SPECTRUM_SWITCH_INPUT).eq(1).click() - cy.contains("Save Column").click() - }) - cy.contains("nameupdated ").should("contain", "nameupdated") - }) - - it("edits a row", () => { - cy.contains("button", "Edit").click({ force: true }) - cy.wait(500) - cy.get(interact.SPECTRUM_MODAL_INPUT).clear() - cy.get(interact.SPECTRUM_MODAL_INPUT).type("Updated") - cy.contains("Save").click() - cy.contains("Updated").should("have.text", "Updated") - }) - - it("deletes a row", () => { - cy.get(interact.SPECTRUM_CHECKBOX_INPUT).check({ force: true }) - cy.contains("Delete 1 row").click() - cy.get(interact.SPECTRUM_MODAL).contains("Delete").click() - cy.contains("RoverUpdated").should("not.exist") - }) - - if (Cypress.env("TEST_ENV")) { - // No Pagination in CI - Test env only for the next two tests - xit("Adds 15 rows and checks pagination", () => { - // 10 rows per page, 15 rows should create 2 pages within table - const totalRows = 16 - for (let i = 1; i < totalRows; i++) { - cy.addRow([i]) - } - cy.reload() - cy.get(interact.SPECTRUM_PAGINATION, { timeout: 2000 }).within(() => { - cy.get(interact.SPECTRUM_ACTION_BUTTON).eq(1).click() - }) - cy.get(interact.SPECTRUM_PAGINATION).within(() => { - cy.get(interact.SPECTRUM_BODY_SECOND).contains("Page 2") - }) - }) - - xit("Deletes rows and checks pagination", () => { - // Delete rows, removing second page from table - cy.get(interact.SPECTRUM_CHECKBOX_INPUT).check({ force: true }) - cy.get(interact.POPOVERS).within(() => { - cy.get(interact.SPECTRUM_BUTTON).click({ force: true }) - }) - cy.get(interact.SPECTRUM_DIALOG_GRID).contains("Delete").click({ force: true }) - - // Confirm table only has one page - cy.get(interact.SPECTRUM_PAGINATION, { timeout: 1000 }).within(() => { - cy.get(interact.SPECTRUM_ACTION_BUTTON).eq(1).should("not.be.enabled") - }) - }) - } - - it("deletes a column", () => { - const columnName = "nameupdated" - cy.get(interact.TABLE_TITLE).click() - cy.get(interact.SPECTRUM_TABLE_EDIT).click() - cy.contains("Delete").click() - cy.get(interact.DELETE_COLUMN_CONFIRM).type(columnName) - cy.contains("Delete Column").click() - cy.contains("nameupdated").should("not.exist") - }) - - it("deletes a table", () => { - cy.get(interact.NAV_ITEM) - .contains("dog") - .parents(interact.NAV_ITEM) - .first() - .within(() => { - cy.get(interact.ACTION_SPECTRUM_ICON).click({ force: true }) - }) - cy.get(interact.SPECTRUM_MENU_CHILD2).click() - cy.get(interact.DELETE_TABLE_CONFIRM).type("dog") - cy.contains("Delete Table").click() - cy.contains("dog").should("not.exist") - }) - }) -}) diff --git a/packages/builder/cypress/integration/createView.spec.js b/packages/builder/cypress/integration/createView.spec.js deleted file mode 100644 index c1494b6756..0000000000 --- a/packages/builder/cypress/integration/createView.spec.js +++ /dev/null @@ -1,161 +0,0 @@ -import filterTests from "../support/filterTests" -const interact = require('../support/interact') - -filterTests(['smoke', 'all'], () => { - xcontext("Create a View", () => { - before(() => { - cy.login() - cy.createTestApp() - cy.createTable("data") - cy.addColumn("data", "group", "Text") - cy.addColumn("data", "age", "Number") - cy.addColumn("data", "rating", "Number") - - // 6 Rows - cy.addRow(["Students", 25, 1]) - cy.addRow(["Students", 20, 3]) - cy.addRow(["Students", 18, 6]) - cy.addRow(["Students", 25, 2]) - cy.addRow(["Teachers", 49, 5]) - cy.addRow(["Teachers", 36, 3]) - }) - - xit("creates a view", () => { - cy.contains("Create view").click() - cy.get(interact.MODAL_INNER_WRAPPER).within(() => { - cy.get("input").type("Test View") - cy.get("button").contains("Create View").click({ force: true }) - }) - cy.contains(interact.TABLE_TITLE_H1, "Test View", { timeout: 10000 }) - cy.get(".table-wrapper").within(() => { - cy.get(interact.TITLE).then($headers => { - expect($headers).to.have.length(3) - const headers = Array.from($headers).map(header => - header.textContent.trim() - ) - expect(removeSpacing(headers)).to.deep.eq(["group", "age", "rating"]) - }) - }) - }) - - xit("filters the view by age over 10", () => { - cy.contains("Filter").click() - cy.contains("Add Filter").click() - - cy.get(interact.MODAL_INNER_WRAPPER).within(() => { - cy.get(interact.SPECTRUM_PICKER_LABEL).eq(0).click() - cy.contains("age").click({ force: true }) - - cy.get(interact.SPECTRUM_PICKER_LABEL).eq(1).click() - cy.contains("More Than").click({ force: true }) - - cy.get("input").type(18) - cy.contains("Save").click() - }) - - cy.get(interact.SPECTRUM_TABLE_ROW).get($values => { - expect($values).to.have.length(5) - }) - }) - - xit("creates a stats calculation view based on age", () => { - cy.wait(1000) - cy.contains("Calculate").click() - cy.get(interact.MODAL_INNER_WRAPPER).within(() => { - cy.get(interact.SPECTRUM_PICKER_LABEL).eq(0).click() - cy.contains("Statistics").click() - - cy.get(interact.SPECTRUM_PICKER_LABEL).eq(1).click() - cy.contains("age").click({ force: true }) - - cy.get(interact.SPECTRUM_BUTTON).contains("Save").click({ force: true }) - }) - - cy.wait(1000) - cy.get(".table-wrapper").within(() => { - cy.get(interact.TITLE).then($headers => { - expect($headers).to.have.length(7) - const headers = Array.from($headers).map(header => - header.textContent.trim() - ) - expect(removeSpacing(headers)).to.deep.eq([ - "field", - "sum", - "min", - "max", - "count", - "sumsqr", - "avg", - ]) - }) - }) - cy.get(interact.SPECTRUM_TABLE_CELL).then($values => { - let values = Array.from($values).map(header => header.textContent.trim()) - expect(values).to.deep.eq(["age", "155", "20", "49", "5", "5347", "31"]) - }) - }) - - xit("groups the view by group", () => { - cy.contains("Group by").click() - cy.get(interact.MODAL_INNER_WRAPPER).within(() => { - cy.get(interact.SPECTRUM_PICKER_LABEL).eq(0).click() - cy.contains("group").click() - cy.contains("Save").click() - }) - cy.wait(1000) - cy.contains("Students").should("be.visible") - cy.contains("Teachers").should("be.visible") - - cy.get(interact.SPECTRUM_TABLE_CELL).then($values => { - let values = Array.from($values).map(header => header.textContent.trim()) - expect(values).to.deep.eq([ - "Students", - "70", - "20", - "25", - "3", - "1650", - "23.333333333333332", - "Teachers", - "85", - "36", - "49", - "2", - "3697", - "42.5", - ]) - }) - }) - - xit("renames a view", () => { - cy.contains(interact.NAV_ITEM, "Test View") - .find(".actions .icon.open-popover") - .click({ force: true }) - cy.get(interact.SPECTRUM_MENU_ITEM_LABEL).contains("Edit").click() - cy.get(interact.MODAL_INNER_WRAPPER).within(() => { - cy.get("input").type(" Updated") - cy.contains("Save").click() - }) - cy.wait(1000) - cy.contains("Test View Updated").should("be.visible") - }) - - it("deletes a view", () => { - cy.contains(interact.NAV_ITEM, "Test View Updated") - .find(".actions .icon.open-popover") - .click({ force: true }) - cy.contains("Delete").click() - cy.contains("Delete View").click() - cy.wait(500) - cy.contains("TestView Updated").should("not.exist") - }) - }) - - function removeSpacing(headers) { - let newHeaders = [] - for (let header of headers) { - newHeaders.push(header.replace(/\s\s+/g, " ")) - } - return newHeaders - } -}) diff --git a/packages/builder/cypress/integration/customThemingProperties.spec.js b/packages/builder/cypress/integration/customThemingProperties.spec.js deleted file mode 100644 index e9de0985d0..0000000000 --- a/packages/builder/cypress/integration/customThemingProperties.spec.js +++ /dev/null @@ -1,86 +0,0 @@ -import filterTests from "../support/filterTests" - -filterTests(['all'], () => { - xcontext("Custom Theming Properties", () => { - before(() => { - cy.login() - cy.createTestApp() - cy.navigateToFrontend() - }) - - /* Default Values: - Button roundness = Large - Accent colour = Blue 600 - Accent colour (hover) = Blue 500 - Navigation bar background colour = Gray 100 - Navigation bar text colour = Gray 800 */ - it("should reset the color property values", () => { - // Open Theme modal and change colours - cy.get(".spectrum-ActionButton-label").contains("Theme").click() - cy.get(".spectrum-Picker").contains("Large").click() - .parents() - .get(".spectrum-Menu-itemLabel").contains("None").click() - changeThemeColors() - // Reset colours - cy.get(".spectrum-Button-label").contains("Reset").click({force: true}) - // Check values have reset - checkThemeColorDefaults() - }) - - /* Button Roundness Values: - None = 0 - Small = 4px - Medium = 8px - Large = 16px */ - it("should test button roundness", () => { - const buttonRoundnessValues = ["0", "4px", "8px", "16px"] - // Add button, change roundness and confirm value - cy.addComponent("Button", null).then((componentId) => { - buttonRoundnessValues.forEach(function (item, index){ - cy.get(".spectrum-ActionButton-label").contains("Theme").click() - cy.get(".setting").contains("Button roundness").parent() - .get(".select-wrapper").click() - cy.get(".spectrum-Popover").find('li').eq(index).click() - cy.get(".spectrum-Button").contains("View changes").click({force: true}) - cy.reload() - cy.getComponent(componentId) - .parents(".svelte-xiqd1c").eq(0).should('have.attr', 'style').and('contains', `--buttonBorderRadius:${item}`) - }) - }) - }) - - const changeThemeColors = () => { - // Changes the theme colours - cy.get(".spectrum-FieldLabel").contains("Accent color") - .parent().find(".container.svelte-z3cm5a").click() - .find('[title="Red 400"]').click() - cy.get(".spectrum-FieldLabel").contains("Accent color (hover)") - .parent().find(".container.svelte-z3cm5a").click() - .find('[title="Orange 400"]').click() - cy.get(".spectrum-FieldLabel").contains("Navigation bar background color") - .parent().find(".container.svelte-z3cm5a").click() - .find('[title="Yellow 400"]').click() - cy.get(".spectrum-FieldLabel").contains("Navigation bar text color") - .parent().find(".container.svelte-z3cm5a").click() - .find('[title="Green 400"]').click() - } - - const checkThemeColorDefaults = () => { - cy.get(".spectrum-FieldLabel").contains("Accent color") - .parent().find(".container.svelte-z3cm5a").click() - .get('[title="Blue 600"]').children().find('[aria-label="Checkmark"]') - cy.get(".spectrum-Dialog-grid").click() - cy.get(".spectrum-FieldLabel").contains("Accent color (hover)") - .parent().find(".container.svelte-z3cm5a").click() - .get('[title="Blue 500"]').children().find('[aria-label="Checkmark"]') - cy.get(".spectrum-Dialog-grid").click() - cy.get(".spectrum-FieldLabel").contains("Navigation bar background color") - .parent().find(".container.svelte-z3cm5a").click() - .get('[title="Gray 100"]').children().find('[aria-label="Checkmark"]') - cy.get(".spectrum-Dialog-grid").click() - cy.get(".spectrum-FieldLabel").contains("Navigation bar text color") - .parent().find(".container.svelte-z3cm5a").click() - .get('[title="Gray 800"]').children().find('[aria-label="Checkmark"]') - } - }) -}) diff --git a/packages/builder/cypress/integration/datasources/datasourceWizard.spec.js b/packages/builder/cypress/integration/datasources/datasourceWizard.spec.js deleted file mode 100644 index 837a433951..0000000000 --- a/packages/builder/cypress/integration/datasources/datasourceWizard.spec.js +++ /dev/null @@ -1,42 +0,0 @@ -import filterTests from "../../support/filterTests" - -filterTests(['all'], () => { - xcontext("Datasource Wizard", () => { - if (Cypress.env("TEST_ENV")) { - before(() => { - cy.login() - cy.createTestApp() - }) - - it("should navigate in and out of a datasource via wizard", () => { - // Select PostgreSQL and add config (without fetch) - const datasource = "Oracle" - cy.selectExternalDatasource(datasource) - cy.addDatasourceConfig(datasource, true) - - // Navigate back within datasource wizard - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button").contains("Back").click({ force: true }) - }) - - // Select PostgreSQL datasource again - cy.get(".item-list", { timeout: 1000 }).contains(datasource).click() - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button").contains("Continue").click({ force: true }) - }) - - // Fetch tables after selection - // Previously entered config should not have been saved - // Config is back to default values - // Modal will close and provide 500 error - cy.intercept('**/datasources').as('datasourceConnection') - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button").contains("Save and fetch tables").click({ force: true }) - }) - cy.wait("@datasourceConnection") - cy.get("@datasourceConnection").its('response.body') - .should('have.property', 'status', 500) - }) - } - }) -}) diff --git a/packages/builder/cypress/integration/datasources/mySql.spec.js b/packages/builder/cypress/integration/datasources/mySql.spec.js deleted file mode 100644 index 11370a9bf3..0000000000 --- a/packages/builder/cypress/integration/datasources/mySql.spec.js +++ /dev/null @@ -1,229 +0,0 @@ -import filterTests from "../../support/filterTests" - -filterTests(["all"], () => { - xcontext("MySQL Datasource Testing", () => { - if (Cypress.env("TEST_ENV")) { - before(() => { - cy.login() - cy.createTestApp() - }) - const datasource = "MySQL" - const queryName = "Cypress Test Query" - const queryRename = "CT Query Rename" - - it("Should add MySQL datasource without configuration", () => { - // Select MySQL datasource - cy.selectExternalDatasource(datasource) - // Attempt to fetch tables without applying configuration - cy.intercept("**/datasources").as("datasource") - cy.get(".spectrum-Button") - .contains("Save and fetch tables") - .click({ force: true }) - cy.wait(500) - // Intercept Request after button click & apply assertions - cy.wait("@datasource") - cy.get("@datasource") - .its("response.body") - .should( - "have.property", - "message", - "connect ECONNREFUSED 127.0.0.1:3306" - ) - cy.get("@datasource") - .its("response.body") - .should("have.property", "status", 500) - cy.get(".spectrum-Button").contains("Skip table fetch").click({ force: true }) - }) - - it("should add MySQL datasource and fetch tables", () => { - // Add & configure MySQL datasource - cy.selectExternalDatasource(datasource) - cy.intercept("**/datasources").as("datasource") - cy.addDatasourceConfig(datasource) - // Check response from datasource after adding configuration - cy.wait("@datasource") - cy.get("@datasource").its("response.statusCode").should("eq", 200) - // Confirm fetch tables was successful - cy.get(".spectrum-Table") - .eq(0) - .find(".spectrum-Table-row") - .its("length") - .should("be.gt", 0) - }) - - it("should check table fetching error", () => { - // MySQL test datasource contains tables without primary keys - cy.get(".spectrum-InLineAlert") - .should("contain", "Error fetching tables") - .and("contain", "No primary key constraint found") - }) - - it("should define a One relationship type", () => { - // Select relationship type & configure - cy.get(".spectrum-Button") - .contains("Define relationship") - .click({ force: true }) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Picker").eq(0).click() - cy.get(".spectrum-Popover").contains("One").click() - cy.get(".spectrum-Picker").eq(1).click() - cy.get(".spectrum-Popover").contains("REGIONS").click() - cy.get(".spectrum-Picker").eq(2).click() - cy.get(".spectrum-Popover").contains("REGION_ID").click() - cy.get(".spectrum-Picker").eq(3).click() - cy.get(".spectrum-Popover").contains("COUNTRIES").click() - cy.get(".spectrum-Picker").eq(4).click() - cy.get(".spectrum-Popover").contains("REGION_ID").click() - }) - // Save relationship & reload page - cy.get(".spectrum-ButtonGroup").within(() => { - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - }) - cy.reload() - - // Confirm table length & column name - cy.get(".spectrum-Table") - .eq(1) - .find(".spectrum-Table-row") - .its("length") - .should("eq", 1) - cy.get(".spectrum-Table-cell").should("contain", "COUNTRIES to REGIONS") - }) - - it("should define a Many relationship type", () => { - // Select relationship type & configure - cy.get(".spectrum-Button") - .contains("Define relationship") - .click({ force: true }) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Picker").eq(0).click() - cy.get(".spectrum-Popover").contains("Many").click() - cy.get(".spectrum-Picker").eq(1).click() - cy.get(".spectrum-Popover").contains("LOCATIONS").click() - cy.get(".spectrum-Picker").eq(2).click() - cy.get(".spectrum-Popover").contains("REGIONS").click() - cy.get(".spectrum-Picker").eq(3).click() - cy.get(".spectrum-Popover").contains("COUNTRIES").click() - cy.get(".spectrum-Picker").eq(4).click() - cy.get(".spectrum-Popover").contains("COUNTRY_ID").click() - cy.get(".spectrum-Picker").eq(5).click() - cy.get(".spectrum-Popover").contains("REGION_ID").click() - // Save relationship & reload page - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - cy.reload() - cy.wait(1000) - }) - // Confirm table length & relationship name - cy.get(".spectrum-Table", { timeout: 1000 }) - .eq(1) - .find(".spectrum-Table-row") - .its("length") - .should("eq", 2) - cy.get(".spectrum-Table-cell").should( - "contain", - "LOCATIONS through COUNTRIES → REGIONS" - ) - }) - - it("should delete relationships", () => { - // Delete both relationships - cy.get(".spectrum-Table") - .eq(1) - .find(".spectrum-Table-row") - .its("length") - .then(len => { - for (let i = 0; i < len; i++) { - cy.get(".spectrum-Table") - .eq(1) - .within(() => { - cy.get(".spectrum-Table-cell").eq(0).click({ force: true }) - }) - cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => { - cy.get(".spectrum-Button") - .contains("Delete") - .click({ force: true }) - }) - cy.reload() - cy.wait(500) - } - // Confirm relationships no longer exist - cy.get(".spectrum-Body").should( - "contain", - "No relationships configured" - ) - }) - }) - - it("should add a query", () => { - // Add query - cy.get(".spectrum-Button").contains("Add query").click({ force: true }) - cy.get(".spectrum-Form-item") - .eq(0) - .within(() => { - cy.get("input").type(queryName) - }) - // Insert Query within Fields section - cy.get(".CodeMirror textarea") - .eq(0) - .type("SELECT * FROM books", { force: true }) - // Intercept query execution - cy.intercept("**/queries/preview").as("query") - cy.get(".spectrum-Button").contains("Run Query").click({ force: true }) - cy.wait(500) - cy.wait("@query") - // Assert against Status Code & Body - cy.get("@query").its("response.statusCode").should("eq", 200) - cy.get("@query").its("response.body").should("not.be.empty") - // Save query - cy.intercept("POST", "**/queries").as("saveQuery") - cy.get(".spectrum-Button").contains("Save Query").click({ force: true }) - cy.wait("@saveQuery") - cy.get("@saveQuery").its("response.statusCode").should("eq", 200) - cy.get(".nav-item").should("contain", queryName) - }) - - it("should duplicate a query", () => { - /// Get query nav item - QueryName - cy.get(".nav-item") - .contains(queryName) - .parent() - .within(() => { - cy.get(".spectrum-Icon").eq(1).click({ force: true }) - }) - // Select and confirm duplication - cy.get(".spectrum-Menu").contains("Duplicate").click() - cy.get(".nav-item").should("contain", queryName + " (1)") - }) - - it("should edit a query name", () => { - // Rename query - cy.get(".spectrum-Form-item") - .eq(0) - .within(() => { - cy.get("input").clear().type(queryRename) - }) - // Click on a nav item - cy.get(".nav-item").first().click() - // Confirm name change - cy.get(".nav-item").should("contain", queryRename) - }) - - it("should delete a query", () => { - // Get query nav item - QueryName - cy.get(".nav-item") - .contains(queryRename) - .parent() - .within(() => { - cy.get(".spectrum-Icon").eq(1).click({ force: true }) - }) - // Select Delete - cy.get(".spectrum-Menu").contains("Delete").click() - cy.get(".spectrum-Button") - .contains("Delete Query") - .click({ force: true }) - // Confirm deletion - cy.get(".nav-item", { timeout: 1000 }).should("not.contain", queryRename) - }) - } - }) -}) diff --git a/packages/builder/cypress/integration/datasources/oracle.spec.js b/packages/builder/cypress/integration/datasources/oracle.spec.js deleted file mode 100644 index ae1ca5cd75..0000000000 --- a/packages/builder/cypress/integration/datasources/oracle.spec.js +++ /dev/null @@ -1,229 +0,0 @@ -import filterTests from "../../support/filterTests" - -filterTests(["all"], () => { - xcontext("Oracle Datasource Testing", () => { - if (Cypress.env("TEST_ENV")) { - before(() => { - cy.login() - cy.createTestApp() - }) - const datasource = "Oracle" - const queryName = "Cypress Test Query" - const queryRename = "CT Query Rename" - - it("Should add Oracle datasource and skip table fetch", () => { - // Select Oracle datasource - cy.selectExternalDatasource(datasource) - // Skip table fetch - no config added - cy.get(".spectrum-Button") - .contains("Skip table fetch") - .click({ force: true }) - cy.wait(500) - // Confirm config contains localhost - cy.get(".spectrum-Textfield-input", { timeout: 500 }) - .eq(1) - .should("have.value", "localhost") - // Add another Oracle datasource, configure & skip table fetch - cy.selectExternalDatasource(datasource) - cy.addDatasourceConfig(datasource, true) - // Confirm config and no tables - cy.get(".spectrum-Textfield-input") - .eq(1) - .should("have.value", Cypress.env("oracle").HOST) - cy.get(".spectrum-Body").eq(2).should("contain", "No tables found.") - }) - - it("Should add Oracle datasource and fetch tables without configuration", () => { - // Select Oracle datasource - cy.selectExternalDatasource(datasource) - // Attempt to fetch tables without applying configuration - cy.intercept("**/datasources").as("datasource") - cy.get(".spectrum-Button") - .contains("Save and fetch tables") - .click({ force: true }) - // Intercept Request after button click & apply assertions - cy.wait("@datasource") - cy.get("@datasource") - .its("response.body") - .should("have.property", "status", 500) - cy.get(".spectrum-Button").contains("Skip table fetch").click({ force: true }) - }) - - xit("should add Oracle datasource and fetch tables", () => { - // Add & configure Oracle datasource - cy.selectExternalDatasource(datasource) - cy.intercept("**/datasources").as("datasource") - cy.addDatasourceConfig(datasource) - // Check response from datasource after adding configuration - cy.wait("@datasource") - cy.get("@datasource").its("response.statusCode").should("eq", 200) - // Confirm fetch tables was successful - cy.get(".spectrum-Table") - .eq(0) - .find(".spectrum-Table-row") - .its("length") - .should("be.gt", 0) - }) - - xit("should define a One relationship type", () => { - // Select relationship type & configure - cy.get(".spectrum-Button") - .contains("Define relationship") - .click({ force: true }) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Picker").eq(0).click() - cy.get(".spectrum-Popover").contains("One").click() - cy.get(".spectrum-Picker").eq(1).click() - cy.get(".spectrum-Popover").contains("REGIONS").click() - cy.get(".spectrum-Picker").eq(2).click() - cy.get(".spectrum-Popover").contains("REGION_ID").click() - cy.get(".spectrum-Picker").eq(3).click() - cy.get(".spectrum-Popover").contains("COUNTRIES").click() - cy.get(".spectrum-Picker").eq(4).click() - cy.get(".spectrum-Popover").contains("REGION_ID").click() - // Save relationship & reload page - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - cy.reload() - }) - // Confirm table length & column name - cy.get(".spectrum-Table") - .eq(1) - .find(".spectrum-Table-row") - .its("length") - .should("eq", 1) - cy.get(".spectrum-Table-cell").should("contain", "COUNTRIES to REGIONS") - }) - - xit("should define a Many relationship type", () => { - // Select relationship type & configure - cy.get(".spectrum-Button") - .contains("Define relationship") - .click({ force: true }) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Picker").eq(0).click() - cy.get(".spectrum-Popover").contains("Many").click() - cy.get(".spectrum-Picker").eq(1).click() - cy.get(".spectrum-Popover").contains("LOCATIONS").click() - cy.get(".spectrum-Picker").eq(2).click() - cy.get(".spectrum-Popover").contains("REGIONS").click() - cy.get(".spectrum-Picker").eq(3).click() - cy.get(".spectrum-Popover").contains("COUNTRIES").click() - cy.get(".spectrum-Picker").eq(4).click() - cy.get(".spectrum-Popover").contains("COUNTRY_ID").click() - cy.get(".spectrum-Picker").eq(5).click() - cy.get(".spectrum-Popover").contains("REGION_ID").click() - // Save relationship & reload page - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - cy.reload() - }) - // Confirm table length & relationship name - cy.get(".spectrum-Table") - .eq(1) - .find(".spectrum-Table-row") - .its("length") - .should("eq", 2) - cy.get(".spectrum-Table-cell").should( - "contain", - "LOCATIONS through COUNTRIES → REGIONS" - ) - }) - - xit("should delete relationships", () => { - // Delete both relationships - cy.get(".spectrum-Table") - .eq(1) - .find(".spectrum-Table-row") - .its("length") - .then(len => { - for (let i = 0; i < len; i++) { - cy.get(".spectrum-Table") - .eq(1) - .within(() => { - cy.get(".spectrum-Table-row").eq(0).click() - }) - cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => { - cy.get(".spectrum-Button") - .contains("Delete") - .click({ force: true }) - }) - cy.reload() - } - // Confirm relationships no longer exist - cy.get(".spectrum-Body").should( - "contain", - "No relationships configured" - ) - }) - }) - - xit("should add a query", () => { - // Add query - cy.get(".spectrum-Button").contains("Add query").click({ force: true }) - cy.get(".spectrum-Form-item") - .eq(0) - .within(() => { - cy.get("input").type(queryName) - }) - // Insert Query within Fields section - cy.get(".CodeMirror textarea") - .eq(0) - .type("SELECT * FROM JOBS", { force: true }) - // Intercept query execution - cy.intercept("**/queries/preview").as("query") - cy.get(".spectrum-Button").contains("Run Query").click({ force: true }) - cy.wait(500) - cy.wait("@query") - // Assert against Status Code & Body - cy.get("@query").its("response.statusCode").should("eq", 200) - cy.get("@query").its("response.body").should("not.be.empty") - // Save query - cy.get(".spectrum-Button").contains("Save Query").click({ force: true }) - cy.get(".nav-item").should("contain", queryName) - }) - - xit("should duplicate a query", () => { - // Get query nav item - cy.get(".nav-item") - .contains(queryName) - .parent() - .within(() => { - cy.get(".spectrum-Icon").eq(1).click({ force: true }) - }) - // Select and confirm duplication - cy.get(".spectrum-Menu").contains("Duplicate").click() - cy.get(".nav-item").should("contain", queryName + " (1)") - }) - - xit("should edit a query name", () => { - // Rename query - cy.get(".spectrum-Form-item") - .eq(0) - .within(() => { - cy.get("input").clear().type(queryRename) - }) - // Save query - cy.get(".spectrum-Button").contains("Save Query").click({ force: true }) - cy.get(".nav-item").should("contain", queryRename) - }) - - xit("should delete a query", () => { - // Get query nav item - QueryName - cy.get(".nav-item") - .contains(queryName) - .parent() - .within(() => { - cy.get(".spectrum-Icon").eq(1).click({ force: true }) - }) - - // Select Delete - cy.get(".spectrum-Menu").contains("Delete").click() - cy.get(".spectrum-Button") - .contains("Delete Query") - .click({ force: true }) - - // Confirm deletion - cy.get(".nav-item", { timeout: 1000 }).should("not.contain", queryName) - }) - } - }) -}) diff --git a/packages/builder/cypress/integration/datasources/postgreSql.spec.js b/packages/builder/cypress/integration/datasources/postgreSql.spec.js deleted file mode 100644 index e1aa0ff128..0000000000 --- a/packages/builder/cypress/integration/datasources/postgreSql.spec.js +++ /dev/null @@ -1,283 +0,0 @@ -import filterTests from "../../support/filterTests" - -filterTests(["all"], () => { - xcontext("PostgreSQL Datasource Testing", () => { - if (Cypress.env("TEST_ENV")) { - before(() => { - cy.login() - cy.createTestApp() - }) - const datasource = "PostgreSQL" - const queryName = "Cypress Test Query" - const queryRename = "CT Query Rename" - - xit("Should add PostgreSQL datasource without configuration", () => { - // Select PostgreSQL datasource - cy.selectExternalDatasource(datasource) - // Attempt to fetch tables without applying configuration - cy.intercept("**/datasources").as("datasource") - cy.get(".spectrum-Button") - .contains("Save and fetch tables") - .click({ force: true }) - // Intercept Request after button click & apply assertions - cy.wait("@datasource") - cy.get("@datasource") - .its("response.body") - .should("have.property", "status", 500) - cy.get(".spectrum-Button").contains("Skip table fetch").click({ force: true }) - }) - - it("should add PostgreSQL datasource and fetch tables", () => { - // Add & configure PostgreSQL datasource - cy.selectExternalDatasource(datasource) - cy.intercept("**/datasources").as("datasource") - cy.addDatasourceConfig(datasource) - // Check response from datasource after adding configuration - cy.wait("@datasource") - cy.get("@datasource").its("response.statusCode").should("eq", 200) - cy.wait(2000) - // Confirm fetch tables was successful - cy.get(".spectrum-Table") - .eq(0) - .find(".spectrum-Table-row") - .its("length") - .should("be.gt", 0) - }) - - it("should define a One relationship type", () => { - // Select relationship type & configure - cy.get(".spectrum-Button") - .contains("Define relationship") - .click({ force: true }) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Picker").eq(0).click() - cy.get(".spectrum-Popover").contains("One").click() - cy.get(".spectrum-Picker").eq(1).click() - cy.get(".spectrum-Popover").contains("REGIONS").click() - cy.get(".spectrum-Picker").eq(2).click() - cy.get(".spectrum-Popover").contains("REGION_ID").click() - cy.get(".spectrum-Picker").eq(3).click() - cy.get(".spectrum-Popover").contains("COUNTRIES").click() - cy.get(".spectrum-Picker").eq(4).click() - cy.get(".spectrum-Popover").contains("REGION_ID").click() - // Save relationship & reload page - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - cy.reload() - }) - // Confirm table length & column name - cy.get(".spectrum-Table") - .eq(1) - .find(".spectrum-Table-row") - .its("length") - .should("eq", 1) - cy.get(".spectrum-Table-cell").should("contain", "COUNTRIES to REGIONS") - }) - - it("should define a Many relationship type", () => { - // Select relationship type & configure - cy.get(".spectrum-Button") - .contains("Define relationship") - .click({ force: true }) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Picker").eq(0).click() - cy.get(".spectrum-Popover").contains("Many").click() - cy.get(".spectrum-Picker").eq(1).click() - cy.get(".spectrum-Popover").contains("LOCATIONS").click() - cy.get(".spectrum-Picker").eq(2).click() - cy.get(".spectrum-Popover").contains("REGIONS").click() - cy.get(".spectrum-Picker").eq(3).click() - cy.get(".spectrum-Popover").contains("COUNTRIES").click() - cy.get(".spectrum-Picker").eq(4).click() - cy.get(".spectrum-Popover").contains("COUNTRY_ID").click() - cy.get(".spectrum-Picker").eq(5).click() - cy.get(".spectrum-Popover").contains("REGION_ID").click() - // Save relationship & reload page - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - cy.reload() - }) - // Confirm table length & relationship name - cy.get(".spectrum-Table") - .eq(1) - .find(".spectrum-Table-row") - .its("length") - .should("eq", 2) - cy.get(".spectrum-Table-cell").should( - "contain", - "LOCATIONS through COUNTRIES → REGIONS" - ) - }) - - it("should delete a relationship", () => { - cy.get(".hierarchy-items-container").contains("PostgreSQL").click({ force: true }) - cy.reload() - // Delete one relationship - cy.get(".spectrum-Table") - .eq(1) - .within(() => { - cy.get(".spectrum-Table-cell").eq(0).click({ force: true }) - }) - cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => { - cy.get(".spectrum-Button").contains("Delete").click({ force: true }) - }) - cy.reload() - cy.wait(500) - // Confirm relationship was deleted - cy.get(".spectrum-Table") - .eq(1) - .find(".spectrum-Table-row") - .its("length") - .should("eq", 1) - }) - - it("should add a query", () => { - // Add query - cy.get(".spectrum-Button").contains("Add query").click({ force: true }) - cy.get(".spectrum-Form-item") - .eq(0) - .within(() => { - cy.get("input").type(queryName) - }) - // Insert Query within Fields section - cy.get(".CodeMirror textarea") - .eq(0) - .type("SELECT * FROM books", { force: true }) - // Intercept query execution - cy.intercept("**/queries/preview").as("query") - cy.get(".spectrum-Button").contains("Run Query").click({ force: true }) - cy.wait(500) - cy.wait("@query") - // Assert against Status Code & Body - cy.get("@query").its("response.statusCode").should("eq", 200) - cy.get("@query").its("response.body").should("not.be.empty") - // Save query - cy.intercept("**/queries").as("saveQuery") - cy.get(".spectrum-Button").contains("Save Query").click({ force: true }) - cy.wait("@saveQuery") - cy.get(".spectrum-Tabs-content", { timeout: 2000 }).should("contain", queryName) - }) - - it("should switch to schema with no tables", () => { - // Switch Schema - To one without any tables - cy.get(".hierarchy-items-container").contains("PostgreSQL").click({ force: true }) - switchSchema("randomText") - - // No tables displayed - cy.get(".spectrum-Body", { timeout: 10000 }).eq(2, { timeout: 10000 }).should("contain", "No tables found") - - // Previously created query should be visible - cy.get(".spectrum-Table").should("contain", queryName) - }) - - it("should switch schemas", () => { - // Switch schema - To one with tables - switchSchema("1") - - // Confirm tables exist - Check for specific one - cy.get(".spectrum-Table", { timeout: 20000 }).eq(0).should("contain", "test") - cy.get(".spectrum-Table") - .eq(0) - .find(".spectrum-Table-row") - .its("length") - .should("eq", 1) - - // Confirm specific table visible within left nav bar - cy.get(".hierarchy-items-container").should("contain", "test") - - // Switch back to public schema - switchSchema("public") - - // Confirm tables exist - again - cy.get(".spectrum-Table", { timeout: 20000 }).eq(0).should("contain", "REGIONS") - cy.get(".spectrum-Table") - .eq(0) - .find(".spectrum-Table-row") - .its("length") - .should("be.gt", 1) - - // Confirm specific table visible within left nav bar - cy.get(".hierarchy-items-container").should("contain", "REGIONS") - - // No relationships and one query - cy.get(".spectrum-Body") - .eq(3) - .should("contain", "No relationships configured.") - cy.get(".spectrum-Table").eq(1).should("contain", queryName) - }) - - it("should duplicate a query", () => { - // Locate previously created query - cy.get(".nav-item") - .contains(queryName) - .siblings(".actions") - .within(() => { - cy.get(".spectrum-Icon").click({ force: true }) - }) - // Select and confirm duplication - cy.get(".spectrum-Menu").contains("Duplicate").click() - cy.get(".nav-item").should("contain", queryName + " (1)") - }) - - it("should edit a query name", () => { - // Access query - cy.get(".hierarchy-items-container", { timeout: 2000 }) - //.contains(queryName + " (1)") - .contains(queryName) - .click({ force: true }) - - // Rename query - cy.wait(1000) - cy.get(".spectrum-Form-item", { timeout: 2000 }) - .eq(0) - .within(() => { - cy.get("input").clear().type(queryRename) - }) - - // Click on a nav item and confirm name change - cy.get(".nav-item").first().click() - // Confirm name change - cy.get(".nav-item").should("contain", queryRename) - }) - - it("should delete a query", () => { - // Get query nav item - QueryName - cy.get(".nav-item") - .contains(queryRename) - .parent() - .within(() => { - cy.get(".spectrum-Icon").eq(1).click({ force: true }) - }) - // Select Delete - cy.get(".spectrum-Menu").contains("Delete").click() - cy.get(".spectrum-Button") - .contains("Delete Query") - .click({ force: true }) - // Confirm deletion - cy.reload() - cy.get(".nav-item", { timeout: 30000 }).contains(datasource).click({ force: true }) - cy.get(".nav-item", { timeout: 1000 }).should("not.contain", queryRename) - }) - - const switchSchema = schema => { - // Edit configuration - Change Schema - cy.get(".spectrum-Textfield") - .eq(6) - .within(() => { - cy.get("input").clear().type(schema) - }) - // Save configuration & fetch - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - cy.get(".spectrum-Button") - .contains("Fetch tables") - .click({ force: true }) - // Click fetch tables again within modal - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button") - .contains("Fetch tables") - .click({ force: true }) - }) - cy.reload() - cy.wait(1000) - } - } - }) -}) diff --git a/packages/builder/cypress/integration/datasources/rest.spec.js b/packages/builder/cypress/integration/datasources/rest.spec.js deleted file mode 100644 index 7f715ae50c..0000000000 --- a/packages/builder/cypress/integration/datasources/rest.spec.js +++ /dev/null @@ -1,45 +0,0 @@ -import filterTests from "../../support/filterTests" - -filterTests(["smoke", "all"], () => { - xcontext("REST Datasource Testing", () => { - before(() => { - cy.login() - cy.createTestApp() - }) - - const datasource = "REST" - const restUrl = "https://api.openbrewerydb.org/breweries" - - it("Should add REST datasource with incorrect API", () => { - // Select REST datasource - cy.selectExternalDatasource(datasource) - // Enter incorrect api & attempt to send query - cy.get(".query-buttons", { timeout: 1000 }).contains("Add query").click({ force: true }) - cy.intercept("**/preview").as("queryError") - cy.get("input").clear().type("random text") - cy.get(".spectrum-Button").contains("Send").click({ force: true }) - // Intercept Request after button click & apply assertions - cy.wait("@queryError") - cy.get("@queryError") - .its("response.body") - .should("have.property", "message", "Invalid URL: http://random text") - cy.get("@queryError") - .its("response.body") - .should("have.property", "status", 400) - }) - - it("should add and configure a REST datasource", () => { - // Select REST datasource and create query - cy.selectExternalDatasource(datasource) - cy.wait(500) - // createRestQuery confirms query creation - cy.createRestQuery("GET", restUrl, "/breweries") - // Confirm status code response within REST datasource - cy.get(".stats", { timeout: 1000 }).within(() => { - cy.get(".spectrum-FieldLabel") - .eq(0) - .should("contain", 200) - }) - }) - }) -}) diff --git a/packages/builder/cypress/integration/queryLevelTransformers.spec.js b/packages/builder/cypress/integration/queryLevelTransformers.spec.js deleted file mode 100644 index 7357bbe905..0000000000 --- a/packages/builder/cypress/integration/queryLevelTransformers.spec.js +++ /dev/null @@ -1,147 +0,0 @@ -import filterTests from "../support/filterTests" -const interact = require("../support/interact") - -filterTests(["smoke", "all"], () => { - context("Query Level Transformers", () => { - before(() => { - cy.login() - cy.createTestApp() - }) - - it("should write a transformer function", () => { - // Add REST datasource - contains API for breweries - const datasource = "REST" - const restUrl = "https://api.openbrewerydb.org/breweries" - cy.selectExternalDatasource(datasource) - cy.createRestQuery("GET", restUrl, "breweries") - cy.reload() - cy.contains(".nav-item-content", "breweries", { timeout: 20000 }).click() - cy.contains(interact.SPECTRUM_TABS_ITEM, "Transformer", { timeout: 5000 }).click({ force: true }) - // Get Transformer Function from file - cy.readFile("cypress/support/queryLevelTransformerFunction.js").then( - transformerFunction => { - cy.get(interact.CODEMIRROR_TEXTAREA, { timeout: 5000 }) - // Highlight current text and overwrite with file contents - .type(Cypress.platform === "darwin" ? "{cmd}a" : "{ctrl}a", { - force: true, - }) - .type(transformerFunction, { parseSpecialCharSequences: false }) - } - ) - // Send Query - cy.intercept("**/queries/preview").as("query") - cy.get(interact.SPECTRUM_BUTTON).contains("Save").click({ force: true }) - cy.get(interact.SPECTRUM_BUTTON).contains("Send").click({ force: true }) - cy.wait("@query") - // Assert against Status Code, body, & body rows - cy.get("@query").its("response.statusCode").should("eq", 200) - cy.get("@query").its("response.body").should("not.be.empty") - cy.get("@query").its("response.body.rows").should("not.be.empty") - }) - - it("should add data to the previous query", () => { - // Add REST datasource - contains API for breweries - const datasource = "REST" - const restUrl = "https://api.openbrewerydb.org/breweries" - cy.selectExternalDatasource(datasource) - cy.createRestQuery("GET", restUrl, "breweries") - cy.reload() - cy.contains(".nav-item-content", "breweries", { timeout: 2000 }).click() - cy.contains(interact.SPECTRUM_TABS_ITEM, "Transformer", { timeout: 5000 }).click({ force: true }) - // Get Transformer Function with Data from file - cy.readFile( - "cypress/support/queryLevelTransformerFunctionWithData.js" - ).then(transformerFunction => { - //console.log(transformerFunction[1]) - cy.get(interact.CODEMIRROR_TEXTAREA) - // Highlight current text and overwrite with file contents - .type(Cypress.platform === "darwin" ? "{cmd}a" : "{ctrl}a", { - force: true, - }) - .type(transformerFunction, { parseSpecialCharSequences: false }) - }) - // Send Query - cy.intercept("**/queries/preview").as("query") - cy.get(interact.SPECTRUM_BUTTON).contains("Send").click({ force: true }) - cy.wait("@query") - // Assert against Status Code, body, & body rows - cy.get("@query").its("response.statusCode").should("eq", 200) - cy.get("@query").its("response.body").should("not.be.empty") - cy.get("@query").its("response.body.rows").should("not.be.empty") - }) - - it("should run an invalid query within the transformer section", () => { - // Add REST datasource - contains API for breweries - const datasource = "REST" - const restUrl = "https://api.openbrewerydb.org/breweries" - cy.selectExternalDatasource(datasource) - cy.createRestQuery("GET", restUrl, "breweries") - cy.reload() - cy.contains(".nav-item-content", "breweries", { timeout: 10000 }).click() - cy.contains(interact.SPECTRUM_TABS_ITEM, "Transformer", { timeout: 5000 }).click({ force: true }) - // Clear the code box and add "test" - cy.get(interact.CODEMIRROR_TEXTAREA) - .type(Cypress.platform === "darwin" ? "{cmd}a" : "{ctrl}a", { - force: true, - }) - .type("test") - // Run Query and intercept - cy.intercept("**/preview").as("queryError") - cy.get(interact.SPECTRUM_BUTTON).contains("Send").click({ force: true }) - cy.wait("@queryError") - cy.wait(500) - // Assert against message and status for the query error - cy.get("@queryError") - .its("response.body") - .should("have.property", "message", "test is not defined") - cy.get("@queryError") - .its("response.body") - .should("have.property", "status", 400) - }) - - xit("should run an invalid query via POST request", () => { - // POST request with transformer as null - cy.request({ - method: "POST", - url: `${Cypress.config().baseUrl}/api/queries/`, - body: { - fields: { headers: {}, queryString: null, path: null }, - parameters: [], - schema: {}, - name: "test", - queryVerb: "read", - transformer: null, - datasourceId: "test", - }, - // Expected 400 error - Transformer must be a string - failOnStatusCode: false, - }).then(response => { - expect(response.status).to.equal(400) - expect(response.body.message).to.include( - 'Invalid body - "transformer" must be a string' - ) - }) - }) - - xit("should run an empty query", () => { - // POST request with Transformer as an empty string - cy.request({ - method: "POST", - url: `${Cypress.config().baseUrl}/api/queries/preview`, - body: { - fields: { headers: {}, queryString: null, path: null }, - queryVerb: "read", - transformer: "", - datasourceId: "test", - }, - // Expected 400 error - Transformer is not allowed to be empty - failOnStatusCode: false, - }).then(response => { - expect(response.status).to.equal(400) - expect(response.body.message).to.include( - 'Invalid body - "transformer" is not allowed to be empty' - ) - }) - }) - }) -}) diff --git a/packages/builder/cypress/integration/renameAnApplication.spec.js b/packages/builder/cypress/integration/renameAnApplication.spec.js deleted file mode 100644 index 6e432e476b..0000000000 --- a/packages/builder/cypress/integration/renameAnApplication.spec.js +++ /dev/null @@ -1,112 +0,0 @@ -import filterTests from "../support/filterTests" -const interact = require("../support/interact") - -filterTests(["all"], () => { - xcontext("Rename an App", () => { - beforeEach(() => { - cy.login() - cy.createTestApp() - }) - - it("should rename an unpublished application", () => { - const appName = "Cypress Tests" - const appRename = "Cypress Renamed" - // Rename app, Search for app, Confirm name was changed - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - renameApp(appName, appRename) - cy.reload() - cy.searchForApplication(appRename) - cy.get(interact.APP_TABLE).find(interact.TITLE).should("have.length", 1) - cy.applicationInAppTable(appRename) - // Set app name back to Cypress Tests - cy.reload() - renameApp(appRename, appName) - }) - - xit("Should rename a published application", () => { - // It is not possible to rename a published application - const appName = "Cypress Tests" - const appRename = "Cypress Renamed" - // Publish the app - cy.get(interact.TOP_RIGHT_NAV) - cy.get(interact.SPECTRUM_BUTTON) - .contains("Publish") - .click({ force: true }) - cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => { - // Click publish again within the modal - cy.get(interact.SPECTRUM_BUTTON) - .contains("Publish") - .click({ force: true }) - }) - // Rename app, Search for app, Confirm name was changed - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - renameApp(appName, appRename, true) - cy.get(interact.APP_TABLE).find(interact.WRAPPER).should("have.length", 1) - cy.applicationInAppTable(appRename) - }) - - it("Should try to rename an application to have no name", () => { - const appName = "Cypress Tests" - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - renameApp(appName, " ", false, true) - // Close modal and confirm name has not been changed - cy.get(interact.SPECTRUM_DIALOG_GRID, { timeout: 1000 }).contains("Cancel").click() - cy.applicationInAppTable(appName) - }) - - xit("Should create two applications with the same name", () => { - // It is not possible to have applications with the same name - const appName = "Cypress Tests" - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - cy.get(interact.SPECTRUM_BUTTON), { timeout: 500 } - .contains("Create app") - .click({ force: true }) - cy.contains(/Start from scratch/).click() - cy.get(interact.SPECTRUM_MODAL).within(() => { - cy.get("input").eq(0).type(appName) - cy.get(interact.SPECTRUM_BUTTON_GROUP) - .contains("Create app") - .click({ force: true }) - cy.get(interact.ERROR).should( - "have.text", - "Another app with the same name already exists" - ) - }) - }) - - it("should validate application names", () => { - // App name must be letters, numbers and spaces only - // This test checks numbers and special characters specifically - const appName = "Cypress Tests" - const numberName = 12345 - const specialCharName = "£$%^" - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - renameApp(appName, numberName) - cy.applicationInAppTable(numberName) - renameApp(numberName, specialCharName) - cy.get(interact.ERROR).should( - "have.text", - "App name must be letters, numbers and spaces only" - ) - // Set app name back to Cypress Tests - renameApp(numberName, appName) - }) - - const renameApp = (originalName, changedName, published, noName) => { - cy.searchForApplication(originalName) - cy.get(interact.APP_TABLE, { timeout: 1000 }).within(() => { - cy.get(".app-row-actions button") - .contains("Manage") - .eq(0) - .click({ force: true }) - }) - cy.get(".spectrum-Tabs-item").contains("Settings").click() - cy.get(".spectrum-Tabs-item.is-selected").contains("Settings") - cy.get(".settings-tab").should("be.visible") - cy.get(".details-section .page-action button") - .contains("Edit") - .click({ force: true }) - cy.updateAppName(changedName, noName) - } - }) -}) diff --git a/packages/builder/cypress/integration/revertApp.spec.js b/packages/builder/cypress/integration/revertApp.spec.js deleted file mode 100644 index 2cd806b02c..0000000000 --- a/packages/builder/cypress/integration/revertApp.spec.js +++ /dev/null @@ -1,75 +0,0 @@ -import filterTests from "../support/filterTests" -const interact = require('../support/interact') - -filterTests(['smoke', 'all'], () => { - xcontext("Revert apps", () => { - before(() => { - cy.login() - cy.createTestApp() - }) - - it("should try to revert an unpublished app", () => { - // Click revert icon - cy.get(interact.TOP_RIGHT_NAV).within(() => { - cy.get(interact.AREA_LABEL_REVERT).click({ force: true }) - }) - cy.get(interact.SPECTRUM_MODAL).within(() => { - // Enter app name before revert - cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).type("Cypress Tests") - cy.intercept('**/revert').as('revertApp') - // Click Revert - cy.get(interact.SPECTRUM_BUTTON).contains("Revert").click({ force: true }) - // Intercept Request after button click & apply assertions - cy.wait("@revertApp") - cy.get("@revertApp").its('response.body').should('have.property', 'message', "App has not yet been deployed") - cy.get("@revertApp").its('response.body').should('have.property', 'status', 400) - }) - }) - - it("should revert a published app", () => { - cy.navigateToFrontend() - - // Add initial component - Paragraph - cy.searchAndAddComponent("Paragraph") - // Publish app - cy.get(interact.SPECTRUM_BUTTON).contains("Publish").click({ force: true }) - cy.get(interact.SPECTRUM_BUTTON_GROUP).within(() => { - cy.get(interact.SPECTRUM_BUTTON).contains("Publish").click({ force: true }) - }) - cy.wait(1000) // Wait for next modal to finish loading - cy.get(interact.SPECTRUM_BUTTON_GROUP, { timeout: 1000 }).within(() => { - cy.get(interact.SPECTRUM_BUTTON).contains("Done").click({ force: true }) - }) - - // Add second component - Button - cy.searchAndAddComponent("Button") - // Click Revert - cy.get(interact.TOP_RIGHT_NAV).within(() => { - cy.get(interact.AREA_LABEL_REVERT).click({ force: true }) - }) - cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => { - cy.get("input").type("Cypress Tests") - // Click Revert - cy.get(interact.SPECTRUM_BUTTON).contains("Revert").click({ force: true }) - cy.wait(2000) // Wait for app to finish reverting - }) - // Confirm Paragraph component is still visible - cy.get(interact.ROOT, { timeout: 1000 }).contains("New Paragraph") - // Confirm Button component is not visible - cy.get(interact.ROOT, { timeout: 1000 }).should("not.have.text", "New Button") - }) - - it("should enter incorrect app name when reverting", () => { - // Click Revert - cy.get(interact.TOP_RIGHT_NAV, { timeout: 1000 }).within(() => { - cy.get(interact.AREA_LABEL_REVERT).click({ force: true }) - }) - // Enter incorrect app name - cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => { - cy.get("input").type("Cypress Tests") - // Revert button within modal should be disabled - cy.get(interact.SPECTRUM_BUTTON).eq(1).should('be.disabled') - }) - }) - }) -}) diff --git a/packages/builder/cypress/plugins/index.js b/packages/builder/cypress/plugins/index.js deleted file mode 100644 index 771ba886b5..0000000000 --- a/packages/builder/cypress/plugins/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/// -// *********************************************************** -// This example plugins/index.js can be used to load plugins -// -// You can change the location of this file or turn off loading -// the plugins file with the 'pluginsFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/plugins-guide -// *********************************************************** - -// This function is called when a project is opened or re-opened (e.g. due to -// the project's config changing) - -/** - * @type {Cypress.PluginConfig} - */ -// eslint-disable-next-line no-unused-vars -module.exports = (on, config) => { - // `on` is used to hook into various events Cypress emits - // `config` is the resolved Cypress config - require("cypress-terminal-report/src/installLogsPrinter")(on) -} diff --git a/packages/builder/cypress/setup.js b/packages/builder/cypress/setup.js deleted file mode 100644 index 0e2f25b028..0000000000 --- a/packages/builder/cypress/setup.js +++ /dev/null @@ -1,45 +0,0 @@ -const cypressConfig = require("../cypress.json") - -// normal development system -const SERVER_PORT = cypressConfig.env.PORT -const WORKER_PORT = cypressConfig.env.WORKER_PORT - -if (!process.env.NODE_ENV) { - process.env.NODE_ENV = "cypress" -} -process.env.ENABLE_ANALYTICS = "0" -process.env.JWT_SECRET = cypressConfig.env.JWT_SECRET -process.env.SELF_HOSTED = 1 -process.env.WORKER_URL = `http://localhost:${WORKER_PORT}/` -process.env.APPS_URL = `http://localhost:${SERVER_PORT}/` -process.env.MINIO_URL = `http://localhost:4004` -process.env.MINIO_ACCESS_KEY = "budibase" -process.env.MINIO_SECRET_KEY = "budibase" -process.env.COUCH_DB_USER = "budibase" -process.env.COUCH_DB_PASSWORD = "budibase" -process.env.INTERNAL_API_KEY = "budibase" -process.env.ALLOW_DEV_AUTOMATIONS = 1 - -// Stop info logs polluting test outputs -process.env.LOG_LEVEL = "error" - -exports.run = ( - serverLoc = "../../server/dist", - workerLoc = "../../worker/dist" -) => { - // require("dotenv").config({ path: resolve(dir, ".env") }) - // don't make this a variable or top level require - // it will cause environment module to be loaded prematurely - - // override the port with the worker port temporarily - process.env.PORT = WORKER_PORT - require(workerLoc) - - // override the port with the server port - process.env.PORT = SERVER_PORT - require(serverLoc) -} - -if (require.main === module) { - exports.run() -} diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js deleted file mode 100644 index e63fd41591..0000000000 --- a/packages/builder/cypress/support/commands.js +++ /dev/null @@ -1,945 +0,0 @@ -Cypress.on("uncaught:exception", () => { - return false -}) - -// ACCOUNTS & USERS -Cypress.Commands.add("login", (email, password) => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) - cy.url() - .should("include", "/builder/") - .then(url => { - if (url.includes("builder/admin")) { - // create admin user - cy.get("input").first().type("test@test.com") - cy.get('input[type="password"]').first().type("test") - cy.get('input[type="password"]').eq(1).type("test") - cy.contains("Create super admin user").click({ force: true }) - } - if (url.includes("builder/auth") || url.includes("builder/admin")) { - // login - cy.contains("Sign in to Budibase").then(() => { - if (email == null) { - cy.get("input").first().type("test@test.com") - cy.get('input[type="password"]').type("test") - } else { - cy.get("input").first().type(email) - cy.get('input[type="password"]').type(password) - } - cy.get("button").first().click({ force: true }) - cy.wait(1000) - }) - } - }) -}) - -Cypress.Commands.add("logOut", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) - cy.get(".user-dropdown .avatar > .icon").click({ force: true }) - cy.get(".spectrum-Popover[data-cy='user-menu']").within(() => { - cy.get("li[data-cy='user-logout']").click({ force: true }) - }) - cy.wait(2000) -}) - -Cypress.Commands.add("logoutNoAppGrid", () => { - // Logs user out when app grid is not present - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) - cy.get(".avatar > .icon").click({ force: true }) - cy.get(".spectrum-Popover[data-cy='user-menu']").within(() => { - cy.get(".spectrum-Menu-item").contains("Log out").click({ force: true }) - }) - cy.wait(2000) -}) - -Cypress.Commands.add("createUser", (email, permission) => { - cy.contains("Users").click() - cy.get(`[data-cy="add-user"]`).click() - cy.get(".spectrum-Dialog-grid").within(() => { - // Enter email - cy.get(".spectrum-Textfield-input").clear().click().type(email) - - // Select permission, if applicable - // Default is App User - if (permission != null) { - cy.get(".spectrum-Picker-label").click() - cy.get(".spectrum-Menu").within(() => { - cy.get(".spectrum-Menu-item") - .contains(permission) - .click({ force: true }) - }) - } - // Add user - cy.get(".spectrum-Button").contains("Add users").click({ force: true }) - cy.get(".spectrum-ActionButton").contains("Add email").should("not.exist") - }) - // Onboarding modal - cy.get(".spectrum-Dialog-grid", { timeout: 5000 }).contains( - "Choose your onboarding" - ) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".onboarding-type").eq(1).click() - cy.get(".spectrum-Button").contains("Done").click({ force: true }) - cy.get(".spectrum-Button").contains("Cancel").should("not.exist") - }) - - // Accounts created modal - Click Done button - cy.get(".spectrum-Button").contains("Done").click({ force: true }) -}) - -Cypress.Commands.add("deleteUser", email => { - // Assumes user has access to Users section - cy.contains("Users", { timeout: 2000 }).click() - cy.contains(email).click() - - cy.get(".title").within(() => { - cy.get(".spectrum-Icon").click({ force: true }) - }) - cy.get(".spectrum-Menu").within(() => { - cy.get(".spectrum-Menu-item").contains("Delete").click({ force: true }) - }) - cy.get(".spectrum-Dialog-grid").contains("Delete user").click({ force: true }) -}) - -Cypress.Commands.add("updateUserInformation", (firstName, lastName) => { - cy.get(".user-dropdown .icon", { timeout: 2000 }).click({ - force: true, - }) - - cy.get(".spectrum-Popover[data-cy='user-menu']").within(() => { - cy.get("li[data-cy='user-info']").click({ force: true }) - }) - - cy.get(".spectrum-Modal.is-open").within(() => { - cy.get("[data-cy='user-first-name']").clear() - - if (!firstName || firstName == "") { - cy.get("[data-cy='user-first-name']").invoke("val").should("be.empty") - } else { - cy.get("[data-cy='user-first-name']") - .type(firstName) - .should("have.value", firstName) - .blur() - } - - cy.get("[data-cy='user-last-name']").clear() - - if (!lastName || lastName == "") { - cy.get("[data-cy='user-last-name']").invoke("val").should("be.empty") - } else { - cy.get("[data-cy='user-last-name']") - .type(lastName) - .should("have.value", lastName) - .blur() - } - cy.get(".confirm-wrap").within(() => { - cy.get("button").contains("Save").click({ force: true }) - }) - cy.get(".spectrum-Dialog-grid").should("not.exist") - }) -}) - -Cypress.Commands.add("setUserRole", (user, role) => { - cy.contains("Users").click() - cy.contains(user).click() - - // Set Role - cy.wait(500) - cy.get(".spectrum-Form-itemField") - .eq(3) - .within(() => { - cy.get(".spectrum-Picker-label").click({ force: true }) - }) - cy.get(".spectrum-Menu").within(() => { - cy.get(".spectrum-Menu-itemLabel").contains(role).click({ force: true }) - }) - cy.get(".spectrum-Form-itemField").eq(3).should("contain", role) -}) - -// APPLICATIONS -Cypress.Commands.add("createTestApp", () => { - const appName = "Cypress Tests" - cy.deleteApp(appName) - cy.createApp(appName, "This app is used for Cypress testing.") -}) - -Cypress.Commands.add("createApp", (name, addDefaultTable) => { - const shouldCreateDefaultTable = - typeof addDefaultTable != "boolean" ? true : addDefaultTable - - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) - cy.url({ timeout: 30000 }).should("include", "/apps") - cy.get(`[data-cy="create-app-btn"]`, { timeout: 5000 }).click({ force: true }) - - // If apps already exist - cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`, { - timeout: 5000, - }) - .its("body") - .then(val => { - if (val.length > 0) { - cy.get(`[data-cy="create-app-btn"]`, { timeout: 5000 }).click({ - force: true, - }) - } - }) - - cy.get(".spectrum-Modal").within(() => { - cy.get("input").eq(0).should("have.focus") - if (name && name != "") { - cy.get("input").eq(0).clear() - cy.get("input").eq(0).type(name).should("have.value", name).blur() - } - cy.get(".spectrum-ButtonGroup") - .contains("Create app") - .click({ force: true }) - cy.wait(2000) - }) - if (shouldCreateDefaultTable) { - cy.createTable("Cypress Tests", true) - } -}) - -Cypress.Commands.add("deleteApp", name => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) - cy.wait(2000) - cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) - .its("body") - .then(val => { - const findAppName = val.some(val => val.name == name) - if (findAppName) { - if (val.length > 0) { - const appId = val.reduce((acc, app) => { - if (name === app.name) { - acc = app.appId - } - return acc - }, "") - - if (appId == "") { - return - } - - // Go to app overview - const appIdParsed = appId.split("_").pop() - const actionEleId = `[data-cy=row_actions_${appIdParsed}]` - cy.get(actionEleId).click() - cy.get(`[aria-label="ShowMenu"]`).click() - cy.get(".spectrum-Menu").within(() => { - cy.contains("Overview").click() - }) - - cy.wait(500) - - // Unpublish first if needed - cy.get(`[data-cy="app-status"]`).then($status => { - if ($status.text().includes("- Unpublish")) { - // Exact match for Unpublish - cy.contains("Unpublish").click({ force: true }) - cy.get(".spectrum-Modal").within(() => { - cy.contains("Unpublish app").click({ force: true }) - }) - } - }) - - // Delete app - cy.get(".app-overview-actions-icon").within(() => { - cy.get(".spectrum-Icon").click({ force: true }) - }) - cy.get(".spectrum-Menu").contains("Delete").click({ force: true }) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get("input").type(name) - }) - cy.get(".spectrum-Button--warning").click() - } else { - return - } - } else { - return - } - }) -}) - -Cypress.Commands.add("deleteAllApps", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) - cy.wait(500) - cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`, { - timeout: 5000, - }) - .its("body") - .then(val => { - for (let i = 0; i < val.length; i++) { - cy.deleteApp(val[i].name) - cy.reload() - } - }) -}) - -Cypress.Commands.add("unlockApp", unlock_config => { - let config = { ...unlock_config } - - cy.get(".spectrum-Modal .spectrum-Dialog[data-cy='app-lock-modal']") - .should("be.visible") - .within(() => { - if (config.owned) { - cy.get(".spectrum-Dialog-heading").contains("Locked by you") - cy.get(".lock-expiry-body").contains( - "This lock will expire in 10 minutes from now" - ) - - cy.intercept("**/lock").as("unlockApp") - cy.get(".spectrum-Button") - .contains("Release Lock") - .click({ force: true }) - cy.wait("@unlockApp") - cy.get("@unlockApp").its("response.statusCode").should("eq", 200) - cy.get("@unlockApp").its("response.body").should("deep.equal", { - message: "Lock released successfully.", - }) - } else { - //Show the name ? - cy.get(".lock-expiry-body").should("not.be.visible") - cy.get(".spectrum-Button").contains("Done") - } - }) -}) - -Cypress.Commands.add("updateAppName", (changedName, noName) => { - cy.get(".spectrum-Modal").within(() => { - if (noName == true) { - cy.get("input").clear() - cy.get(".spectrum-Dialog-grid") - .click() - .contains("App name must be letters, numbers and spaces only") - return cy - } - cy.get("input").clear() - cy.get("input") - .eq(0) - .type(changedName) - .should("have.value", changedName) - .blur() - cy.get(".spectrum-ButtonGroup").contains("Save").click({ force: true }) - cy.wait(500) - }) -}) - -Cypress.Commands.add("publishApp", resolvedAppPath => { - // Assumes you have navigated to an application first - cy.get(".toprightnav button.spectrum-Button") - .contains("Publish") - .click({ force: true }) - - cy.get(".spectrum-Modal [data-cy='deploy-app-modal']") - .should("be.visible") - .within(() => { - cy.get(".spectrum-Button").contains("Publish").click({ force: true }) - cy.wait(1000) - }) - - // Verify that the app url is presented correctly to the user - cy.get(".spectrum-Modal [data-cy='deploy-app-success-modal']") - .should("be.visible") - .within(() => { - let appUrl = Cypress.config().baseUrl + "/app/" + resolvedAppPath - cy.get("[data-cy='deployed-app-url'] input").should("have.value", appUrl) - cy.get(".spectrum-Button").contains("Done").click({ force: true }) - }) -}) - -Cypress.Commands.add("alterAppVersion", (appId, version) => { - return cy - .request("put", `${Cypress.config().baseUrl}/api/applications/${appId}`, { - version: version || "0.0.1-alpha.0", - }) - .then(resp => { - expect(resp.status).to.eq(200) - }) -}) - -Cypress.Commands.add("importApp", (exportFilePath, name) => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) - - cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) - .its("body") - .then(val => { - if (val.length > 0) { - cy.get(`[data-cy="create-app-btn"]`).click({ force: true }) - } - cy.wait(500) - cy.get(`[data-cy="import-app-btn"]`).click({ - force: true, - }) - }) - - cy.get(".spectrum-Modal").within(() => { - cy.get("input").eq(1).should("have.focus") - - cy.get(".spectrum-Dropzone").selectFile(exportFilePath, { - action: "drag-drop", - }) - - cy.get(".gallery .filename").contains("exported-app.txt") - - if (name && name != "") { - cy.get("input").eq(0).type(name).should("have.value", name).blur() - } - cy.get(".confirm-wrap button") - .should("not.be.disabled") - .click({ force: true }) - cy.wait(3000) - }) -}) - -// Filters visible with 1 or more -Cypress.Commands.add("searchForApplication", appName => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) - cy.wait(2000) - - // No app filter functionality if only 1 app exists - cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) - .its("body") - .then(val => { - if (val.length < 2) { - return - } else { - // Searches for the app - cy.get(".spectrum-Search").then(() => { - cy.get(".spectrum-Textfield").within(() => { - cy.get("input").eq(0).clear({ force: true }) - cy.get("input").eq(0).type(appName, { force: true }) - }) - }) - } - }) -}) - -// Assumes there are no others -Cypress.Commands.add("applicationInAppTable", appName => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) - cy.get(".app-table", { timeout: 30000 }).within(() => { - cy.get(".title").contains(appName).should("exist") - }) -}) - -Cypress.Commands.add("createAppFromScratch", appName => { - cy.get(`[data-cy="create-app-btn"]`) - .contains("Start from scratch") - .click({ force: true }) - cy.get(".spectrum-Modal").within(() => { - cy.get("input") - .eq(0) - .clear() - .type(appName) - .should("have.value", appName) - .blur() - cy.get(".spectrum-ButtonGroup").contains("Create app").click() - cy.wait(10000) - }) - cy.createTable("Cypress Tests", true) -}) - -// TABLES -Cypress.Commands.add("createTable", (tableName, initialTable) => { - // Creates an internal Budibase DB table - if (!initialTable) { - cy.navigateToDataSection() - } - cy.get(`[data-cy="new-datasource"]`, { timeout: 20000 }).click() - cy.wait(2000) - cy.get(".item", { timeout: 2000 }) - .contains("Budibase DB") - .click({ force: true }) - .then(() => { - cy.get(".spectrum-Button", { timeout: 2000 }) - .contains("Continue") - .click({ force: true }) - }) - cy.get(".spectrum-Modal").contains("Create Table", { timeout: 10000 }) - cy.get(".spectrum-Modal", { timeout: 2000 }).within(() => { - cy.get("input", { timeout: 2000 }).first().type(tableName).blur() - cy.get(".spectrum-ButtonGroup").contains("Create").click() - }) - // Ensure modal has closed and table is created - cy.get(".spectrum-Modal", { timeout: 2000 }).should("not.exist") - cy.get(".nav-item", { timeout: 2000 }) - .contains("Budibase DB") - .click({ force: true }) - cy.get(".nav-item-content", { timeout: 2000 }).should("contain", tableName) -}) - -Cypress.Commands.add("createTestTableWithData", () => { - cy.createTable("dog") - cy.addColumn("dog", "name", "Text") - cy.addColumn("dog", "age", "Number") -}) - -Cypress.Commands.add( - "addColumn", - (tableName, columnName, type, multiOptions = null) => { - // Select Table - cy.selectTable(tableName) - cy.contains(".nav-item", tableName).click() - cy.contains("Create column").click() - - // Configure column - cy.get(".spectrum-Modal").within(() => { - cy.get("input").first().type(columnName) - - // Unset table display column - cy.contains("display column").click({ force: true }) - cy.get(".spectrum-Picker-label").click() - cy.contains(type).click() - - // Add options for Multi-select Type - if (multiOptions !== null) { - cy.get(".spectrum-Textfield-input").eq(1).type(multiOptions) - } - - cy.contains("Save Column").click() - }) - } -) - -Cypress.Commands.add("addRow", values => { - cy.contains("Create row").click() - cy.get(".spectrum-Modal").within(() => { - for (let i = 0; i < values.length; i++) { - cy.get("input").eq(i).type(values[i]).blur() - } - cy.get(".spectrum-ButtonGroup").contains("Create").click() - }) -}) - -Cypress.Commands.add("addRowMultiValue", values => { - cy.contains("Create row").click() - cy.get(".spectrum-Modal").within(() => { - cy.get(".spectrum-Form-itemField") - .click() - .then(() => { - cy.get(".spectrum-Popover").within(() => { - for (let i = 0; i < values.length; i++) { - cy.get(".spectrum-Menu-item").eq(i).click() - } - }) - cy.get(".spectrum-Dialog-grid").click("top") - cy.get(".spectrum-ButtonGroup").contains("Create").click() - }) - }) -}) - -Cypress.Commands.add("selectTable", tableName => { - cy.get(".nav-item").contains("Budibase DB").click() - cy.contains(".nav-item", tableName).click() -}) - -Cypress.Commands.add("addCustomSourceOptions", totalOptions => { - cy.get('[data-cy="customOptions-prop-control"]').within(() => { - cy.get(".spectrum-ActionButton-label").click({ force: true }) - }) - for (let i = 0; i < totalOptions; i++) { - // Add radio button options - cy.get(".spectrum-Button-label", { timeout: 1000 }) - .contains("Add Option") - .click({ force: true }) - .then(() => { - cy.get("[placeholder='Label']", { timeout: 500 }).eq(i).type(i) - cy.get("[placeholder='Value']").eq(i).type(i) - }) - } - // Save options - cy.get(".spectrum-Button").contains("Save").click({ force: true }) -}) - -// DESIGN SECTION -Cypress.Commands.add("searchAndAddComponent", component => { - // Open component menu - cy.get(".icon-side-nav").within(() => { - cy.get(".icon-side-nav-item").eq(1).click() - }) - cy.get(".add-component > .spectrum-Button") - .contains("Add component") - .click({ force: true }) - cy.get(".container", { timeout: 1000 }).within(() => { - cy.get(".title").should("contain", "Add component") - - // Search and add component - cy.get(".spectrum-Textfield-input").clear().type(component) - cy.get(".body").within(() => { - cy.get(".component") - .contains(new RegExp("^" + component + "$"), { timeout: 3000 }) - .click({ force: true }) - }) - }) - cy.wait(1000) - cy.location().then(loc => { - const params = loc.pathname.split("/") - const componentId = params[params.length - 1] - cy.getComponent(componentId, { timeout: 3000 }).should("exist") - return cy.wrap(componentId) - }) -}) - -Cypress.Commands.add("deleteComponentByName", componentName => { - cy.get(".body") - .eq(0) - .contains(componentName) - .siblings(".actions") - .within(() => { - cy.get(".spectrum-Icon").click({ force: true }) - }) - cy.get(".spectrum-Menu").contains("Delete").click() - cy.get(".spectrum-Dialog").contains("Delete Component").click() -}) - -Cypress.Commands.add("addComponent", (category, component) => { - if (category) { - cy.get(`[data-cy="category-${category}"]`, { timeout: 3000 }).click({ - force: true, - }) - } - cy.wait(500) - if (component) { - cy.get(`[data-cy="component-${component}"]`, { timeout: 3000 }).click({ - force: true, - }) - } - cy.wait(1000) - cy.location().then(loc => { - const params = loc.pathname.split("/") - const componentId = params[params.length - 1] - cy.getComponent(componentId, { timeout: 3000 }).should("exist") - return cy.wrap(componentId) - }) -}) - -Cypress.Commands.add("getComponent", componentId => { - return cy - .get("iframe") - .its("0.contentDocument") - .should("exist") - .its("body") - .should("not.be.undefined") - .then(cy.wrap) - .find(`[data-id='${componentId}']`) -}) - -Cypress.Commands.add("createScreen", (route, accessLevelLabel) => { - // Blank Screen - cy.contains("Design").click() - cy.get(".spectrum-Button").contains("Add screen").click({ force: true }) - cy.get(".spectrum-Modal").within(() => { - cy.get("[data-cy='blank-screen']").click() - cy.get(".spectrum-Button").contains("Continue").click({ force: true }) - }) - cy.wait(500) - cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => { - cy.get(".spectrum-Form-itemField").eq(0).type(route) - cy.get(".confirm-wrap").contains("Continue").click({ force: true }) - }) - - cy.get(".spectrum-Modal", { timeout: 1000 }).within(() => { - if (accessLevelLabel) { - cy.get(".spectrum-Picker-label").click() - cy.wait(500) - cy.contains(accessLevelLabel).click() - } - cy.get(".spectrum-Button").contains("Done").click({ force: true }) - }) -}) - -Cypress.Commands.add( - "createDatasourceScreen", - (datasourceNames, accessLevelLabel) => { - cy.contains("Design").click() - cy.get(".spectrum-Button").contains("Add screen").click({ force: true }) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get("[data-cy='autogenerated-screens']").click() - cy.intercept("**/api/datasources").as("autoScreens") - cy.get(".spectrum-Button").contains("Continue").click({ force: true }) - cy.wait("@autoScreens") - cy.wait(5000) - }) - cy.get("[data-cy='autogenerated-screens']").should("not.exist") - cy.get("[data-cy='data-source-modal']", { timeout: 10000 }).within(() => { - for (let i = 0; i < datasourceNames.length; i++) { - cy.get(".data-source-entry") - .contains(datasourceNames[i], { timeout: 20000 }) - .click({ force: true }) - // Ensure the check mark is visible - cy.get(".data-source-entry") - .contains(datasourceNames[i]) - .get(".data-source-check", { timeout: 20000 }) - .should("exist") - } - - cy.get(".spectrum-Button").contains("Confirm").click({ force: true }) - }) - - cy.get(".spectrum-Modal", { timeout: 10000 }).within(() => { - if (accessLevelLabel) { - cy.get(".spectrum-Picker-label", { timeout: 10000 }).click() - cy.contains(accessLevelLabel).click() - } - cy.get(".spectrum-Button").contains("Done").click({ force: true }) - }) - - cy.contains("Design").click() - } -) - -Cypress.Commands.add( - "createAutogeneratedScreens", - (screenNames, accessLevelLabel) => { - cy.navigateToAutogeneratedModal() - - for (let i = 0; i < screenNames.length; i++) { - cy.get(".data-source-entry").contains(screenNames[i]).click() - } - - cy.get(".spectrum-Modal").within(() => { - if (accessLevelLabel) { - cy.get(".spectrum-Picker-label").click() - cy.wait(500) - cy.contains(accessLevelLabel).click() - } - cy.get(".spectrum-Button").contains("Confirm").click({ force: true }) - cy.wait(4000) - }) - } -) - -Cypress.Commands.add("filterScreensAccessLevel", accessLevel => { - // Filters screens by access level dropdown - cy.get(".body").within(() => { - cy.get(".spectrum-Form-item").eq(1).click() - }) - cy.get(".spectrum-Menu").within(() => { - cy.contains(accessLevel).click() - }) -}) - -Cypress.Commands.add("deleteScreen", screen => { - // Navigates to Design section and deletes specified screen - cy.contains("Design").click() - cy.get(".body").within(() => { - cy.contains(screen) - .siblings(".actions") - .within(() => { - cy.get(".spectrum-Icon").click({ force: true }) - }) - }) - cy.get(".spectrum-Menu > .spectrum-Menu-item > .spectrum-Menu-itemLabel") - .contains("Delete") - .click() - - cy.get( - ".spectrum-Dialog-grid > .spectrum-ButtonGroup > .confirm-wrap > .spectrum-Button" - ).click({ force: true }) - cy.get(".spectrum-Dialog-grid", { timeout: 10000 }).should("not.exist") -}) - -Cypress.Commands.add("deleteAllScreens", () => { - // Deletes all screens - cy.get(".body") - .find(".nav-item") - .its("length") - .then(len => { - for (let i = 0; i < len; i++) { - cy.get(".body > .nav-item") - .eq(0) - .invoke("text") - .then(text => { - cy.deleteScreen(text.trim()) - }) - } - }) -}) - -// NAVIGATION -Cypress.Commands.add("navigateToFrontend", () => { - // Clicks on Design tab and then the Home nav item - cy.wait(500) - cy.intercept("**/preview").as("preview") - cy.contains("Design").click() - cy.wait("@preview") - cy.get("@preview").then(res => { - if (res.statusCode != 200) { - cy.reload() - } - }) - cy.get(".spectrum-Search", { timeout: 20000 }).type("/") - cy.get(".nav-item", { timeout: 2000 }).contains("home").click({ force: true }) -}) - -Cypress.Commands.add("navigateToDataSection", () => { - // Clicks on the Data tab - cy.wait(500) - cy.contains("Data").click() -}) - -Cypress.Commands.add("navigateToAutogeneratedModal", () => { - // Screen name must already exist within datasource - cy.contains("Design").click() - cy.get(".spectrum-Button").contains("Add screen").click({ force: true }) - cy.get(".spectrum-Modal").within(() => { - cy.get(".item", { timeout: 2000 }) - .contains("Autogenerated screens") - .click({ force: true }) - cy.get(".spectrum-Button").contains("Continue").click({ force: true }) - cy.wait(500) - }) -}) - -// DATASOURCES -Cypress.Commands.add("selectExternalDatasource", datasourceName => { - // Navigates to Data Section - cy.navigateToDataSection() - // Open Datasource modal - cy.get(".container").within(() => { - cy.get("[data-cy='new-datasource']").click() - }) - // Clicks specified datasource & continue - cy.get(".item-list", { timeout: 1000 }).contains(datasourceName).click() - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button").contains("Continue").click({ force: true }) - }) - cy.wait(500) -}) - -Cypress.Commands.add("addDatasourceConfig", (datasource, skipFetch) => { - // selectExternalDatasource should be called prior to this - // Adds the config for specified datasource & fetches tables - // Currently supports MySQL, PostgreSQL, Oracle - // Host IP Address - cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => { - cy.get(".form-row") - .eq(0) - .within(() => { - cy.get(".spectrum-Textfield").within(() => { - if (datasource == "Oracle") { - cy.get("input").clear().type(Cypress.env("oracle").HOST) - } else { - cy.get("input") - .clear({ force: true }) - .type(Cypress.env("HOST_IP"), { force: true }) - } - }) - }) - }) - // Database Name - cy.get(".spectrum-Dialog-grid").within(() => { - if (datasource == "MySQL") { - cy.get(".form-row") - .eq(4) - .within(() => { - cy.get("input").clear().type(Cypress.env("mysql").DATABASE) - }) - } else { - cy.get(".form-row") - .eq(2) - .within(() => { - if (datasource == "PostgreSQL") { - cy.get("input").clear().type(Cypress.env("postgresql").DATABASE) - } - if (datasource == "Oracle") { - cy.get("input").clear().type(Cypress.env("oracle").DATABASE) - } - }) - } - }) - // User - cy.get(".spectrum-Dialog-grid").within(() => { - if (datasource == "MySQL") { - cy.get(".form-row") - .eq(2) - .within(() => { - cy.get("input").clear().type(Cypress.env("mysql").USER) - }) - } else { - cy.get(".form-row") - .eq(3) - .within(() => { - if (datasource == "PostgreSQL") { - cy.get("input").clear().type(Cypress.env("postgresql").USER) - } - if (datasource == "Oracle") { - cy.get("input").clear().type(Cypress.env("oracle").USER) - } - }) - } - }) - // Password - cy.get(".spectrum-Dialog-grid").within(() => { - if (datasource == "MySQL") { - cy.get(".form-row") - .eq(3) - .within(() => { - cy.get("input").clear().type(Cypress.env("mysql").PASSWORD) - }) - } else { - cy.get(".form-row") - .eq(4) - .within(() => { - if (datasource == "PostgreSQL") { - cy.get("input").clear().type(Cypress.env("postgresql").PASSWORD) - } - if (datasource == "Oracle") { - cy.get("input").clear().type(Cypress.env("oracle").PASSWORD) - } - }) - } - }) - // Click to fetch tables - if (skipFetch) { - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button") - .contains("Skip table fetch") - .click({ force: true }) - }) - } else { - cy.intercept("**/tables").as("datasourceTables") - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button") - .contains("Save and fetch tables") - .click({ force: true }) - }) - // Wait for tables to be fetched - cy.wait("@datasourceTables", { timeout: 60000 }) - } -}) - -Cypress.Commands.add("createRestQuery", (method, restUrl, queryPrettyName) => { - // addExternalDatasource should be called prior to this - // Configures REST datasource & sends query - cy.get(".spectrum-Button", { timeout: 1000 }) - .contains("Add query") - .click({ force: true }) - // Select Method & add Rest URL - cy.get(".spectrum-Picker-label").eq(1).click() - cy.get(".spectrum-Menu").contains(method).click() - cy.get("input").clear().type(restUrl) - // Send query - cy.get(".spectrum-Button").contains("Send").click({ force: true }) - cy.get(".spectrum-Button", { timeout: 500 }) - .contains("Save") - .click({ force: true }) - cy.get(".hierarchy-items-container") - .should("contain", method) - .and("contain", queryPrettyName) -}) - -// MISC -Cypress.Commands.add("closeModal", () => { - cy.get(".spectrum-Modal", { timeout: 2000 }).within(() => { - cy.get(".close-icon").click() - }) - // Confirm modal has closed - cy.get(".spectrum-Modal", { timeout: 10000 }).should("not.exist") -}) - -Cypress.Commands.add("expandBudibaseConnection", () => { - if (Cypress.$(".nav-item > .content > .opened").length === 0) { - // expand the Budibase DB connection string - cy.get(".icon.arrow").eq(0).click() - } -}) diff --git a/packages/builder/cypress/support/cookies.js b/packages/builder/cypress/support/cookies.js deleted file mode 100644 index 3e2fba6481..0000000000 --- a/packages/builder/cypress/support/cookies.js +++ /dev/null @@ -1,3 +0,0 @@ -Cypress.Cookies.defaults({ - preserve: "budibase:auth", -}) diff --git a/packages/builder/cypress/support/filterTests.js b/packages/builder/cypress/support/filterTests.js deleted file mode 100644 index 074fd05d33..0000000000 --- a/packages/builder/cypress/support/filterTests.js +++ /dev/null @@ -1,16 +0,0 @@ -const filterTests = (testTags, runTest) => { - // testTags is an array of tags - // runTest is all tests - if (Cypress.env("TEST_TAGS")) { - const tags = Cypress.env("TEST_TAGS").split("/") - const found = testTags.some($testTags => tags.includes($testTags)) - - if (found) { - runTest() - } - } else { - runTest() - } -} - -export default filterTests diff --git a/packages/builder/cypress/support/index.js b/packages/builder/cypress/support/index.js deleted file mode 100644 index acd53a1592..0000000000 --- a/packages/builder/cypress/support/index.js +++ /dev/null @@ -1,22 +0,0 @@ -// *********************************************************** -// 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 -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import "./commands" -import "./cookies" - -// Alternatively you can use CommonJS syntax: -// require('./commands') -require("cypress-terminal-report/src/installLogsCollector")() diff --git a/packages/builder/cypress/support/interact.js b/packages/builder/cypress/support/interact.js deleted file mode 100644 index 4f2451ce4b..0000000000 --- a/packages/builder/cypress/support/interact.js +++ /dev/null @@ -1,136 +0,0 @@ -// createApp test -export const CREATE_APP_BUTTON = '[data-cy="create-app-btn"]' -export const TEMPLATE_CATEGORY_FILTER = ".template-category-filters" -export const TEMPLATE_CATEGORY = ".template-categories" -export const APP_TABLE = ".appTable" -export const SPECTRUM_BUTTON_TEMPLATE = ".spectrum-Button" -export const TEMPLATE_CATEGORY_ACTIONGROUP = ".template-category" -export const TEMPLATE_CATEGORY_FILTER_ACTIONBUTTON = - ".template-category-filters .spectrum-ActionButton" -export const SPECTRUM_MODAL = ".spectrum-Modal" -export const APP_NAME_INPUT = "input" // we need to update this with atribute cy-data; -export const SPECTRUM_BUTTON_GROUP = ".spectrum-ButtonGroup" -export const SPECTRUM_MODAL_INPUT = ".spectrum-Modal input" - -//AddMultiOptionDatatype -export const CATEGORY_DATA = '[data-cy="category-Data"]' -export const COMPONENT_DATA_PROVIDER = '[data-cy="component-Data Provider"]' -export const DATASOURCE_PROP_CONTROL = '[data-cy="dataSource-prop-control"]' -export const DROPDOWN = ".dropdown" -export const SPECTRUM_PICKER_LABEL = ".spectrum-Picker-label" -export const DATASOURCE_FIELD_CONTROL = '[data-cy="field-prop-control"]' -export const OPTION_TYPE_PROP_CONTROL = '[data-cy="optionsType-prop-control' - -//AddRadioButtons -export const SPECTRUM_POPOVER = ".spectrum-Popover" -export const OPTION_SOURCE_PROP_CONROL = '[data-cy="optionsSource-prop-control' -export const APP_TABLE_STATUS = ".appTable .app-status" -export const APP_TABLE_ROW_ACTION = ".appTable .app-row-actions" -export const APP_TABLE_APP_NAME = '[data-cy="app-name-link"]' -export const DEPLOYMENT_TOP_NAV_GLOBESTRIKE = - ".deployment-top-nav svg[aria-label=GlobeStrike]" -export const DEPLOYMENT_TOP_GLOBE = ".deployment-top-nav svg[aria-label=Globe]" -export const PUBLISH_POPOVER_MENU = '[data-cy="publish-popover-menu"]' -export const PUBLISH_POPOVER_ACTION = '[data-cy="publish-popover-action"]' -export const PUBLISH_POPOVER_MESSAGE = ".publish-popover-message" -export const SPECTRUM_BUTTON = ".spectrum-Button" -export const SPECTRUM_LINK = ".spectrum-Link" -export const TOPRIGHTNAV_BUTTON_SPECTRUM = ".toprightnav button.spectrum-Button" - -//createComponents -export const SETTINGS = "[data-cy=Settings]" -export const SETTINGS_INPUT = "[data-cy=setting-text] input" -export const DESIGN = "[data-cy=Design]" -export const FONT_SIZE_PROP_CONTROL = "[data-cy=font-size-prop-control]" -export const DATA_CY_DATASOURCE = "[data-cy=setting-dataSource]" -export const DROPDOWN_CONTAINER = ".dropdown-container" -export const SPECTRUM_PICKER = ".spectrum-Picker" - -//autoScreens -export const LABEL_ADD_CIRCLE = "[aria-label=AddCircle]" -export const ITEM_DISABLED = ".item.disabled" -export const CONFIRM_WRAP_SPE_BUTTON = ".confirm-wrap .spectrum-Button" -export const DATA_SOURCE_ENTRY = ".data-source-entry" -export const BODY = ".body" - -//publishWorkFlow -export const DEPLOY_APP_MODAL = ".spectrum-Modal [data-cy=deploy-app-modal]" -export const DEPLOY_SUCCESS_MODAL = - ".spectrum-Modal [data-cy=deploy-app-success-modal]" -export const DEPLOY_APP_URL_INPUT = "[data-cy=deployed-app-url] input" -export const GLOBESTRIKE = "svg[aria-label=GlobeStrike]" -export const GLOBE = "svg[aria-label=Globe]" -export const UNPUBLISH_MODAL = "[data-cy=unpublish-modal]" -export const CONFIRM_WRAP_BUTTON = ".confirm-wrap button" -export const DEPLOYMENT_TOP_NAV = ".deployment-top-nav" - -//changeAppiconAndColour -export const APP_ROW_ACTION = ".app-row-actions-icon" -export const SPECTRUM_MENU = ".spectrum-Menu" -export const ICON_ITEM = ".icon-item" -export const FILL = ".fill" -export const COLOURSS = ".colors" -export const AREA_LABEL = "[aria-label]" -export const TITLE = ".title" -export const GRID = ".grid" -export const COLOUR = ".color" - -//createAutomation -export const ADD_BUTTON_SPECTRUM = ".add-button .spectrum-Icon" -export const MODAL_INNER_WRAPPER = ".modal-inner-wrapper" -export const SPECTRUM_BUTTON_CTA = ".spectrum-Button--cta" -export const SPECTRUM_TEXTFIELD_INPUT = ".spectrum-Textfield-input" - -//createTable -export const TABLE_TITLE_H1 = ".table-title h1" -export const TABLE_TITLE = ".title" -export const SPECTRUM_TABLE_EDIT = ".spectrum-Table-editIcon > use" -export const SPECTRUM_SWITCH_INPUT = ".spectrum-Switch-input" -export const SPECTRUM_CHECKBOX_INPUT = ".spectrum-Checkbox-input" -export const SPECTRUM_PAGINATION = ".spectrum-Pagination" -export const SPECTRUM_ACTION_BUTTON = ".spectrum-ActionButton" -export const SPECTRUM_BODY_SECOND = ".spectrum-Body--secondary" -export const POPOVERS = ".popovers" -export const SPECTRUM_DIALOG_GRID = ".spectrum-Dialog-grid" -export const DELETE_COLUMN_CONFIRM = '[data-cy="delete-column-confirm"]' -export const NAV_ITEM = ".nav-item" -export const ACTION_SPECTRUM_ICON = ".actions .spectrum-Icon" -export const SPECTRUM_MENU_CHILD2 = ".spectrum-Menu > :nth-child(2)" -export const DELETE_TABLE_CONFIRM = '[data-cy="delete-table-confirm"]' - -//adminAndManagement Folder -export const SPECTRUM_TABLE = ".spectrum-Table" -export const SPECTRUM_SIDENAV = ".spectrum-SideNav" -export const SPECTRUM_TABLE_ROW = ".spectrum-Table-row" -export const SPECTRUM_TABLE_CELL = ".spectrum-Table-cell" -export const FIELD = ".field" -export const CONTAINER = ".container" -export const REGENERATE = ".regenerate" -export const SPECTRUM_DIALOG_CONTENT = ".spectrum-Dialog-content" -export const SPECTRUM_ICON = ".spectrum-Icon" -export const SPECTRUM_HEADING = ".spectrum-Heading" -export const SPECTRUM_FORM_ITEMFIELD = ".spectrum-Form-itemField" -export const LIST_ITEMS = ".list-items" - -//createView -export const SPECTRUM_MENU_ITEM_LABEL = ".spectrum-Menu-itemLabel" - -//revertApp -export const TOP_RIGHT_NAV = ".toprightnav" -export const AREA_LABEL_REVERT = "[aria-label=Revert]" -export const ROOT = ".root" - -//queryLevelTransformers -export const SPECTRUM_TABS_ITEM = ".spectrum-Tabs-itemLabel" -export const CODEMIRROR_TEXTAREA = ".CodeMirror textarea" - -//renameApplication -export const WRAPPER = ".wrapper" -export const ERROR = ".error" -export const AREA_LABEL_MORE = "[aria-label=More]" -export const APP_ROW_ACTION_MENU_POPOVER = - '[data-cy="app-row-actions-menu-popover"]' -export const SPECTRUM_MENU_ITEM = ".spectrum-Menu-item" - -//commands -export const HOME_LOGO = ".home-logo" diff --git a/packages/builder/cypress/support/queryLevelTransformerFunction.js b/packages/builder/cypress/support/queryLevelTransformerFunction.js deleted file mode 100644 index 7dc05018f8..0000000000 --- a/packages/builder/cypress/support/queryLevelTransformerFunction.js +++ /dev/null @@ -1,14 +0,0 @@ -/* eslint-disable */ -const breweries = data -const totals = {} - -for (let brewery of breweries) - {const state = brewery.state - if (totals[state] == null) - {totals[state] = 1 - } else - {totals[state]++ - } -} -const entries = Object.entries(totals) -return entries.map(([state, count]) => ({ state, count })) diff --git a/packages/builder/cypress/support/queryLevelTransformerFunctionWithData.js b/packages/builder/cypress/support/queryLevelTransformerFunctionWithData.js deleted file mode 100644 index fcf50b4412..0000000000 --- a/packages/builder/cypress/support/queryLevelTransformerFunctionWithData.js +++ /dev/null @@ -1,31 +0,0 @@ -/* eslint-disable */ -const breweries = data -const totals = {} -for (let brewery of breweries) - {const state = brewery.state - if (totals[state] == null) - {totals[state] = 1 - } else - {totals[state]++ - } -} -const stateCodes = - {texas: "tx", - colorado: "co", - florida: "fl", - iwoa: "ia", - louisiana: "la", - california: "ca", - pennsylvania: "pa", - georgia: "ga", - "new hampshire": "nh", - virginia: "va", - michigan: "mi", - maryland: "md", - ohio: "oh", -} -const entries = Object.entries(totals) -return entries.map(([state, count]) => - {stateCodes[state.toLowerCase()] - return { state, count, flag: "http://flags.ox3.in/svg/us/${stateCode}.svg" } -}) diff --git a/packages/builder/cypress/ts/setup.ts b/packages/builder/cypress/ts/setup.ts deleted file mode 100644 index b6b12bf730..0000000000 --- a/packages/builder/cypress/ts/setup.ts +++ /dev/null @@ -1,4 +0,0 @@ -// @ts-ignore -import { run } from "../setup" - -run("../../server/src/index", "../../worker/src/index")