Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Commit

Permalink
Add Medea E2E tests runner (#178)
Browse files Browse the repository at this point in the history
- rename old E2E tests as integration tests
- implement Cucumber tests runner for new E2E tests
- make 'medea-control-api-mock' protocol structures public
- impl E2E test scenarios for Member joining
- upd CI pipeline to run new E2E tests in Chrome and Firefox
  • Loading branch information
evdokimovs authored Mar 2, 2021
1 parent 70a72f3 commit dcbdcc3
Show file tree
Hide file tree
Showing 57 changed files with 3,235 additions and 291 deletions.
2 changes: 1 addition & 1 deletion .clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ doc-valid-idents = [
"RTCStats", "RTCStatsReport",
"RTCTrackEvent",
"RTCVideoSenderStats",
"WebRTC", "WebSocket",
"WebDriver", "WebRTC", "WebSocket",
]
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ indent_size = 4
indent_style = space
indent_size = 2

[**/nginx{/*,.*}.conf]
[**/ngin{x,x/*,x.*}.conf]
indent_style = space
indent_size = 2
7 changes: 7 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,12 @@ MEDEA_CONF=_dev/config.toml
MEDEA_CONTROL__STATIC_SPECS_DIR=_dev/specs/

COMPOSE_PROJECT_NAME=medea

COMPOSE_IMAGE_NAME=instrumentisto/medea
COMPOSE_IMAGE_VER=dev

COMPOSE_CONTROL_MOCK_IMAGE_NAME=instrumentisto/medea-control-api-mock
COMPOSE_CONTROL_MOCK_IMAGE_VER=dev

COMPOSE_WEBDRIVER_IMAGE_NAME=selenoid/chrome
COMPOSE_WEBDRIVER_IMAGE_VER=latest
66 changes: 58 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ jobs:

test-e2e:
name: E2E tests
needs: ['docker']
if: ${{ github.ref == 'refs/heads/master'
|| startsWith(github.ref, 'refs/tags/medea-')
|| !contains(github.event.head_commit.message, '[skip ci]') }}
Expand All @@ -157,6 +158,8 @@ jobs:
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown

- uses: Swatinem/rust-cache@v1
if: ${{ !contains(github.event.head_commit.message, '[fresh ci]') }}
- uses: satackey/action-docker-layer-caching@v0.0.11
Expand All @@ -165,7 +168,56 @@ jobs:
restore-keys: test-e2e-
continue-on-error: true
if: ${{ !contains(github.event.head_commit.message, '[fresh ci]') }}
- run: make test.e2e up=yes dockerized=no

- uses: actions-rs/install@v0.1
with:
crate: wasm-pack
use-tool-cache: true

- uses: actions/download-artifact@v2
with:
name: docker-medea-${{ github.run_number }}
- name: Unpack `medea` Docker image
run: make docker.untar from-file=image.tar

- uses: actions/download-artifact@v2
with:
name: docker-medea-control-api-mock-${{ github.run_number }}
- name: Unpack `medea-control-api-mock` Docker image
run: make docker.untar from-file=image.tar

- uses: c-py/action-dotenv-to-setenv@v2

- name: Chrome
run: make test.e2e browser=chrome up=yes dockerized=yes
tag=build-${{ github.run_number }}
- name: Firefox
run: make test.e2e browser=firefox up=yes dockerized=yes
tag=build-${{ github.run_number }}

test-integration:
name: Integration tests
if: ${{ github.ref == 'refs/heads/master'
|| startsWith(github.ref, 'refs/tags/medea-')
|| !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable

- uses: Swatinem/rust-cache@v1
if: ${{ !contains(github.event.head_commit.message, '[fresh ci]') }}
- uses: satackey/action-docker-layer-caching@v0.0.11
with:
key: test-integration-{hash}
restore-keys: test-integration-
continue-on-error: true
if: ${{ !contains(github.event.head_commit.message, '[fresh ci]') }}

- run: make test.integration up=yes dockerized=no



Expand Down Expand Up @@ -273,18 +325,15 @@ jobs:
cache: ${{ github.ref != 'refs/heads/master'
&& !startsWith(github.ref, 'refs/tags/medea-')
&& !contains(github.event.head_commit.message, '[fresh ci]') }}
export: ${{ github.ref == 'refs/heads/master'
|| startsWith(github.ref, 'refs/tags/medea-') }}
export: true
if: true

- image: medea-control-api-mock
cache: ${{ github.ref != 'refs/heads/master'
&& !startsWith(github.ref, 'refs/tags/medea-control-api-mock-')
&& !contains(github.event.head_commit.message, '[fresh ci]') }}
export: ${{ github.ref == 'refs/heads/master'
|| startsWith(github.ref, 'refs/tags/medea-control-api-mock-') }}
if: ${{ !startsWith(github.ref, 'refs/tags/medea-')
|| startsWith(github.ref, 'refs/tags/medea-control-api-mock-') }}
export: true
if: true

- image: medea-demo
cache: ${{ github.ref != 'refs/heads/master'
Expand Down Expand Up @@ -314,6 +363,7 @@ jobs:
key: docker-${{ matrix.image }}-build-{hash}
restore-keys: docker-${{ matrix.image }}-build-
continue-on-error: true
timeout-minutes: 10
if: ${{ matrix.if && matrix.cache }}
- run: make docker.build debug=yes no-cache=no
image=${{ matrix.image }} tag=build-${{ github.run_number }}
Expand All @@ -338,7 +388,7 @@ jobs:

release-github:
name: Release on GitHub
needs: ['clippy', 'rustfmt', 'rustdoc', 'test-e2e', 'test-unit']
needs: ['clippy', 'rustfmt', 'rustdoc', 'test-e2e', 'test-integration', 'test-unit']
if: ${{ startsWith(github.ref, 'refs/tags/medea-') }}
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://github.com/rust-lang-nursery/rustfmt/blob/master/Configurations.md

max_width = 80
format_strings = true
format_strings = false
imports_granularity = "Crate"
normalize_comments = true
wrap_comments = true
Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ $ make test.unit crate=medea
$ make test.unit crate=medea-jason
```

To run integration tests use docker-wrapped commands from [`Makefile`]:
```bash
$ make test.integration
```

To run E2E tests use docker-wrapped commands from [`Makefile`]:
```bash
$ make test.e2e
Expand Down
Loading

0 comments on commit dcbdcc3

Please sign in to comment.