Skip to content

Commit

Permalink
テストの環境変数を TEST_ に変更する
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Dec 25, 2024
1 parent 28f6c35 commit ee96dee
Show file tree
Hide file tree
Showing 16 changed files with 203 additions and 201 deletions.
20 changes: 11 additions & 9 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# サンプルやテストに利用する Sora の Signaling URL を指定してください
# サンプルに利用する Sora の Signaling URL を指定してください
VITE_SORA_SIGNALING_URL=wss://sora.example.com/signaling
# サンプルやテストに利用する Sora の ChannelID を指定してください
# サンプルに利用する Sora の ChannelID を指定してください
VITE_SORA_CHANNEL_ID=sora-js-sdk
# サンプルやテストに利用するアクセストークンを指定してください、不要であれば空欄で大丈夫です
# サンプルに利用するアクセストークンを指定してください、不要であれば空欄で大丈夫です
VITE_ACCESS_TOKEN=access_token


# サンプルやテストに利用する Sora の API URL を指定ください、不要であれば空欄で大丈夫です
VITE_SORA_API_URL=https://sora.example.com/api
# サンプルやテストに利用する Sora の WHIP のエンドポイント URL を指定してください、不要であれば空欄で大丈夫です
VITE_SORA_WHIP_ENDPOINT_URL=https://sora.example.com/whip
# サンプルやテストに利用する Sora の WHEP のエンドポイント URL を指定してください、不要であれば空欄で大丈夫です
VITE_SORA_WHEP_ENDPOINT_URL=https://sora.example.com/whep
# テストに利用する Sora の設定
VITE_TEST_SIGNALING_URL=
VITE_TEST_CHANNEL_ID_PREFIX=
VITE_TEST_CHANNEL_ID_SUFFIX=
VITE_TEST_API_URL=
VITE_TEST_WHIP_ENDPOINT_URL=
VITE_TEST_WHEP_ENDPOINT_URL=
VITE_TEST_SECRET_KEY=
14 changes: 7 additions & 7 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
# browser: ["chromium", "firefox", "webkit"]
browser: ["chromium"]
env:
VITE_SORA_SIGNALING_URL: ${{ secrets.TEST_SIGNALING_URL }}
VITE_SORA_WHIP_ENDPOINT_URL: ${{ secrets.TEST_WHIP_ENDPOINT_URL }}
VITE_SORA_WHEP_ENDPOINT_URL: ${{ secrets.TEST_WHEP_ENDPOINT_URL }}
VITE_SORA_CHANNEL_ID_PREFIX: ${{ secrets.TEST_CHANNEL_ID_PREFIX }}
VITE_SORA_API_URL: ${{ secrets.TEST_API_URL }}
VITE_ACCESS_TOKEN: ${{ secrets.TEST_SECRET_KEY }}
TEST_SIGNALING_URL: ${{ secrets.TEST_SIGNALING_URL }}
TEST_WHIP_ENDPOINT_URL: ${{ secrets.TEST_WHIP_ENDPOINT_URL }}
TEST_WHEP_ENDPOINT_URL: ${{ secrets.TEST_WHEP_ENDPOINT_URL }}
TEST_CHANNEL_ID_PREFIX: ${{ secrets.TEST_CHANNEL_ID_PREFIX }}
TEST_API_URL: ${{ secrets.TEST_API_URL }}
TEST_SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }}
steps:
- uses: actions/checkout@v4
- uses: tailscale/github-action@v2
Expand All @@ -46,7 +46,7 @@ jobs:
- run: pnpm exec playwright install ${{ matrix.browser }} --with-deps
- run: pnpm exec playwright test --project=${{ matrix.browser }}
env:
VITE_SORA_CHANNEL_ID_SUFFIX: _${{ matrix.node }}
VITE_TEST_CHANNEL_ID_SUFFIX: _${{ matrix.node }}
# - uses: actions/upload-artifact@v4
# if: always()
# with:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/npm-pkg-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ jobs:
# browser: ["chromium", "firefox", "webkit"]
browser: ["chromium"]
env:
VITE_SORA_SIGNALING_URL: ${{ secrets.TEST_SIGNALING_URL }}
VITE_SORA_WHIP_ENDPOINT_URL: ${{ secrets.TEST_WHIP_ENDPOINT_URL }}
VITE_SORA_WHEP_ENDPOINT_URL: ${{ secrets.TEST_WHEP_ENDPOINT_URL }}
VITE_SORA_CHANNEL_ID_PREFIX: ${{ secrets.TEST_CHANNEL_ID_PREFIX }}
VITE_SORA_API_URL: ${{ secrets.TEST_API_URL }}
VITE_ACCESS_TOKEN: ${{ secrets.TEST_SECRET_KEY }}
VITE_TEST_SIGNALING_URL: ${{ secrets.TEST_SIGNALING_URL }}
VITE_TEST_WHIP_ENDPOINT_URL: ${{ secrets.TEST_WHIP_ENDPOINT_URL }}
VITE_TEST_WHEP_ENDPOINT_URL: ${{ secrets.TEST_WHEP_ENDPOINT_URL }}
VITE_TEST_CHANNEL_ID_PREFIX: ${{ secrets.TEST_CHANNEL_ID_PREFIX }}
VITE_TEST_API_URL: ${{ secrets.TEST_API_URL }}
VITE_TEST_SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }}
NPM_PKG_E2E_TEST: true
steps:
- uses: actions/checkout@v4
Expand All @@ -62,7 +62,7 @@ jobs:
- run: pnpm exec playwright install ${{ matrix.browser }} --with-deps
- run: pnpm exec playwright test --project=${{ matrix.browser }}
env:
VITE_SORA_CHANNEL_ID_SUFFIX: _${{ matrix.node }}_${{ matrix.sdk_version }}
VITE_TEST_CHANNEL_ID_SUFFIX: _${{ matrix.node }}_${{ matrix.sdk_version }}
# - uses: actions/upload-artifact@v4
# if: always()
# with:
Expand Down
30 changes: 15 additions & 15 deletions e2e-tests/data_channel_signaling_only/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import Sora, {
} from 'sora-js-sdk'

