Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SITES-26731 Add e2e tests #69

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
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
61 changes: 61 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: E2E Tests

on:
push:
branches:
- main

jobs:
e2e-tests:
name: Run E2E Tests with TestCafe
runs-on: ubuntu-latest

strategy:
matrix:
host-app-version: [ "0.8.0", "0.8.1", "0.8.2", "0.8.3", "0.8.4", "0.8.5", "0.9.0", "0.9.1", "0.9.2", "0.10.0","0.10.1", "0.10.2","0.10.3","0.10.4", "latest" ]
guest-app-version: [ "0.8.0", "0.8.1", "0.8.2", "0.8.3", "0.8.4", "0.8.5", "0.9.0", "0.9.1", "0.9.2", "0.10.0","0.10.1", "0.10.2","0.10.3","0.10.4", "latest" ]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18' # Adjust this as per project requirements

- name: Install Dependencies for Host App
working-directory: e2e/host-app
run: |
npm install @adobe/uix-host-react@${{ matrix.host-app-version }}
npm install

- name: Install Dependencies for Guest App
working-directory: e2e/guest-app

run: |
npm install @adobe/uix-guest@${{ matrix.guest-app-version }}
npm install

- name: Start Host App
working-directory: e2e/host-app
run: |
npm start &

- name: Start Guest App
working-directory: e2e/guest-app
run: |
npm start &

- name: Wait for Applications to be Ready
run: |
echo "Waiting for services to start..."
sleep 10 # Adjust the time based on how long the apps take to start

- name: Run E2E Tests with TestCafe
working-directory: e2e/e2e-tests
run: |
npm install
npm test


1 change: 1 addition & 0 deletions e2e/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
35 changes: 35 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# UIX SDK end-to-end tests

To run the end-to-end tests locally, you need to do the following:

- cd to host-app folder
```bash
npm install
npm start
```

- cd to guest-app folder
```bash
npm install
npm start
```

- cd to e2e-tests folder
```bash
npm install
npm test
```

The end-to-end tests will run, and you will see the results in the console.

The host-app and guest-app have the last version of the sdk installed.

To test any new version of the sdk, you need to update the matrix in the `root/.github/workflows/e2e-tests.yml` file adding the new version.

```yaml
strategy:
matrix:
host-app-version: [ "0.8.0", "0.8.1", "0.8.2", "0.8.3", "0.8.4", "0.8.5", "0.9.0", "0.9.1", "0.9.2", "0.10.0","0.10.1", "0.10.2","0.10.3","0.10.4", "latest" ]
guest-app-version: [ "0.8.0", "0.8.1", "0.8.2", "0.8.3", "0.8.4", "0.8.5", "0.9.0", "0.9.1", "0.9.2", "0.10.0","0.10.1", "0.10.2","0.10.3","0.10.4", "latest" ]

```
24 changes: 24 additions & 0 deletions e2e/e2e-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
/artifacts

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
20 changes: 20 additions & 0 deletions e2e/e2e-tests/.testcaferc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"src": "./tests/**/*.js",
"browsers": ["chrome:headless"],
"baseUrl": "http://localhost:3000",
"hostname": "localhost",
"screenshots": {
"path": "./artifacts/screenshots/",
"takeOnFails": true,
"fullPage": true
},
"reporter": "spec",
"speed": 0.2,
"debugMode": false,
"debugOnFail": true,
"stopOnFirstFail": true,
"selectorTimeout": 5000,
"assertionTimeout": 10000,
"pageLoadTimeout": 10000,
"pageRequestTimeout": 80000
}
Loading