Env variables & data files
Changes as per PR -Created files for transformer queries - tests updated accordingly -Updates for Env variables and usage -Changes surrounding App Rename testing
This commit is contained in:
parent
543fb1dcc6
commit
c7c4bd607f
|
@ -1,9 +1,11 @@
|
||||||
{
|
{
|
||||||
"baseUrl": "http://localhost:10001/builder/",
|
"baseUrl": "http://localhost:10001",
|
||||||
"video": true,
|
"video": true,
|
||||||
"projectId": "bmbemn",
|
"projectId": "bmbemn",
|
||||||
"env": {
|
"env": {
|
||||||
"PORT": "10001",
|
"PORT": "10001",
|
||||||
"JWT_SECRET": "test"
|
"JWT_SECRET": "test",
|
||||||
|
"HOST_IP": "",
|
||||||
|
"TEST_ENV" : true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ context("Create an Application", () => {
|
||||||
it("should create a new application", () => {
|
it("should create a new application", () => {
|
||||||
cy.login()
|
cy.login()
|
||||||
cy.createTestApp()
|
cy.createTestApp()
|
||||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
cy.contains("Cypress Tests").should("exist")
|
cy.contains("Cypress Tests").should("exist")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -19,7 +19,7 @@ context("Create a User and Assign Roles", () => {
|
||||||
|
|
||||||
it("should assign role types", () => {
|
it("should assign role types", () => {
|
||||||
// 3 apps minimum required - to assign an app to each role type
|
// 3 apps minimum required - to assign an app to each role type
|
||||||
cy.request(`localhost:${Cypress.env("PORT")}/api/applications?status=all`)
|
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
||||||
.its("body")
|
.its("body")
|
||||||
.then(val => {
|
.then(val => {
|
||||||
if (val.length < 3) {
|
if (val.length < 3) {
|
||||||
|
@ -31,7 +31,7 @@ context("Create a User and Assign Roles", () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// Navigate back to the user
|
// Navigate back to the user
|
||||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
cy.get(".spectrum-SideNav").contains("Users").click()
|
cy.get(".spectrum-SideNav").contains("Users").click()
|
||||||
cy.get(".spectrum-Table").contains("bbuser").click()
|
cy.get(".spectrum-Table").contains("bbuser").click()
|
||||||
|
@ -54,6 +54,7 @@ context("Create a User and Assign Roles", () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// Confirm roles exist within Configure roles table
|
// Confirm roles exist within Configure roles table
|
||||||
|
cy.wait(500)
|
||||||
cy.get(".spectrum-Table-body").eq(0).within((assginedRoles) => {
|
cy.get(".spectrum-Table-body").eq(0).within((assginedRoles) => {
|
||||||
expect(assginedRoles).to.contain("Admin")
|
expect(assginedRoles).to.contain("Admin")
|
||||||
expect(assginedRoles).to.contain("Power")
|
expect(assginedRoles).to.contain("Power")
|
||||||
|
@ -83,11 +84,12 @@ context("Create a User and Assign Roles", () => {
|
||||||
it("should enable Developer access", () => {
|
it("should enable Developer access", () => {
|
||||||
// Enable Developer access
|
// Enable Developer access
|
||||||
cy.get(".field").eq(4).within(() => {
|
cy.get(".field").eq(4).within(() => {
|
||||||
cy.get(".spectrum-Form-item").click()
|
cy.get(".spectrum-Switch-input").click({ force: true })
|
||||||
})
|
})
|
||||||
// No Access table should now be empty
|
// No Access table should now be empty
|
||||||
cy.get(".container").contains("No Access").parent().within(() => {
|
cy.get(".container").contains("No Access").parent().within(() => {
|
||||||
cy.get(".spectrum-Table").contains("No rows found")
|
cy.get(".spectrum-Table").contains("No rows found")
|
||||||
|
})
|
||||||
|
|
||||||
// Each app within Configure roles should have Admin access
|
// Each app within Configure roles should have Admin access
|
||||||
cy.get(".spectrum-Table-body").eq(0).find('tr').its('length').then((len) => {
|
cy.get(".spectrum-Table-body").eq(0).find('tr').its('length').then((len) => {
|
||||||
|
@ -97,12 +99,11 @@ context("Create a User and Assign Roles", () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
|
||||||
it("should disable Developer access", () => {
|
it("should disable Developer access", () => {
|
||||||
// Disable Developer access
|
// Disable Developer access
|
||||||
cy.get(".field").eq(4).within(() => {
|
cy.get(".field").eq(4).within(() => {
|
||||||
cy.get(".spectrum-Form-item").click()
|
cy.get(".spectrum-Switch-input").click({ force: true })
|
||||||
})
|
})
|
||||||
// Configure roles table should now be empty
|
// Configure roles table should now be empty
|
||||||
cy.get(".container").contains("Configure roles").parent().within(() => {
|
cy.get(".container").contains("Configure roles").parent().within(() => {
|
||||||
|
|
|
@ -4,6 +4,8 @@ context("Add and Configure External Data Sources", () => {
|
||||||
cy.createTestApp()
|
cy.createTestApp()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// PostgreSQL/MySQL tests currently only run in TEST environment
|
||||||
|
if (Cypress.env("TEST_ENV")) {
|
||||||
it("should add and configure a PostgreSQL data source", () => {
|
it("should add and configure a PostgreSQL data source", () => {
|
||||||
// Select PostgreSQL datasource and add config
|
// Select PostgreSQL datasource and add config
|
||||||
const datasource = "PostgreSQL"
|
const datasource = "PostgreSQL"
|
||||||
|
@ -27,6 +29,7 @@ context("Add and Configure External Data Sources", () => {
|
||||||
cy.get(".query-list-item").should('exist')
|
cy.get(".query-list-item").should('exist')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
it("should add and configure a REST data source", () => {
|
it("should add and configure a REST data source", () => {
|
||||||
// Select REST datasource and add config
|
// Select REST datasource and add config
|
||||||
|
|
|
@ -13,7 +13,15 @@ context("Query Level Transformers", () => {
|
||||||
// Add Query
|
// Add Query
|
||||||
cy.get(".spectrum-Button").contains("Add Query").click({ force: true })
|
cy.get(".spectrum-Button").contains("Add Query").click({ force: true })
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
addTransformerQuery()
|
|
||||||
|
// Get Transformer Function from file
|
||||||
|
cy.readFile("cypress/support/queryLevelTransformerFunction.js").then((transformerFunction) => {
|
||||||
|
console.log(transformerFunction[1])
|
||||||
|
cy.get(".CodeMirror textarea")
|
||||||
|
// Highlight current text and overwrite with file contents
|
||||||
|
.type(Cypress.platform === 'darwin' ? '{cmd}a' : '{ctrl}a', { force: true })
|
||||||
|
.type(transformerFunction, { parseSpecialCharSequences: false })
|
||||||
|
})
|
||||||
// Run Query
|
// Run Query
|
||||||
cy.get(".spectrum-Button").contains("Run Query").click({ force: true })
|
cy.get(".spectrum-Button").contains("Run Query").click({ force: true })
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
|
@ -30,7 +38,14 @@ context("Query Level Transformers", () => {
|
||||||
// Add Query
|
// Add Query
|
||||||
cy.get(".spectrum-Button").contains("Add Query").click({ force: true })
|
cy.get(".spectrum-Button").contains("Add Query").click({ force: true })
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
addTransformerQuery(true)
|
// Get Transformer Function with Data from file
|
||||||
|
cy.readFile("cypress/support/queryLevelTransformerFunctionWithData.js").then((transformerFunction) => {
|
||||||
|
console.log(transformerFunction[1])
|
||||||
|
cy.get(".CodeMirror textarea")
|
||||||
|
// Highlight current text and overwrite with file contents
|
||||||
|
.type(Cypress.platform === 'darwin' ? '{cmd}a' : '{ctrl}a', { force: true })
|
||||||
|
.type(transformerFunction, { parseSpecialCharSequences: false })
|
||||||
|
})
|
||||||
// Run Query
|
// Run Query
|
||||||
cy.get(".spectrum-Button").contains("Run Query").click({ force: true })
|
cy.get(".spectrum-Button").contains("Run Query").click({ force: true })
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
|
@ -43,7 +58,7 @@ context("Query Level Transformers", () => {
|
||||||
it("should run an invalid query via POST request", () => {
|
it("should run an invalid query via POST request", () => {
|
||||||
// POST request with transformer as null
|
// POST request with transformer as null
|
||||||
cy.request({method: 'POST',
|
cy.request({method: 'POST',
|
||||||
url: 'https://test.budi.live/api/queries/',
|
url: `${Cypress.config().baseUrl}/api/queries/`,
|
||||||
body: {fields : {"headers":{},"queryString":null,"path":null},
|
body: {fields : {"headers":{},"queryString":null,"path":null},
|
||||||
parameters : [],
|
parameters : [],
|
||||||
schema : {},
|
schema : {},
|
||||||
|
@ -61,7 +76,7 @@ context("Query Level Transformers", () => {
|
||||||
it("should run an empty query", () => {
|
it("should run an empty query", () => {
|
||||||
// POST request with Transformer as an empty string
|
// POST request with Transformer as an empty string
|
||||||
cy.request({method: 'POST',
|
cy.request({method: 'POST',
|
||||||
url: 'https://test.budi.live/api/queries/preview',
|
url: `${Cypress.config().baseUrl}/api/queries/preview`,
|
||||||
body: {fields : {"headers":{},"queryString":null,"path":null},
|
body: {fields : {"headers":{},"queryString":null,"path":null},
|
||||||
queryVerb : "read",
|
queryVerb : "read",
|
||||||
transformer : "",
|
transformer : "",
|
||||||
|
@ -71,54 +86,5 @@ context("Query Level Transformers", () => {
|
||||||
expect(response.status).to.equal(400)
|
expect(response.status).to.equal(400)
|
||||||
expect(response.body.message).to.include('Invalid body - "transformer" is not allowed to be empty')
|
expect(response.body.message).to.include('Invalid body - "transformer" is not allowed to be empty')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const addTransformerQuery = (addData = false) => {
|
|
||||||
// Adds query within the Transformer section of Query REST API
|
|
||||||
cy.get(".CodeMirror textarea")
|
|
||||||
// Highlight current text within CodeMirror
|
|
||||||
.type(Cypress.platform === 'darwin' ? '{cmd}a' : '{ctrl}a', { force: true })
|
|
||||||
// Overwrite current text with function
|
|
||||||
.type("const breweries = data\n" +
|
|
||||||
"const totals = {}\n" +
|
|
||||||
"for (let brewery of breweries) {")
|
|
||||||
// Delete key in place to remove extra brackets that are added
|
|
||||||
.type('{del}')
|
|
||||||
.type("\n const state = brewery.state\n" +
|
|
||||||
" if (totals[state] == null) {")
|
|
||||||
.type('{del}')
|
|
||||||
.type("\n totals[state] = 1\n" +
|
|
||||||
"} else {")
|
|
||||||
.type('{del}')
|
|
||||||
.type("\n totals[state]++\n" +
|
|
||||||
"}}\n", { parseSpecialCharSequences: false })
|
|
||||||
|
|
||||||
if (addData) {
|
|
||||||
cy.get(".CodeMirror textarea")
|
|
||||||
.type('const stateCodes = {"texas":"tx",\n' +
|
|
||||||
'"colorado":"co",\n' +
|
|
||||||
'"florida":"fl",\n' +
|
|
||||||
'"iwoa":"ia",\n' +
|
|
||||||
'"louisiana":"la",\n' +
|
|
||||||
'"california":"ca",\n' +
|
|
||||||
'"pennsylvania":"pa",\n' +
|
|
||||||
'"georgia":"ga",\n' +
|
|
||||||
'"new hampshire":"nh",\n' +
|
|
||||||
'"virginia":"va",\n' +
|
|
||||||
'"michigan":"mi",\n' +
|
|
||||||
'"maryland":"md",\n' +
|
|
||||||
'"ohio":"oh"}\n')
|
|
||||||
.type('const entries = Object.entries(totals)\n' +
|
|
||||||
"return entries.map(([state, count]) => \n" +
|
|
||||||
"{ const stateCode = stateCodes[state.toLowerCase()]\n" +
|
|
||||||
"return {state, count, flag: 'http://flags.ox3.in/svg/us/${stateCode}.svg'",
|
|
||||||
{ parseSpecialCharSequences: false })
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
cy.get(".CodeMirror textarea")
|
|
||||||
.type("const entries = Object.entries(totals)\n" +
|
|
||||||
"return entries.map(([state, count]) => ({state, count}))",
|
|
||||||
{ parseSpecialCharSequences: false })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,17 +5,24 @@ context("Rename an App", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should rename an unpublished application", () => {
|
it("should rename an unpublished application", () => {
|
||||||
|
const appName = "Cypress Tests"
|
||||||
const appRename = "Cypress Renamed"
|
const appRename = "Cypress Renamed"
|
||||||
// Rename app, Search for app, Confirm name was changed
|
// Rename app, Search for app, Confirm name was changed
|
||||||
cy.get(".home-logo").click()
|
cy.get(".home-logo").click()
|
||||||
renameApp(appRename)
|
renameApp(appName, appRename)
|
||||||
|
cy.reload()
|
||||||
|
cy.wait(1000)
|
||||||
cy.searchForApplication(appRename)
|
cy.searchForApplication(appRename)
|
||||||
cy.get(".appGrid").find(".wrapper").should("have.length", 1)
|
cy.get(".appGrid").find(".wrapper").should("have.length", 1)
|
||||||
cy.deleteApp(appRename)
|
// Set app name back to Cypress Tests
|
||||||
|
cy.reload()
|
||||||
|
cy.wait(1000)
|
||||||
|
renameApp(appRename, appName)
|
||||||
})
|
})
|
||||||
|
|
||||||
xit("Should rename a published application", () => {
|
xit("Should rename a published application", () => {
|
||||||
// It is not possible to rename a published application
|
// It is not possible to rename a published application
|
||||||
|
const appName = "Cypress Tests"
|
||||||
const appRename = "Cypress Renamed"
|
const appRename = "Cypress Renamed"
|
||||||
// Publish the app
|
// Publish the app
|
||||||
cy.get(".toprightnav")
|
cy.get(".toprightnav")
|
||||||
|
@ -27,24 +34,28 @@ xit("Should rename a published application", () => {
|
||||||
})
|
})
|
||||||
// Rename app, Search for app, Confirm name was changed
|
// Rename app, Search for app, Confirm name was changed
|
||||||
cy.get(".home-logo").click()
|
cy.get(".home-logo").click()
|
||||||
renameApp(appRename, true)
|
renameApp(appName, appRename, true)
|
||||||
cy.searchForApplication(appRename)
|
cy.searchForApplication(appRename)
|
||||||
cy.get(".appGrid").find(".wrapper").should("have.length", 1)
|
cy.get(".appGrid").find(".wrapper").should("have.length", 1)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("Should try to rename an application to have no name", () => {
|
it("Should try to rename an application to have no name", () => {
|
||||||
|
const appName = "Cypress Tests"
|
||||||
cy.get(".home-logo").click()
|
cy.get(".home-logo").click()
|
||||||
renameApp(" ", false, true)
|
renameApp(appName, " ", false, true)
|
||||||
|
cy.wait(500)
|
||||||
// Close modal and confirm name has not been changed
|
// Close modal and confirm name has not been changed
|
||||||
cy.get(".spectrum-Dialog-grid").contains("Cancel").click()
|
cy.get(".spectrum-Dialog-grid").contains("Cancel").click()
|
||||||
cy.searchForApplication("Cypress Tests")
|
cy.reload()
|
||||||
|
cy.wait(1000)
|
||||||
|
cy.searchForApplication(appName)
|
||||||
cy.get(".appGrid").find(".wrapper").should("have.length", 1)
|
cy.get(".appGrid").find(".wrapper").should("have.length", 1)
|
||||||
})
|
})
|
||||||
|
|
||||||
xit("Should create two applications with the same name", () => {
|
xit("Should create two applications with the same name", () => {
|
||||||
// It is not possible to have applications with the same name
|
// It is not possible to have applications with the same name
|
||||||
const appName = "Cypress Tests"
|
const appName = "Cypress Tests"
|
||||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
cy.get(".spectrum-Button").contains("Create app").click({force: true})
|
cy.get(".spectrum-Button").contains("Create app").click({force: true})
|
||||||
cy.contains(/Start from scratch/).click()
|
cy.contains(/Start from scratch/).click()
|
||||||
|
@ -59,18 +70,28 @@ xit("Should create two applications with the same name", () => {
|
||||||
it("should validate application names", () => {
|
it("should validate application names", () => {
|
||||||
// App name must be letters, numbers and spaces only
|
// App name must be letters, numbers and spaces only
|
||||||
// This test checks numbers and special characters specifically
|
// This test checks numbers and special characters specifically
|
||||||
|
const appName = "Cypress Tests"
|
||||||
const numberName = 12345
|
const numberName = 12345
|
||||||
const specialCharName = "£$%^"
|
const specialCharName = "£$%^"
|
||||||
cy.get(".home-logo").click()
|
cy.get(".home-logo").click()
|
||||||
renameApp(numberName)
|
renameApp(appName, numberName)
|
||||||
|
cy.reload()
|
||||||
|
cy.wait(1000)
|
||||||
cy.searchForApplication(numberName)
|
cy.searchForApplication(numberName)
|
||||||
cy.get(".appGrid").find(".wrapper").should("have.length", 1)
|
cy.get(".appGrid").find(".wrapper").should("have.length", 1)
|
||||||
renameApp(specialCharName)
|
cy.reload()
|
||||||
|
cy.wait(1000)
|
||||||
|
renameApp(numberName, specialCharName)
|
||||||
cy.get(".error").should("have.text", "App name must be letters, numbers and spaces only")
|
cy.get(".error").should("have.text", "App name must be letters, numbers and spaces only")
|
||||||
|
// Set app name back to Cypress Tests
|
||||||
|
cy.reload()
|
||||||
|
cy.wait(1000)
|
||||||
|
renameApp(numberName, appName)
|
||||||
})
|
})
|
||||||
|
|
||||||
const renameApp = (appName, published, noName) => {
|
const renameApp = (originalName, changedName, published, noName) => {
|
||||||
cy.request(`localhost:${Cypress.env("PORT")}/api/applications?status=all`)
|
cy.searchForApplication(originalName)
|
||||||
|
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
||||||
.its("body")
|
.its("body")
|
||||||
.then(val => {
|
.then(val => {
|
||||||
if (val.length > 0) {
|
if (val.length > 0) {
|
||||||
|
@ -93,7 +114,7 @@ it("should validate application names", () => {
|
||||||
return cy
|
return cy
|
||||||
}
|
}
|
||||||
cy.get("input").clear()
|
cy.get("input").clear()
|
||||||
cy.get("input").eq(0).type(appName).should("have.value", appName).blur()
|
cy.get("input").eq(0).type(changedName).should("have.value", changedName).blur()
|
||||||
cy.get(".spectrum-ButtonGroup").contains("Save").click({force: true})
|
cy.get(".spectrum-ButtonGroup").contains("Save").click({force: true})
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
})
|
})
|
||||||
|
|
|
@ -10,7 +10,7 @@ Cypress.on("uncaught:exception", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("login", () => {
|
Cypress.Commands.add("login", () => {
|
||||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
cy.wait(2000)
|
cy.wait(2000)
|
||||||
cy.url().then(url => {
|
cy.url().then(url => {
|
||||||
if (url.includes("builder/admin")) {
|
if (url.includes("builder/admin")) {
|
||||||
|
@ -33,9 +33,9 @@ Cypress.Commands.add("login", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("createApp", name => {
|
Cypress.Commands.add("createApp", name => {
|
||||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
cy.request(`localhost:${Cypress.env("PORT")}/api/applications?status=all`)
|
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
||||||
.its("body")
|
.its("body")
|
||||||
.then(body => {
|
.then(body => {
|
||||||
if (body.length > 0) {
|
if (body.length > 0) {
|
||||||
|
@ -52,9 +52,9 @@ Cypress.Commands.add("createApp", name => {
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("deleteApp", name => {
|
Cypress.Commands.add("deleteApp", name => {
|
||||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
cy.wait(2000)
|
cy.wait(2000)
|
||||||
cy.request(`localhost:${Cypress.env("PORT")}/api/applications?status=all`)
|
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
||||||
.its("body")
|
.its("body")
|
||||||
.then(val => {
|
.then(val => {
|
||||||
if (val.length > 0) {
|
if (val.length > 0) {
|
||||||
|
@ -80,9 +80,9 @@ Cypress.Commands.add("deleteApp", name => {
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("deleteAllApps", () => {
|
Cypress.Commands.add("deleteAllApps", () => {
|
||||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
cy.request(`localhost:${Cypress.env("PORT")}/api/applications?status=all`)
|
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
||||||
.its("body")
|
.its("body")
|
||||||
.then(val => {
|
.then(val => {
|
||||||
for (let i = 0; i < val.length; i++) {
|
for (let i = 0; i < val.length; i++) {
|
||||||
|
@ -324,7 +324,7 @@ Cypress.Commands.add("addSqlDatasourceConfig", (sqlType, noFetch) => {
|
||||||
.children()
|
.children()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get(".spectrum-Textfield").within(() => {
|
cy.get(".spectrum-Textfield").within(() => {
|
||||||
cy.get("input").clear().type("3.251.63.170")
|
cy.get("input").clear().type(Cypress.env("HOST_IP"))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
const breweries = data
|
||||||
|
const totals = {}
|
||||||
|
|
||||||
|
for (let brewery of breweries)
|
||||||
|
{const state = brewery.state
|
||||||
|
if (totals[state] == null)
|
||||||
|
{totals[state] = 1}
|
||||||
|
else
|
||||||
|
{totals[state]++}}
|
||||||
|
const entries = Object.entries(totals)
|
||||||
|
return entries.map(([state, count]) => ({state, count}))
|
|
@ -0,0 +1,27 @@
|
||||||
|
const breweries = data
|
||||||
|
const totals = {}
|
||||||
|
for (let brewery of breweries)
|
||||||
|
{const state = brewery.state
|
||||||
|
if (totals[state] == null)
|
||||||
|
{totals[state] = 1
|
||||||
|
} else
|
||||||
|
{totals[state]++
|
||||||
|
}}
|
||||||
|
const stateCodes =
|
||||||
|
{"texas":"tx",
|
||||||
|
"colorado":"co",
|
||||||
|
"florida":"fl",
|
||||||
|
"iwoa":"ia",
|
||||||
|
"louisiana":"la",
|
||||||
|
"california":"ca",
|
||||||
|
"pennsylvania":"pa",
|
||||||
|
"georgia":"ga",
|
||||||
|
"new hampshire":"nh",
|
||||||
|
"virginia":"va",
|
||||||
|
"michigan":"mi",
|
||||||
|
"maryland":"md",
|
||||||
|
"ohio":"oh"}
|
||||||
|
const entries = Object.entries(totals)
|
||||||
|
return entries.map(([state, count]) =>
|
||||||
|
{const stateCode = stateCodes[state.toLowerCase()]
|
||||||
|
return {state, count, flag: 'http://flags.ox3.in/svg/us/${stateCode}.svg'}})
|
Loading…
Reference in New Issue