diff --git a/.env b/.env.development
similarity index 88%
rename from .env
rename to .env.development
index b7744dbf4..c8c8de089 100644
--- a/.env
+++ b/.env.development
@@ -7,4 +7,5 @@ VITE_WMTS_BASE_URL=https://sys-wmts.dev.bgdi.ch/
VITE_WMS_BASE_URL=https://sys-wms.dev.bgdi.ch/
VITE_API_SERVICES_BASE_URL=https://sys-map.dev.bgdi.ch/api/
VITE_API_SERVICE_KML_BASE_URL=https://sys-public.dev.bgdi.ch/
+VITE_API_SERVICE_KML_STORAGE_BASE_URL=https://sys-public.dev.bgdi.ch/
VITE_APP_API_SERVICE_SHORTLINK_BASE_URL=https://sys-s.dev.bgdi.ch/
diff --git a/.env.integration b/.env.integration
index d2ab352ad..2ae17afd0 100644
--- a/.env.integration
+++ b/.env.integration
@@ -6,4 +6,5 @@ VITE_WMTS_BASE_URL=https://sys-wmts.int.bgdi.ch/
VITE_WMS_BASE_URL=https://sys-wms.int.bgdi.ch/
VITE_API_SERVICES_BASE_URL=https://sys-map.int.bgdi.ch/api/
VITE_API_SERVICE_KML_BASE_URL=https://sys-public.int.bgdi.ch/
+VITE_API_SERVICE_KML_STORAGE_BASE_URL=https://sys-public.int.bgdi.ch/
VITE_APP_API_SERVICE_SHORTLINK_BASE_URL=https://sys-s.int.bgdi.ch/
diff --git a/.env.production b/.env.production
index 397748d5c..af9fb5e34 100644
--- a/.env.production
+++ b/.env.production
@@ -1,10 +1,10 @@
-VITE_APP_API_BASE_URL=https://api3.geo.admin.ch/
+VITE_API_BASE_URL=https://api3.geo.admin.ch/
VITE_API_SERVICE_ALTI_BASE_URL=https://api3.geo.admin.ch/
VITE_API_SERVICE_SEARCH_BASE_URL=https://api3.geo.admin.ch/
-VITE_APP_API_PUBLIC_URL=https://public.geo.admin.ch/
-VITE_APP_DATA_BASE_URL=https://data.geo.admin.ch/
-VITE_APP_WMTS_BASE_URL=https://wmts.geo.admin.ch/
-VITE_APP_WMS_BASE_URL=https://wms.geo.admin.ch/
-VITE_APP_API_SERVICES_BASE_URL=https://map.geo.admin.ch/
-VITE_APP_API_SERVICE_KML_BASE_URL=https://public.geo.admin.ch/
+VITE_DATA_BASE_URL=https://data.geo.admin.ch/
+VITE_WMTS_BASE_URL=https://wmts.geo.admin.ch/
+VITE_WMS_BASE_URL=https://wms.geo.admin.ch/
+VITE_API_SERVICES_BASE_URL=https://map.geo.admin.ch/api/
+VITE_API_SERVICE_KML_BASE_URL=https://public.geo.admin.ch/
+VITE_API_SERVICE_KML_STORAGE_BASE_URL=https://public.geo.admin.ch/
VITE_APP_API_SERVICE_SHORTLINK_BASE_URL=https://s.geo.admin.ch/
diff --git a/.gitignore b/.gitignore
index 9c09eac3e..8cbfe0f8b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
.DS_Store
node_modules
-/dist
+dist/
# local env files
.env.local
diff --git a/buildspec.yml b/buildspec.yml
index f012195d6..10110e4a4 100644
--- a/buildspec.yml
+++ b/buildspec.yml
@@ -44,11 +44,20 @@ phases:
export GIT_BRANCH=${GIT_BRANCH##*/}
fi
# if this build has been triggered by a push on master (PR merge on master), we deploy on INT (otherwise everything goes to dev)
- - export BUILD_TYPE=dev
- export DEPLOY_TARGET="dev"
- - if [ "${GIT_BRANCH}" = "master" ] ; then
+ - export BUILD_TYPE_1=dev
+ - export BUILD_OUTPUT_1=development
+ - export BUILD_TYPE_2=dev
+ - export BUILD_OUTPUT_2=development
+ - if [[ "${GIT_BRANCH}" == "master" ]]; then
export DEPLOY_TARGET="int";
- export BUILD_TYPE=prod;
+ export BUILD_TYPE_1=int;
+ export BUILD_OUTPUT_1=integration;
+ export BUILD_TYPE_2=prod;
+ export BUILD_OUTPUT_2=production;
+ elif [[ "${GIT_BRANCH}" == "develop" ]]; then
+ export BUILD_TYPE_2=int;
+ export BUILD_OUTPUT_2=integration;
fi
# if we are on DEV, we have to switch to the account "swisstopo-bgdi-dev", otherwise the account is "swisstopo-bgdi"
- export AWS_ACCOUNT_TO_USE="${AWS_SWISSTOPO_BGDI_DEV_ACCOUNT_ID}:role/BgdiDevCodebuildAccess"
@@ -75,7 +84,10 @@ phases:
- echo GIT_HASH=${GIT_HASH}
- echo GIT_TAG=${GIT_TAG}
- echo GIT_DIRTY=${GIT_DIRTY}
- - echo BUILD_TYPE=${BUILD_TYPE}
+ - echo BUILD_TYPE_1=${BUILD_TYPE_1}
+ - echo BUILD_TYPE_2=${BUILD_TYPE_2}
+ - echo BUILD_OUTPUT_2=${BUILD_OUTPUT_2}
+ - echo BUILD_OUTPUT_1=${BUILD_OUTPUT_1}
- echo DEPLOY_TARGET=${DEPLOY_TARGET}
- echo AWS_ACCOUNT_TO_USE=${AWS_ACCOUNT_TO_USE}
- echo APP_VERSION=${GIT_TAG}
@@ -85,8 +97,13 @@ phases:
build:
commands:
- echo ===================================================================
- - echo Building application for ${BUILD_TYPE}
- - npm run build-${BUILD_TYPE}
+ - echo Building application for ${BUILD_TYPE_1}
+ - npm run build:${BUILD_TYPE_1}
+ - if [[ "${BUILD_TYPE_1}" != "${BUILD_TYPE_2}" ]]; then
+ echo -------------------------------------------------------------------;
+ echo Building application for ${BUILD_TYPE_2};
+ npm run build:${BUILD_TYPE_2};
+ fi
post_build:
@@ -105,13 +122,19 @@ phases:
- echo ===================================================================
- echo E2E Testings...
# will build the application in dev mode before testing
- - CYPRESS_CACHE_FOLDER=/tmp/.cache npm run test:e2e:ci
+ - CYPRESS_CACHE_FOLDER=/tmp/.cache npm run test:e2e:ci:${BUILD_TYPE_1}
- echo DONE
artifacts:
# The name below is only used for manual build (not by build started by the webhook)
- name: ${BUILD_TYPE}/web-mapviewer/${APP_VERSION}
+ name: ${BUILD_TYPE_1}/web-mapviewer/${APP_VERSION}
files:
- '**/*'
- base-directory: dist
\ No newline at end of file
+ base-directory: dist/${BUILD_OUTPUT_1}
+ secondary-artifacts:
+ production:
+ name: ${BUILD_TYPE_2}/web-mapviewer/${APP_VERSION}
+ files:
+ - '**/*'
+ base-directory: dist/${BUILD_OUTPUT_2}
\ No newline at end of file
diff --git a/cypress.config.ts b/cypress.config.ts
index d66e1e54c..9d0b7f4b5 100644
--- a/cypress.config.ts
+++ b/cypress.config.ts
@@ -69,6 +69,6 @@ module.exports = defineConfig({
},
baseUrl: 'http://localhost:8080',
specPattern: 'tests/e2e-cypress/integration/**/*.*',
- supportFile: 'tests/e2e-cypress/support/index.js',
+ supportFile: 'tests/e2e-cypress/support/index.js'
},
})
diff --git a/package.json b/package.json
index fe93f5e4b..13e7a35c7 100644
--- a/package.json
+++ b/package.json
@@ -4,19 +4,23 @@
"scripts": {
"start": "npm run dev",
"dev": "vite --port 8080",
- "preview": "vite build && vite preview --port 8080",
+ "preview": "npm run build:prod && vite preview --port 8080 --outDir dist/production",
+ "preview:dev": "npm run build:dev && vite preview --port 8080 --outDir dist/development",
"test:unit": "vitest --run --environment jsdom",
"test:unit:watch": "vitest --environment jsdom",
"test:e2e": "start-server-and-test dev 8080 'cypress open'",
"test:e2e:tablet": "start-server-and-test preview 8080 'cypress open --config viewportWidth=768,viewportHeight=1024'",
"test:e2e:desktop": "start-server-and-test preview 8080 'cypress open --config viewportWidth=1440,viewportHeight=900'",
"test:e2e:ci": "start-server-and-test preview 8080 'cypress run'",
+ "test:e2e:ci:dev": "start-server-and-test preview:dev 8080 'cypress run'",
+ "test:e2e:ci:prod": "npm run test:e2e:ci",
"test:ci": "npm run test:unit && npm run test:e2e:ci",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
"build": "npm run type-check && vite build",
- "build-dev": "npm run build -- --mode development",
- "build-prod": "npm run build -- --mode production",
+ "build:dev": "npm run build -- --mode development",
+ "build:int": "npm run build -- --mode integration",
+ "build:prod": "npm run build -- --mode production",
"deploy:dev": "node scripts/deploy.js dev",
"deploy:int": "node scripts/deploy.js int",
"update:translations": "node scripts/generate-i18n-files.js",
diff --git a/scripts/deploy.js b/scripts/deploy.js
index f5c68b810..454589c8e 100644
--- a/scripts/deploy.js
+++ b/scripts/deploy.js
@@ -65,7 +65,7 @@ const s3Utils = require('./s3-utils')
const fileUtils = require('./file-utils')
// Checking if index.html file is present in dist folder (if build has been done beforehand)
-if (!fileUtils.fileExists('./dist/index.html')) {
+if (!fileUtils.fileExists('./dist/development/index.html')) {
console.error('Please build the project before trying to deploy')
process.exit(1)
}
@@ -114,7 +114,7 @@ s3Utils
bucketFolder = branch
}
- const distFolderRelativePath = './dist/'
+ const distFolderRelativePath = './dist/development'
const distFolderFullPath = resolve(distFolderRelativePath)
let countFileBeingUploaded = 0
diff --git a/src/config.js b/src/config.js
index 20baf1d88..83bbe2dfe 100644
--- a/src/config.js
+++ b/src/config.js
@@ -96,7 +96,7 @@ export const API_SERVICES_BASE_URL = enforceEndingSlashInUrl(
* @type String
*/
export const API_SERVICE_KML_BASE_URL = enforceEndingSlashInUrl(
- import.meta.env.VITE_API_SERVICE_KML_BASE_URL || API_PUBLIC_URL
+ import.meta.env.VITE_API_SERVICE_KML_BASE_URL
)
/**
@@ -108,7 +108,7 @@ export const API_SERVICE_KML_BASE_URL = enforceEndingSlashInUrl(
* @type String
*/
export const API_SERVICE_KML_STORAGE_BASE_URL = enforceEndingSlashInUrl(
- import.meta.env.VITE_API_SERVICE_KML_STORAGE_BASE_URL || API_SERVICE_KML_BASE_URL
+ import.meta.env.VITE_API_SERVICE_KML_STORAGE_BASE_URL
)
/**
diff --git a/tests/e2e-cypress/fixtures/service-kml/lonelyMarker.kml b/tests/e2e-cypress/fixtures/service-kml/lonelyMarker.kml
index 74a235d20..85fdb5ccd 100644
--- a/tests/e2e-cypress/fixtures/service-kml/lonelyMarker.kml
+++ b/tests/e2e-cypress/fixtures/service-kml/lonelyMarker.kml
@@ -6,7 +6,7 @@
- {"id":"drawing_feature_149","coordinates":[[852274.1196923893,5923114.175634811]],"title":"A not interesting comment","description":"","featureType":"MARKER","textColor":{"name":"red","fill":"#ff0000","border":"#ffffff"},"textSize":{"label":"medium_size","textScale":1.5,"iconScale":1},"fillColor":{"name":"red","fill":"#ff0000","border":"#ffffff"},"icon":{"name":"001-marker","imageURL":"https://sys-map.dev.bgdi.ch/api/icons/sets/default/icons/001-marker%401x-255%2C0%2C0.png","imageTemplateURL":"https://sys-map.dev.bgdi.ch/api/icons/sets/{icon_set_name}/icons/{icon_name}@{icon_scale}-{r},{g},{b}.png","iconSetName":"default","anchor":[0.5,0.875]},"iconSize":{"label":"medium_size","textScale":1.5,"iconScale":1}}
+ {"id":"drawing_feature_149","coordinates":[[852274.1196923893,5923114.175634811]],"title":"A not interesting comment","description":"","featureType":"MARKER","textColor":{"name":"red","fill":"#ff0000","border":"#ffffff"},"textSize":{"label":"medium_size","textScale":1.5,"iconScale":1},"fillColor":{"name":"red","fill":"#ff0000","border":"#ffffff"},"icon":{"name":"001-marker","imageURL":"https://map.geo.admin.ch/api/icons/sets/default/icons/001-marker%401x-255%2C0%2C0.png","imageTemplateURL":"https://map.geo.admin.ch/api/icons/sets/{icon_set_name}/icons/{icon_name}@{icon_scale}-{r},{g},{b}.png","iconSetName":"default","anchor":[0.5,0.875]},"iconSize":{"label":"medium_size","textScale":1.5,"iconScale":1}}
point
diff --git a/tests/e2e-cypress/fixtures/service-qrcode/position-popup.png b/tests/e2e-cypress/fixtures/service-qrcode/position-popup.png
new file mode 100644
index 000000000..fed2ce226
Binary files /dev/null and b/tests/e2e-cypress/fixtures/service-qrcode/position-popup.png differ
diff --git a/tests/e2e-cypress/integration/drawing/kml.cy.js b/tests/e2e-cypress/integration/drawing/kml.cy.js
index b1eb96054..609cee07a 100644
--- a/tests/e2e-cypress/integration/drawing/kml.cy.js
+++ b/tests/e2e-cypress/integration/drawing/kml.cy.js
@@ -61,7 +61,7 @@ describe('Drawing loading KML', () => {
it('load kml file, open drawing mode and try to delete a feature', () => {
//load map with an injected kml layer containing a text
const kmlFileId = 'test-fileID12345678900'
- const kmlUrlParam = `KML|https://sys-public.dev.bgdi.ch/api/kml/files/${kmlFileId}|Dessin`
+ const kmlUrlParam = `KML|https://public.geo.admin.ch/api/kml/files/${kmlFileId}|Dessin`
cy.intercept(`**/api/kml/files/${kmlFileId}`, {
fixture: 'service-kml/lonelyMarker.kml',
}).as('initialKmlFile')
@@ -85,7 +85,7 @@ describe('Drawing loading KML', () => {
.should('have.length', 1)
//click on the delete button
cy.get('[data-cy="drawing-style-delete-button"]').click()
- //ckeck that the text was correctly deleted
+ //check that the text was correctly deleted
cy.readStoreValue('state.features.selectedFeatures').should('have.length', 0)
cy.readStoreValue('state.drawing.featureIds').should('have.length', 0)
cy.readWindowValue('drawingLayer')
diff --git a/tests/e2e-cypress/integration/mouseposition.cy.js b/tests/e2e-cypress/integration/mouseposition.cy.js
index 4856c4ca7..9d2ffc02b 100644
--- a/tests/e2e-cypress/integration/mouseposition.cy.js
+++ b/tests/e2e-cypress/integration/mouseposition.cy.js
@@ -105,6 +105,9 @@ describe('Test mouse position', () => {
const lon = 8
beforeEach(() => {
// Viewport set to see the whole popup
+ cy.intercept(`**/api/qrcode/generate**`, {
+ fixture: 'service-qrcode/position-popup.png',
+ }).as('qrcode')
cy.viewport(320, 1000)
cy.goToMapView('en', { lat, lon })
cy.get('[data-cy="map"]').rightclick()
diff --git a/tests/e2e-cypress/integration/shareShortLink.cy.js b/tests/e2e-cypress/integration/shareShortLink.cy.js
index 1f9af9fdf..a9c9e10d3 100644
--- a/tests/e2e-cypress/integration/shareShortLink.cy.js
+++ b/tests/e2e-cypress/integration/shareShortLink.cy.js
@@ -7,9 +7,9 @@ describe('Testing the share menu', () => {
cy.get('[data-cy="menu-button"]').click()
// intercepting short link requests, in order not to have to import the config
// we check only for the first part of the URL (without the staging)
- cy.intercept('https://s.geo.admin.ch**', { body: { shorturl: dummyShortLink } }).as(
- 'shortLink'
- )
+ cy.intercept('POST', /^https?:\/\/(sys-s\.\w+\.bgdi\.ch|s\.geo\.admin\.ch)\//, {
+ body: { shorturl: dummyShortLink },
+ }).as('shortLink')
})
context('Short link generation', () => {
it('Does not generate a short link at startup', () => {
diff --git a/vite.config.ts b/vite.config.ts
index 965e846bc..c4e1e2f4c 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -18,6 +18,7 @@ export default defineConfig(({ command, mode }) => {
build: {
emptyOutDir: true,
assetsDir: `${appVersion}/assets`,
+ outDir: `./dist/${mode}`
},
plugins: [vue(), generateBuildInfo(appVersion)],
resolve: {