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

Feature/add specific e2e prison #742

Merged
merged 4 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The app now takes it's establishment name from the hostname of each request. In
When running locally, in order to access the application as if you were at a specific establishment, `/etc/hosts` will need to be configured so that `127.0.0.1 localhost` includes one or more of the following:

- `berwyn.prisoner-content-hub.local`
- `cookhamwood.prisoner-content-hub.local`
- `etwoe.prisoner-content-hub.local`
- `erlestoke.prisoner-content-hub.local`
- `felthama.prisoner-content-hub.local`
- `felthamb.prisoner-content-hub.local`
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/features/incentives.feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('Profile', () => {
cy.task('stubPrimaryNavigation');
cy.task('stubUrgentBanners');
cy.task('stubBrowseAllTopics');
cy.visit(`http://cookhamwood.content-hub.localhost:3000/profile`);
cy.visit(`http://etwoe.content-hub.localhost:3000/profile`);
});

describe('When signed in', () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/features/money.feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('Profile', () => {
cy.task('stubPrimaryNavigation');
cy.task('stubUrgentBanners');
cy.task('stubBrowseAllTopics');
cy.visit(`http://cookhamwood.content-hub.localhost:3000/profile`);
cy.visit(`http://etwoe.content-hub.localhost:3000/profile`);
});

describe('When signed out', () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/features/profile.feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('Profile', () => {
cy.task('stubPrimaryNavigation');
cy.task('stubUrgentBanners');
cy.task('stubBrowseAllTopics');
cy.visit(`http://cookhamwood.content-hub.localhost:3000/profile`);
cy.visit(`http://etwoe.content-hub.localhost:3000/profile`);
});
describe('When signed out', () => {
it('displays the sign in link', () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/features/timetable.feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('Timetable', () => {
cy.task('stubPrimaryNavigation');
cy.task('stubUrgentBanners');
cy.task('stubBrowseAllTopics');
cy.visit(`http://cookhamwood.content-hub.localhost:3000/timetable`);
cy.visit(`http://etwoe.content-hub.localhost:3000/timetable`);
});
describe('When signed out', () => {
it('displays the sign in link', () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/features/visits.feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('Profile', () => {
cy.task('stubPrimaryNavigation');
cy.task('stubUrgentBanners');
cy.task('stubBrowseAllTopics');
cy.visit(`http://cookhamwood.content-hub.localhost:3000/profile`);
cy.visit(`http://etwoe.content-hub.localhost:3000/profile`);
});

describe('When signed in', () => {
Expand Down
6 changes: 3 additions & 3 deletions e2e/cypress/ignored/homepage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ Feature: Home Page
Then I see the "Wayland" home page
And I am displayed the "Sign in" link

Scenario: I go to the Cookham Wood home page
Given that I go to the Prisoner Content Hub for "Cookham Wood"
Then I see the "Cookham Wood" home page
Scenario: I go to the etwoe home page
Given that I go to the Prisoner Content Hub for "etwoe"
Then I see the "etwoe" home page
10 changes: 5 additions & 5 deletions e2e/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ services:
build: ..
container_name: web
networks:
prisoner-content-hub-e2e:
prisoner-content-hub-etwoe:
aliases:
- content-hub.localhost
- wayland.content-hub.localhost
- berwyn.content-hub.localhost
- cookhamwood.content-hub.localhost
- etwoe.content-hub.localhost
depends_on:
- wiremock
restart: always
Expand All @@ -22,7 +22,7 @@ services:
image: rodolpheche/wiremock
container_name: wiremock
networks:
- prisoner-content-hub-e2e
- prisoner-content-hub-etwoe
restart: always
ports:
- "9091:8080"
Expand All @@ -31,7 +31,7 @@ services:
build: .
container_name: cypress
networks:
- prisoner-content-hub-e2e
- prisoner-content-hub-etwoe
depends_on:
- web
- wiremock
Expand All @@ -41,4 +41,4 @@ services:
- WIREMOCK_BASE_URL=http://wiremock:8080

networks:
prisoner-content-hub-e2e:
prisoner-content-hub-etwoe:
4 changes: 4 additions & 0 deletions server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ module.exports = {
enabled: false,
features: [],
},
etwoe: {
enabled: true,
features: ['adjudications', 'incentives', 'money', 'timetable', 'visits'],
},
felthama: {
enabled: false,
features: [],
Expand Down
6 changes: 6 additions & 0 deletions server/content/establishmentData.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
"youth": false,
"agencyId": "CKI"
},
"1": {
"name": "etwoe",
"displayName": "HMP etwoe",
"youth": false,
"agencyId": "EEE"
},
"1074": {
"name": "erlestoke",
"displayName": "HMP Erlestoke",
Expand Down
14 changes: 7 additions & 7 deletions server/middleware/__tests__/getEstablishmentFromUrl.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('getEstablishmentFromUrl', () => {
it(`should retrieve establishment from the header in ${env} and set in the session`, () => {
req.headers.host = urlStubWith;
getEstablishmentFromUrl(req, res, next);
expect(req.session.establishmentName).toBe('cookhamwood');
expect(req.session.establishmentName).toBe('etwoe');
});
it(`should not retrieve establishment from the header and set in the session in ${env} if not provided`, () => {
req.headers.host = urlStubWithout;
Expand All @@ -28,35 +28,35 @@ describe('getEstablishmentFromUrl', () => {
};

describe('for localhost urls', () => {
getTests('development', 'cookhamwood.localhost:3000', 'localhost:3000');
getTests('development', 'etwoe.localhost:3000', 'localhost:3000');
});

describe('for local urls', () => {
getTests(
'local',
'cookhamwood.prisoner-content-hub.local:3000',
'etwoe.prisoner-content-hub.local:3000',
'localhost:3000',
);
});

describe('for development urls', () => {
getTests(
'development',
'cookhamwood-prisoner-content-hub-development-395.apps.live.cloud-platform.service.justice.gov.uk/',
'prisoner-content-hub-development-395.apps.live.cloud-platform.service.justice.gov.uk/',
'etwoe-prisoner-content-hub-development.apps.live.cloud-platform.service.justice.gov.uk/',
'prisoner-content-hub-development.apps.live.cloud-platform.service.justice.gov.uk/',
);
});
describe('for staging urls', () => {
getTests(
'staging',
'cookhamwood-prisoner-content-hub-staging.apps.live.cloud-platform.service.justice.gov.uk',
'etwoe-prisoner-content-hub-staging.apps.live.cloud-platform.service.justice.gov.uk',
'prisoner-content-hub-staging.apps.live.cloud-platform.service.justice.gov.uk',
);
});
describe('for production urls', () => {
getTests(
'production',
'cookhamwood.content-hub.prisoner.service.justice.gov.uk',
'etwoe.content-hub.prisoner.service.justice.gov.uk',
'content-hub.prisoner.service.justice.gov.uk/',
);
});
Expand Down
4 changes: 2 additions & 2 deletions server/repositories/__tests__/cmsApi.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ describe('CmsApi', () => {

it('should format and return single value', async () => {
const individual =
'https://cms.org//jsonapi/prison/cookhamwood/taxonomy_term/series/1562712e-ecdc-4d99-82ae-86c04349a6a0';
'https://cms.org//jsonapi/prison/etwoe/taxonomy_term/series/1562712e-ecdc-4d99-82ae-86c04349a6a0';
const resourceName = 'taxonomy_term--series';
mockDrupal.get(lookupPath).reply(200, {
jsonapi: {
Expand Down Expand Up @@ -412,7 +412,7 @@ describe('CmsApi', () => {

it('should format and return single value', async () => {
const individual =
'https://cms.org//jsonapi/prison/cookhamwood/taxonomy_term/series/1562712e-ecdc-4d99-82ae-86c04349a6a0';
'https://cms.org//jsonapi/prison/etwoe/taxonomy_term/series/1562712e-ecdc-4d99-82ae-86c04349a6a0';
const resourceName = 'taxonomy_term--series';
mockDrupal.get(lookupPath).reply(200, {
jsonapi: {
Expand Down
Loading