Skip to content

Commit 44664d2

Browse files
committed
Use serverless demo for browse compatibility tests
1 parent a65cb2f commit 44664d2

7 files changed

Lines changed: 115 additions & 76 deletions

File tree

.github/actions/setup-integration-test/action.yml

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -115,35 +115,39 @@ runs:
115115
echo "use_sauce=false" >> $GITHUB_OUTPUT
116116
fi
117117
shell: bash
118-
- name: Create a Job ID for SauceLabs
119-
if: |
120-
(steps.test_needed.outputs.integ_test_required == 'true' || inputs.browser-compatibility-test == 'true')
121-
&& steps.check-sauce.outputs.use_sauce == 'true'
122-
id: create-job-id
123-
uses: filipstefansson/uuid-action@ce29ebbb0981ac2448c2e406e848bfaa30ddf04c
124-
- name: Set JOB_ID Env Variable for SauceLabs
125-
if: |
126-
(steps.test_needed.outputs.integ_test_required == 'true' || inputs.browser-compatibility-test == 'true')
127-
&& steps.check-sauce.outputs.use_sauce == 'true'
128-
run: echo "JOB_ID=${{ steps.create-job-id.outputs.uuid }}" >> $GITHUB_ENV
129-
shell: bash
130-
- name: Echo Job ID for SauceLabs
131-
if: |
132-
(steps.test_needed.outputs.integ_test_required == 'true' || inputs.browser-compatibility-test == 'true')
133-
&& steps.check-sauce.outputs.use_sauce == 'true'
134-
run: echo "${{ steps.create-job-id.outputs.uuid }}"
135-
shell: bash
136-
- name: Setup Sauce Connect
137-
if: |
138-
(steps.test_needed.outputs.integ_test_required == 'true' || inputs.browser-compatibility-test == 'true')
139-
&& steps.check-sauce.outputs.use_sauce == 'true'
140-
uses: saucelabs/sauce-connect-action@v3.0.0
141-
with:
142-
username: ${{ inputs.sauce-username }}
143-
accessKey: ${{ inputs.sauce-access-key }}
144-
tunnelName: ${{ steps.create-job-id.outputs.uuid }}
145-
region: us
146-
proxyLocalhost: direct
118+
# TODO: Re-enable JOB_ID and Sauce Connect tunnel once local proxying issue is resolved.
119+
# Using TEST_URL (deployed serverless demo) instead for now.
120+
# - name: Create a Job ID for SauceLabs
121+
# if: |
122+
# (steps.test_needed.outputs.integ_test_required == 'true' || inputs.browser-compatibility-test == 'true')
123+
# && steps.check-sauce.outputs.use_sauce == 'true'
124+
# id: create-job-id
125+
# uses: filipstefansson/uuid-action@ce29ebbb0981ac2448c2e406e848bfaa30ddf04c
126+
# - name: Set JOB_ID Env Variable for SauceLabs
127+
# if: |
128+
# (steps.test_needed.outputs.integ_test_required == 'true' || inputs.browser-compatibility-test == 'true')
129+
# && steps.check-sauce.outputs.use_sauce == 'true'
130+
# run: echo "JOB_ID=${{ steps.create-job-id.outputs.uuid }}" >> $GITHUB_ENV
131+
# shell: bash
132+
# - name: Echo Job ID for SauceLabs
133+
# if: |
134+
# (steps.test_needed.outputs.integ_test_required == 'true' || inputs.browser-compatibility-test == 'true')
135+
# && steps.check-sauce.outputs.use_sauce == 'true'
136+
# run: echo "${{ steps.create-job-id.outputs.uuid }}"
137+
# shell: bash
138+
# TODO: Re-enable Sauce Connect tunnel once local proxying issue is resolved.
139+
# Using TEST_URL (deployed serverless demo) instead for now.
140+
# - name: Setup Sauce Connect
141+
# if: |
142+
# (steps.test_needed.outputs.integ_test_required == 'true' || inputs.browser-compatibility-test == 'true')
143+
# && steps.check-sauce.outputs.use_sauce == 'true'
144+
# uses: saucelabs/sauce-connect-action@v3.0.0
145+
# with:
146+
# username: ${{ inputs.sauce-username }}
147+
# accessKey: ${{ inputs.sauce-access-key }}
148+
# tunnelName: ${{ steps.create-job-id.outputs.uuid }}
149+
# region: us
150+
# proxyLocalhost: direct
147151
- name: Setup Chrome for local testing
148152
if: |
149153
steps.test_needed.outputs.integ_test_required == 'true' &&

