Skip to content

Commit

Permalink
Merge pull request #364 from City-of-Helsinki/feat/HAUKI-483-matomo-t…
Browse files Browse the repository at this point in the history
…racking

feat: Matomo tracking HAUKI-483
  • Loading branch information
mikkojamG authored Mar 5, 2024
2 parents d2d9231 + 24cc3a6 commit c22e679
Show file tree
Hide file tree
Showing 31 changed files with 791 additions and 243 deletions.
7 changes: 5 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
API_URL=""
API_URL="http://localhost:8000"
USE_AXE=""
SENTRY_DSN=""
SENTRY_ENV=""
REACT_APP_VERSION=""
FEEDBACK_EMAILS=""
MATOMO_SRC_URL=""
MATOMO_URL_BASE=""
MATOMO_SITE_ID=""
MATOMO_ENABLED=false
1 change: 1 addition & 0 deletions cypress/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ declare namespace Cypress {
hours: string;
minutes: string;
}) => Chainable;
acceptAllCookies(): void;
}
}
1 change: 1 addition & 0 deletions cypress/integration/App.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
describe('Open aukiolot app', () => {
beforeEach(() => {
cy.visitResourcePageAsAuthenticatedUser(Cypress.env('resourceId'));
cy.acceptAllCookies();
});

it('Contains correct page title', () => {
Expand Down
2 changes: 2 additions & 0 deletions cypress/integration/CopyResourcePeriods.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ describe('User visits resource page with target resource', () => {
Cypress.env('resourceId'),
Cypress.env('targetResourceId')
);

cy.acceptAllCookies();
});

it('Contains copy section title and copy button', () => {
Expand Down
1 change: 1 addition & 0 deletions cypress/integration/ExceptionOpeningHours.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
describe('User adds a new exception date period', () => {
beforeEach(() => {
cy.visitResourcePageAsAuthenticatedUser(Cypress.env('resourceId'));
cy.acceptAllCookies();
});

it('Users successfully adds a new exception opening hours', () => {
Expand Down
1 change: 1 addition & 0 deletions cypress/integration/Holidays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ describe('User adds a new holiday opening period', () => {
beforeEach(() => {
cy.visitResourcePageAsAuthenticatedUser(Cypress.env('resourceId'));
cy.intercept('POST', '/v1/date_period/').as('saveHoliday');
cy.acceptAllCookies();
});

it('Users successfully adds a new holiday opening hours', () => {
Expand Down
1 change: 1 addition & 0 deletions cypress/integration/NormalOpeningHours.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
describe('User adds a new opening period', () => {
beforeEach(() => {
cy.visitResourcePageAsAuthenticatedUser(Cypress.env('resourceId'));
cy.acceptAllCookies();
});

it('Users successfully adds a new opening hours', () => {
Expand Down
2 changes: 2 additions & 0 deletions cypress/integration/User.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
describe('Unauthenticated user', () => {
beforeEach(() => {
cy.visitResourcePageAsUnauthenticatedUser(Cypress.env('resourceId'));
cy.acceptAllCookies();
});

it('Is redirected to unauthenticated page', () => {
Expand All @@ -13,6 +14,7 @@ describe('Unauthenticated user', () => {
describe('Authenticated user', () => {
beforeEach(() => {
cy.visitResourcePageAsAuthenticatedUser(Cypress.env('resourceId'));
cy.acceptAllCookies();
});

it('should logout permanently on application close', () => {
Expand Down
9 changes: 9 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,12 @@ Cypress.Commands.add(
cy.get(`#${id}-minutes`).type(minutes);
}
);

Cypress.Commands.add('acceptAllCookies', () => {
const cookieConsentModal = cy.get('#cookie-consent-content');
const acceptAllButton = cookieConsentModal.get(
'button[data-testid="cookie-consent-approve-button"]'
);

acceptAllButton.click();
});
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
version: "3.7"
version: '3.7'
services:
app:
platform: linux/amd64
container_name: hauki-admin-ui
build:
context: .
env_file:
- .env
- .env.local
ports:
- '3000:8000'
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"cypress-axe": "^0.12.1",
"date-fns": "2.29.3",
"date-holidays": "^3.16.1",
"dotenv-cli": "^7.3.0",
"enzyme": "^3.11.0",
"eslint-config-airbnb-typescript-prettier": "^5.0.0",
"hds-core": "^3.5.0",
Expand All @@ -47,10 +48,10 @@
"typescript": "4.4.3"
},
"scripts": {
"start": "REACT_APP_VERSION=$npm_package_version SENTRY_ENV=${SENTRY_ENV:=local} API_URL=${API_URL:=http://localhost:8000} USE_AXE=${USE_AXE:=true} ./scripts/env.sh && cp env-config.js ./public/ && BROWSER=none react-scripts start",
"start-with-test-api": "REACT_APP_VERSION=$npm_package_version SENTRY_ENV=local API_URL=https://hauki-api.test.hel.ninja USE_AXE=${USE_AXE:=true} ./scripts/env.sh && cp env-config.js ./public/ && react-scripts start",
"start-with-new-test-api": "REACT_APP_VERSION=$npm_package_version SENTRY_ENV=local API_URL=https://hauki-api.test.hel.ninja USE_AXE=${USE_AXE:=true} ./scripts/env.sh && cp env-config.js ./public/ && react-scripts start",
"build": "REACT_APP_VERSION=$npm_package_version react-scripts build",
"start": "dotenv -c -v REACT_APP_VERSION=$npm_package_version -- ./scripts/env.sh && cp env-config.js ./public/ && BROWSER=none react-scripts start",
"start-with-test-api": "dotenv -c -v REACT_APP_VERSION=$npm_package_version SENTRY_ENV=local API_URL=https://hauki-api.test.hel.ninja USE_AXE=${USE_AXE:=true} -- ./scripts/env.sh && cp env-config.js ./public/ && react-scripts start",
"start-with-new-test-api": "dotenv -c -v REACT_APP_VERSION=$npm_package_version SENTRY_ENV=local API_URL=https://hauki-api.test.hel.ninja USE_AXE=${USE_AXE:=true} -- ./scripts/env.sh && cp env-config.js ./public/ && react-scripts start",
"build": "dotenv -c -v REACT_APP_VERSION=$npm_package_version -- react-scripts build",
"test": "react-scripts test --env=jest-environment-jsdom-sixteen",
"test:cov": "react-scripts test --env=jest-environment-jsdom-sixteen --coverage",
"test-cypress": "start-server-and-test start http://localhost:3000 cypress-run-chrome",
Expand Down
Loading

0 comments on commit c22e679

Please sign in to comment.