Skip to content

alphagov/government-frontend

Folders and files

NameName
Last commit message
Last commit date
Apr 12, 2017
Aug 11, 2016
Apr 10, 2017
Nov 13, 2014
Feb 9, 2015
Mar 8, 2017
Nov 13, 2014
Apr 10, 2017
Apr 10, 2017
Mar 9, 2017
Nov 13, 2014
Sep 16, 2016
Mar 15, 2017
Apr 11, 2017
Apr 11, 2017
Mar 16, 2017
Feb 11, 2016
Apr 11, 2017
Nov 13, 2014
Feb 11, 2016
Aug 8, 2016
Aug 5, 2016

Repository files navigation

Government Frontend

Government Frontend is a public-facing app to display the majority of documents on the /government part of GOV.UK. It is a replacement for the public-facing parts of the Whitehall application.

Screenshots

A  Case Study

Formats

Not all formats that this app can handle are rendered by it in production.

Format Live example Production status
Case study View on GOV.UK Migrated
Coming soon Rendered by Whitehall
Consultation View on GOV.UK Migrated
Contacts View on GOV.UK Migrated
Corporate information page View on GOV.UK Migrated
Detailed guide View on GOV.UK Migrated
Document collection View on GOV.UK Migrated on live. Draft rendered by Whitehall.
Fatality notice View on GOV.UK Migrated
HTML Publication View on GOV.UK Migrated
News Article View on GOV.UK Migrated
Publication View on GOV.UK Migrated on live. Draft rendered by Whitehall
Statistics announcement View on GOV.UK Migrated
Statistical data set View on GOV.UK Migrated
Speech View on GOV.UK Migrated
Take part View on GOV.UK Migrated
Topical event about page View on GOV.UK Migrated
Travel advice View on GOV.UK Migrated
Unpublishing Rendered by Whitehall, might not be migrated
World Location News Article View on GOV.UK Migrated
Working group View on GOV.UK Migrated

Technical documentation

This is a Ruby on Rails application that fetches documents from content-store and displays them.

Dependencies

  • content-store - provides documents
  • static - provides shared GOV.UK assets and templates.
  • phantomjs Used by poltergeist for integration testing

Running the application

./startup.sh

The app should start on http://localhost:3090 or http://government-frontend.dev.gov.uk on GOV.UK development machines.

./startup.sh --live

This will run the app and point it at the production GOV.UK content-store and static instances.

Running the test suite

The test suite relies on the presence of the govuk-content-schemas repository. If it is present at the same directory level as the government-frontend repository then run the tests with:

bundle exec rake

Or to specify the location explicitly:

GOVUK_CONTENT_SCHEMAS_PATH=/some/dir/govuk-content-schemas bundle exec rake

Debugging Integration tests

If you want to see the page that is being tested in our integration tests, you can use save_and_open_page to see what's rendered. This is helpful when a page is mostly comprised of GOV.UK Publishing Components

Visual regression tests

Use Wraith ("A responsive screenshot comparison tool") to generate a visual diff to compare rendering changes in this application.

With government-frontend running on the development VM, navigate to the project directory and run

cd test/wraith
bundle install # only need to run this once to grab the dependencies

Compare with production

Compare development with production:

bundle exec wraith capture config.yaml

Compare staging with production:

bundle exec wraith capture config-staging-vs-production.yaml

This will generate image diffs comparing the two runs, including a browsable gallery of the output, located at test/wraith/shots/gallery.html.

Compare examples on master with examples on branch

Examples are referencing https://github.com/alphagov/govuk-content-schemas

With government-frontend running master on the development VM and while pointing at the dummy content store, create a set of historical screenshots using:

cd test/wraith
bundle exec wraith history config-examples.yaml

Then switch to your branch and create a set of screenshots to compare against using:

bundle exec wraith latest config-examples.yaml

If you wish to have your own local wip configs, wip* is in the .gitignore, so as an example wip-kittens.yaml will be ignored

Adding a new format

There’s a rails generator you can use to stub the basic files needed for a new format. It stubs the following:

  • Stylesheet
  • Template
  • Presenter
  • Presenter test
  • Integration test
bundle exec rails generate format [format_name]

Licence

MIT License