document.addEventListener('DOMContentLoaded', async () => {
const SORA_SIGNALING_URL = import.meta.env.VITE_SORA_SIGNALING_URL
const SORA_CHANNEL_ID_PREFIX = import.meta.env.VITE_SORA_CHANNEL_ID_PREFIX || ''
const SORA_CHANNEL_ID_SUFFIX = import.meta.env.VITE_SORA_CHANNEL_ID_SUFFIX || ''
const ACCESS_TOKEN = import.meta.env.VITE_ACCESS_TOKEN || ''
const signalingUrl = import.meta.env.VITE_TEST_SIGNALING_URL
const channelIdPrefix = import.meta.env.VITE_TEST_CHANNEL_ID_PREFIX || ''
const channelIdSuffix = import.meta.env.VITE_TEST_CHANNEL_ID_SUFFIX || ''
const secretKey = import.meta.env.VITE_TEST_SECRET_KEY

const client = new SoraClient(
SORA_SIGNALING_URL,
SORA_CHANNEL_ID_PREFIX,
SORA_CHANNEL_ID_SUFFIX,
ACCESS_TOKEN,
signalingUrl,
channelIdPrefix,
channelIdSuffix,
secretKey,
)

// SDK バージョンの表示
Expand Down Expand Up @@ -77,17 +77,17 @@ class SoraClient {
private connection: ConnectionPublisher

constructor(
signaling_url: string,
channel_id_prefix: string,
channel_id_suffix: string,
access_token: string,
signalingUrl: string,
channelIdPrefix: string,
channelIdSuffix: string,
secretKey: string,
) {
this.sora = Sora.connection(signaling_url, this.debug)
this.sora = Sora.connection(signalingUrl, this.debug)

// channel_id の生成
this.channelId = `${channel_id_prefix}sendonly_recvonly${channel_id_suffix}`
this.channelId = `${channelIdPrefix}sendonly_recvonly${channelIdSuffix}`
// access_token を指定する metadata の生成
this.metadata = { access_token: access_token }
this.metadata = { access_token: secretKey }

this.connection = this.sora.sendonly(this.channelId, this.metadata, this.options)
this.connection.on('notify', this.onNotify.bind(this))
Expand Down
20 changes: 10 additions & 10 deletions e2e-tests/messaging/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ const getChannelName = (): string => {
}

document.addEventListener('DOMContentLoaded', async () => {
const SORA_SIGNALING_URL = import.meta.env.VITE_SORA_SIGNALING_URL
const SORA_CHANNEL_ID_PREFIX = import.meta.env.VITE_SORA_CHANNEL_ID_PREFIX || ''
const SORA_CHANNEL_ID_SUFFIX = import.meta.env.VITE_SORA_CHANNEL_ID_SUFFIX || ''
const ACCESS_TOKEN = import.meta.env.VITE_ACCESS_TOKEN || ''
const signalingUrl = import.meta.env.VITE_TEST_SIGNALING_URL
const channelIdPrefix = import.meta.env.VITE_TEST_CHANNEL_ID_PREFIX || ''
const channelIdSuffix = import.meta.env.VITE_TEST_CHANNEL_ID_SUFFIX || ''
const secretKey = import.meta.env.VITE_TEST_SECRET_KEY

const soraJsSdkVersion = Sora.version()
const soraJsSdkVersionElement = document.getElementById('sora-js-sdk-version')
Expand All @@ -32,10 +32,10 @@ document.addEventListener('DOMContentLoaded', async () => {
document.querySelector('#connect')?.addEventListener('click', async () => {
const channelName = getChannelName()
client = new SoraClient(
SORA_SIGNALING_URL,
SORA_CHANNEL_ID_PREFIX,
SORA_CHANNEL_ID_SUFFIX,
ACCESS_TOKEN,
signalingUrl,
channelIdPrefix,
channelIdSuffix,
secretKey,
channelName,
)
const checkCompress = document.getElementById('check-compress') as HTMLInputElement
Expand Down Expand Up @@ -94,12 +94,12 @@ class SoraClient {
signalingUrl: string,
channelIdPrefix: string,
channelIdSuffix: string,
accessToken: string,
secretKey: string,
channelName: string,
) {
this.sora = Sora.connection(signalingUrl, this.debug)
this.channelId = `${channelIdPrefix}${channelName}${channelIdSuffix}`
this.metadata = { access_token: accessToken }
this.metadata = { access_token: secretKey }

this.options = {
dataChannelSignaling: true,
Expand Down
16 changes: 8 additions & 8 deletions e2e-tests/recvonly/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import Sora, {

document.addEventListener('DOMContentLoaded', () => {
// 環境変数の読み込み
const SORA_SIGNALING_URL = import.meta.env.VITE_SORA_SIGNALING_URL
const SORA_CHANNEL_ID_PREFIX = import.meta.env.VITE_SORA_CHANNEL_ID_PREFIX || ''
const SORA_CHANNEL_ID_SUFFIX = import.meta.env.VITE_SORA_CHANNEL_ID_SUFFIX || ''
const ACCESS_TOKEN = import.meta.env.VITE_ACCESS_TOKEN || ''
const signalingUrl = import.meta.env.VITE_TEST_SIGNALING_URL
const channelIdPrefix = import.meta.env.VITE_TEST_CHANNEL_ID_PREFIX || ''
const channelIdSuffix = import.meta.env.VITE_TEST_CHANNEL_ID_SUFFIX || ''
const secretKey = import.meta.env.VITE_TEST_SECRET_KEY

// Sora クライアントの初期化
const client = new SoraClient(
SORA_SIGNALING_URL,
SORA_CHANNEL_ID_PREFIX,
SORA_CHANNEL_ID_SUFFIX,
ACCESS_TOKEN,
signalingUrl,
channelIdPrefix,
channelIdSuffix,
secretKey,
)

// SDK バージョンの表示
Expand Down
30 changes: 15 additions & 15 deletions e2e-tests/sendonly/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import Sora, {
} from 'sora-js-sdk'

document.addEventListener('DOMContentLoaded', async () => {
const SORA_SIGNALING_URL = import.meta.env.VITE_SORA_SIGNALING_URL
const SORA_CHANNEL_ID_PREFIX = import.meta.env.VITE_SORA_CHANNEL_ID_PREFIX || ''
const SORA_CHANNEL_ID_SUFFIX = import.meta.env.VITE_SORA_CHANNEL_ID_SUFFIX || ''
const ACCESS_TOKEN = import.meta.env.VITE_ACCESS_TOKEN || ''
const signalingUrl = import.meta.env.VITE_TEST_SIGNALING_URL
const channelIdPrefix = import.meta.env.VITE_TEST_CHANNEL_ID_PREFIX || ''
const channelIdSuffix = import.meta.env.VITE_TEST_CHANNEL_ID_SUFFIX || ''
const secretKey = import.meta.env.VITE_TEST_SECRET_KEY

const client = new SoraClient(
SORA_SIGNALING_URL,
SORA_CHANNEL_ID_PREFIX,
SORA_CHANNEL_ID_SUFFIX,
ACCESS_TOKEN,
signalingUrl,
channelIdPrefix,
channelIdSuffix,
secretKey,
)

// SDK バージョンの表示
Expand Down Expand Up @@ -69,17 +69,17 @@ class SoraClient {
private connection: ConnectionPublisher

constructor(
signaling_url: string,
channel_id_prefix: string,
channel_id_suffix: string,
access_token: string,
signalingUrl: string,
channelIdPrefix: string,
channelIdSuffix: string,
secretKey: string,
) {
this.sora = Sora.connection(signaling_url, this.debug)
this.sora = Sora.connection(signalingUrl, this.debug)

// channel_id の生成
this.channelId = `${channel_id_prefix}sendonly_recvonly${channel_id_suffix}`
this.channelId = `${channelIdPrefix}sendonly_recvonly${channelIdSuffix}`
// access_token を指定する metadata の生成
this.metadata = { access_token: access_token }
this.metadata = { access_token: secretKey }

this.connection = this.sora.sendonly(this.channelId, this.metadata, this.options)
this.connection.on('notify', this.onNotify.bind(this))
Expand Down
30 changes: 15 additions & 15 deletions e2e-tests/sendonly_audio/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import Sora, {
} from 'sora-js-sdk'

document.addEventListener('DOMContentLoaded', async () => {
const SORA_SIGNALING_URL = import.meta.env.VITE_SORA_SIGNALING_URL
const SORA_CHANNEL_ID_PREFIX = import.meta.env.VITE_SORA_CHANNEL_ID_PREFIX || ''
const SORA_CHANNEL_ID_SUFFIX = import.meta.env.VITE_SORA_CHANNEL_ID_SUFFIX || ''
const ACCESS_TOKEN = import.meta.env.VITE_ACCESS_TOKEN || ''
const signalingUrl = import.meta.env.VITE_TEST_SIGNALING_URL
const channelIdPrefix = import.meta.env.VITE_TEST_CHANNEL_ID_PREFIX || ''
const channelIdSuffix = import.meta.env.VITE_TEST_CHANNEL_ID_SUFFIX || ''
const secretKey = import.meta.env.VITE_TEST_SECRET_KEY

const client = new SoraClient(
SORA_SIGNALING_URL,
SORA_CHANNEL_ID_PREFIX,
SORA_CHANNEL_ID_SUFFIX,
ACCESS_TOKEN,
signalingUrl,
channelIdPrefix,
channelIdSuffix,
secretKey,
)

document.querySelector('#connect')?.addEventListener('click', async () => {
Expand Down Expand Up @@ -73,17 +73,17 @@ class SoraClient {
private connection: ConnectionPublisher

constructor(
signaling_url: string,
channel_id_prefix: string,
channel_id_suffix: string,
access_token: string,
signalingUrl: string,
channelIdPrefix: string,
channelIdSuffix: string,
secretKey: string,
) {
this.sora = Sora.connection(signaling_url, this.debug)
this.sora = Sora.connection(signalingUrl, this.debug)

// channel_id の生成
this.channelId = `${channel_id_prefix}sendonly_audio_codec${channel_id_suffix}`
this.channelId = `${channelIdPrefix}sendonly_audio_codec${channelIdSuffix}`
// access_token を指定する metadata の生成
this.metadata = { access_token: access_token }
this.metadata = { access_token: secretKey }

this.connection = this.sora.sendonly(this.channelId, this.metadata, this.options)
this.connection.on('notify', this.onnotify.bind(this))
Expand Down
20 changes: 10 additions & 10 deletions e2e-tests/sendrecv/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const getVideoCodecType = (): VideoCodecType | undefined => {
}

document.addEventListener('DOMContentLoaded', async () => {
const SORA_SIGNALING_URL = import.meta.env.VITE_SORA_SIGNALING_URL
const SORA_CHANNEL_ID_PREFIX = import.meta.env.VITE_SORA_CHANNEL_ID_PREFIX || ''
const SORA_CHANNEL_ID_SUFFIX = import.meta.env.VITE_SORA_CHANNEL_ID_SUFFIX || ''
const ACCESS_TOKEN = import.meta.env.VITE_ACCESS_TOKEN || ''
const signalingUrl = import.meta.env.VITE_TEST_SIGNALING_URL
const channelIdPrefix = import.meta.env.VITE_TEST_CHANNEL_ID_PREFIX || ''
const channelIdSuffix = import.meta.env.VITE_TEST_CHANNEL_ID_SUFFIX || ''
const secretKey = import.meta.env.VITE_TEST_SECRET_KEY

let client: SoraClient

Expand All @@ -37,10 +37,10 @@ document.addEventListener('DOMContentLoaded', async () => {
const videoCodecType = getVideoCodecType()

client = new SoraClient(
SORA_SIGNALING_URL,
SORA_CHANNEL_ID_PREFIX,
SORA_CHANNEL_ID_SUFFIX,
ACCESS_TOKEN,
signalingUrl,
channelIdPrefix,
channelIdSuffix,
secretKey,
channelName,
videoCodecType,
)
Expand Down Expand Up @@ -92,15 +92,15 @@ class SoraClient {
signalingUrl: string,
channelIdPrefix: string,
channelIdSuffix: string,
accessToken: string,
secretKey: string,
channelName: string,
videoCodecType: VideoCodecType | undefined,
) {
this.sora = Sora.connection(signalingUrl, this.debug)

this.channelId = `${channelIdPrefix}${channelName}${channelIdSuffix}`

this.metadata = { access_token: accessToken }
this.metadata = { access_token: secretKey }
this.options = {}

if (videoCodecType !== undefined) {
Expand Down
Loading

0 comments on commit ee96dee

Please sign in to comment.