diff --git a/lerna.json b/lerna.json index d6ca00a41a..d122442788 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.0.191-alpha.0", + "version": "1.0.192-alpha.5", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 823e9e6ca7..64ede16c9f 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.0.191-alpha.0", + "version": "1.0.192-alpha.5", "description": "Budibase backend core libraries used in server and worker", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index b677d0c01c..ce829fb115 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.0.191-alpha.0", + "version": "1.0.192-alpha.5", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "^1.0.191-alpha.0", + "@budibase/string-templates": "^1.0.192-alpha.5", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/cypress/integration/appOverview.spec.js b/packages/builder/cypress/integration/appOverview.spec.js index db093344b4..090e4e369b 100644 --- a/packages/builder/cypress/integration/appOverview.spec.js +++ b/packages/builder/cypress/integration/appOverview.spec.js @@ -132,22 +132,36 @@ filterTests(['all'], () => { }) }) - it("Should allow the editing of the application icon", () => { + it("Should allow the editing of the application icon and colour", () => { cy.visit(`${Cypress.config().baseUrl}/builder`) - - cy.get(".appTable .name").eq(0).click() - - cy.get(".app-logo .edit-hover").should("exist").invoke("show").click() - - cy.customiseAppIcon() - - cy.get(".app-logo") - .within(() => { - cy.get('[aria-label]').eq(0).children() - .should('have.attr', 'xlink:href').and('not.contain', '#spectrum-icon-18-Apps') - cy.get(".app-icon") - .should('have.attr', 'style').and('contains', 'color') + cy.get(".appTable", { timeout: 2000}) + .within(() => { + cy.get(".app-row-actions-icon").eq(0).click() + }) + cy.get(".spectrum-Menu").contains("Edit icon").click() + // Select random icon + 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(".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') + }) }) it("Should reflect the last time the application was edited", () => { @@ -259,6 +273,7 @@ filterTests(['all'], () => { }); cy.visit(`${Cypress.config().baseUrl}/builder`) + cy.wait(1000) cy.get(".appTable .name").eq(0).click() cy.get(".spectrum-Tabs-item").contains("Settings").click() cy.get(".spectrum-Tabs-item.is-selected").contains("Settings") @@ -269,7 +284,7 @@ filterTests(['all'], () => { }) - it("Should allow copying of the published application Id", () => { + xit("Should allow copying of the published application Id", () => { cy.visit(`${Cypress.config().baseUrl}/builder`) cy.get(".appTable .app-row-actions").eq(0) .within(() => { diff --git a/packages/builder/cypress/integration/appPublishWorkflow.spec.js b/packages/builder/cypress/integration/appPublishWorkflow.spec.js index d05a97f691..f0a7dd791a 100644 --- a/packages/builder/cypress/integration/appPublishWorkflow.spec.js +++ b/packages/builder/cypress/integration/appPublishWorkflow.spec.js @@ -1,4 +1,5 @@ import filterTests from "../support/filterTests" +import { APP_TABLE_APP_NAME, DEPLOY_SUCCESS_MODAL } from "../support/interact"; const interact = require('../support/interact') filterTests(['all'], () => { @@ -20,10 +21,9 @@ filterTests(['all'], () => { cy.get(interact.APP_TABLE_ROW_ACTION).eq(0) .within(() => { - cy.get(interact.SPECTRUM_BUTTON_TEMPLATE).contains("Preview") 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") }) @@ -39,7 +39,7 @@ filterTests(['all'], () => { }); //Verify that the app url is presented correctly to the user - cy.get(interact.DEPLOY_APP_MODAL) + cy.get(interact.DEPLOY_SUCCESS_MODAL) .should("be.visible") .within(() => { let appUrl = Cypress.config().baseUrl + '/app/cypress-tests' @@ -63,7 +63,7 @@ filterTests(['all'], () => { }) 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") @@ -72,9 +72,9 @@ filterTests(['all'], () => { }) }) - it("Should unpublish an application from the top navigation and reflect the status change", () => { + it("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`) cy.get(interact.APP_TABLE_STATUS).eq(0) @@ -85,17 +85,11 @@ filterTests(['all'], () => { cy.get(interact.APP_TABLE_ROW_ACTION).eq(0) .within(() => { - cy.get(interact.SPECTRUM_BUTTON).contains("View app") - cy.get(interact.SPECTRUM_BUTTON).contains("Edit").click({ force: true }) + cy.get(interact.SPECTRUM_BUTTON).contains("View") + cy.get(interact.APP_TABLE_APP_NAME).click({ force: true }) }) - //The published status - cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("exist") - .click({ force: true }) - - cy.get(interact.PUBLISH_POPOVER_MENU).should("be.visible") - cy.get("[data-cy='publish-popover-menu'] [data-cy='publish-popover-action']") - .click({ force : true }) + cy.get(interact.SPECTRUM_LINK).contains('Unpublish').click(); cy.get(interact.UNPUBLISH_MODAL).should("be.visible") .within(() => { diff --git a/packages/builder/cypress/integration/changeAppIconAndColour.spec.js b/packages/builder/cypress/integration/changeAppIconAndColour.spec.js deleted file mode 100644 index 2e5bca9074..0000000000 --- a/packages/builder/cypress/integration/changeAppIconAndColour.spec.js +++ /dev/null @@ -1,45 +0,0 @@ -import filterTests from "../support/filterTests" -const interact = require('../support/interact') - -filterTests(['all'], () => { - context("Change Application Icon and Colour", () => { - before(() => { - cy.login() - }) - - it("should change the icon and colour for an application", () => { - // Search for test application - cy.applicationInAppTable("Cypress Tests") - cy.get(".appTable") - .within(() => { - cy.get(interact.APP_ROW_ACTION).eq(0).click() - }) - cy.get(interact.SPECTRUM_MENU).contains("Edit icon").click() - // Select random icon - cy.get(interact.GRID).within(() => { - cy.get(interact.ICON_ITEM).eq(Math.floor(Math.random() * 23) + 1).click() - }) - // Select random colour - cy.get(interact.FILL).click() - cy.get(interact.COLOURSS).within(() => { - cy.get(interact.COLOUR).eq(Math.floor(Math.random() * 33) + 1).click() - }) - cy.intercept('**/applications/**').as('iconChange') - cy.get(interact.SPECTRUM_BUTTON).contains("Save").click({ force: true }) - cy.wait("@iconChange") - cy.get("@iconChange").its('response.statusCode') - .should('eq', 200) - cy.wait(1000) - // Confirm icon has changed from default - // Confirm colour has been applied - There is no default colour - cy.get(".appTable") - .within(() => { - cy.get(interact.AREA_LABEL).eq(0).children() - .should('have.attr', 'xlink:href').and('not.contain', '#spectrum-icon-18-Apps') - cy.get(interact.TITLE).children().children() - .should('have.attr', 'style').and('contains', 'color') - }) - cy.deleteAllApps() - }) - }) -}) diff --git a/packages/builder/cypress/integration/templates/HR/hrTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/HR/hrTemplateDetails.spec.js deleted file mode 100644 index fbac463bfe..0000000000 --- a/packages/builder/cypress/integration/templates/HR/hrTemplateDetails.spec.js +++ /dev/null @@ -1,56 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify HR Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter HR Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="HR"]').click() - }) - }) - - it("should verify the details option for HR templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - - if (templateNameText == "Job Application Tracker") { - // Template name should include 'applicant-tracking-system' - cy.get('a') - .should('have.attr', 'href').and('contain', 'applicant-tracking-system') - } - else if (templateNameText == "Job Portal App") { - // Template name should include 'job-portal' - const templateNameSplit = templateNameParsed.split('-app')[0] - cy.get('a') - .should('have.attr', 'href').and('contain', templateNameSplit) - } - else { - cy.get('a') - .should('have.attr', 'href').and('contain', templateNameParsed) - } - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/integration/templates/HR/jobApplicationTracker.spec.js b/packages/builder/cypress/integration/templates/HR/jobApplicationTracker.spec.js deleted file mode 100644 index 045a85d8f6..0000000000 --- a/packages/builder/cypress/integration/templates/HR/jobApplicationTracker.spec.js +++ /dev/null @@ -1,222 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Job Application Tracker Template Functionality", () => { - const templateName = "Job Application Tracker" - const templateNameParsed = templateName.toLowerCase().replace(/\s+/g, '-') - - before(() => { - cy.login() - cy.deleteApp(templateName) - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`, { - onBeforeLoad(win) { - cy.stub(win, 'open') - } - }) - cy.wait(2000) - }) - - it("should create and publish app with Job Application Tracker template", () => { - // Select Job Application Tracker template - cy.get(".template-thumbnail-text") - .contains(templateName).parentsUntil(".template-grid").within(() => { - cy.get(".spectrum-Button").contains("Use template").click({ force: true }) - }) - - // Confirm URL matches template name - const appUrl = cy.get(".app-server") - appUrl.invoke('text').then(appUrlText => { - expect(appUrlText).to.equal(`${Cypress.config().baseUrl}/app/` + templateNameParsed) - }) - - // Create App - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button").contains("Create app").click({ force: true }) - }) - - // Publish App & Verify it opened - cy.wait(2000) // Wait for app to generate - cy.publishApp(true) - cy.window().its('open').should('be.calledOnce') - }) - - it("should add active/inactive vacancies", () => { - // Visit published app - cy.visit(`${Cypress.config().baseUrl}/app/` + templateNameParsed) - - // loop for active/inactive vacancies - for (let i = 0; i < 2; i++) { - // Vacancies section - cy.get(".links").contains("Vacancies").click({ force: true }) - cy.get(".spectrum-Button").contains("Create New").click() - - // Add inactive vacancy - // Title - cy.get('[data-name="Title"]').within(() => { - cy.get(".spectrum-Textfield").type("Tester") - }) - - // Closing Date - cy.get('[data-name="Closing date"]').within(() => { - cy.get('[aria-label=Calendar]').click({ force: true }) - }) - cy.get("[aria-current=date]").click() - - // Department - cy.get('[data-name="Department"]').within(() => { - cy.get(".spectrum-Picker-label").click() - }) - cy.get(".spectrum-Menu").find('li').its('length').then(len => { - cy.get(".spectrum-Menu-item").eq(Math.floor(Math.random() * len)).click() - }) - - // Employment Type - cy.get('[data-name="Employment type"]').within(() => { - cy.get(".spectrum-Picker-label").click() - }) - cy.get(".spectrum-Menu").find('li').its('length').then(len => { - cy.get(".spectrum-Menu-item").eq(Math.floor(Math.random() * len)).click() - }) - - // Salary - cy.get('[data-name="Salary ($)"]').within(() => { - cy.get(".spectrum-Textfield").type(40000) - }) - - // Description - cy.get('[data-name="Description"]').within(() => { - cy.get(".spectrum-Textfield").type("description") - }) - - // Responsibilities - cy.get('[data-name="Responsibilities"]').within(() => { - cy.get(".spectrum-Textfield").type("Responsibilities") - }) - - // Requirements - cy.get('[data-name="Requirements"]').within(() => { - cy.get(".spectrum-Textfield").type("Requirements") - }) - - // Hiring manager - cy.get('[data-name="Hiring manager"]').within(() => { - cy.get(".spectrum-Picker-label").click() - }) - cy.get(".spectrum-Menu").find('li').its('length').then(len => { - cy.get(".spectrum-Menu-item").eq(Math.floor(Math.random() * len)).click() - }) - - // Active - if (i == 0) { - cy.get('[data-name="Active"]').within(() => { - cy.get(".spectrum-Checkbox-box").click({ force: true }) - }) - } - - // Location - cy.get('[data-name="Location"]').within(() => { - cy.get(".spectrum-Picker-label").click() - }) - cy.get(".spectrum-Menu").find('li').its('length').then(len => { - cy.get(".spectrum-Menu-item").eq(Math.floor(Math.random() * len)).click() - }) - - // Save vacancy - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - cy.wait(1000) - - // Check table was updated - cy.get('[data-name="Vacancies Table"]').eq(i).should('contain', 'Tester') - } - }) - - xit("should filter applications by stage", () => { - // Visit published app - cy.visit(`${Cypress.config().baseUrl}/app/` + templateNameParsed) - cy.wait(1000) - - // Applications section - cy.get(".links").contains("Applications").click({ force: true }) - cy.wait(1000) - - // Filter by stage - Confirm table updates - cy.get(".spectrum-Picker").contains("Filter by stage").click({ force: true }) - cy.get(".spectrum-Menu").find('li').its('length').then(len => { - for (let i = 1; i < len; i++) { - cy.get(".spectrum-Menu-item").eq(i).click() - const stage = cy.get(".spectrum-Picker-label") - stage.invoke('text').then(stageText => { - if (stageText == "1st interview") { - cy.get(".placeholder").should('contain', 'No rows found') - } - else { - cy.get(".spectrum-Table-row").should('contain', stageText) - } - cy.get(".spectrum-Picker").contains(stageText).click({ force: true }) - }) - } - }) - }) - - xit("should edit an application", () => { - // Switch application from not hired to hired - // Visit published app - cy.visit(`${Cypress.config().baseUrl}/app/` + templateNameParsed) - cy.wait(1000) - - // Not Hired section - cy.get(".links").contains("Not hired").click({ force: true }) - cy.wait(500) - - // View application - cy.get(".spectrum-Table").within(() => { - cy.get(".spectrum-Button").contains("View").click({ force: true }) - cy.wait(500) - }) - - // Update value for 'Staged' - cy.get('[data-name="Stage"]').within(() => { - cy.get(".spectrum-Picker-label").click() - }) - cy.get(".spectrum-Menu").within(() => { - cy.get(".spectrum-Menu-item").contains("Hired").click() - }) - - // Save application - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - cy.wait(500) - - // Hired section - cy.get(".links").contains("Hired").click({ force: true }) - cy.wait(500) - - // Verify Table size - Total rows = 2 - cy.get(".spectrum-Table").find(".spectrum-Table-row").its('length').then((len => { - expect(len).to.eq(2) - })) - }) - - xit("should delete an application", () => { - // Visit published app - cy.visit(`${Cypress.config().baseUrl}/app/` + templateNameParsed) - cy.wait(1000) - - // Hired section - cy.get(".links").contains("Hired").click({ force: true }) - cy.wait(500) - - // View first application - cy.get(".spectrum-Table-row").eq(0).within(() => { - cy.get(".spectrum-Button").contains("View").click({ force: true }) - cy.wait(500) - }) - - // Delete application - cy.get(".spectrum-Button").contains("Delete").click({ force: true }) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button").contains("Confirm").click() - }) - }) - }) -}) diff --git a/packages/builder/cypress/integration/templates/IT/ITTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/IT/ITTemplateDetails.spec.js deleted file mode 100644 index 84cbc5707e..0000000000 --- a/packages/builder/cypress/integration/templates/IT/ITTemplateDetails.spec.js +++ /dev/null @@ -1,60 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify IT Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter IT Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="IT"]').click() - }) - }) - - it("should verify the details option for IT templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - // Verify template name is within details link - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - - if (templateNameText == "Hashicorp Scorecard Template") { - const templateNameSplit = templateNameParsed.split('-template')[0] - cy.get('a') - .should('have.attr', 'href').and('contain', templateNameSplit) - } - else if (templateNameText == "IT Ticketing System") { - const templateNameSplit = templateNameParsed.split('it-')[1] - cy.get('a') - .should('have.attr', 'href').and('contain', templateNameSplit) - } - else if (templateNameText == "IT Incident Report Form") { - const templateNameSplit = templateNameParsed.split('-form')[0] - cy.get('a') - .should('have.attr', 'href').and('contain', templateNameSplit) - } - else { - cy.get('a').should('have.attr', 'href').and('contain', templateNameParsed) - } - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/integration/templates/IT/ITTicketingSystem.spec.js b/packages/builder/cypress/integration/templates/IT/ITTicketingSystem.spec.js deleted file mode 100644 index 15628ab131..0000000000 --- a/packages/builder/cypress/integration/templates/IT/ITTicketingSystem.spec.js +++ /dev/null @@ -1,72 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("IT Ticketing System Template Functionality", () => { - const templateName = "IT Ticketing System" - const templateNameParsed = templateName.toLowerCase().replace(/\s+/g, '-') - - before(() => { - cy.login() - cy.deleteApp(templateName) - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`, { - onBeforeLoad(win) { - cy.stub(win, 'open') - } - }) - cy.wait(2000) - }) - - it("should create and publish app with IT Ticketing System template", () => { - // Select IT Ticketing System template - cy.get(".template-thumbnail-text") - .contains(templateName).parentsUntil(".template-grid").within(() => { - cy.get(".spectrum-Button").contains("Use template").click({ force: true }) - }) - - // Confirm URL matches template name - const appUrl = cy.get(".app-server") - appUrl.invoke('text').then(appUrlText => { - expect(appUrlText).to.equal(`${Cypress.config().baseUrl}/app/` + templateNameParsed) - }) - - // Create App - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button").contains("Create app").click({ force: true }) - }) - - // Publish App & Verify it opened - cy.wait(2000) // Wait for app to generate - cy.publishApp(true) - cy.window().its('open').should('be.calledOnce') - }) - - xit("should filter tickets by status", () => { - // Visit published app - cy.visit(`${Cypress.config().baseUrl}/app/` + templateNameParsed) - cy.wait(1000) - - // Tickets section - cy.get(".links").contains("Tickets").click({ force: true }) - cy.wait(1000) - - // Filter by stage - Confirm table updates - cy.get(".spectrum-Picker").contains("Filter by status").click({ force: true }) - cy.get(".spectrum-Menu").find('li').its('length').then(len => { - for (let i = 1; i < len; i++) { - cy.get(".spectrum-Menu-item").eq(i).click() - const stage = cy.get(".spectrum-Picker-label") - stage.invoke('text').then(stageText => { - if (stageText == "In progress" || stageText == "On hold" || stageText == "Triaged") { - cy.get(".placeholder").should('contain', 'No rows found') - } - else { - cy.get(".spectrum-Table-row").should('contain', stageText) - } - cy.get(".spectrum-Picker").contains(stageText).click({ force: true }) - }) - } - }) - }) - }) -}) diff --git a/packages/builder/cypress/integration/templates/adminPanels/adminPanelsTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/adminPanels/adminPanelsTemplateDetails.spec.js deleted file mode 100644 index 2fa57b2c89..0000000000 --- a/packages/builder/cypress/integration/templates/adminPanels/adminPanelsTemplateDetails.spec.js +++ /dev/null @@ -1,42 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify Admin Panel Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter Admin Panels Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="Admin Panels"]').click() - }) - }) - - it("should verify the details option for Admin Panels templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - // Verify template name is within details link - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - cy.get('a').should('have.attr', 'href').and('contain', templateNameParsed) - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/integration/templates/approvalApps/approvalAppsTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/approvalApps/approvalAppsTemplateDetails.spec.js deleted file mode 100644 index 322a17f6c2..0000000000 --- a/packages/builder/cypress/integration/templates/approvalApps/approvalAppsTemplateDetails.spec.js +++ /dev/null @@ -1,51 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify Aproval Apps Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter Approval Apps Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="Approval Apps"]').click() - }) - }) - - it("should verify the details option for Approval Apps templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - // Verify template name is within details link - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - - if (templateNameText == "Content Approval System") { - // Template name should include 'content-approval' - const templateNameSplit = templateNameParsed.split('-system')[0] - cy.get('a') - .should('have.attr', 'href').and('contain', templateNameSplit) - } - else { - cy.get('a').should('have.attr', 'href').and('contain', templateNameParsed) - } - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/integration/templates/businessApps/businessAppsTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/businessApps/businessAppsTemplateDetails.spec.js deleted file mode 100644 index 734fb9a968..0000000000 --- a/packages/builder/cypress/integration/templates/businessApps/businessAppsTemplateDetails.spec.js +++ /dev/null @@ -1,51 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify Business Apps Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter Business Apps Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="Business Apps"]').click() - }) - }) - - it("should verify the details option for Business Apps templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - // Verify template name is within details link - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - - if (templateNameText == "Employee Check-in/Check-Out Template") { - // Remove / from template name - const templateNameReplace = templateNameParsed.replace(/\//g, "-") - cy.get('a') - .should('have.attr', 'href').and('contain', templateNameReplace) - } - else { - cy.get('a').should('have.attr', 'href').and('contain', templateNameParsed) - } - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/integration/templates/directories/directoriesTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/directories/directoriesTemplateDetails.spec.js deleted file mode 100644 index dc874fcbaf..0000000000 --- a/packages/builder/cypress/integration/templates/directories/directoriesTemplateDetails.spec.js +++ /dev/null @@ -1,44 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify Directories Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter Directories Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="Directories"]').click() - }) - }) - - it("should verify the details option for Directories templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - // Verify template name is within details link - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - const templateNameSplit = templateNameParsed.split('-template')[0] - cy.get('a') - .should('have.attr', 'href').and('contain', templateNameSplit) - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/integration/templates/forms/formsTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/forms/formsTemplateDetails.spec.js deleted file mode 100644 index 3206a71f6e..0000000000 --- a/packages/builder/cypress/integration/templates/forms/formsTemplateDetails.spec.js +++ /dev/null @@ -1,42 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify Forms Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter Forms Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="Forms"]').click() - }) - }) - - it("should verify the details option for Forms templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - // Verify template name is within details link - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - cy.get('a').should('have.attr', 'href').and('contain', templateNameParsed) - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/integration/templates/healthcare/healthcareTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/healthcare/healthcareTemplateDetails.spec.js deleted file mode 100644 index b46bb46274..0000000000 --- a/packages/builder/cypress/integration/templates/healthcare/healthcareTemplateDetails.spec.js +++ /dev/null @@ -1,43 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify Healthcare Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter Healthcare Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="Healthcare"]').click() - }) - }) - - it("should verify the details option for Healthcare templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - // Verify template name is within details link - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - - cy.get('a').should('have.attr', 'href').and('contain', templateNameParsed) - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/integration/templates/legal/legalTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/legal/legalTemplateDetails.spec.js deleted file mode 100644 index 57485aee40..0000000000 --- a/packages/builder/cypress/integration/templates/legal/legalTemplateDetails.spec.js +++ /dev/null @@ -1,42 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify Legal Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter Legal Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="Legal"]').click() - }) - }) - - it("should verify the details option for Legal templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - // Verify template name is within details link - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - cy.get('a').should('have.attr', 'href').and('contain', templateNameParsed) - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/integration/templates/logistics/logisticsTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/logistics/logisticsTemplateDetails.spec.js deleted file mode 100644 index e5d5745e4e..0000000000 --- a/packages/builder/cypress/integration/templates/logistics/logisticsTemplateDetails.spec.js +++ /dev/null @@ -1,42 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify Logistics Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter Logistics Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="Logistics"]').click() - }) - }) - - it("should verify the details option for Logistics templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - // Verify template name is within details link - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - cy.get('a').should('have.attr', 'href').and('contain', templateNameParsed) - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/integration/templates/manufacturing/manufacturingTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/manufacturing/manufacturingTemplateDetails.spec.js deleted file mode 100644 index 30019c87fd..0000000000 --- a/packages/builder/cypress/integration/templates/manufacturing/manufacturingTemplateDetails.spec.js +++ /dev/null @@ -1,42 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify Manufacturing Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter Manufacturing Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="Manufacturing"]').click() - }) - }) - - it("should verify the details option for Manufacturing templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - // Verify template name is within details link - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - cy.get('a').should('have.attr', 'href').and('contain', templateNameParsed) - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/integration/templates/marketing/leadGenerationForm.spec.js b/packages/builder/cypress/integration/templates/marketing/leadGenerationForm.spec.js deleted file mode 100644 index 9f08b36d56..0000000000 --- a/packages/builder/cypress/integration/templates/marketing/leadGenerationForm.spec.js +++ /dev/null @@ -1,44 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Lead Generation Form Template Functionality", () => { - const templateName = "Lead Generation Form" - const templateNameParsed = templateName.toLowerCase().replace(/\s+/g, '-') - - before(() => { - cy.login() - cy.deleteApp(templateName) - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`, { - onBeforeLoad(win) { - cy.stub(win, 'open') - } - }) - cy.wait(2000) - }) - - it("should create and publish app with Lead Generation Form template", () => { - // Select Lead Generation Form template - cy.get(".template-thumbnail-text") - .contains(templateName).parentsUntil(".template-grid").within(() => { - cy.get(".spectrum-Button").contains("Use template").click({ force: true }) - }) - - // Confirm URL matches template name - const appUrl = cy.get(".app-server") - appUrl.invoke('text').then(appUrlText => { - expect(appUrlText).to.equal(`${Cypress.config().baseUrl}/app/` + templateNameParsed) - }) - - // Create App - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button").contains("Create app").click({ force: true }) - }) - - // Publish App & Verify it opened - cy.wait(2000) // Wait for app to generate - cy.publishApp(true) - cy.window().its('open').should('be.calledOnce') - }) - }) -}) diff --git a/packages/builder/cypress/integration/templates/marketing/marketingTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/marketing/marketingTemplateDetails.spec.js deleted file mode 100644 index 66875e6939..0000000000 --- a/packages/builder/cypress/integration/templates/marketing/marketingTemplateDetails.spec.js +++ /dev/null @@ -1,51 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify Marketing Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter Marketing Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="Marketing"]').click() - }) - }) - - it("should verify the details option for Marketing templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - // Verify template name is within details link - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - - if (templateNameText == "Lead Generation Form") { - // Multi-step lead form - // Template name includes 'multi-step-lead-form' - cy.get('a') - .should('have.attr', 'href').and('contain', 'multi-step-lead-form') - } - else { - cy.get('a').should('have.attr', 'href').and('contain', templateNameParsed) - } - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/integration/templates/operations/operationsTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/operations/operationsTemplateDetails.spec.js deleted file mode 100644 index 1a2ee1703a..0000000000 --- a/packages/builder/cypress/integration/templates/operations/operationsTemplateDetails.spec.js +++ /dev/null @@ -1,42 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify Operations Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter Operations Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="Operations"]').click() - }) - }) - - it("should verify the details option for Operations templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - // Verify template name is within details link - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - cy.get('a').should('have.attr', 'href').and('contain', templateNameParsed) - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/integration/templates/portals/portalsTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/portals/portalsTemplateDetails.spec.js deleted file mode 100644 index e81e12318d..0000000000 --- a/packages/builder/cypress/integration/templates/portals/portalsTemplateDetails.spec.js +++ /dev/null @@ -1,71 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify Portals Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter Portal Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="Portal"]').click() - }) - }) - - it("should verify the details option for Portal templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - cy.get('a') - .should('have.attr', 'href').and('contain', templateNameParsed) - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) - - it("should verify the details option for Portals templates", () => { - // Filter Portals Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="Portals"]').click() - }) - - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - cy.get('a') - .should('have.attr', 'href').and('contain', templateNameParsed) - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/integration/templates/professionalServices/professionalServicesTemplateDetails.spec.js b/packages/builder/cypress/integration/templates/professionalServices/professionalServicesTemplateDetails.spec.js deleted file mode 100644 index 1267d8bd5c..0000000000 --- a/packages/builder/cypress/integration/templates/professionalServices/professionalServicesTemplateDetails.spec.js +++ /dev/null @@ -1,42 +0,0 @@ -import filterTests from "../../../support/filterTests" - -filterTests(["all"], () => { - context("Verify Professional Services Template Details", () => { - - before(() => { - cy.login() - - // Template navigation - cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`) - - // Filter Professional Services Templates - cy.get(".template-category-filters").within(() => { - cy.get('[data-cy="Professional Services"]').click() - }) - }) - - it("should verify the details option for Professional Services templates", () => { - cy.get(".template-grid").find(".template-card").its('length') - .then(len => { - // Verify template name is within details link - for (let i = 0; i < len; i++) { - cy.get(".template-card").eq(i).within(() => { - const templateName = cy.get(".template-thumbnail-text") - templateName.invoke('text') - .then(templateNameText => { - const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-') - cy.get('a').should('have.attr', 'href').and('contain', templateNameParsed) - }) - // Verify correct status from Details link - 200 - cy.get('a') - .then(link => { - cy.request(link.prop('href')) - .its('status') - .should('eq', 200) - }) - }) - } - }) - }) -}) -}) diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index d50364fd54..804b22f0fc 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -1,14 +1,8 @@ -// *********************************************** -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// - Cypress.on("uncaught:exception", () => { return false }) +// ACCOUNTS & USERS Cypress.Commands.add("login", () => { cy.visit(`${Cypress.config().baseUrl}/builder`) cy.wait(2000) @@ -41,43 +35,20 @@ Cypress.Commands.add("logOut", () => { cy.wait(2000) }) -Cypress.Commands.add("closeModal", () => { - cy.get(".spectrum-Modal").within(() => { - cy.get(".close-icon").click() - cy.wait(1000) // Wait for modal to close - }) -}) +Cypress.Commands.add("createUser", email => { + // quick hacky recorded way to create a user + cy.contains("Users").click() + cy.get(`[data-cy="add-user"]`).click() + cy.get(".spectrum-Picker-label").click() + cy.get(".spectrum-Menu-item:nth-child(2) > .spectrum-Menu-itemLabel").click() -Cypress.Commands.add("importApp", (exportFilePath, name) => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - - 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(5000) - }) + //Onboarding type selector + cy.get( + ":nth-child(2) > .spectrum-Form-itemField > .spectrum-Textfield > .spectrum-Textfield-input" + ) + .first() + .type(email, { force: true }) + cy.get(".spectrum-Button--cta").click({ force: true }) }) Cypress.Commands.add("updateUserInformation", (firstName, lastName) => { @@ -113,6 +84,13 @@ Cypress.Commands.add("updateUserInformation", (firstName, lastName) => { }) }) +// 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 @@ -218,57 +196,6 @@ Cypress.Commands.add("deleteAllApps", () => { }) }) -Cypress.Commands.add("customiseAppIcon", () => { - // Select random icon - 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) - cy.wait(1000) -}) - -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("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("unlockApp", unlock_config => { let config = { ...unlock_config } @@ -298,6 +225,26 @@ Cypress.Commands.add("unlockApp", unlock_config => { }) }) +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") @@ -321,34 +268,96 @@ Cypress.Commands.add("publishApp", resolvedAppPath => { }) }) -Cypress.Commands.add("createTestApp", () => { - const appName = "Cypress Tests" - cy.deleteApp(appName) - cy.createApp(appName, "This app is used for Cypress testing.") - //cy.createScreen("home") +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("createTestTableWithData", () => { - cy.createTable("dog") - cy.addColumn("dog", "name", "Text") - cy.addColumn("dog", "age", "Number") -}) +Cypress.Commands.add("importApp", (exportFilePath, name) => { + cy.visit(`${Cypress.config().baseUrl}/builder`) -Cypress.Commands.add("publishApp", (viewApp = false) => { - cy.get(".toprightnav").contains("Publish").click({ force: true }) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button").contains("Publish").click({ force: true }) - }) - cy.wait(2000) // Wait for App to publish and modal to appear - cy.get(".spectrum-Dialog-grid").within(() => { - if (viewApp) { - cy.get(".spectrum-Button").contains("View App").click({ force: true }) - } else { - cy.get(".spectrum-Button").contains("Done").click({ force: true }) + 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(5000) }) }) +// Filters visible with 1 or more +Cypress.Commands.add("searchForApplication", appName => { + cy.visit(`${Cypress.config().baseUrl}/builder`) + 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(".filter").then(() => { + cy.get(".spectrum-Textfield").within(() => { + cy.get("input").eq(0).clear() + cy.get("input").eq(0).type(appName) + }) + }) + } + }) +}) + +// Assumes there are no others +Cypress.Commands.add("applicationInAppTable", appName => { + cy.get(".appTable").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) => { if (!initialTable) { cy.navigateToDataSection() @@ -369,6 +378,12 @@ Cypress.Commands.add("createTable", (tableName, initialTable) => { cy.contains(tableName).should("be.visible") }) +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) => { @@ -423,22 +438,33 @@ Cypress.Commands.add("addRowMultiValue", values => { }) }) -Cypress.Commands.add("createUser", email => { - // quick hacky recorded way to create a user - cy.contains("Users").click() - cy.get(`[data-cy="add-user"]`).click() - cy.get(".spectrum-Picker-label").click() - cy.get(".spectrum-Menu-item:nth-child(2) > .spectrum-Menu-itemLabel").click() - - //Onboarding type selector - cy.get( - ":nth-child(2) > .spectrum-Form-itemField > .spectrum-Textfield > .spectrum-Textfield-input" - ) - .first() - .type(email, { force: true }) - cy.get(".spectrum-Button--cta").click({ force: true }) +Cypress.Commands.add("selectTable", tableName => { + cy.expandBudibaseConnection() + cy.contains(".nav-item", tableName).click() }) +Cypress.Commands.add("addCustomSourceOptions", totalOptions => { + cy.get(".spectrum-ActionButton") + .contains("Define Options") + .click() + .then(() => { + for (let i = 0; i < totalOptions; i++) { + // Add radio button options + cy.get(".spectrum-Button") + .contains("Add Option") + .click({ force: true }) + .then(() => { + cy.wait(500) + cy.get("[placeholder='Label']").eq(i).type(i) + cy.get("[placeholder='Value']").eq(i).type(i) + }) + } + // Save options + cy.get(".spectrum-Button").contains("Save").click({ force: true }) + }) +}) + +// DESIGN AREA Cypress.Commands.add("addComponent", (category, component) => { if (category) { cy.get(`[data-cy="category-${category}"]`).click({ force: true }) @@ -466,22 +492,8 @@ Cypress.Commands.add("getComponent", componentId => { .find(`[data-id=${componentId}]`) }) -Cypress.Commands.add("navigateToFrontend", () => { - // Clicks on Design tab and then the Home nav item - cy.wait(1000) - cy.contains("Design").click() - cy.get(".spectrum-Search").type("/") - cy.get(".nav-item").contains("home").click() -}) - -Cypress.Commands.add("navigateToDataSection", () => { - // Clicks on the Data tab - cy.wait(500) - cy.contains("Data").click() -}) - -//Blank Cypress.Commands.add("createScreen", (route, accessLevelLabel) => { + // Blank Screen cy.contains("Design").click() cy.get("[aria-label=AddCircle]").click() cy.get(".spectrum-Modal").within(() => { @@ -541,17 +553,6 @@ Cypress.Commands.add( } ) -Cypress.Commands.add("navigateToAutogeneratedModal", () => { - // Screen name must already exist within data source - cy.contains("Design").click() - cy.get("[aria-label=AddCircle]").click() - cy.get(".spectrum-Modal").within(() => { - cy.get(".item").contains("Autogenerated screens").click() - cy.get(".spectrum-Button").contains("Continue").click({ force: true }) - cy.wait(500) - }) -}) - Cypress.Commands.add( "createAutogeneratedScreens", (screenNames, accessLevelLabel) => { @@ -573,96 +574,33 @@ Cypress.Commands.add( } ) -Cypress.Commands.add("addRow", values => { - cy.contains("Create row").click() +// NAVIGATION +Cypress.Commands.add("navigateToFrontend", () => { + // Clicks on Design tab and then the Home nav item + cy.wait(1000) + cy.contains("Design").click() + cy.get(".spectrum-Search").type("/") + cy.get(".nav-item").contains("home").click() +}) + +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 data source + cy.contains("Design").click() + cy.get("[aria-label=AddCircle]").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() + cy.get(".item").contains("Autogenerated screens").click() + cy.get(".spectrum-Button").contains("Continue").click({ force: true }) + cy.wait(500) }) }) -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() - } -}) - -Cypress.Commands.add("selectTable", tableName => { - cy.expandBudibaseConnection() - cy.contains(".nav-item", tableName).click() -}) - -Cypress.Commands.add("addCustomSourceOptions", totalOptions => { - cy.get(".spectrum-ActionButton") - .contains("Define Options") - .click() - .then(() => { - for (let i = 0; i < totalOptions; i++) { - // Add radio button options - cy.get(".spectrum-Button") - .contains("Add Option") - .click({ force: true }) - .then(() => { - cy.wait(500) - cy.get("[placeholder='Label']").eq(i).type(i) - cy.get("[placeholder='Value']").eq(i).type(i) - }) - } - // Save options - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - }) -}) - -//Filters visible with 1 or more -Cypress.Commands.add("searchForApplication", appName => { - cy.visit(`${Cypress.config().baseUrl}/builder`) - 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(".filter").then(() => { - cy.get(".spectrum-Textfield").within(() => { - cy.get("input").eq(0).clear() - cy.get("input").eq(0).type(appName) - }) - }) - } - }) -}) - -//Assumes there are no others -Cypress.Commands.add("applicationInAppTable", appName => { - cy.get(".appTable").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) -}) - +// DATASOURCES Cypress.Commands.add("selectExternalDatasource", datasourceName => { // Navigates to Data Section cy.navigateToDataSection() @@ -798,3 +736,18 @@ Cypress.Commands.add("createRestQuery", (method, restUrl, queryPrettyName) => { .should("contain", method) .and("contain", queryPrettyName) }) + +// MISC +Cypress.Commands.add("closeModal", () => { + cy.get(".spectrum-Modal").within(() => { + cy.get(".close-icon").click() + cy.wait(1000) // Wait for modal to close + }) +}) + +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/interact.js b/packages/builder/cypress/support/interact.js index 1f55956450..4a70b2fa8c 100644 --- a/packages/builder/cypress/support/interact.js +++ b/packages/builder/cypress/support/interact.js @@ -26,6 +26,7 @@ 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]" @@ -33,13 +34,14 @@ 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_CONTRO = "[data-cy=font-size-prop-control]" +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" @@ -53,6 +55,8 @@ export const NAV_ITEMS_CONTAINER = ".nav-items-container" //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]" diff --git a/packages/builder/package.json b/packages/builder/package.json index de0faa2880..d07431b74d 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.0.191-alpha.0", + "version": "1.0.192-alpha.5", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.0.191-alpha.0", - "@budibase/client": "^1.0.191-alpha.0", - "@budibase/frontend-core": "^1.0.191-alpha.0", - "@budibase/string-templates": "^1.0.191-alpha.0", + "@budibase/bbui": "^1.0.192-alpha.5", + "@budibase/client": "^1.0.192-alpha.5", + "@budibase/frontend-core": "^1.0.192-alpha.5", + "@budibase/string-templates": "^1.0.192-alpha.5", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/builder/src/components/backend/DatasourceNavigator/icons/Snowflake.svelte b/packages/builder/src/components/backend/DatasourceNavigator/icons/Snowflake.svelte new file mode 100644 index 0000000000..fed9025126 --- /dev/null +++ b/packages/builder/src/components/backend/DatasourceNavigator/icons/Snowflake.svelte @@ -0,0 +1,50 @@ + + + diff --git a/packages/builder/src/components/backend/DatasourceNavigator/icons/index.js b/packages/builder/src/components/backend/DatasourceNavigator/icons/index.js index 1a8df2507e..8003317212 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/icons/index.js +++ b/packages/builder/src/components/backend/DatasourceNavigator/icons/index.js @@ -14,6 +14,7 @@ import Oracle from "./Oracle.svelte" import GoogleSheets from "./GoogleSheets.svelte" import Firebase from "./Firebase.svelte" import Redis from "./Redis.svelte" +import Snowflake from "./Snowflake.svelte" export default { BUDIBASE: Budibase, @@ -32,4 +33,5 @@ export default { GOOGLE_SHEETS: GoogleSheets, FIREBASE: Firebase, REDIS: Redis, + SNOWFLAKE: Snowflake, } diff --git a/packages/builder/src/components/deploy/DeployModal.svelte b/packages/builder/src/components/deploy/DeployModal.svelte index 0d9bfb7539..ed2687579e 100644 --- a/packages/builder/src/components/deploy/DeployModal.svelte +++ b/packages/builder/src/components/deploy/DeployModal.svelte @@ -101,7 +101,7 @@ confirmText="Done" cancelText="View App" onCancel={viewApp} - dataCy={"deploy-app-success-modal"} + dataCy="deploy-app-success-modal" >