.github/workflows/browser-compatibility-test.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
name: Browser Compatibility Test
22

33
on:
4-
schedule:
5-
# More information on cron https://crontab.guru/
6-
# GitHub actions is using UTC time. Scheduling action at 5 am PST
7-
- cron: '0 13 * * *'
4+
pull_request:
5+
branches:
6+
- main
7+
- 'release-**'
88

99
env:
1010
CLOUD_WATCH_METRIC: false
1111
TEST_TYPE: Browser-Compatibility-Test
1212
SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}}
1313
SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}}
14+
TEST_URL: ${{secrets.TEST_URL}}
1415
MESSAGING_USER_ARN: ${{secrets.MESSAGING_USER_ARN}}
1516
SLACK_JS_SDK_DEV_CORE_WEBHOOK: ${{secrets.SLACK_JS_SDK_DEV_CORE_WEBHOOK}}
1617
PRE_RUN_SCRIPT_URL: ${{secrets.PRE_RUN_SCRIPT_URL}}
@@ -44,6 +45,6 @@ jobs:
4445
- name: Run Video Test
4546
working-directory: ./integration
4647
run: npm run test -- --test-name VideoTest --host saucelabs --test-type browser-compatibility
47-
- name: Run Video Processing Test
48-
working-directory: ./integration
49-
run: npm run test -- --test-name VideoProcessingTest --host saucelabs --test-type browser-compatibility
48+
# - name: Run Video Processing Test
49+
# working-directory: ./integration
50+
# run: npm run test -- --test-name VideoProcessingTest --host saucelabs --test-type browser-compatibility

integration/README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ export SAUCE_USERNAME=<Sauce Labs account username>
7575
export SAUCE_ACCESS_KEY=<Sauce Labs access key>
7676
```
7777

78+
#### Option 1: Using a deployed serverless demo (no tunnel required)
7879
Sauce Labs will open a browser and load a test url. The following command requires the [Chime SDK serverless demo](https://github.com/aws/amazon-chime-sdk-js/tree/main/demos/serverless) deployed in your AWS account. If you haven't already, follow the [Chime SDK serverless demo instruction](https://github.com/aws/amazon-chime-sdk-js/tree/main/demos/serverless) to deploy the demo. You can set the demo url as an environment variable with the following command:
7980
```bash
80-
export TEST_URL=<Chime SDK for JavaScript serverelss demo URL>
81+
export TEST_URL=<Chime SDK for JavaScript serverless demo URL>
8182
```
8283

8384
The following command can be used to run browser compatibility tests with default settings on Sauce Labs:
@@ -86,6 +87,38 @@ The following command can be used to run browser compatibility tests with defaul
8687
npm run test -- --test-name AudioTest --host saucelabs --test-type browser-compatibility
8788
```
8889

