-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
# Conflicts: # cypress/integration/home_page_spec.js
Just realised there's a conflicting change with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few suggestions :)
{% extends "base.html" %} | ||
|
||
{% block page_title %}Current monthly update - {{ strategic_action.name }} update – {{ supply_chain.name }} – {{ block.super }}{% endblock page_title %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think you could get rid of the 'update' after the strategic action name since it says it in the first bit :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, that's left over from the form pages where the update is being created, so not really relevant here :)
context('The <title> of', () => { | ||
|
||
describe('The Home Page', () => { | ||
it('has the correct title', () => { | ||
cy.visit(urls.home); | ||
cy.title().should('equal', expectedTitles.home()); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the tests being called 'has the correct title' I don't think you'd need the context line. Alternatively you could have 'The title of - The {page} - is correct'? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The context are mainly not necessary, I think, so I've tidied it up a bit :)
const strategicActionUpdate = strategicActionUpdates.find((strategicActionUpdate) => strategicActionUpdate.fields.strategic_action === strategicAction.pk && strategicActionUpdate.fields.slug === '05-2021'); | ||
|
||
|
||
const urls = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be really useful to move this out to be accessible by other specs :) Could be in support/utils?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good idea :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it's a bit more complicated than that… as it needs the various fixtures passed to it, I'll make it callable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
|
||
const urls = urlBuilder(supplyChain, strategicAction, strategicActionUpdate); | ||
|
||
const expectedTitles = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Nice way to collate and organise all title tests.
{% extends "base.html" %} | ||
|
||
{% block page_title %}Current monthly update - {{ strategic_action.name }} – {{ supply_chain.name }} – {{ block.super }}{% endblock page_title %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any recommendation/restrictions for the length of the title from GDS ?
Would this title show up as ?
Current monthly update - Strategic action 01 - Ceramics - Update supply chain information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there's very little advice - just the things I linked in the PR. HMRC recommend no more than four dash-separated components, so although it's a little verbose, it's within that limit.
# Conflicts: # defend_data_capture/supply_chains/templates/base.html
Adds <title>s for each page.
Draws on https://www.gov.uk/service-manual/design/writing-for-user-interfaces#style which has some pointers, and additional discussion at alphagov/govuk-design-system-backlog#157
A couple more fixtures were added, which meant some of the existing Cypress tests had to be tweaked. In order to avoid having to change them again if further fixtures are added in future, I've replaced tests using
contains()
withinvoke('text').matches()
using regular expressions with\d+
instead of the embedded numerical values that had changed.