Skip to content

Commit

Permalink
Adding Scenario Test pipeline for react video sample (#419)
Browse files Browse the repository at this point in the history
Co-authored-by: Chengcheng Hu <[email protected]>
  • Loading branch information
stephaniewhoo and Chengcheng Hu committed Mar 22, 2023
1 parent 046a85e commit 94fc825
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 2 deletions.
80 changes: 80 additions & 0 deletions .azure-devops/live-share-pr-scenario.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# https://domoreexp.visualstudio.com/Teamspace/_build?definitionId=6457

resources:
repositories:
- repository: SkypeSpaces-Infra
type: git
name: SkypeSpaces-Infra
- repository: MsTeamsServices-Tools
type: git
name: MsTeamsServices-Tools

variables:
- template: variables/variables.yml
- name: esLintExclusionFilePath
value: "$(Build.SourcesDirectory)/.eslintignore"
- name: esLintTargets
value: ''

trigger:
- scenario_test

extends:
template: azure-devops-templates/steps/coral/general_build_template.yml@SkypeSpaces-Infra
parameters:
name: 'build'
pool:
name: 1ES-Teams-MMSWindows2019
jobParams:
displayName: 'CI SDK Build'
condition: succeeded()
timeoutInMinutes: 30
cancelTimeoutInMinutes: 5
service_tree:
service_id: ${{ variables.ServiceTreeID }}
isProduction: false
sdl:
esLint:
esLintExclusionFilePath: ${{ variables.esLintExclusionFilePath }}

stages:
- stage: BuildLiveShareSDK
jobs:
- job: Phase1
displayName: Build Live Share SDK
pool:
name: 1ES-Teams-MMSWindows2019
condition: succeeded()
variables:
Build.SDL.Roslyn.Enabled: false
timeoutInMinutes: 10
cancelTimeoutInMinutes: 1

steps:
- script: "npm install --no-audit --legacy-peer-deps"
workingDirectory: ""
displayName: "npm install"

- script: "npm run build"
workingDirectory: ""
displayName: "npm run build"

- script: "npm install --no-audit --legacy-peer-deps"
workingDirectory: "${{ variables.sdk_samples_directory }}/javascript/02.react-video"
displayName: "npm install sample"

- script: "npm install jest"
workingDirectory: "${{ variables.sdk_samples_directory }}/javascript/02.react-video"
displayName: "npm install jest"

- script: "npm run build"
workingDirectory: "${{ variables.sdk_samples_directory }}/javascript/02.react-video"
displayName: "npm run build sample"

- task: Bash@3
inputs:
targetType: "inline"
workingDirectory: "${{ variables.sdk_samples_directory }}/javascript/02.react-video"
script: |
sh ../../../.azure-devops/scenario_test.sh
displayName: "run test"
2 changes: 1 addition & 1 deletion .azure-devops/live-share-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extends:
- stage: BuildLiveShareSDK
jobs:
- job: Phase1
displayName: Bluild Live Share SDK
displayName: Build Live Share SDK
pool:
name: 1ES-Teams-MMSWindows2019
condition: succeeded()
Expand Down
21 changes: 21 additions & 0 deletions .azure-devops/scenario_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
RET=""
npm run start &
success=0
tries=5
pause=30
while [ $success = 0 -a $tries -gt 0 ]; do
sleep $pause
let tries=tries-1
yarn test 1>logs 2>results &
RET=$(cat results | grep "Tests:" | tail -f -n 1)
if [[ "$RET" != *"failed"* ]]; then
success=1
fi
done
if [ $success = 0 ]; then
echo $(RET) >&2
exit 1
else
echo "sucess" >&2
fi
2 changes: 2 additions & 0 deletions .azure-devops/variables/variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ variables:
value: '4b310c23-4420-4e37-bdee-ce6d119fd03d'
- name: sdk_packages_directory
value: "packages"
- name: sdk_samples_directory
value: "samples"
- name: teams_interactive_sdk_working_directory
value: "packages/live-share"
- name: teams_interactive_media_sdk_working_directory
Expand Down
3 changes: 2 additions & 1 deletion samples/javascript/02.react-video/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ module.exports = async function () {
console.log(chalk.green("Setup Puppeteer"));
const browser = await puppeteer.launch({
headless: false,
executablePath: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
executablePath: "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
// if you are an OS user, please use "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
});
// This global is not available inside tests but only in global teardown
global.__BROWSER_GLOBAL__ = browser;
Expand Down

0 comments on commit 94fc825

Please sign in to comment.