90+
#### Option 2: Using a local Sauce Connect tunnel
91+
If you want to test against the local demo server (served on `127.0.0.1:8080`), you need to set up a Sauce Connect tunnel so that SauceLabs browsers can reach your local machine.
92+
93+
1. Install Sauce Connect:
94+
```bash
95+
brew install sauce-connect
96+
```
97+
98+
2. Start the tunnel in a separate terminal:
99+
```bash
100+
export SAUCE_USERNAME=<Sauce Labs account username>
101+
export SAUCE_ACCESS_KEY=<Sauce Labs access key>
102+
export JOB_ID=$(uuidgen)
103+
104+
sc run --username $SAUCE_USERNAME --access-key $SAUCE_ACCESS_KEY --tunnel-name $JOB_ID --tls-passthrough-domains "all" --proxy-localhost allow
105+
```
106+
107+
- `--tls-passthrough-domains "all"` prevents SauceLabs from intercepting SSL traffic, which is important for WebRTC.
108+
- `--proxy-localhost allow` permits the tunnel to forward requests to `127.0.0.1` on your machine.
109+
110+
3. In another terminal, make sure `TEST_URL` is **not** set (so the test runner starts the local demo), then run the test:
111+
```bash
112+
unset TEST_URL
113+
export SAUCE_USERNAME=<Sauce Labs account username>
114+
export SAUCE_ACCESS_KEY=<Sauce Labs access key>
115+
export JOB_ID=<same UUID used when starting the tunnel>
116+
117+
npm run test -- --test-name AudioTest --host saucelabs --test-type browser-compatibility
118+
```
119+
120+
The `JOB_ID` must match the `--tunnel-name` used when starting `sc` — this is how SauceLabs routes browser traffic through your tunnel.
121+
89122
There are scenarios where a test might not be compatible with one of the browsers or OS. In that case, the user can provide a custom config with an updated clients array. `sample_test.config.json` is a sample test config already provided.
90123
The following command can be used to run a browser compatibility test with a custom config:
91124

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
const browserCompatibilityConfig = [
2-
{
3-
"browserName": "chrome",
4-
"browserVersion": "latest-2",
5-
"platform": "MAC"
6-
},
7-
{
8-
"browserName": "chrome",
9-
"browserVersion": "latest-1",
10-
"platform": "MAC"
11-
},
12-
{
13-
"browserName": "chrome",
14-
"browserVersion": "latest",
15-
"platform": "MAC"
16-
},
2+
// {
3+
// "browserName": "chrome",
4+
// "browserVersion": "latest-2",
5+
// "platform": "MAC"
6+
// },
7+
// {
8+
// "browserName": "chrome",
9+
// "browserVersion": "latest-1",
10+
// "platform": "MAC"
11+
// },
12+
// {
13+
// "browserName": "chrome",
14+
// "browserVersion": "latest",
15+
// "platform": "MAC"
16+
// },
1717
{
1818
"browserName": "chrome",
1919
"browserVersion": "latest-2",
@@ -29,21 +29,21 @@ const browserCompatibilityConfig = [
2929
"browserVersion": "latest",
3030
"platform": "WINDOWS"
3131
},
32-
{
33-
"browserName": "firefox",
34-
"browserVersion": "latest-2",
35-
"platform": "MAC"
36-
},
37-
{
38-
"browserName": "firefox",
39-
"browserVersion": "latest-1",
40-
"platform": "MAC"
41-
},
42-
{
43-
"browserName": "firefox",
44-
"browserVersion": "latest",
45-
"platform": "MAC"
46-
},
32+
// {
33+
// "browserName": "firefox",
34+
// "browserVersion": "latest-2",
35+
// "platform": "MAC"
36+
// },
37+
// {
38+
// "browserName": "firefox",
39+
// "browserVersion": "latest-1",
40+
// "platform": "MAC"
41+
// },
42+
// {
43+
// "browserName": "firefox",
44+
// "browserVersion": "latest",
45+
// "platform": "MAC"
46+
// },
4747
{
4848
"browserName": "firefox",
4949
"browserVersion": "latest-2",
@@ -59,11 +59,11 @@ const browserCompatibilityConfig = [
5959
"browserVersion": "latest",
6060
"platform": "WINDOWS"
6161
},
62-
{
63-
"browserName": "safari",
64-
"browserVersion": "latest",
65-
"platform": "MAC"
66-
}
62+
// {
63+
// "browserName": "safari",
64+
// "browserVersion": "latest",
65+
// "platform": "MAC"
66+
// }
6767
];
6868

6969
module.exports = browserCompatibilityConfig;

integration/configs/IntegrationTestBrowserConfig.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const integrationTestBrowserConfig = [
22
{
3-
browserName: "chrome",
3+
browserName: "firefox",
44
browserVersion: "latest",
5-
platform: "macOS 13"
5+
platform: "MAC"
66
}
77
];
88

integration/utils/ClientHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const getPlatformName = (platform) => {
4545
case 'MAC':
4646
return 'macOS 13';
4747
case 'WINDOWS':
48-
return 'Windows 10';
48+
return 'Windows 11';
4949
case 'LINUX':
5050
return 'Linux Beta';
5151
case 'IOS':

integration/utils/SdkBaseTest.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ class SdkBaseTest {
3737
for (let i = 0; i < urlParams.length; i++) {
3838
if (i === 0) {
3939
this.url = this.url.concat(`?${urlParams[i]}`);
40+
} else {
41+
this.url = this.url.concat(`&${urlParams[i]}`);
4042
}
41-
this.url = this.url.concat(`&${urlParams[i]}`);
4243
}
4344
}
4445
}

0 commit comments

Comments
 (0)