mirror of https://github.com/Budibase/budibase.git
95 changed files with 2477 additions and 408 deletions
@ -0,0 +1,61 @@ |
|||
const { |
|||
generateAppID, |
|||
getDevelopmentAppID, |
|||
getProdAppID, |
|||
isDevAppID, |
|||
isProdAppID, |
|||
} = require("../utils") |
|||
|
|||
function getID() { |
|||
const appId = generateAppID() |
|||
const split = appId.split("_") |
|||
const uuid = split[split.length - 1] |
|||
const devAppId = `app_dev_${uuid}` |
|||
return { appId, devAppId, split, uuid } |
|||
} |
|||
|
|||
describe("app ID manipulation", () => { |
|||
it("should be able to generate a new app ID", () => { |
|||
expect(generateAppID().startsWith("app_")).toEqual(true) |
|||
}) |
|||
|
|||
it("should be able to convert a production app ID to development", () => { |
|||
const { appId, uuid } = getID() |
|||
expect(getDevelopmentAppID(appId)).toEqual(`app_dev_${uuid}`) |
|||
}) |
|||
|
|||
it("should be able to convert a development app ID to development", () => { |
|||
const { devAppId, uuid } = getID() |
|||
expect(getDevelopmentAppID(devAppId)).toEqual(`app_dev_${uuid}`) |
|||
}) |
|||
|
|||
it("should be able to convert a development ID to a production", () => { |
|||
const { devAppId, uuid } = getID() |
|||
expect(getProdAppID(devAppId)).toEqual(`app_${uuid}`) |
|||
}) |
|||
|
|||
it("should be able to convert a production ID to production", () => { |
|||
const { appId, uuid } = getID() |
|||
expect(getProdAppID(appId)).toEqual(`app_${uuid}`) |
|||
}) |
|||
|
|||
it("should be able to confirm dev app ID is development", () => { |
|||
const { devAppId } = getID() |
|||
expect(isDevAppID(devAppId)).toEqual(true) |
|||
}) |
|||
|
|||
it("should be able to confirm prod app ID is not development", () => { |
|||
const { appId } = getID() |
|||
expect(isDevAppID(appId)).toEqual(false) |
|||
}) |
|||
|
|||
it("should be able to confirm prod app ID is prod", () => { |
|||
const { appId } = getID() |
|||
expect(isProdAppID(appId)).toEqual(true) |
|||
}) |
|||
|
|||
it("should be able to confirm dev app ID is not prod", () => { |
|||
const { devAppId } = getID() |
|||
expect(isProdAppID(devAppId)).toEqual(false) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,62 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify HR Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
|
|||
// 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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,239 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Job Application Functionality", () => { |
|||
const templateName = "Job Application Tracker" |
|||
const templateNameParsed = templateName.toLowerCase().replace(/\s+/g, '-') |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
cy.deleteApp(templateName) |
|||
cy.visit(`${Cypress.config().baseUrl}/builder`, { |
|||
onBeforeLoad(win) { |
|||
cy.stub(win, 'open') |
|||
} |
|||
}) |
|||
cy.wait(2000) |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
}) |
|||
|
|||
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
|
|||
cy.wait(2000) // Wait for app to generate
|
|||
cy.get(".toprightnav").contains("Publish").click({ force: true }) |
|||
cy.get(".spectrum-Dialog-grid").within(() => { |
|||
cy.get(".spectrum-Button").contains("Publish").click({ force: true }) |
|||
}) |
|||
|
|||
// Verify Published app
|
|||
cy.wait(2000) // Wait for App to publish and modal to appear
|
|||
cy.get(".spectrum-Dialog-grid").within(() => { |
|||
cy.get(".spectrum-Button").contains("View App").click({ force: 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() |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,66 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify IT Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
|
|||
// 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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,48 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify Admin Panel Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
|
|||
// 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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,57 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify Aproval Apps Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
|
|||
// 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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,57 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify Business Apps Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
|
|||
// 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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,50 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify Directories Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
|
|||
// 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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,48 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify Forms Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
|
|||
// 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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,49 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify Healthcare Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
|
|||
// 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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,48 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify Legal Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
|
|||
// 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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,48 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify Logistics Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
|
|||
// 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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,48 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify Manufacturing Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
|
|||
// 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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,57 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify Marketing Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
|
|||
// 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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,48 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify Operations Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
|
|||
// 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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,77 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify Portals Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
}) |
|||
|
|||
it("should verify the details option for Portal templates", () => { |
|||
// Filter Portal Templates
|
|||
cy.get(".template-category-filters").within(() => { |
|||
cy.get('[data-cy="Portal"]').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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
|
|||
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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,48 @@ |
|||
import filterTests from "../../../support/filterTests" |
|||
|
|||
filterTests(["all"], () => { |
|||
context("Verify Professional Services Template Details", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
|
|||
// Template navigation
|
|||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|||
.its("body") |
|||
.then(val => { |
|||
if (val.length > 0) { |
|||
cy.get(".spectrum-Button").contains("Templates").click({force: true}) |
|||
} |
|||
}) |
|||
|
|||
// 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) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,145 @@ |
|||
<script> |
|||
export let width = 100 |
|||
export let height = 100 |
|||
</script> |
|||
|
|||
<svg |
|||
{width} |
|||
{height} |
|||
viewBox="0 0 46 46" |
|||
version="1.1" |
|||
xmlns="http://www.w3.org/2000/svg" |
|||
xmlns:xlink="http://www.w3.org/1999/xlink" |
|||
xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" |
|||
> |
|||
<!-- Generator: Sketch 3.3.3 (12081) - http://www.bohemiancoding.com/sketch --> |
|||
<title>btn_google_dark_normal_ios</title> |
|||
<desc>Created with Sketch.</desc> |
|||
<defs> |
|||
<filter |
|||
x="-50%" |
|||
y="-50%" |
|||
width="200%" |
|||
height="200%" |
|||
filterUnits="objectBoundingBox" |
|||
id="filter-1" |
|||
> |
|||
<feOffset dx="0" dy="1" in="SourceAlpha" result="shadowOffsetOuter1" /> |
|||
<feGaussianBlur |
|||
stdDeviation="0.5" |
|||
in="shadowOffsetOuter1" |
|||
result="shadowBlurOuter1" |
|||
/> |
|||
<feColorMatrix |
|||
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.168 0" |
|||
in="shadowBlurOuter1" |
|||
type="matrix" |
|||
result="shadowMatrixOuter1" |
|||
/> |
|||
<feOffset dx="0" dy="0" in="SourceAlpha" result="shadowOffsetOuter2" /> |
|||
<feGaussianBlur |
|||
stdDeviation="0.5" |
|||
in="shadowOffsetOuter2" |
|||
result="shadowBlurOuter2" |
|||
/> |
|||
<feColorMatrix |
|||
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.084 0" |
|||
in="shadowBlurOuter2" |
|||
type="matrix" |
|||
result="shadowMatrixOuter2" |
|||
/> |
|||
<feMerge> |
|||
<feMergeNode in="shadowMatrixOuter1" /> |
|||
<feMergeNode in="shadowMatrixOuter2" /> |
|||
<feMergeNode in="SourceGraphic" /> |
|||
</feMerge> |
|||
</filter> |
|||
<rect id="path-2" x="0" y="0" width="40" height="40" rx="2" /> |
|||
<rect id="path-3" x="5" y="5" width="38" height="38" rx="1" /> |
|||
</defs> |
|||
<g |
|||
id="Google-Button" |
|||
stroke="none" |
|||
stroke-width="1" |
|||
fill="none" |
|||
fill-rule="evenodd" |
|||
sketch:type="MSPage" |
|||
> |
|||
<g |
|||
id="9-PATCH" |
|||
sketch:type="MSArtboardGroup" |
|||
transform="translate(-608.000000, -219.000000)" |
|||
/> |
|||
<g |
|||
id="btn_google_dark_normal" |
|||
sketch:type="MSArtboardGroup" |
|||
transform="translate(-1.000000, -1.000000)" |
|||
> |
|||
<g |
|||
id="button" |
|||
sketch:type="MSLayerGroup" |
|||
transform="translate(4.000000, 4.000000)" |
|||
filter="url(#filter-1)" |
|||
> |
|||
<g id="button-bg"> |
|||
<use |
|||
fill="#4285F4" |
|||
fill-rule="evenodd" |
|||
sketch:type="MSShapeGroup" |
|||
xlink:href="#path-2" |
|||
/> |
|||
<use fill="none" xlink:href="#path-2" /> |
|||
<use fill="none" xlink:href="#path-2" /> |
|||
<use fill="none" xlink:href="#path-2" /> |
|||
</g> |
|||
</g> |
|||
<g id="button-bg-copy"> |
|||
<use |
|||
fill="#FFFFFF" |
|||
fill-rule="evenodd" |
|||
sketch:type="MSShapeGroup" |
|||
xlink:href="#path-3" |
|||
/> |
|||
<use fill="none" xlink:href="#path-3" /> |
|||
<use fill="none" xlink:href="#path-3" /> |
|||
<use fill="none" xlink:href="#path-3" /> |
|||
</g> |
|||
<g |
|||
id="logo_googleg_48dp" |
|||
sketch:type="MSLayerGroup" |
|||
transform="translate(15.000000, 15.000000)" |
|||
> |
|||
<path |
|||
d="M17.64,9.20454545 C17.64,8.56636364 17.5827273,7.95272727 17.4763636,7.36363636 L9,7.36363636 L9,10.845 L13.8436364,10.845 C13.635,11.97 13.0009091,12.9231818 12.0477273,13.5613636 L12.0477273,15.8195455 L14.9563636,15.8195455 C16.6581818,14.2527273 17.64,11.9454545 17.64,9.20454545 L17.64,9.20454545 Z" |
|||
id="Shape" |
|||
fill="#4285F4" |
|||
sketch:type="MSShapeGroup" |
|||
/> |
|||
<path |
|||
d="M9,18 C11.43,18 13.4672727,17.1940909 14.9563636,15.8195455 L12.0477273,13.5613636 C11.2418182,14.1013636 10.2109091,14.4204545 9,14.4204545 C6.65590909,14.4204545 4.67181818,12.8372727 3.96409091,10.71 L0.957272727,10.71 L0.957272727,13.0418182 C2.43818182,15.9831818 5.48181818,18 9,18 L9,18 Z" |
|||
id="Shape" |
|||
fill="#34A853" |
|||
sketch:type="MSShapeGroup" |
|||
/> |
|||
<path |
|||
d="M3.96409091,10.71 C3.78409091,10.17 3.68181818,9.59318182 3.68181818,9 C3.68181818,8.40681818 3.78409091,7.83 3.96409091,7.29 L3.96409091,4.95818182 L0.957272727,4.95818182 C0.347727273,6.17318182 0,7.54772727 0,9 C0,10.4522727 0.347727273,11.8268182 0.957272727,13.0418182 L3.96409091,10.71 L3.96409091,10.71 Z" |
|||
id="Shape" |
|||
fill="#FBBC05" |
|||
sketch:type="MSShapeGroup" |
|||
/> |
|||
<path |
|||
d="M9,3.57954545 C10.3213636,3.57954545 11.5077273,4.03363636 12.4404545,4.92545455 L15.0218182,2.34409091 C13.4631818,0.891818182 11.4259091,0 9,0 C5.48181818,0 2.43818182,2.01681818 0.957272727,4.95818182 L3.96409091,7.29 C4.67181818,5.16272727 6.65590909,3.57954545 9,3.57954545 L9,3.57954545 Z" |
|||
id="Shape" |
|||
fill="#EA4335" |
|||
sketch:type="MSShapeGroup" |
|||
/> |
|||
<path |
|||
d="M0,0 L18,0 L18,18 L0,18 L0,0 Z" |
|||
id="Shape" |
|||
sketch:type="MSShapeGroup" |
|||
/> |
|||
</g> |
|||
<g id="handles_square" sketch:type="MSLayerGroup" /> |
|||
</g> |
|||
</g> |
|||
</svg> |
|||
@ -0,0 +1,36 @@ |
|||
module FirebaseMock { |
|||
const firebase: any = {} |
|||
|
|||
firebase.Firestore = function () { |
|||
this.get = jest.fn(() => [ |
|||
{ |
|||
data: jest.fn(() => ({ result: "test" })), |
|||
}, |
|||
]) |
|||
|
|||
this.update = jest.fn() |
|||
this.set = jest.fn() |
|||
this.delete = jest.fn() |
|||
|
|||
this.doc = jest.fn(() => ({ |
|||
update: this.update, |
|||
set: this.set, |
|||
delete: this.delete, |
|||
get: jest.fn(() => ({ |
|||
data: jest.fn(() => ({ result: "test" })), |
|||
})), |
|||
id: "test_id", |
|||
})) |
|||
|
|||
this.where = jest.fn(() => ({ |
|||
get: this.get, |
|||
})) |
|||
|
|||
this.collection = jest.fn(() => ({ |
|||
doc: this.doc, |
|||
where: this.where, |
|||
})) |
|||
} |
|||
|
|||
module.exports = firebase |
|||
} |
|||
@ -0,0 +1,92 @@ |
|||
const firebase = require("@google-cloud/firestore") |
|||
const FirebaseIntegration = require("../firebase") |
|||
jest.mock("@google-cloud/firestore") |
|||
|
|||
class TestConfiguration { |
|||
constructor(config = {}) { |
|||
this.integration = new FirebaseIntegration.integration(config) |
|||
} |
|||
} |
|||
|
|||
describe("Firebase Integration", () => { |
|||
let config |
|||
let tableName = "Users" |
|||
|
|||
beforeEach(() => { |
|||
config = new TestConfiguration({ |
|||
serviceAccount: "{}" |
|||
}) |
|||
}) |
|||
|
|||
it("calls the create method with the correct params", async () => { |
|||
await config.integration.create({ |
|||
table: tableName, |
|||
json: { |
|||
Name: "Test Name" |
|||
}, |
|||
extra: { |
|||
collection: "test" |
|||
} |
|||
}) |
|||
expect(config.integration.client.collection).toHaveBeenCalledWith("test") |
|||
expect(config.integration.client.set).toHaveBeenCalledWith({ |
|||
Name: "Test Name", |
|||
id: "test_id" |
|||
}) |
|||
}) |
|||
|
|||
it("calls the read method with the correct params", async () => { |
|||
const response = await config.integration.read({ |
|||
table: tableName, |
|||
json: { |
|||
Name: "Test" |
|||
}, |
|||
extra: { |
|||
collection: "test", |
|||
filterField: "field", |
|||
filter: "==", |
|||
filterValue: "value", |
|||
} |
|||
}) |
|||
expect(config.integration.client.collection).toHaveBeenCalledWith("test") |
|||
expect(config.integration.client.where).toHaveBeenCalledWith("field", "==", "value") |
|||
expect(response).toEqual([{ result: "test"}]) |
|||
}) |
|||
|
|||
it("calls the update method with the correct params", async () => { |
|||
const response = await config.integration.update({ |
|||
table: tableName, |
|||
json: { |
|||
id: "test", |
|||
Name: "Test" |
|||
}, |
|||
extra: { |
|||
collection: "test" |
|||
} |
|||
}) |
|||
expect(config.integration.client.collection).toHaveBeenCalledWith("test") |
|||
expect(config.integration.client.update).toHaveBeenCalledWith({ |
|||
Name: "Test", |
|||
id: "test" |
|||
}) |
|||
expect(response).toEqual({ |
|||
result: "test" |
|||
}) |
|||
}) |
|||
|
|||
it("calls the delete method with the correct params", async () => { |
|||
const response = await config.integration.delete({ |
|||
table: tableName, |
|||
json: { |
|||
id: "test", |
|||
Name: "Test" |
|||
}, |
|||
extra: { |
|||
collection: "test" |
|||
} |
|||
}) |
|||
expect(config.integration.client.collection).toHaveBeenCalledWith("test") |
|||
expect(config.integration.client.doc).toHaveBeenCalledWith("test") |
|||
expect(config.integration.client.delete).toHaveBeenCalled() |
|||
}) |
|||
}) |
|||
File diff suppressed because it is too large
@ -1,8 +1,12 @@ |
|||
## Description |
|||
_Describe the problem or feature in addition to a link to the relevant github issues._ |
|||
|
|||
Addresses: |
|||
- `<Enter the Link to the issue(s) this PR addresses>` |
|||
- ...more if required |
|||
|
|||
## Screenshots |
|||
_If a UI facing feature, some screenshots of the new functionality._ |
|||
_If a UI facing feature, a short video of the happy path, and some screenshots of the new functionality._ |
|||
|
|||
|
|||
|
|||
|
|||
Loading…
Reference in new issue