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

Release 3.17.1 #1031

Merged
merged 43 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
50dd613
Remove old cypress config
dtrucs Jul 27, 2023
cf0b805
Upgrade cypress package to 12.17.2
dtrucs Jul 27, 2023
89642bf
Setup cypress config
dtrucs Jul 27, 2023
21b3f7a
Create homepage e2e test
dtrucs Jul 27, 2023
cca4e94
Review cypress config
dtrucs Dec 14, 2023
43e070a
add cypress job
submarcos Jan 15, 2024
af96999
add dependabot auto PR
submarcos Jan 15, 2024
d8ec739
add dependabot auto PR
submarcos Jan 15, 2024
110ff9b
add dependabot auto PR
submarcos Jan 15, 2024
86de723
change working directory
submarcos Jan 15, 2024
5e6f82c
archive results
submarcos Jan 15, 2024
06d100c
run tests on main merge and limit concurrency
submarcos Jan 15, 2024
793c361
fix cache
submarcos Jan 15, 2024
d9fbe25
fix modules
submarcos Jan 15, 2024
bef574c
fix modules
submarcos Jan 15, 2024
af10f1a
fix modules
submarcos Jan 15, 2024
f23fa0d
update actions/setup-node
submarcos Jan 15, 2024
dd53aff
update actions/setup-node
submarcos Jan 15, 2024
3efeb05
update actions/setup-node
submarcos Jan 15, 2024
9be1bde
update actions/setup-node
submarcos Jan 15, 2024
991b7fd
dont install cypress but run yarn
submarcos Jan 15, 2024
740c16e
dont install cypress but run yarn
submarcos Jan 15, 2024
2c8fd3d
dont install cypress but run yarn
submarcos Jan 15, 2024
08be67d
dont install cypress but run yarn
submarcos Jan 15, 2024
d4243fd
dont install cypress but run yarn
submarcos Jan 15, 2024
49f38d8
change default url
submarcos Jan 15, 2024
bde716c
update develop
submarcos Jan 15, 2024
b5a355f
fix dependabot
submarcos Jan 15, 2024
b44d6dd
Define color/bg-color on #header instead of first node child
dtrucs Jan 15, 2024
1b04f36
update cypress
submarcos Jan 22, 2024
b584065
documentation for cypress in development
submarcos Jan 22, 2024
7e9c703
Fix scriptsHeader/Footer containing one node
dtrucs Jan 23, 2024
70ed40b
Rename elevation to positiveElevation
dtrucs Jan 9, 2024
89365f3
Create resultCard config
dtrucs Jan 9, 2024
6a2d592
Display/hide and order resultCard information according to its config…
dtrucs Jan 9, 2024
8b79a0a
Possibility to add negativeElevation to resultCard
dtrucs Jan 9, 2024
651d150
Possibility to add trek networks to resultCard
dtrucs Jan 10, 2024
5b33976
Possibility to add trek courseType to resultCard
dtrucs Jan 10, 2024
2e4173f
Fetch dictionaries for resultCard only if it's necessary
dtrucs Jan 10, 2024
000991f
Fix conditional display of theme according by the config
dtrucs Jan 10, 2024
8d1a242
Remove max height for resultCard
dtrucs Jan 10, 2024
d43fffc
Documentation related to resultCard customization
dtrucs Jan 11, 2024
27034f8
Bump package.json / 3.17.1
dtrucs Jan 25, 2024
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
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

- package-ecosystem: "npm"
directory: "./frontend" # Location of package manifests
schedule:
interval: "weekly"
22 changes: 19 additions & 3 deletions .github/workflows/action-intall-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
name: Install and test

on: [pull_request]
on:
pull_request:
push:
branches:
- main
- develop

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CYPRESS_INSTALL_BINARY: 0

jobs:
install-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup node
id: cache-node-modules
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: ./frontend/.nvmrc
cache: "yarn"
cache-dependency-path: "**/yarn.lock"

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
working-directory: ./frontend

- name: Check types
run: yarn tsc
working-directory: ./frontend

- name: Run tests
run: yarn test:coverage
working-directory: ./frontend

- name: Check linter
run: yarn lint
working-directory: ./frontend
45 changes: 45 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: E2E tests

on:
pull_request:
push:
branches:
- main
- develop

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
e2e:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup node
id: cache-node-modules
uses: actions/setup-node@v4
with:
node-version-file: ./frontend/.nvmrc
cache: "yarn"
cache-dependency-path: "**/yarn.lock"

- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: ./frontend

- name: Cypress run
uses: cypress-io/github-action@v6
with:
start: yarn dev
working-directory: ./frontend

