Skip to content

Commit

Permalink
feat: Change Career stages Navigation url
Browse files Browse the repository at this point in the history
Merge pull request #425 from DFE-Digital/changecareer-stagesurl
  • Loading branch information
MartinBelton-gov authored Feb 16, 2024
2 parents 34a325e + b75e101 commit 8f32507
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Childrens-Social-Care-CPD/Views/Shared/_ErrorLayout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</a>
</li>
<li class="dfe-header__navigation-item" id="mmi-career">
<a class="dfe-header__navigation-link" href="/career-stages">
<a class="dfe-header__navigation-link" href="/career-stages/practitioner">
Career stages
<svg class="dfe-icon dfe-icon__chevron-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" width="34" height="34">
<path d="M15.5 12a1 1 0 0 1-.29.71l-5 5a1 1 0 0 1-1.42-1.42l4.3-4.29-4.3-4.29a1 1 0 0 1 1.42-1.42l5 5a1 1 0 0 1 .29.71z"></path>
Expand Down
2 changes: 1 addition & 1 deletion Childrens-Social-Care-CPD/Views/Shared/_Header.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<ul class="dfe-header__navigation-list">
@{
RenderMenuItem("home", "Home", "home", category == "Home");
RenderMenuItem("career", "Career stages", "career-stages", category == "Career information");
RenderMenuItem("career", "Career stages", "career-stages/practitioner", category == "Career information");
RenderMenuItem("developmentProgrammes", "Development programmes", "development-programmes", category == "Development programmes");
RenderMenuItem("exploreRoles", "Explore roles", "explore-roles", category == "Explore roles");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,76 @@
import { test, expect } from '@playwright/test'

test.describe('Experienced Practitioners', () => {
test.describe('Practitioner', () => {

test('User journey via menu @journey', async ({ page }) => {
await page.goto('/')
await page.getByLabel('Menu').getByRole('link', { name: 'Career stages', exact: true }).click()
await page.getByRole('link', { name: 'Practitioner', exact: true }).click()

await expect(page.locator('h1', { hasText: /^Practitioner$/ })).toBeVisible()
await expect(page).toHaveURL(/.*\/practitioner/)
await expect(page.locator('#mmi-career')).toHaveClass(/dfe-header__navigation-item--current/)

})

})

test.describe('Experienced Practitioner', () => {

test('User journey from homepage @journey', async ({ page }) => {
await page.goto('/')
await page.getByRole('link', { name: 'Practitioners', exact: true }).click()
await page.getByRole('link', { name: 'Develop your social work practice', exact: true }).click()
await page.getByRole('link', { name: 'Practitioner', exact: true }).click()
await page.getByRole('link', { name: 'Experienced practitioner', exact: true }).click()

await expect(page.locator('h1', { hasText: /^Develop your social work practice$/ })).toBeVisible()
await expect(page).toHaveURL(/.*\/develop-social-work-practice/)
await expect(page.locator('h1', { hasText: /^Experienced practitioner$/ })).toBeVisible()
await expect(page).toHaveURL(/.*experienced-practitioner/)
await expect(page.locator('#mmi-career')).toHaveClass(/dfe-header__navigation-item--current/)

})

})

test.describe('Manager', () => {

test('User journey via menu @journey', async ({ page }) => {
await page.goto('/')
await page.getByLabel('Menu').getByRole('link', { name: 'Career stages', exact: true }).click()
await page.getByRole('link', { name: 'Practitioners', exact: true }).click()
await page.getByRole('link', { name: 'Develop your social work practice', exact: true }).click()
await page.getByRole('link', { name: 'Manager', exact: true }).click()

await expect(page.locator('h1', { hasText: /^Manager$/ })).toBeVisible()
await expect(page).toHaveURL(/.*\/manager/)
await expect(page.locator('#mmi-career')).toHaveClass(/dfe-header__navigation-item--current/)

})

await expect(page.locator('h1', { hasText: /^Develop your social work practice$/ })).toBeVisible()
await expect(page).toHaveURL(/.*\/develop-social-work-practice/)
})

test.describe('Senior Manager', () => {

test('User journey via menu @journey', async ({ page }) => {
await page.goto('/')
await page.getByLabel('Menu').getByRole('link', { name: 'Career stages', exact: true }).click()
await page.getByRole('link', { name: 'Senior manager', exact: true }).click()

await expect(page.locator('h1', { hasText: /^Senior manager$/ })).toBeVisible()
await expect(page).toHaveURL(/.*\/senior-manager/)
await expect(page.locator('#mmi-career')).toHaveClass(/dfe-header__navigation-item--current/)

})

test.describe('External links @external', () => {
const links = [
['Find out more about the types of CPD you can do', 'https://www.socialworkengland.org.uk/cpd/what-counts-as-cpd/'],
['Find out more about CPD requirements', 'https://www.socialworkengland.org.uk/cpd/'],
['Social work post-qualifying standards', 'https://www.gov.uk/government/publications/knowledge-and-skills-statements-for-child-and-family-social-work'],
]

for (const link of links) {
test(`'${link[0]}' goes to ${link[1]}`, async ({ page }) => {
await page.goto('/develop-social-work-practice')
var promise = page.waitForResponse(`**${link[1]}`)
await page.getByRole('link', { name: link[0], exact: true }).click()
var response = await promise

expect(response.ok()).toBeTruthy()
})
}
})

test.describe('Senior Leader', () => {

test('User journey via menu @journey', async ({ page }) => {
await page.goto('/')
await page.getByLabel('Menu').getByRole('link', { name: 'Career stages', exact: true }).click()
await page.getByRole('link', { name: 'Senior leader', exact: true }).click()

await expect(page.locator('h1', { hasText: /^Senior Leader$/ })).toBeVisible()
await expect(page).toHaveURL(/.*\/senior-leader/)
await expect(page.locator('#mmi-career')).toHaveClass(/dfe-header__navigation-item--current/)

})

})
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,40 @@ test.describe('Experienced Practitioners', () => {

test('User journey from homepage @journey', async ({ page }) => {
await page.goto('/')
await page.getByRole('link', { name: 'Experienced practitioners', exact: true }).click()
await page.getByRole('link', { name: 'Experienced practitioner', exact: true }).click()

await expect(page.locator('h1', { hasText: /^Experienced practitioners$/ })).toBeVisible()
await expect(page).toHaveURL(/.*\/experienced-practitioners/)
await expect(page.locator('h1', { hasText: /^Experienced practitioner$/ })).toBeVisible()
await expect(page).toHaveURL(/.*\/experienced-practitioner/)
await expect(page.locator('#mmi-career')).toHaveClass(/dfe-header__navigation-item--current/)
})


test('User journey via menu @journey', async ({ page }) => {
await page.goto('/')
await page.getByLabel('Menu').getByRole('link', { name: 'Career stages', exact: true }).click()
await page.getByRole('link', { name: 'Experienced practitioners', exact: true }).click()
await page.getByRole('link', { name: 'Experienced practitioner', exact: true }).click()

await expect(page.locator('h1', { hasText: /^Experienced practitioners$/ })).toBeVisible()
await expect(page).toHaveURL(/.*\/experienced-practitioners/)
await expect(page.locator('h1', { hasText: /^Experienced practitioner$/ })).toBeVisible()
await expect(page).toHaveURL(/.*\/experienced-practitioner/)
await expect(page.locator('#mmi-career')).toHaveClass(/dfe-header__navigation-item--current/)
})


test.describe('Links', () => {
const links = [
['Pathway 1: practice supervisors', '/pathway-1', 'Pathway 1: practice supervisors'],
['Pathway 2: middle managers', '/pathway-2', 'Pathway 2: middle managers'],
['View all programmes', '/development-programmes', 'Child and family social work development programmes'],
['Explore roles', '/explore-roles', 'Roles in child and family social work'],
['Explore roles', '/explore-roles', 'Explore roles in child and family social work'],
]

for (const link of links) {
test(`Goes to the ${link[0]} page`, async ({ page }) => {
await page.goto('/experienced-practitioners')
await page.getByRole('link', { name: link[0], exact: true }).last().click()
await page.goto('/experienced-practitioner')
await page.goto(link[1])
await expect(page).toHaveURL(new RegExp(`.*${link[1]}`))
await expect(page.locator('h1', { hasText: new RegExp(`^${link[2]}$`) })).toBeVisible()
})
}
})

})

0 comments on commit 8f32507

Please sign in to comment.