remove seperate test project, intgrate cypress

This commit is contained in:
Erik Jan de Wit 2021-02-19 07:37:22 +01:00
parent e4c2259563
commit 39ef50bb1b
33 changed files with 107 additions and 5482 deletions

View file

@ -36,18 +36,18 @@ jobs:
run: ./import.js
- name: Cypress run
run: cd tests && npx cypress run --headless --browser chrome && cd ..
run: yarn start:cypress-tests --headless --browser chrome
- name: Add Cypress videos artifacts
uses: actions/upload-artifact@v2
if: failure()
with:
name: cypress-videos
path: tests/assets/videos
path: assets/videos
- name: Add Cypress screenshots artifacts
uses: actions/upload-artifact@v2
if: failure()
with:
name: cypress-screenshots
path: tests/assets/screenshots
path: assets/screenshots

View file

@ -43,6 +43,80 @@ $> npx grunt switch-rh-sso
To switch back just do a `git checkout public`
# Keycloak UI Test Suite in Cypress
This repository contains the UI tests for Keycloak developed with Cypress framework
## Run the test suite
### Prerequisites
* `Keycloak distribution` has to be [downloaded](https://www.keycloak.org/downloads) and started on 8081 port.
**note**: the port in at the test suite side in [cypress.json](cypress.json) or at the Keycloak side, see [Keycloak Getting Started Guide](https://www.keycloak.org/docs/latest/getting_started/#starting-the-keycloak-server),
* `npm package manager` has to be [downloaded](https://nodejs.org/en/download/) and installed.
### via Cypress Test Runner
**By using `npx`:**
**note**: [npx](https://www.npmjs.com/package/npx) is included with `npm > v5.2` or can be installed separately.
```shell
npx cypress open
```
After a moment, the Cypress Test Runner will launch:
![image](https://drive.google.com/uc?export=view&id=1i4_VABpM29VwrrAcvEY31w7EuymifcwV)
### via terminal
**By executing:**
```shell
$(npm bin)/cypress run
```
...or...
```shell
./node_modules/.bin/cypress run
```
...or... (requires npm@5.2.0 or greater)
```shell
npx cypress run
```
**To execute a specific test on a specific browser run:**
```shell
cypress run --spec "cypress/integration/example-test.spec.js" --browser chrome
```
**note**: the complete list of parameters can be found in the [official Cypress documentation](https://docs.cypress.io/guides/guides/command-line.html#Commands).
## Project Structure
```text
/assets (added to .gitignore)
/videos - if test fails, the video is stored here
/screenshots - if test fails, the screenshot is stored here
/cypress
/fixtures - external pieces of static data that can be used by your tests
/integration - used for test files (supported filetypes are .js, .jsx, .coffee and .cjsx)
/plugins
- index.js - extends Cypress behaviour, custom plugins are imported before every single spec file run
/support - reusable behaviour
- commands.js - custom commands
- index.js - runs before each test file
/cypress.json - Cypress configuration file
/jsconfig.json - Cypress code autocompletion is enabled here
```
**note**: More about the project structure in the [official Cypress documentation](https://docs.cypress.io/guides/core-concepts/writing-and-organizing-tests.html#Folder-Structure).
## License
* [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
[1]: https://www.patternfly.org/v4/
[2]: (https://classic.yarnpkg.com)
[3]: https://www.keycloak.org/downloads

View file

@ -3,10 +3,6 @@
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"workspaces": [
"tests"
],
"scripts": {
"build": "snowpack build",
"build-storybook": "build-storybook -s public",
@ -18,8 +14,8 @@
"start": "snowpack dev",
"storybook": "start-storybook -p 6006 -s public",
"test": "jest",
"start:cypress": "cd tests && npx cypress open",
"start:cypress-tests": "cd tests && npx cypress run"
"start:cypress": "cypress open",
"start:cypress-tests": "cypress run"
},
"dependencies": {
"@patternfly/patternfly": "^4.87.1",
@ -68,6 +64,7 @@
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"babel-loader": "^8.1.0",
"cypress": "^6.5.0",
"decompress": "^4.2.1",
"decompress-targz": "^4.1.1",
"enzyme": "^3.11.0",

View file

@ -1,72 +0,0 @@
# Keycloak UI Test Suite in Cypress
This repository contains the UI tests for Keycloak developed with Cypress framework
## Run the test suite
### Prerequisites
* `Keycloak distribution` has to be [downloaded](https://www.keycloak.org/downloads) and started on 8081 port.
**note**: the port in at the test suite side in [cypress.json](cypress.json) or at the Keycloak side, see [Keycloak Getting Started Guide](https://www.keycloak.org/docs/latest/getting_started/#starting-the-keycloak-server),
* `npm package manager` has to be [downloaded](https://nodejs.org/en/download/) and installed.
### via Cypress Test Runner
**By using `npx`:**
**note**: [npx](https://www.npmjs.com/package/npx) is included with `npm > v5.2` or can be installed separately.
```shell
npx cypress open
```
After a moment, the Cypress Test Runner will launch:
![image](https://drive.google.com/uc?export=view&id=1i4_VABpM29VwrrAcvEY31w7EuymifcwV)
### via terminal
**By executing:**
```shell
$(npm bin)/cypress run
```
...or...
```shell
./node_modules/.bin/cypress run
```
...or... (requires npm@5.2.0 or greater)
```shell
npx cypress run
```
**To execute a specific test on a specific browser run:**
```shell
cypress run --spec "cypress/integration/example-test.spec.js" --browser chrome
```
**note**: the complete list of parameters can be found in the [official Cypress documentation](https://docs.cypress.io/guides/guides/command-line.html#Commands).
## Project Structure
```text
/assets (added to .gitignore)
/videos - if test fails, the video is stored here
/screenshots - if test fails, the screenshot is stored here
/cypress
/fixtures - external pieces of static data that can be used by your tests
/integration - used for test files (supported filetypes are .js, .jsx, .coffee and .cjsx)
/plugins
- index.js - extends Cypress behaviour, custom plugins are imported before every single spec file run
/support - reusable behaviour
- commands.js - custom commands
- index.js - runs before each test file
/cypress.json - Cypress configuration file
/jsconfig.json - Cypress code autocompletion is enabled here
```
**note**: More about the project structure in the [official Cypress documentation](https://docs.cypress.io/guides/core-concepts/writing-and-organizing-tests.html#Folder-Structure).
## License
* [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)

View file

@ -1,6 +0,0 @@
{
"include": [
"./node_modules/cypress",
"cypress/**/*.js"
]
}

3964
tests/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,15 +0,0 @@
{
"name": "cypress-keycloak-ui-testsuite",
"version": "1.0.0",
"description": "UI tests for Keycloak using Cypress.",
"main": "index.js",
"scripts": {
"build": "tsc",
"test": "cypress open"
},
"author": "",
"license": "ISC",
"devDependencies": {
"cypress": "6.2.1"
}
}

File diff suppressed because it is too large Load diff

View file

@ -4876,6 +4876,11 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.1.tgz#5d93e0a099cd0acd5ef3d5bde3c086e1f49ff68c"
integrity sha512-FAYBGwC+W6F9+huFIDtn43cpy7+SzG+atzRiTfdp3inUKL2hXnd4rG8hylJLIh4+hqrQy1P17kvJByE/z825hA==
"@types/node@12.12.50":
version "12.12.50"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.50.tgz#e9b2e85fafc15f2a8aa8fdd41091b983da5fd6ee"
integrity sha512-5ImO01Fb8YsEOYpV+aeyGYztcYcjGsBvN4D7G5r1ef2cuQOpymjWNQi5V0rKHE6PC2ru3HkoUr/Br2/8GUA84w==
"@types/normalize-package-data@^2.4.0":
version "2.4.0"
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"
@ -8343,14 +8348,15 @@ cyclist@^1.0.1:
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=
cypress@6.2.1:
version "6.2.1"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-6.2.1.tgz#27d5fbcf008c698c390fdb0c03441804176d06c4"
integrity sha512-OYkSgzA4J4Q7eMjZvNf5qWpBLR4RXrkqjL3UZ1UzGGLAskO0nFTi/RomNTG6TKvL3Zp4tw4zFY1gp5MtmkCZrA==
cypress@^6.5.0:
version "6.5.0"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-6.5.0.tgz#d853d7a8f915f894249a8788294bfba077278c17"
integrity sha512-ol/yTAqHrQQpYBjxLlRSvZf4DOb9AhaQNVlwdOZgJcBHZOOa52/p/6/p3PPcvzjWGOMG6Yq0z4G+jrbWyk/9Dg==
dependencies:
"@cypress/listr-verbose-renderer" "^0.4.1"
"@cypress/request" "^2.88.5"
"@cypress/xvfb" "^1.2.4"
"@types/node" "12.12.50"
"@types/sinonjs__fake-timers" "^6.0.1"
"@types/sizzle" "^2.3.2"
arch "^2.1.2"
@ -8362,7 +8368,8 @@ cypress@6.2.1:
cli-table3 "~0.6.0"
commander "^5.1.0"
common-tags "^1.8.0"
debug "^4.1.1"
dayjs "^1.9.3"
debug "4.3.2"
eventemitter2 "^6.4.2"
execa "^4.0.2"
executable "^4.1.1"
@ -8376,7 +8383,7 @@ cypress@6.2.1:
lodash "^4.17.19"
log-symbols "^4.0.0"
minimist "^1.2.5"
moment "^2.27.0"
moment "^2.29.1"
ospath "^1.2.2"
pretty-bytes "^5.4.1"
ramda "~0.26.1"
@ -8435,6 +8442,11 @@ dateformat@~3.0.3:
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==
dayjs@^1.9.3:
version "1.10.4"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.4.tgz#8e544a9b8683f61783f570980a8a80eaf54ab1e2"
integrity sha512-RI/Hh4kqRc1UKLOAf/T5zdMMX5DQIlDxwUe3wSyMMnEbGunnpENCdbUgM+dW7kXidZqCttBrmw7BhN4TMddkCw==
de-indent@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
@ -8447,6 +8459,13 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9:
dependencies:
ms "2.0.0"
debug@4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b"
integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==
dependencies:
ms "2.1.2"
debug@^3.0.0, debug@^3.1.1, debug@^3.2.5:
version "3.2.6"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
@ -14376,7 +14395,7 @@ mkdirp@^1.0.3, mkdirp@^1.0.4, mkdirp@~1.0.4:
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
moment@^2.27.0, moment@^2.29.1:
moment@^2.29.1:
version "2.29.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3"
integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==
@ -14415,7 +14434,7 @@ ms@2.1.1:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"
integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==
ms@^2.1.1:
ms@2.1.2, ms@^2.1.1:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==