From 042f9b5a89d9758a6fadec860814374a84e5db9e Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Wed, 21 May 2025 13:20:18 +0200 Subject: [PATCH] ov-components: add E2E tests for toolbar --- .../openvidu-components-angular-tests.yml | 24 ++++--------------- .../{webcomponent-e2e => }/toolbar.test.ts | 24 ++++++++++--------- openvidu-components-angular/package.json | 2 +- 3 files changed, 19 insertions(+), 31 deletions(-) rename openvidu-components-angular/e2e/{webcomponent-e2e => }/toolbar.test.ts (66%) diff --git a/.github/workflows/openvidu-components-angular-tests.yml b/.github/workflows/openvidu-components-angular-tests.yml index 7af85cee..79bce3eb 100644 --- a/.github/workflows/openvidu-components-angular-tests.yml +++ b/.github/workflows/openvidu-components-angular-tests.yml @@ -385,9 +385,9 @@ jobs: if: always() uses: ./.github/actions/cleanup - webcomponent_e2e_toolbar: + e2e_toolbar: needs: test_setup - name: Webcomponent toolbar + name: Toolbar E2E if: false runs-on: ubuntu-latest steps: @@ -409,26 +409,12 @@ jobs: uses: ./.github/actions/setup-local-deployment - name: Setup OpenVidu Call Backend uses: ./.github/actions/setup-openvidu-call-backend - - name: Install dependencies - run: | - cd openvidu-components-angular - npm install - - name: Build openvidu-angular - run: npm run lib:build --prefix openvidu-components-angular - - name: Build openvidu-webcomponent - run: npm run webcomponent:testing-build --prefix openvidu-components-angular - - name: Serve Webcomponent Testapp - run: npm run webcomponent:serve-testapp --prefix openvidu-components-angular & - - name: Wait for openvidu-components-angular Testapp - run: | - until curl -s -f -o /dev/null http://localhost:8080; do - echo "Waiting for openvidu-components-angular Testapp to be ready..." - sleep 5 - done + - name: Build and Serve openvidu-components-angular Testapp + uses: ./.github/actions/build-and-serve-components-testapp - name: Run Webcomponent E2E env: LAUNCH_MODE: CI - run: npm run e2e:webcomponent-toolbar --prefix openvidu-components-angular + run: npm run e2e:lib-toolbar --prefix openvidu-components-angular - name: Cleanup if: always() uses: ./.github/actions/cleanup diff --git a/openvidu-components-angular/e2e/webcomponent-e2e/toolbar.test.ts b/openvidu-components-angular/e2e/toolbar.test.ts similarity index 66% rename from openvidu-components-angular/e2e/webcomponent-e2e/toolbar.test.ts rename to openvidu-components-angular/e2e/toolbar.test.ts index 50137800..d96c5fee 100644 --- a/openvidu-components-angular/e2e/webcomponent-e2e/toolbar.test.ts +++ b/openvidu-components-angular/e2e/toolbar.test.ts @@ -1,19 +1,18 @@ import { Builder, WebDriver } from 'selenium-webdriver'; -import { OPENVIDU_CALL_SERVER } from '../config'; -import { WebComponentConfig } from '../selenium.conf'; -import { OpenViduComponentsPO } from '../utils.po.test'; +import { TestAppConfig } from './selenium.conf'; +import { OpenViduComponentsPO } from './utils.po.test'; -const url = `${WebComponentConfig.appUrl}?OV_URL=${OPENVIDU_CALL_SERVER}`; +const url = TestAppConfig.appUrl; -describe('Testing TOOLBAR features', () => { +describe('Toolbar button functionality for local media control', () => { let browser: WebDriver; let utils: OpenViduComponentsPO; async function createChromeBrowser(): Promise { return await new Builder() - .forBrowser(WebComponentConfig.browserName) - .withCapabilities(WebComponentConfig.browserCapabilities) - .setChromeOptions(WebComponentConfig.browserOptions) - .usingServer(WebComponentConfig.seleniumAddress) + .forBrowser(TestAppConfig.browserName) + .withCapabilities(TestAppConfig.browserCapabilities) + .setChromeOptions(TestAppConfig.browserOptions) + .usingServer(TestAppConfig.seleniumAddress) .build(); } @@ -23,10 +22,13 @@ describe('Testing TOOLBAR features', () => { }); afterEach(async () => { + try { + await utils.leaveRoom(); + } catch (error) {} await browser.quit(); }); - it('should mute and unmute the local microphone', async () => { + it('should toggle mute/unmute on the local microphone and update the icon accordingly', async () => { await browser.get(`${url}&prejoin=false`); await utils.checkLayoutPresent(); @@ -43,7 +45,7 @@ describe('Testing TOOLBAR features', () => { expect(await utils.isPresent('#mic-btn #mic')).toBeTrue(); }); - it('should mute and unmute the local camera', async () => { + it('should toggle mute/unmute on the local camera and update the icon accordingly', async () => { await browser.get(`${url}&prejoin=false`); await utils.checkLayoutPresent(); diff --git a/openvidu-components-angular/package.json b/openvidu-components-angular/package.json index 0f2f94f5..084efa86 100644 --- a/openvidu-components-angular/package.json +++ b/openvidu-components-angular/package.json @@ -97,10 +97,10 @@ "e2e:lib-panels": "tsc --project ./e2e && npx jasmine --fail-fast ./e2e/dist/panels.test.js", "e2e:lib-screensharing": "tsc --project ./e2e && npx jasmine --fail-fast ./e2e/dist/screensharing.test.js", "e2e:lib-stream": "tsc --project ./e2e && npx jasmine --fail-fast ./e2e/dist/stream.test.js", + "e2e:lib-toolbar": "tsc --project ./e2e && npx jasmine --fail-fast ./e2e/dist/toolbar.test.js", "e2e:webcomponent-all": "tsc --project ./e2e && npx jasmine --fail-fast ./e2e/dist/webcomponent-e2e/**/*.test.js", "e2e:webcomponent-captions": "tsc --project ./e2e && npx jasmine --fail-fast ./e2e/dist/webcomponent-e2e/captions.test.js", - "e2e:webcomponent-toolbar": "tsc --project ./e2e && npx jasmine --fail-fast ./e2e/dist/webcomponent-e2e/toolbar.test.js", "webcomponent:testing-build": "./node_modules/@angular/cli/bin/ng.js build openvidu-webcomponent --configuration testing && node ./openvidu-webcomponent-build.js", "webcomponent:build": "./node_modules/@angular/cli/bin/ng.js build openvidu-webcomponent --configuration production && node ./openvidu-webcomponent-build.js", "webcomponent:serve-testapp": "npx http-server ./e2e/webcomponent-app/",