Skip to content

Commit

Permalink
kopi test fra AzDo til github (#2)
Browse files Browse the repository at this point in the history
* first copy of tests

* oppdaterte deps

* eslint og prettier

* do not log passowrd and pin

fixed config loading in plugin

* added xml2js and updated cypress

template correspondence and updated test

* sample env file

* new test
  • Loading branch information
jeevananthank authored Sep 22, 2021
1 parent c174540 commit ea98440
Show file tree
Hide file tree
Showing 32 changed files with 3,649 additions and 2 deletions.
48 changes: 48 additions & 0 deletions src/cypress/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"env": {
"cypress/globals": true
},
"plugins": [
"cypress"
],
"extends": [
"plugin:cypress/recommended",
"plugin:prettier/recommended"
],
"ignorePatterns": [
"src/data",
"src/reports",
"src/fixtures",
"src/config"
],
"rules": {
"eol-last": "error",
"max-len": [
"error",
{
"code": 120,
"tabWidth": 2,
"ignoreUrls": true
}
],
"indent": [
"warn",
2,
{
"SwitchCase": 1
}
],
"quotes": [
"warn",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"semi": [
"warn",
"never"
]
}
}
27 changes: 27 additions & 0 deletions src/cypress/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#vscode settings
.vscode/

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# dotenv environment variables file
.env

# Screenshots and video
screenshots/
videos/

# Junit xml reports
reports/

# Downloads
downloads/

#Test data
data/
8 changes: 8 additions & 0 deletions src/cypress/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"trailingComma": "all",
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"printWidth": 120
}
29 changes: 27 additions & 2 deletions src/cypress/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# Altinn 2 Cypress tests
# Introduction

...
This project is for End to end testing of Altinn solution using [cypress](https://www.cypress.io/).

## Getting Started

These instructions will get you run the end to end tests on test environments.

### Install dependencies

```cmd
npm install # only needed first time, or when dependencies are updated
```

### Open cypress and run tests

Run the below command to open cypress with the environment

```cmd
npm run cy:open --env=at22
```

### Format files with prettier

```cmd
npm run check # For checking the files deviating standards
npm run format # format and save the files based on config
```
23 changes: 23 additions & 0 deletions src/cypress/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://on.cypress.io/cypress.schema.json",
"env": {},
"video": false,
"fixturesFolder": "src/fixtures",
"integrationFolder": "src/integration",
"supportFile": "src/support/index.js",
"pluginsFile": "src/plugins/index.js",
"downloadsFolder": "downloads",
"screenshotOnRunFailure": true,
"screenshotsFolder": "screenshots",
"trashAssetsBeforeRuns": true,
"videosFolder": "videos",
"viewportHeight": 768,
"viewportWidth": 1536,
"requestTimeout": 10000,
"defaultCommandTimeout": 8000,
"chromeWebSecurity": false,
"reporter": "junit",
"reporterOptions": {
"mochaFile": "reports/result-[hash].xml"
}
}
29 changes: 29 additions & 0 deletions src/cypress/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '3.2'

# run Cypress tests and exit with command
# docker-compose up --exit-code-from cypress
services:
cypress:
image: 'cypress/included:6.6.0'
environment:
- CYPRESS_environment=at23
working_dir: /AutomatedportalTest
volumes:
- ./:/AutomatedportalTest
command: '--spec /AutomatedportalTest/src/integration/pdf/pdf.js -b chrome'
cypress2:
image: 'cypress/included:6.6.0'
environment:
- CYPRESS_environment=at23
working_dir: /AutomatedportalTest
volumes:
- ./:/AutomatedportalTest
command: '--spec /AutomatedportalTest/src/integration/login/*.js -b chrome'
cypress3:
image: 'cypress/included:6.6.0'
environment:
- CYPRESS_environment=at23
working_dir: /AutomatedportalTest
volumes:
- ./:/AutomatedportalTest
command: '--spec "/AutomatedportalTest/src/integration/profile/*.js,/AutomatedportalTest/src/integration/services/*.js" -b chrome'
Loading

0 comments on commit ea98440

Please sign in to comment.