Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a basic performance test for v4 establishments and trusts #440

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
84b462c
added a basic performance test for v4 establishments and trusts
mikestock-nimble Dec 19, 2023
36cd0ff
Add legacy Cypress tests for v1, v2 and v3 endpoints (#432)
cshnimble Jan 8, 2024
e62af2b
Updated to v1.4.7 of container app module (#441)
DrizzlyOwl Jan 9, 2024
b078bbe
Start on absence data
paullocknimble Jan 9, 2024
9bb2d99
absence data added
paullocknimble Jan 10, 2024
60045a0
152055: added support for calling external mfsp api to get projects
mikestock-nimble Jan 11, 2024
6a30f31
fixed log of the free school projects
mikestock-nimble Jan 11, 2024
32091a6
Unit test for absence query
paullocknimble Jan 11, 2024
1c7fc60
fixed issue with test potentially getting clashing data with randomis…
mikestock-nimble Jan 11, 2024
cc120bd
fixin g unit tests for absence data
paullocknimble Jan 11, 2024
e09fbbd
trying to get the edpercontext to create in the integration test
paullocknimble Jan 11, 2024
4ade318
Merge pull request #442 from DFE-Digital/feature/152055-get-projects-…
mikestock-nimble Jan 12, 2024
5ae7702
Merge pull request #443 from DFE-Digital/feature/attendance-data
paullocknimble Jan 12, 2024
e33a6b2
Cypress: extend fss endpoint test to check for data and a set of keys…
cshnimble Jan 12, 2024
8fb7aae
152950: fixed the educational performance tests
mikestock-nimble Jan 15, 2024
0b2c060
updated the readme to improve readability
mikestock-nimble Jan 15, 2024
83d320b
Merge pull request #445 from DFE-Digital/feature/152950-fix-education…
mikestock-nimble Jan 18, 2024
d3ad5e7
Update v4 cypress test to check for values regardless of order (#450)
cshnimble Jan 22, 2024
76e3362
added a basic performance test for v4 establishments and trusts
mikestock-nimble Dec 19, 2023
ba16216
Move perf scripts to v4 folder
cshnimble Jan 22, 2024
8e91419
Adds basic performance tests for other supported endpoints in v1, 2 a…
cshnimble Jan 23, 2024
7a6e157
Set baseUrl as env var, add README for perf tests
cshnimble Jan 23, 2024
86e7af9
Merge branch 'feature/performance-test' of https://github.com/DFE-Dig…
cshnimble Jan 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions CypressTests/cypress/e2e/v1/healthchecks.cy.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,35 @@
describe("Health and Database Checks", () => {
let apiKey = Cypress.env('apiKey');
let apiKey = Cypress.env('apiKey')
let url = Cypress.env('url')

context('Health check endpoint', () => {
it('should return a healthy response', () => {
cy.api({
method: 'GET',
failOnStatusCode: false,
url: url + "/HealthCheck",
url: `${url}/HealthCheck`,
headers: {
ApiKey: apiKey,
"Content-type": "application/json"
}
})
.then((response) => {
expect(response.body).to.contain('Health check ok');
expect(response.status).to.eq(200);
cy.log(JSON.stringify(response.body));
expect(response.body).to.contain('Health check ok')
expect(response.status).to.eq(200)
})
})
})

context('Database check endpoint', () => {
it('should return a healthy response', () => {
cy.api({
method: 'GET',
failOnStatusCode: false,
url: url + "check_db",
url: `${url}/check_db`,
headers: {
ApiKey: apiKey,
"Content-type": "application/json"
}
})
.then((response) => {
expect(response.status).to.eq(200);
expect(response.body).to.eq(true);
cy.log("Database Check = " + JSON.stringify(response.body));
expect(response.status).to.eq(200)
expect(response.body).to.eq(true)
})
})
})
Expand Down
24 changes: 24 additions & 0 deletions CypressTests/cypress/e2e/v1/keyStagePerformance.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
describe('Key Stage Performance endpoint tests', () => {

const apiKey = Cypress.env('apiKey')
const url = Cypress.env('url')
const urn = '100000'
const schoolName = 'The Aldgate School'

it('Returns education performance data when URN supplied', () => {

cy.api({
method: 'GET',
url: `${url}/educationPerformance/${urn}`,
headers: {
ApiKey: apiKey,
"Content-type": "application/json"
}
})
.then((response) => {
expect(response.status).to.eq(200)
expect(response.body.schoolName).to.eq(schoolName)
expect(response.body).to.include.keys('schoolName', 'keyStage1', 'keyStage2', 'keyStage4', 'keyStage5')
})
})
})
27 changes: 27 additions & 0 deletions CypressTests/cypress/e2e/v2/baselineTracker.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
describe("Baseline Tracker endpoint", () => {

const apiKey = Cypress.env('apiKey')
const baseUrlV2 = `${Cypress.env('url')}/v2`

it("Should return a list of baseline trackers when default parameters set", () => {

// TODO change url endpoint when spelling mistake resolved
cy.api({
method: 'GET',
url: `${baseUrlV2}/basline-tracker`,
qs: {
page: 1,
count: 50
},
headers: {
ApiKey: apiKey,
"Content-type": "application/json"
}
})
.then((response) => {
expect(response.status).to.eq(200)
expect(response.body.data).to.have.lengthOf.at.least(1).and.lengthOf.at.most(50)
})
})

})
30 changes: 30 additions & 0 deletions CypressTests/cypress/e2e/v2/fssProjects.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/// <reference types="Cypress"/>
describe("Free Schools Store endpoint", () => {

const apiKey = Cypress.env('apiKey')
const baseUrlV2 = `${Cypress.env('url')}/v2`

it("Should return a valid response with data", () => {
cy.api({
url: `${baseUrlV2}/fss/projects`,
headers: {
ApiKey: apiKey,
}
})
.then((response) => {
expect(response.status).to.eq(200)
expect(response.body.data).to.have.lengthOf.at.least(1)
expect(response.body.data[0]).to.include.all.keys('localAuthority', 'projectId', 'projectStatus', 'trustId', 'trustName', 'urn')
})
})

it("Should return a valid 401 response when omitting API key", () => {
cy.api({
failOnStatusCode: false,
url: `${baseUrlV2}/fss/projects`,
headers: {
ApiKey: '',
}
}).its('status').should('eq', 401)
})
})
25 changes: 0 additions & 25 deletions CypressTests/cypress/e2e/v2/get-fss-projects.cy.js

This file was deleted.

116 changes: 116 additions & 0 deletions CypressTests/cypress/e2e/v3/trusts.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
describe('Trusts endpoints tests', () => {

const apiKey = Cypress.env('apiKey')
const baseUrlV3 = `${Cypress.env('url')}/v3`
const companiesHouseNumber = '11082297'
const ukprn = '10067112'
const groupName = 'SOUTH YORK MULTI ACADEMY TRUST'

context('Search Trusts', () => {

it('should return a list of trusts when default search parameters set', () => {

cy.api({
method: 'GET',
url: `${baseUrlV3}/trusts`,
qs: {
page: 1,
count: 50
},
headers: {
ApiKey: apiKey,
"Content-type": "application/json"
}
})
.then((response) => {
expect(response.status).to.eq(200)
expect(response.body.data).to.have.lengthOf.at.least(1).and.lengthOf.at.most(50)
expect(response.body.paging.page).to.eq(1)
})
})

it('should return a single trust when group name set', () => {

cy.api({
method: 'GET',
url: `${baseUrlV3}/trusts`,
qs: {
groupName: groupName,
page: 1,
count: 50
},
headers: {
ApiKey: apiKey,
"Content-type": "application/json"
}
})
.then((response) => {
expect(response.status).to.eq(200)
expect(response.body.data[0].groupName).to.eq(groupName)
})
})

it('should return a single trust when UKPRN set', () => {

cy.api({
method: 'GET',
url: `${baseUrlV3}/trusts`,
qs: {
ukPrn: ukprn,
page: 1,
count: 50
},
headers: {
ApiKey: apiKey,
"Content-type": "application/json"
}
})
.then((response) => {
expect(response.status).to.eq(200)
expect(response.body.data[0].groupName).to.eq(groupName)
})
})

it('should return a single trust when Companies House Number set', () => {

cy.api({
method: 'GET',
url: `${baseUrlV3}/trusts`,
qs: {
companiesHouseNumber: companiesHouseNumber,
page: 1,
count: 50
},
headers: {
ApiKey: apiKey,
"Content-type": "application/json"
}
})
.then((response) => {
expect(response.status).to.eq(200)
expect(response.body.data[0].groupName).to.eq(groupName)
expect(response.body.data[0].companiesHouseNumber).to.eq(companiesHouseNumber)
})
})
})

context('Get Trust by UKPRN', () => {

it('should return a single trust when UKPRN set', () => {

cy.api({
method: 'GET',
url: `${baseUrlV3}/trust/${ukprn}`,
headers: {
ApiKey: apiKey,
"Content-type": "application/json"
}
})
.then((response) => {
expect(response.status).to.eq(200)
expect(response.body.data).to.include.keys('trustData', 'giasData', 'establishments')
expect(response.body.data.giasData.groupName).to.eq(groupName)
})
})
})
})
32 changes: 17 additions & 15 deletions CypressTests/cypress/e2e/v4/trusts.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe('Trusts endpoints tests', () => {

const apiKey = Cypress.env('apiKey');
const apiKey = Cypress.env('apiKey')
const baseUrlV4 = `${Cypress.env('url')}/v4`
const companiesHouseNumber = '11082297'
const ukprns = ['10067112', '10067113']
Expand All @@ -24,7 +24,7 @@ describe('Trusts endpoints tests', () => {
}
})
.then((response) => {
expect(response.status).to.eq(200);
expect(response.status).to.eq(200)
expect(response.body.data).to.have.lengthOf.at.least(1).and.lengthOf.at.most(10)
expect(response.body.paging.page).to.eq(1)
})
Expand All @@ -46,7 +46,7 @@ describe('Trusts endpoints tests', () => {
}
})
.then((response) => {
expect(response.status).to.eq(200);
expect(response.status).to.eq(200)
expect(response.body.data[0].name).to.eq(groupName)
})
})
Expand All @@ -67,7 +67,7 @@ describe('Trusts endpoints tests', () => {
}
})
.then((response) => {
expect(response.status).to.eq(200);
expect(response.status).to.eq(200)
expect(response.body.data[0].name).to.eq(groupName)
})
})
Expand All @@ -88,7 +88,7 @@ describe('Trusts endpoints tests', () => {
}
})
.then((response) => {
expect(response.status).to.eq(200);
expect(response.status).to.eq(200)
expect(response.body.data[0].name).to.eq(groupName)
expect(response.body.data[0].companiesHouseNumber).to.eq(companiesHouseNumber)
})
Expand All @@ -108,7 +108,7 @@ describe('Trusts endpoints tests', () => {
}
})
.then((response) => {
expect(response.status).to.eq(200);
expect(response.status).to.eq(200)
expect(response.body.name).to.eq(groupName)
})
})
Expand All @@ -130,7 +130,7 @@ describe('Trusts endpoints tests', () => {
}
})
.then((response) => {
expect(response.status).to.eq(200);
expect(response.status).to.eq(200)
expect(response.body[0].name).to.eq(groupName)
expect(response.body[0].ukprn).to.eq(ukprns[0])
})
Expand All @@ -153,12 +153,14 @@ describe('Trusts endpoints tests', () => {
}
})
.then((response) => {
expect(response.status).to.eq(200);
// Response isn't in UKPRN order
expect(response.body[1].name).to.eq(groupName)
expect(response.body[1].ukprn).to.eq(ukprns[0])
expect(response.body[0].name).to.eq('THE BISHOP FRASER TRUST')
expect(response.body[0].ukprn).to.eq(ukprns[1])
expect(response.status).to.eq(200)
expect(response.body).to.have.lengthOf(2)
// Response isn't neccessarily in UKPRN order
const resBody = JSON.stringify(response.body)
expect(resBody).to.have.string(groupName)
expect(resBody).to.have.string(ukprns[0])
expect(resBody).to.have.string('THE BISHOP FRASER TRUST')
expect(resBody).to.have.string(ukprns[1])
})
})
})
Expand All @@ -176,7 +178,7 @@ describe('Trusts endpoints tests', () => {
}
})
.then((response) => {
expect(response.status).to.eq(200);
expect(response.status).to.eq(200)
expect(response.body.name).to.eq(groupName)
expect(response.body.companiesHouseNumber).to.eq(companiesHouseNumber)
})
Expand All @@ -196,7 +198,7 @@ describe('Trusts endpoints tests', () => {
}
})
.then((response) => {
expect(response.status).to.eq(200);
expect(response.status).to.eq(200)
expect(response.body.name).to.eq(groupName)
expect(response.body.referenceNumber).to.eq(trustReferenceNumber)
})
Expand Down
2 changes: 1 addition & 1 deletion CypressTests/cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

const { generateZapHTMLReport } = require('./generateZapReport');
const { generateZapHTMLReport } = require('./generateZapReport')

/**
* @type {Cypress.PluginConfig}
Expand Down
4 changes: 2 additions & 2 deletions CypressTests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@



import { validateSchema } from "./validate-schema-command";
import { validateSchema } from "./validate-schema-command"

Cypress.Commands.add("validateSchema", validateSchema);
Cypress.Commands.add("validateSchema", validateSchema)
Loading
Loading