Skip to content

Commit ce1d272

Browse files
authored
Install React SDK for test demo from local instead of npm (#791)
1 parent c60591a commit ce1d272

File tree

9 files changed

+1420
-2746
lines changed

9 files changed

+1420
-2746
lines changed

.github/workflows/roster-integration.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@ jobs:
2323
uses: actions/checkout@v2
2424
with:
2525
fetch-depth: 0
26-
- name: Pack the React Components Library and install the tarball into the Test Demo
27-
run: |
28-
current_version=$(.github/script/get-current-version)
29-
echo "Packing current version:" $current_version
30-
npm ci
31-
npm run build
32-
npm pack
33-
cd integration/app/test-demo
34-
npm uninstall amazon-chime-sdk-component-library-react
35-
npm install ../../../amazon-chime-sdk-component-library-react-$current_version.tgz
3626
- name: Create a Job ID
3727
id: create-job-id
3828
uses: filipstefansson/uuid-action@ce29ebbb0981ac2448c2e406e848bfaa30ddf04c

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
- Improve "Handle Device Permission" guide in Quick Starts.
1919
- Upgrade `storybook` to a fixed `6.5.0-alpha.64` with `webpack v5` to fix security vulnerabilities and issues with external HTTP link rendering.
20+
- Update integration test demo to install `amazon-chime-sdk-component-library-react` from local instead of from npm. Update corresponding GitHub Action and scripts.
2021

2122
### Fixed
2223

integration/app/test-demo/package-lock.json

Lines changed: 1373 additions & 2705 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/app/test-demo/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"name": "test-demo",
33
"version": "0.1.0",
44
"dependencies": {
5-
"amazon-chime-sdk-component-library-react": "^2.15.0",
6-
"amazon-chime-sdk-js": "^3.0.0-beta.1",
5+
"amazon-chime-sdk-component-library-react": "file:../../..",
76
"react": "^17.0.2",
87
"react-dom": "^17.0.2",
98
"styled-components": "^5.3.3",
@@ -28,8 +27,10 @@
2827
},
2928
"scripts": {
3029
"build": "webpack",
30+
"preinstall": "cd ../../.. && npm install && npm run build",
3131
"start:client": "webpack-dev-server",
3232
"start:backend": "node server.js",
33-
"start": "concurrently \"npm run start:client\" \"npm run start:backend\""
33+
"start:fast": "concurrently \"npm run start:client\" \"npm run start:backend\"",
34+
"start": "npm install && npm run start:fast"
3435
}
35-
}
36+
}

integration/app/test-demo/src/pages/VideoFilterTestApp.tsx

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { ChangeEvent, useEffect, useState } from 'react';
2-
import { BackgroundBlurOptions, LogLevel } from 'amazon-chime-sdk-js';
2+
import { BackgroundBlurOptions, isVideoTransformDevice, LogLevel } from 'amazon-chime-sdk-js';
33
import {
44
MeetingProvider,
55
useBackgroundBlur,
@@ -59,19 +59,28 @@ const Meeting: React.FC<Props> = ({ onBlurStrengthChanged }) => {
5959

6060
useEffect(() => {
6161
const addBackgroundBlur = async () => {
62+
console.log('Creating background blur device called');
63+
let current = selectedDevice;
64+
if (
65+
!isBackgroundBlurSupported ||
66+
meetingStatus !== MeetingStatus.Succeeded ||
67+
current === undefined
68+
) {
69+
console.log('Does not meet the conditions of use');
70+
return;
71+
}
72+
6273
try {
63-
if (
64-
isBackgroundBlurSupported &&
65-
meetingStatus === MeetingStatus.Succeeded &&
66-
selectedDevice
67-
) {
68-
console.log('Creating background blur device called');
69-
const chosenVideoTransformDevice = await createBackgroundBlurDevice(selectedDevice);
70-
console.log(chosenVideoTransformDevice);
71-
await meetingManager.startVideoInputDevice(chosenVideoTransformDevice);
72-
toggleVideo();
74+
if (isVideoTransformDevice(current)) {
75+
const intrinsicDevice = await current.intrinsicDevice();
76+
await current.stop();
77+
current = intrinsicDevice;
7378
}
74-
} catch (error) {
79+
current = await createBackgroundBlurDevice(current);
80+
await meetingManager.startVideoInputDevice(current);
81+
toggleVideo();
82+
}
83+
catch (error) {
7584
console.error('Failed to add Background Blur');
7685
}
7786
};

integration/app/test-demo/webpack.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ module.exports = {
1818
},
1919
resolve: {
2020
extensions: ['.tsx', '.ts', '.js'],
21+
alias: {
22+
react: path.resolve('./node_modules/react'),
23+
'styled-components': path.resolve('./node_modules/styled-components'),
24+
'react-dom': path.resolve('./node_modules/react-dom'),
25+
},
2126
},
2227
output: {
2328
path: path.join(__dirname, 'dist'),

integration/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"license": "Apache-2.0",
1010
"dependencies": {
11-
"chromedriver": "^98.0.1",
11+
"chromedriver": "^100.0.0",
1212
"fs-extra": "^10.0.0",
1313
"geckodriver": "^3.0.1",
1414
"minimist": "^1.2.6",

integration/script/run-test

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const setTestTarget = (target) => {
8686
};
8787

8888
// Run the command asynchronously without blocking the Node.js event loop.
89-
function runAsync(command, args, options) {
89+
const runAsync = (command, args, options) => {
9090
options = {
9191
...options,
9292
shell: true
@@ -108,11 +108,11 @@ function runAsync(command, args, options) {
108108
});
109109

110110
return child.pid;
111-
}
111+
};
112112

113113
// Run the command synchronously with blocking the Node.js event loop
114114
// until the spawned process either exits or is terminated.
115-
function runSync(command, args, options, printOutput = true) {
115+
const runSync = (command, args, options, printOutput = true) => {
116116
options = {
117117
...options,
118118
shell: true
@@ -134,7 +134,7 @@ function runSync(command, args, options, printOutput = true) {
134134
}
135135

136136
return output;
137-
}
137+
};
138138

139139
const checkIfPortIsInUse = async port =>
140140
new Promise(resolve => {
@@ -149,15 +149,15 @@ const checkIfPortIsInUse = async port =>
149149
});
150150
});
151151

152-
function startTestDemo() {
152+
const startTestDemo = () => {
153153
console.log(green, 'Installing dependencies in test demo');
154154
runSync('npm', ['install'], { cwd: pathToTestDemoFolder });
155155

156156
console.log(green, ' Starting the test demo');
157157
// The test demo will keep running until the process is terminated,
158158
// so we should execute this command asynchronously without blocking other commands.
159-
runAsync('npm', ['run', 'start'], { cwd: pathToTestDemoFolder });
160-
}
159+
runAsync('npm', ['run', 'start:fast'], { cwd: pathToTestDemoFolder });
160+
};
161161

162162
const waitUntilTestDemoStarts = async () => {
163163
console.log(green, ' Waiting for test demo to start');

0 commit comments

Comments
 (0)