Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 13 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,18 @@ dev-flask-docker:

e2e:
yarn build
[ -d "./venv" ] && . ./venv/bin/activate &&\
export FLASK_APP="$(CURDIR)/cre.py" &&\
export FLASK_CONFIG=development &&\
export INSECURE_REQUESTS=1 &&\
flask run &
sleep 5
yarn test:e2e
sleep 20
killall yarn
killall flask
if [ -d "./venv" ]; then . ./venv/bin/activate; fi
export FLASK_APP="$(CURDIR)/cre.py"
export FLASK_CONFIG=development
export INSECURE_REQUESTS=1
flask run --host=127.0.0.1 --port=5000 > /tmp/opencre-e2e-flask.log 2>&1 &
FLASK_PID=$$!
trap 'kill $$FLASK_PID 2>/dev/null || true' EXIT INT TERM
for i in `seq 1 30`; do \
curl -fsS http://127.0.0.1:5000 >/dev/null && break; \
sleep 1; \
done
env -u ELECTRON_RUN_AS_NODE yarn test:e2e

test:
[ -d "./venv" ] && . ./venv/bin/activate &&\
Expand All @@ -73,8 +75,7 @@ install-deps: install-deps-python install-deps-typescript
install-python:
virtualenv -p python3 venv
. ./venv/bin/activate &&\
make install-deps-python &&\
playwright install
make install-deps-python

install-typescript:
yarn add webpack && cd application/frontend && yarn build
Expand Down
179 changes: 0 additions & 179 deletions application/frontend/src/test/basic-e2e.test.ts

This file was deleted.

10 changes: 10 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { defineConfig } = require('cypress');

module.exports = defineConfig({
video: false,
e2e: {
baseUrl: 'http://127.0.0.1:5000',
specPattern: 'cypress/e2e/**/*.cy.{js,jsx,ts,tsx}',
supportFile: false,
},
});
3 changes: 0 additions & 3 deletions cypress.json

This file was deleted.

20 changes: 20 additions & 0 deletions cypress/e2e/smoke.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
describe('OpenCRE e2e smoke', () => {
it('loads homepage with primary search form', () => {
cy.visit('/');
cy.get('form#search-bar').should('exist');
cy.get('form#search-bar input[type="text"]').should('be.visible');
});

it('home search routes to search results page', () => {
const term = 'asvs';
cy.visit('/');
cy.get('form#search-bar input[type="text"]').type(`${term}{enter}`);
cy.url().should('include', `/search/${term}`);
cy.contains('Results matching').should('be.visible');
});

it('browse route is reachable', () => {
cy.visit('/root_cres');
cy.contains('h1', 'Root CREs').should('be.visible');
});
});
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"lint": "prettier --write '**/*.tsx' '**/*.ts' '**/*.js'",
"build": "webpack --config webpack.prod.js",
"start": "webpack serve",
"test:e2e": "jest",
"test:e2e": "cypress run",
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"postinstall": "del-cli node_modules/@types/react-dom/node_modules/@types && del-cli node_modules/webpack/types.d.ts"
},
"keywords": [],
Expand All @@ -23,6 +25,7 @@
"@types/react-router-dom": "^5",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.1",
"babel-loader": "^8.2.2",
"cypress": "^13.17.0",
"css-loader": "^5.2.4",
"del-cli": "^3.0.1",
"enzyme": "3.11.0",
Expand Down
Loading