Skip to content
Snippets Groups Projects
Commit 692ba299 authored by Anders Lindh Olsson's avatar Anders Lindh Olsson :8ball:
Browse files

Merge branch 'cypress_cache' into 'main'

Cypress/CI improvements

See merge request !436
parents 47ed4a96 379566b6
No related branches found
No related tags found
3 merge requests!446Merge main into develop,!445Draft: Main into develop,!436Cypress/CI improvements
Pipeline #189261 waiting for manual action
**/node_modules
**/dist
*.log
.coverage
.coverage.*
SKIP_PREFLIGHT_CHECK=true
ESLINT_NO_DEV_ERRORS=true
\ No newline at end of file
ESLINT_NO_DEV_ERRORS=true
NODE_OPTIONS=
......@@ -5,6 +5,7 @@ default:
- docker
stages:
- setup
- check
- build
- test
......@@ -16,29 +17,24 @@ include:
variables:
CONTAINER_IMAGE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
CYPRESS_CACHE_FOLDER: "cache/Cypress"
CYPRESS_CACHE_FOLDER: "$CI_PROJECT_DIR/cache/Cypress"
npm_config_cache: "$CI_PROJECT_DIR/.npm"
install-dependencies:
stage: check
stage: setup
script:
- npm ci
artifacts:
paths:
- .cache/*
- cache/Cypress
- node_modules
- ${CYPRESS_CACHE_FOLDER} # for some inexplicable reason this path MUST be in a variable
run-pre-commit:
needs:
- job: install-dependencies
artifacts: true
- .npm
lint:
stage: check
script:
- npm run code-quality
needs:
- job: install-dependencies
artifacts: true
artifacts:
reports:
codequality: gl-codequality.json
......@@ -46,14 +42,14 @@ lint:
build-container:
stage: build
image: docker:latest
needs:
- job: install-dependencies
artifacts: true
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build -t $CONTAINER_IMAGE --build-arg REACT_APP_MUI_PRO_LICENSE_KEY=${REACT_APP_MUI_PRO_LICENSE_KEY} .
- docker push $CONTAINER_IMAGE
needs:
- job: install-dependencies
artifacts: true
build-storybook:
stage: build
......@@ -66,20 +62,30 @@ build-storybook:
paths:
- storybook-static
test-components-chrome:
.test-components:
stage: test
image: cypress/browsers:node16.14.0-slim-chrome99-ff97
script:
- CHOKIDAR_USEPOLLING=true WATCHPACK_POLLING=true npx cypress run --component --browser chrome
needs:
- job: install-dependencies
artifacts: true
- npm ci
- npm start &
- CHOKIDAR_USEPOLLING=true WATCHPACK_POLLING=true npx cypress run --component --browser ${BROWSER}
needs: [] # no requirements since it does an install
artifacts:
when: on_failure
paths:
- cypress/videos
- cypress/screenshots
test-components-chrome:
extends: .test-components
variables:
BROWSER: chrome
test-components-firefox:
extends: .test-components
variables:
BROWSER: firefox
.deploy:
stage: deploy
image: registry.esss.lu.se/ics-docker/awxkit
......
# build CE deploy & monitor Frontend
# build deploy & monitor frontend
FROM node:16.14.0 as builder
ARG REACT_APP_MUI_PRO_LICENSE_KEY
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
ENV PATH /usr/src/app/node_modules/.bin:$PATH
COPY . /usr/src/app
#Remove node-cache if building from local env that compiled project previously natively
RUN rm -rf /usr/src/app/node_modules
RUN npm ci
ENV PUBLIC_URL "/"
......
import { SnackbarProvider } from "notistack";
import React from "react";
import { UserProvider } from "../../../api/UserProvider";
import TokenRenew from ".";
import { DeployAPIProvider } from "../../../api/DeployApi";
function AppHarness({ children }) {
return (
<SnackbarProvider
preventDuplicate
maxSnack="5"
>
<DeployAPIProvider>
<UserProvider>{children}</UserProvider>
</DeployAPIProvider>
</SnackbarProvider>
);
}
function mountIntoHarness(children) {
cy.mount(<AppHarness>{children}</AppHarness>);
}
describe("TokenRenew", () => {
context("when logged in", () => {
beforeEach(() => {
cy.login();
});
it("renews the token periodically", () => {
cy.clock();
mountIntoHarness(<TokenRenew />);
cy.tick(window.TOKEN_RENEW_INTERVAL);
cy.wait("@renew", { responseTimeout: 1000 });
cy.getCookie("ce-deploy-auth").should(
"have.property",
"value",
"FADEDEAD"
);
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment