Skip to content

Commit

Permalink
OBPIH-6216 setup playwright project (#1)
Browse files Browse the repository at this point in the history
* OBPIH-6216 Install playwright in a new project

* OBPIH-6216 Add tsconfig file to the project

* OBPIH-6216 Add node version nvmrc file

* OBPIH-6216 Setup environment variables for testing

* OBPIH-6216 Add Navigation fixture

* OBPIH-6216 Configured test viewport for 1366x768

* OBPIH-6216 change name of the instance of AppConfig

* OBPIH-6216 Setup eslint for playwright

* OBPIH-6216 Added prettier to the project

* OBPIH-6216 Format all of the files in src based on new prettier rules

* OBPIH-6216 Added comment to AppConfig

* OBPIH-6216 Added auto import eslint rule

* OBPIH-6216 Move fixtures to fixtures folder and export each separately

* OBPIH-6216 Added ability to import files with absolute path

* OBPIH-6216 Refactored Navigation fixture to include URL prefix

* OBPIH-6216 Add README

* OBPIH-6216 Fix new line at the end of the file

* OBPIH-6216 Change formatting/linting rules for tabs and singlequotes and reformat the project

* OBPIH-6216 Update package versions

* OBPIH-6216 Workaround for lack of util method mergeTest on playwright version 1.34

* OBPIH-6216 Added additional step for instalation to README
  • Loading branch information
drodzewicz committed Apr 2, 2024
1 parent ea44236 commit d2a2c62
Show file tree
Hide file tree
Showing 17 changed files with 2,579 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
APP_BASE_URL=http:https://localhost:8080
CI=false
24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "simple-import-sort"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:playwright/recommended",
"prettier"
],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"root": true,
"rules": {
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"quotes": ["error", "single"],
"@typescript-eslint/no-empty-function": [
"error",
{ "allow": ["constructors"] }
]
}
}
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# misc
node_modules/
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# playwright
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v14.21.3
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything:
/**/*.*
# Except tests:
!/**/src/**/*.*
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true
}
51 changes: 50 additions & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,51 @@
# openboxes-e2e
# Openboxes E2E tests
End to end testing for OpenBoxes

## Setup
### Required
- NPM 6.14.6
- Node 14+

### Install Dependencies

```
npm run install
npx playwright install
```

## Environment Variables
Environment variables facilitate the configuration of our testing project by allowing us to set appropriate configuration settings. A sample file can be located in the root directory of the project under the title .env.example. To configure this project effectively, it is imperative to create a .env file and declare all necessary variables within it.

**APP_BASE_URL**
<br>base URL of the running openboxes environment

**CI** [optional]
<br>`true` or `false` flag indicating whether tests are running in Continuous Integration.

## Scripts

### Running tests
For more information on available flags when running tests in playwright reffer to the [documentation](https://playwright.dev/docs/running-tests).
```
npm run test
```
_To add a flag to the npm script, do the following eg._ `npm run test -- --headed`

### Linting project
To check if there are any linter errors that require attention run the following command

```
npm run lint
```
If you wish to handle these errors automatically run
```
npm run lint-fix
```

### Code formatting

To format your code run the following command
```
npm run format
```
Loading

0 comments on commit d2a2c62

Please sign in to comment.