-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FHB-634: Finalise Find performance Tests (#228)
* finalised find tests * added sleep * reverted vus change * added data test ids for start now and search now * commented out todo --------- Co-authored-by: Tina Gohil <[email protected]>
- Loading branch information
1 parent
4273e9c
commit 274bb14
Showing
8 changed files
with
88 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,94 @@ | ||
import http from 'k6/http'; | ||
import { browser } from 'k6/browser'; | ||
import { sleep } from 'k6'; | ||
|
||
import { check, sleep } from 'k6'; | ||
export async function searchResultsTest(data) { | ||
const page = await browser.newPage(); | ||
|
||
try { | ||
await page.goto(`${data.SETTINGS.baseUrl}`); | ||
const startButton = await page.locator('[data-testid="start-button"]'); | ||
|
||
await Promise.all([startButton.click()]); | ||
await page.locator('[name="postcode"]').type('E1 2EN'); | ||
|
||
const submitButton = await page.locator('[data-testid="search-button"]'); | ||
|
||
const startButton = await page.locator('input[class="govuk-button govuk-button--start"]').click(); | ||
await Promise.all([submitButton.click()]); | ||
|
||
await Promise.all([page.waitForNavigation(), startButton.click()]); | ||
const title = await page.locator('title').textContent(); | ||
|
||
await page.locator('input[name="postcode"]').type('E1 2EN'); | ||
//TODO: Update when data is seeded | ||
await check(title, { | ||
title: title === 'Services, groups and activities in this area (page 1 of 45) - Find support for your family - GOV.UK', | ||
}); | ||
|
||
} finally { | ||
await page.close(); | ||
} | ||
sleep(1); | ||
} | ||
|
||
const submitButton = await page.locator('input[type="button"]'); | ||
export async function filterSearchResultsTest(data) { | ||
const page = await browser.newPage(); | ||
|
||
await Promise.all([page.waitForNavigation(), submitButton.click()]); | ||
try { | ||
await page.goto(`${data.SETTINGS.baseUrl}`); | ||
const startButton = await page.locator('[data-testid="start-button"]'); | ||
|
||
await Promise.all([startButton.click()]); | ||
await page.locator('[name="postcode"]').type('E1 2EN'); | ||
|
||
const submitButton = await page.locator('[data-testid="search-button"]'); | ||
|
||
await Promise.all([submitButton.click()]); | ||
|
||
const activitiesFilter = await page.locator('[id="activities-10"]'); | ||
const freeFilter = await page.locator('[id="cost-free"]'); | ||
const tenMileFilter = await page.locator('[id="search_within-1]'); | ||
|
||
await Promise.all([activitiesFilter.click()], [freeFilter.click()], [tenMileFilter.click()]); | ||
|
||
sleep(1); | ||
|
||
const headerText = await page.locator('h1').textContent(); | ||
check(headerText, { | ||
header: headerText === 'Your local family hubs, services and activities', | ||
}); //title attribute on the head rather than content body. | ||
|
||
} finally { | ||
await page.close(); | ||
} | ||
sleep(1); | ||
} | ||
|
||
export function verifyStatusCodeTest(data) { | ||
const res = http.get(`${data.SETTINGS.baseUrl}/ServiceFilter?postcode=E1%202EN&adminarea=E09000030&latitude=51.517612&longitude=-0.056838&frompostcodesearch=True')`); | ||
export async function serviceDetailsTest(data) { | ||
const page = await browser.newPage(); | ||
|
||
check(res, { | ||
'status is 200': (r) => r.status === 200, | ||
}); | ||
try { | ||
await page.goto(`${data.SETTINGS.baseUrl}`); | ||
const startButton = await page.locator('[data-testid="start-button"]'); | ||
|
||
await Promise.all([startButton.click()]); | ||
await page.locator('[name="postcode"]').type('E1 2EN'); | ||
|
||
const submitButton = await page.locator('[data-testid="search-button"]'); | ||
|
||
await Promise.all([submitButton.click()]); | ||
|
||
const firstSearchResult = await page.locator('//*[@id="results"]/div[1]/div'); | ||
|
||
await Promise.all([firstSearchResult.click()]); | ||
|
||
} finally { | ||
await page.close(); | ||
} | ||
sleep(1); | ||
} | ||
|
||
export async function verifyStatusCodeTest(data) { | ||
const page = await browser.newPage(); | ||
try { | ||
const res = await page.goto(`${data.SETTINGS.baseUrl}/ServiceFilter?postcode=E1%202EN&adminarea=E09000030&latitude=51.517612&longitude=-0.056838&frompostcodesearch=True')`); | ||
|
||
check(res, { | ||
'status is 200': (r) => r.status === 200, | ||
}); | ||
} finally { | ||
await page.close(); | ||
} | ||
sleep(1); | ||
} |