Skip to content

Commit

Permalink
refactor(cypress): merge the integration workspace (#3992)
Browse files Browse the repository at this point in the history
Merge the contents of the integration workspace with the top level package.

Fixes: canonical/app-tribe#1010.
  • Loading branch information
huwshimi authored Jun 3, 2022
1 parent 5304ecc commit db6969e
Show file tree
Hide file tree
Showing 47 changed files with 49 additions and 109 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/accessibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
install: false
spec: "**/accessibility/**/*.spec.ts"
wait-on: "${{env.MAAS_URL}}/MAAS/r/machines"
working-directory: integration
working-directory: cypress
- name: Create issue on failure
if: failure()
uses: JasonEtco/create-an-issue@v2
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
install: false
spec: "**/no-users/**/*.spec.ts"
wait-on: "${{env.MAAS_URL}}/MAAS/r/machines"
working-directory: integration
working-directory: cypress
- name: Create MAAS admin
run: sudo maas createadmin --username=admin --password=test [email protected]
- name: Create MAAS non-admin user
Expand All @@ -47,12 +47,12 @@ jobs:
install: false
spec: "**/with-users/**/*.spec.ts"
wait-on: "${{env.MAAS_URL}}/MAAS/r/machines"
working-directory: integration
working-directory: cypress
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: integration/cypress/screenshots
path: cypress/screenshots
- name: Create issue on failure
if: failure()
uses: JasonEtco/create-an-issue@v2
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
browser: chrome
config: baseUrl=http://maas.io/docs
spec: "**/docs-links/**/*.spec.ts"
working-directory: integration
working-directory: cypress
- name: Create issue on failure
if: failure()
uses: JasonEtco/create-an-issue@v2
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ yarn-error.log*
# build
/build

# cypress
cypress/screenshots
cypress/videos
cypress.env.json

# local configuration
.env.*.local
.env.local
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Community contributions are most welcome, and there are a number of ways to part

When submitting a PR, please take note that MAAS UI uses the [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) format. To help you conform to this, you can run `yarn commit` instead of `git commit` for an interactive prompt.

Please see [HACKING](HACKING.md) for details on setting up a MAAS UI development environment.
Please see [HACKING](/docs/HACKING.md) for details on setting up a MAAS UI development environment.

## Feedback

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions cypress/percy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /usr/bin/env bash

if [ -f ../.env.test.local ]; then
source ../.env.test.local
elif [ -f ../.env.test ]; then
source ../.env.test
fi

PERCY_TOKEN=$PERCY_TOKEN PERCY_BRANCH=local percy exec -- cypress run --config integrationFolder=percy
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"strict": true,
"baseUrl": "../node_modules",
"baseUrl": "../ui/node_modules",
"target": "es6",
"lib": ["es2017", "dom"],
"types": ["cypress", "cypress-axe", "@testing-library/cypress", "@percy/cypress"],
Expand Down
2 changes: 1 addition & 1 deletion HACKING.md → docs/HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ maas $PROFILE maas set-config name=completed_intro value=false

Integration tests currently run against the maas edge snap (main) [on github actions](https://github.com/canonical-web-and-design/maas-ui/actions?query=workflow%3ACypress) with [Cypress](https://cypress.io).

For details on developing integration tests, see the integration testing [README](integration/README.md).
For details on developing integration tests, see the integration testing [README](/docs/INTEGRATION.md).

## Unit tests

Expand Down
4 changes: 1 addition & 3 deletions integration/README.md → docs/INTEGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ This will automatically start legacy, ui and proxy servers and run the Cypress t

## Edit local configuration

By default, cypress will run tests using the configuration defined in [cypress.json](/integration/cypress.json).
By default, cypress will run tests using the configuration defined in [cypress.json](/cypress/cypress.json).

If you wish to overwrite any of the settings (e.g. MAAS URL or username/password) you can create a local configuration file:

```shell
cd integration
touch cypress.env.json
```

Expand All @@ -44,7 +43,6 @@ yarn serve
Then open the Cypress Test Runner by running:

```shell
cd integration
yarn cypress-open
```

Expand Down
File renamed without changes.
38 changes: 0 additions & 38 deletions integration/.gitignore

This file was deleted.

45 changes: 0 additions & 45 deletions integration/package.json

This file was deleted.

9 changes: 0 additions & 9 deletions integration/percy.sh

This file was deleted.

32 changes: 26 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
"build-legacy": "cd legacy && yarn install && yarn build",
"build-root": "cd root && yarn install && yarn build",
"build-ui": "cd ui && yarn install && yarn build",
"cypress-open": "yarn --cwd integration cypress-open",
"cypress-run": "yarn --cwd integration cypress-run",
"serve-frontends": "yarn --cwd proxy serve-frontends",
"serve-base": "yarn --cwd proxy serve-base",
"cypress-run": "yarn cypress run",
"cypress-run-a11y": "yarn cypress run --config integrationFolder=cypress/integration/accessibility",
"cypress-open": "yarn cypress open",
"percy": "./cypress/percy.sh",
"copy-build": "mkdir -p build && yarn copy-root && yarn copy-legacy-assets && yarn copy-ui-css",
"copy-legacy-assets": "cp -R legacy/dist/assets build/",
"copy-root": "cp -R root/dist/* build/",
Expand All @@ -35,9 +39,9 @@
"lint-ui": "cd ui && yarn run lint",
"lint-shared": "cd shared && yarn run lint",
"lint-root": "cd root && yarn run lint",
"lint-cypress": "cd integration && yarn run lint",
"lint-cypress": "eslint -c cypress/.eslintrc.js \"cypress/**/*.{ts,tsx}\"",
"lint": "yarn build-shared && yarn lint-legacy && yarn lint-ui && yarn lint-shared && yarn lint-root && yarn lint-cypress",
"test-cypress": "yarn --cwd integration run cypress-test",
"test-cypress": "yarn --cwd shared build && start-server-and-test serve-frontends '8401|8402' serve-base 'tcp:8400|8404' cypress-run",
"test-legacy": "cd legacy && yarn run test",
"test-ui": "cd ui && yarn run test --watchAll=false",
"test-shared": "cd shared && yarn run test",
Expand All @@ -46,7 +50,6 @@
},
"workspaces": {
"packages": [
"integration",
"legacy",
"proxy",
"shared",
Expand All @@ -63,7 +66,24 @@
]
},
"devDependencies": {
"cz-conventional-changelog": "3.3.0"
"@maas-ui/maas-ui-shared": "3.3.0",
"@percy/cli": "1.1.4",
"@percy/cypress": "3.1.1",
"@testing-library/cypress": "8.0.2",
"@typescript-eslint/eslint-plugin": "5.23.0",
"@typescript-eslint/parser": "5.23.0",
"concurrently": "7.1.0",
"cypress": "9.6.1",
"cypress-axe": "0.14.0",
"cypress-wait-until": "1.7.2",
"cz-conventional-changelog": "3.3.0",
"dotenv-flow": "3.2.0",
"eslint-plugin-cypress": "2.12.1",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-no-only-tests": "2.6.0",
"nanoid": "3.3.4",
"npm-package-json-lint": "6.3.0",
"start-server-and-test": "1.14.0"
},
"config": {
"commitizen": {
Expand Down

0 comments on commit db6969e

Please sign in to comment.