- name: Archive results as artifacts
uses: actions/upload-artifact@v3
with:
name: cypress
path: |
/home/runner/work/Geotrek-rando-v3/Geotrek-rando-v3/frontend/cypress/videos/*.mp4
/home/runner/work/Geotrek-rando-v3/Geotrek-rando-v3/frontend/cypress/screenshots/*.png
20 changes: 20 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## 3.17.1 (2024-01-25)

**🚀 New features**

- Customization of result card (#987)

**✨ Improvements**

- Remove the limitation of result card max height (#1012)

**🔧 Maintenance**

- Upgrade Cypress package to 13.6.3 (#1028)
- Run Cypress tests on CI (#948 and #1028)

**🐛 Fixes**

- Fix regression customization header - regression since v3.17.0 (#1019 and #1020)
- Fix scriptsHeader/Footer containing only one node - regression since v3.15.4 (#1029 and #1030)

## 3.17.0 (2024-01-12)

Require Geotrek-admin 2.98.0 (March 2023) minimum.
Expand Down
13 changes: 13 additions & 0 deletions docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,19 @@ NB: For "report" and "reservationWidget" sections with `anchors` set to `true`,

- `zoomAvailableOffline` allows you to define the zoom modes allowed in offline mode. This allows you to control the amount of disk space required when caching. Default `[13,14,15]`

- `resultCard.json` to customize the elements to be displayed on featured cards that link to a details page (only trek cards for now).

- You can display/hide the `location` and `themes` by defining a `display` key.
- You can define an array of keywords in `informations` to display them (their order in the array matters). The keywords are as follows:
- `'difficulty'`,
- `'duration'`,
- `'distance'`,
- `'positiveElevation'`,
- `'negativeElevation'`,
- `'courseType'`,
- `'networks'`,
Default value is `"informations": ["difficulty", "duration", "distance", "positiveElevation"]`. See https://github.com/GeotrekCE/Geotrek-rando-v3/blob/main/frontend/config/resultCard.json.

- `redirects.json` to define URL rewriting for your instance. For example, you can use this customization to redirect old URL style (Geotrek-rando V2) to the new URL style (Geotrek-rando V3) or to redirect old URL to a new URL after changing the name of a hike in the backend.

- In `rules`, you can define all the rules needed to redirect clients
Expand Down
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Installation in development:
- Use nvm and then:

```bash
nvm use 18
nvm use
```

Install yarn
Expand Down
1 change: 1 addition & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ node_modules

# testing
/coverage
**/public/*@cypress

# production
/build
Expand Down
11 changes: 11 additions & 0 deletions frontend/config/resultCard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"trek": {
"location": {
"display": true
},
"themes": {
"display": true
},
"informations": ["difficulty", "duration", "distance", "positiveElevation"]
}
}
11 changes: 11 additions & 0 deletions frontend/customization/config/resultCard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"trek": {
"location": {
"display": true
},
"themes": {
"display": true
},
"informations": ["difficulty", "duration", "distance", "positiveElevation"]
}
}
12 changes: 12 additions & 0 deletions frontend/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
baseUrl: "http://rando.localhost:3000",
retries: {
runMode: 3,
},
viewportHeight: 1080,
viewportWidth: 1920,
},
});
7 changes: 0 additions & 7 deletions frontend/cypress.json

This file was deleted.

5 changes: 5 additions & 0 deletions frontend/cypress/e2e/homePage.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('template spec', () => {
it('Visits homepage', () => {
cy.visit('/')
})
})
36 changes: 0 additions & 36 deletions frontend/cypress/integration/login.spec.js

This file was deleted.

37 changes: 37 additions & 0 deletions frontend/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
20 changes: 20 additions & 0 deletions frontend/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
8 changes: 8 additions & 0 deletions frontend/cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress", "node"],
},
"include": ["**/*.ts"],
}
2 changes: 2 additions & 0 deletions frontend/docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Useful commands:

- `npm run test` to launch tests in watch mode

- `npm run e2e` to launch cypress end-to-end tests (after ```npm run dev```)

- * `npm run generate` to generate a new component or a new page. You will be prompted the following questions:

* Do you want a page or a component?
Expand Down
14 changes: 14 additions & 0 deletions frontend/jestAfterEnv.setup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,20 @@ setConfig({
touristicEvent: []
},
},
resultCard: {
trek: {
location: {
display: true,
},
themes: {
display: true,
},
labels: {
display: true,
},
informations: ['difficulty', 'duration', 'distance', 'positiveElevation'],
},
},
detailsSectionHtml: {
forecastWidget: { default: '<iframe\n id="widget_autocomplete_preview"\n className="w-full"\n height="150"\n src="https://meteofrance.com/widget/prevision/{{ cityCode }}0"\n></iframe>\n' }
},
Expand Down
5 changes: 3 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "geotrek-rando-frontend",
"version": "3.17.0",
"version": "3.17.1",
"private": true,
"scripts": {
"debug": "NODE_OPTIONS='--inspect' next ./src",
Expand All @@ -12,6 +12,7 @@
"prestart": "node ./src/services/rewriteBuildedPages.mjs",
"start": "NODE_ENV=production node ./src/server.js",
"test": "jest --coverage=false --runInBand",
"e2e": "cypress run",
"test:coverage": "jest --coverage --runInBand",
"test:compact": "DEBUG_PRINT_LIMIT=50 yarn test",
"tsc": "tsc -p ./src/tsconfig.json",
Expand Down Expand Up @@ -44,7 +45,7 @@
"autoprefixer": "^10.4.14",
"axios": "0.25.0",
"compression": "^1.7.4",
"cypress": "^4.12.1",
"cypress": "^13.6.3",
"debounce": "^1.2.1",
"deepmerge": "^4.3.1",
"diacritics": "^1.3.0",
Expand Down
Loading
Loading