From 675eea396f75414a4803d72758d514b5cc8b9450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikko=20Haapam=C3=A4ki?= Date: Mon, 10 Oct 2022 16:14:39 +0300 Subject: [PATCH] fix: korjaa cypress-testien ajaminen (#433) --- .../2-perusta-projekti/99-imoitustaulusyote.spec.js | 2 -- cypress/plugins/index.js | 13 ++++++++++++- package.json | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/cypress/integration/2-perusta-projekti/99-imoitustaulusyote.spec.js b/cypress/integration/2-perusta-projekti/99-imoitustaulusyote.spec.js index c34e6ba2a..11741b76c 100644 --- a/cypress/integration/2-perusta-projekti/99-imoitustaulusyote.spec.js +++ b/cypress/integration/2-perusta-projekti/99-imoitustaulusyote.spec.js @@ -1,7 +1,5 @@ /// -import { Status } from "../../../common/graphql/apiModel"; - const projektiNimi = Cypress.env("projektiNimi"); const oid = Cypress.env("oid"); diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 3fe72a298..16204eff6 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -28,5 +28,16 @@ module.exports = (on) => { }, }); - require('cypress-mochawesome-reporter/plugin')(on); + on("before:browser:launch", (browser = {}, config) => { + if (browser.name === "chrome") { + // Päivämäärän valinnasta katoaa CI/CD-ajossa kyky kirjoittaa päivämäärä tekstinä. Tällä asetuksella tekstin kirjoittaminen saadaan takaisin. + // Asetukset arvattu näiden perusteella: + // https://github.com/mui/mui-x/pull/5684/files#diff-8cbe9d03b9fa5e04ef3fa3f8be9763779e57a2b026d5c70cb2ed7afcef0d6df5R129 + // https://github.com/grafana/xk6-browser/issues/147 + config.args.push("--blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4"); + } + return config; + }); + + require("cypress-mochawesome-reporter/plugin")(on); }; diff --git a/package.json b/package.json index b300b6d40..50f0080b3 100644 --- a/package.json +++ b/package.json @@ -170,6 +170,7 @@ "postgenerate:velhoapi": "ts-node --project=tsconfig.cdk.json ./tools/velho/processMetaData.ts ./backend/src/velho/metadata.json", "pregenerate:api": "graphql-schema-utilities -s \"{./graphql/types.graphql,./graphql/inputs.graphql,./graphql/operations.graphql}\" -o schema.graphql", "generate:api": "cross-env docker run --rm -v $INIT_CWD:/work ${ACCOUNT_ID:=283563576583}.dkr.ecr.eu-west-1.amazonaws.com/hassu-buildimage:1.0.3 bash -c \"cd /work && amplify codegen\"", + "startBuildImage": "cross-env docker run --rm -it --add-host=hassu:host-gateway -v $INIT_CWD:/work --env=\"DISPLAY=host.docker.internal:0\" -v /tmp/.X11-unix:/tmp/.X11-unix:rw ${ACCOUNT_ID:=283563576583}.dkr.ecr.eu-west-1.amazonaws.com/hassu-buildimage:1.0.3 bash", "generate": "npm-run-all --aggregate-output --parallel generate:*", "lint:backend": "eslint --cache --ignore-path .gitignore --ext .ts backend", "lint:app": "next lint",