|
|
|
@ -1,4 +1,7 @@ |
|
|
|
|
|
|
|
context('Create a View', () => { |
|
|
|
const TOTAL_RECORDS = 6 |
|
|
|
|
|
|
|
before(() => { |
|
|
|
cy.visit('localhost:4001/_builder') |
|
|
|
cy.createApp('View App', 'View App Description') |
|
|
|
@ -7,6 +10,7 @@ context('Create a View', () => { |
|
|
|
cy.addColumn('data', 'age', 'Number') |
|
|
|
cy.addColumn('data', 'rating', 'Number') |
|
|
|
|
|
|
|
// 6 Records
|
|
|
|
cy.addRecord(["Students", 25, 1]) |
|
|
|
cy.addRecord(["Students", 20, 3]) |
|
|
|
cy.addRecord(["Students", 18, 6]) |
|
|
|
@ -15,11 +19,39 @@ context('Create a View', () => { |
|
|
|
cy.addRecord(["Teachers", 36, 3]) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
it('creates a stats view based on age', () => { |
|
|
|
it('creates a view', () => { |
|
|
|
cy.contains("Create New View").click() |
|
|
|
cy.get("[placeholder='View Name']").type("Test View") |
|
|
|
cy.contains("Save View").click() |
|
|
|
cy.get(".title").contains("Test View") |
|
|
|
cy.get("thead th").should(($headers) => { |
|
|
|
expect($headers).to.have.length(3) |
|
|
|
const headers = $headers.map((i, header) => Cypress.$(header).text()) |
|
|
|
expect(headers.get()).to.deep.eq([ |
|
|
|
"group", |
|
|
|
"age", |
|
|
|
"rating" |
|
|
|
]) |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
it('filters the view by age over 10', () => { |
|
|
|
cy.contains("Filter").click() |
|
|
|
cy.contains("Add Filter").click() |
|
|
|
cy.get(".menu-container").find("select").first().select("age") |
|
|
|
cy.get(".menu-container").find("select").eq(1).select("More Than") |
|
|
|
cy.get("input[placeholder='age']").type(18) |
|
|
|
cy.contains("Save").click() |
|
|
|
cy.get("tbody tr").should(($values) => { |
|
|
|
expect($values).to.have.length(5) |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
it('creates a stats calculation view based on age', () => { |
|
|
|
cy.contains("Calculate").click() |
|
|
|
cy.get(".menu-container").find("select").first().select("Statistics") |
|
|
|
cy.get(".menu-container").find("select").eq(1).select("age") |
|
|
|
cy.contains("Save").click() |
|
|
|
cy.get("thead th").should(($headers) => { |
|
|
|
expect($headers).to.have.length(7) |
|
|
|
const headers = $headers.map((i, header) => Cypress.$(header).text()) |
|
|
|
@ -28,8 +60,8 @@ context('Create a View', () => { |
|
|
|
"sum", |
|
|
|
"min", |
|
|
|
"max", |
|
|
|
"sumsqr", |
|
|
|
"count", |
|
|
|
"sumsqr", |
|
|
|
"avg", |
|
|
|
]) |
|
|
|
}) |
|
|
|
@ -37,17 +69,17 @@ context('Create a View', () => { |
|
|
|
const values = $values.map((i, value) => Cypress.$(value).text()) |
|
|
|
expect(values.get()).to.deep.eq([ |
|
|
|
"null", |
|
|
|
"173", |
|
|
|
"18", |
|
|
|
"155", |
|
|
|
"20", |
|
|
|
"49", |
|
|
|
"5671", |
|
|
|
"6", |
|
|
|
"28.833333333333332" |
|
|
|
"5", |
|
|
|
"5347", |
|
|
|
"31" |
|
|
|
]) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
it('groups the stats view by group', () => { |
|
|
|
it('groups the view by group', () => { |
|
|
|
cy.contains("Group By").click() |
|
|
|
cy.get("select").select("group") |
|
|
|
cy.contains("Save").click() |
|
|
|
@ -58,12 +90,12 @@ context('Create a View', () => { |
|
|
|
const values = $values.map((i, value) => Cypress.$(value).text()) |
|
|
|
expect(values.get()).to.deep.eq([ |
|
|
|
"Students", |
|
|
|
"88", |
|
|
|
"18", |
|
|
|
"70", |
|
|
|
"20", |
|
|
|
"25", |
|
|
|
"1974", |
|
|
|
"4", |
|
|
|
"22" |
|
|
|
"3", |
|
|
|
"1650", |
|
|
|
"23.333333333333332" |
|
|
|
]) |
|
|
|
}) |
|
|
|
}) |
|
|
|
@ -77,6 +109,7 @@ context('Create a View', () => { |
|
|
|
}) |
|
|
|
|
|
|
|
it('deletes a view', () => { |
|
|
|
cy.contains("[data-cy=model-nav-item]", "Test View Updated").click() |
|
|
|
cy.contains("[data-cy=model-nav-item]", "Test View Updated").find(".ri-more-line").click() |
|
|
|
cy.contains("Delete").click() |
|
|
|
cy.get(".content").contains("button", "Delete").click() |
|
|
|
|