Skip to content

Commit

Permalink
Feature/fix e2e test (#493)
Browse files Browse the repository at this point in the history
* simulcast のテストの動作確認

* worker を一つにしぼる

* 終了処理を丁寧に

* 終了処理をキレイにする

* 一つ一つ skip してなにと連携すると駄目なのか調べる

* まずは sendrecv と simulcast の組み合わせを試す

* sendonly_recvonly を追加

* simulcast_sendonly_recvonly を追加

* page / browser の close を追加

* spotlight が原因か

* spotlight 復帰

* spotlight とのみ組み合わせてみる

* 増やすと駄目?

* 終了処理整理

* 最後の一つを追加

* only 外す

* messaging も有効にしてみる

* skip にする

* メッセージは削除しておく

* 18,20,21 復活

* Revert "18,20,21 復活"

This reverts commit 12c4db3.
  • Loading branch information
voluntas authored Feb 22, 2024
1 parent 30021a4 commit d2c81ed
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 11 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ jobs:
# name: playwright-report
# path: playwright-report/
# retention-days: 30
- name: Slack Notification
if: success()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: sora-js-sdk
SLACK_COLOR: good
SLACK_TITLE: Success test
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Slack Notification
if: failure()
uses: rtCamp/action-slack-notify@v2
Expand Down
1 change: 1 addition & 0 deletions examples/messaging/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ document.querySelector('#start').addEventListener('click', async () => {
})
document.querySelector('#stop').addEventListener('click', async () => {
await recvonly.disconnect()
document.querySelector('#received-messages').innerHTML = null
})
document.querySelector('#send-message').addEventListener('click', async () => {
const value = document.querySelector('input[name=message]').value
Expand Down
7 changes: 7 additions & 0 deletions examples/simulcast/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const sendonly = sora.sendonly(channelId, metadata, {
simulcast: true,
})
sendonly.on('notify', (event) => {
console.log(event)
if (event.event_type === 'connection.created' && event.connection_id === sendonly.connectionId) {
document.querySelector('#local-video-connection-id').textContent = `${event.connection_id}`
}
Expand Down Expand Up @@ -93,11 +94,17 @@ document.querySelector('#start').addEventListener('click', async () => {

document.querySelector('#stop').addEventListener('click', async () => {
await sendonly.disconnect()
document.querySelector('#local-video').srcObject = null

// recvonly r0
await recvonlyR0.disconnect()
document.querySelector('#remote-video-r0').srcObject = null

// recvonly r1
await recvonlyR1.disconnect()
document.querySelector('#remote-video-r1').srcObject = null

// recvonly r2
await recvonlyR2.disconnect()
document.querySelector('#remote-video-r2').srcObject = null
})
6 changes: 6 additions & 0 deletions examples/spotlight_recvonly/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,16 @@ recvonly.on('track', (event) => {
recvonly.on('removetrack', (event) => {
const remoteVideo = document.querySelector(`#remotevideo-${event.target.id}`)
if (remoteVideo) {
remoteVideo.srcObject = null
document.querySelector('#remote-videos').removeChild(remoteVideo)
}
})

document.querySelector('#start-recvonly').addEventListener('click', async () => {
await recvonly.connect()
})

document.querySelector('#stop-recvonly').addEventListener('click', async () => {
await recvonly.disconnect()
document.querySelector('#remote-videos').innerHTML = null
})
5 changes: 5 additions & 0 deletions examples/spotlight_sendonly/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ document.querySelector('#start-sendonly').addEventListener('click', async () =>
document.querySelector('#sendonly-local-video').srcObject = mediaStream
await sendonly.connect(mediaStream)
})

document.querySelector('#stop-sendonly').addEventListener('click', async () => {
await sendonly.disconnect()
document.querySelector('#sendonly-local-video').srcObject = null
})
19 changes: 9 additions & 10 deletions examples/spotlight_sendrecv/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ sendrecv2.on('track', (event) => {
sendrecv2.on('removetrack', (event) => {
const remoteVideo = document.querySelector(`#sendrecv2-remotevideo-${event.target.id}`)
if (remoteVideo) {
remoteVideo.srcObject = null
document.querySelector('#sendrecv2-remote-videos').removeChild(remoteVideo)
}
})
Expand All @@ -94,15 +95,13 @@ document.querySelector('#start-sendrecv2').addEventListener('click', async () =>
document.querySelector('#sendrecv2-local-video').srcObject = mediaStream
await sendrecv2.connect(mediaStream)
})
document.querySelector('#stop-sendrecv1').addEventListener('click', () => {
sendrecv1.disconnect().then(() => {
document.querySelector('#sendrecv1-local-video').srcObject = null
document.querySelector('#sendrecv1-remote-videos').innerHTML = null
})
document.querySelector('#stop-sendrecv1').addEventListener('click', async () => {
await sendrecv1.disconnect()
document.querySelector('#sendrecv1-local-video').srcObject = null
document.querySelector('#sendrecv1-remote-videos').innerHTML = null
})
document.querySelector('#stop-sendrecv2').addEventListener('click', () => {
sendrecv2.disconnect().then(() => {
document.querySelector('#sendrecv2-local-video').srcObject = null
document.querySelector('#sendrecv2-remote-videos').innerHTML = null
})
document.querySelector('#stop-sendrecv2').addEventListener('click', async () => {
sendrecv2.disconnect()
document.querySelector('#sendrecv2-local-video').srcObject = null
document.querySelector('#sendrecv2-remote-videos').innerHTML = null
})
3 changes: 3 additions & 0 deletions tests/e2ee.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ test.skip('e2ee sendrecv x2', async ({ browser }) => {

await page1.click('#stop-sendrecv')
await page2.click('#stop-sendrecv')

await page1.close()
await page2.close()
})
4 changes: 3 additions & 1 deletion tests/messaging.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { test } from '@playwright/test'

// FIXME: ローカルだと通る
test.skip('messaging pages', async ({ browser }) => {
// 新しいページを2つ作成
const page1 = await browser.newPage()
Expand Down Expand Up @@ -47,4 +46,7 @@ test.skip('messaging pages', async ({ browser }) => {

await page1.click('#stop')
await page2.click('#stop')

await page1.close()
await page2.close()
})
3 changes: 3 additions & 0 deletions tests/sendonly_recvonly.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ test('sendonly/recvonly pages', async ({ browser }) => {

await page1.click('#stop-sendonly')
await page2.click('#stop-recvonly')

await page1.close()
await page2.close()
})
3 changes: 3 additions & 0 deletions tests/spotlight_sendonly_recvonly.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ test('spotlight sendonly/recvonly pages', async ({ browser }) => {

await page1.click('#stop-sendonly')
await page2.click('#stop-recvonly')

await page1.close()
await page2.close()
})

0 comments on commit d2c81ed

Please sign in to comment.