-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Browser-Functional-Tests] Add browser test build YAML file (#1469)
* Add build yaml file to run browser tests * Add step by step guide to configure pipeline * Update yaml file name to browser-tests-build-ci * Update browser functional test readme local steps
- Loading branch information
Showing
6 changed files
with
186 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
## Description | ||
|
||
The library **browser-functional-tests** is a suite of tests running with **Nightwatch** and **Selenium** to check the compatibility of a bot using libraries from BotBuilder-JS with different browsers. | ||
|
||
## Run the test locally | ||
|
||
_Note: The tests are configured to run in two-terminals, one for the webpack-dev-server which runs the bot, another for running the tests._ | ||
|
||
1. Go to `libraries/browser-functional-tests`, open a terminal and run `npm install` | ||
|
||
|
||
2. Go to `libraries/browser-functional-tests/browser-echo-bot`, open a terminal and run the following commands: | ||
* `npm install` | ||
* `npm run start` | ||
This command will start the browser bot using `webpack-dev-server`. | ||
|
||
3. In the `botbuilder-js` root directory, open a new terminal and run the following commands: | ||
* `npm install` | ||
* `npm run browser-functional-test browser` where browser is _chrome_ or _firefox_ | ||
|
||
4. Go to the `.env` file and set the **TestURI** variable with `http://localhost:8080/` value | ||
|
||
## Azure Build Pipeline Configuration | ||
The next steps will guide you thought the configuration of a Build pipeline based on YAML file. | ||
|
||
### Prerequisites | ||
|
||
- Azure DevOps organization. You can find documentation [here](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/create-organization?view=azure-devops). | ||
- Azure subscription. Required to create and delete Azure resources. | ||
|
||
### Step by step | ||
|
||
1. Create a pipeline using the classic editor, this options allows to us select the YAML file to configure the pipeline. | ||
![image](https://user-images.githubusercontent.com/38112957/70251315-07982e80-175e-11ea-8edf-6f49af38922f.png) | ||
|
||
2. Configure the repository and branch. | ||
![image](https://user-images.githubusercontent.com/38112957/70251361-1da5ef00-175e-11ea-9c2a-777ab959829a.png) | ||
|
||
3. In the section Configuration as code select YAML | ||
![image](https://user-images.githubusercontent.com/38112957/70251402-331b1900-175e-11ea-9cb0-58094984e84f.png) | ||
|
||
4. In the section YAML, write the build name, select the build YAML file. | ||
![image](https://user-images.githubusercontent.com/38112957/70251437-4201cb80-175e-11ea-89b9-b1da5f7ab552.png) | ||
|
||
5. In the Section Variables, Add a variable to save the azure subscription value. | ||
![image](https://user-images.githubusercontent.com/38112957/70251455-4d54f700-175e-11ea-8ddb-e6f6766f25d7.png) | ||
|
||
`Variable: AzureSubscription = "YOUR_AZ_SUBSCRIPTION"` | ||
|
||
6. Save and queue. |
96 changes: 96 additions & 0 deletions
96
libraries/browser-functional-tests/browser-tests-build-ci.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
trigger: | ||
- master | ||
|
||
pr: | ||
- master | ||
|
||
pool: | ||
vmImage: 'vs2017-win2016' | ||
|
||
variables: | ||
TestResourceGroup: 'BrowserBotTest' | ||
TestAppServicePlan: 'BrowserBotServicePlan' | ||
TestWebApp: 'BrowserBotWebApp' | ||
TESTURI: 'https://$(TestWebApp).azurewebsites.net/' | ||
|
||
steps: | ||
|
||
- task: NodeTool@0 | ||
displayName: 'Use Node 10.' | ||
inputs: | ||
versionSpec: 10.x | ||
|
||
- task: Npm@1 | ||
displayName: 'npm install bot dependencies' | ||
inputs: | ||
workingDir: 'libraries/browser-functional-tests/browser-echo-bot' | ||
verbose: false | ||
|
||
- task: Npm@1 | ||
displayName: 'npm build bot ' | ||
inputs: | ||
command: custom | ||
workingDir: 'libraries/browser-functional-tests/browser-echo-bot' | ||
verbose: false | ||
customCommand: 'run build' | ||
|
||
- powershell: | | ||
# Compress Bot Source Code | ||
cd $(System.DefaultWorkingDirectory)/libraries/browser-functional-tests/browser-echo-bot/dist | ||
$DirToCompress = "$(System.DefaultWorkingDirectory)/libraries/browser-functional-tests/browser-echo-bot/dist" | ||
$files = Get-ChildItem -Path $DirToCompress | ||
$ZipFileResult="$(System.DefaultWorkingDirectory)/libraries/browser-functional-tests/browser-echo-bot/browser-echo-bot.zip" | ||
Compress-Archive -Path $files -DestinationPath $ZipFileResult | ||
displayName: 'Compress Bot Source Code' | ||
|
||
- task: AzureCLI@1 | ||
displayName: 'Deploy browser bot' | ||
inputs: | ||
azureSubscription: '$(AzureSubscription)' | ||
scriptLocation: inlineScript | ||
inlineScript: | | ||
echo "# Create resource group" | ||
call az group create -l westus -n "$(TestResourceGroup)" | ||
echo "# Create app service plan" | ||
call az appservice plan create -g "$(TestResourceGroup)" -n "$(TestAppServicePlan)" --number-of-workers 4 --sku S1 | ||
echo "# Create web app" | ||
call az webapp create -g "$(TestResourceGroup)" -p "$(TestAppServicePlan)" -n "$(TestWebApp)" | ||
echo "# Deploy source code" | ||
call az webapp deployment source config-zip --resource-group "$(TestResourceGroup)" --name "$(TestWebApp)" --src "$(System.DefaultWorkingDirectory)/libraries/browser-functional-tests/browser-echo-bot/browser-echo-bot.zip" | ||
- task: Npm@1 | ||
displayName: 'npm install tests dependecies' | ||
inputs: | ||
workingDir: 'libraries/browser-functional-tests' | ||
verbose: false | ||
|
||
- task: Npm@1 | ||
displayName: 'run chrome tests' | ||
inputs: | ||
command: custom | ||
workingDir: '' | ||
verbose: false | ||
customCommand: 'run browser-functional-test chrome' | ||
|
||
- task: Npm@1 | ||
displayName: 'run firefox tests' | ||
inputs: | ||
command: custom | ||
workingDir: '' | ||
verbose: false | ||
customCommand: 'run browser-functional-test firefox' | ||
|
||
- task: AzureCLI@1 | ||
displayName: 'Delete Resource Group' | ||
inputs: | ||
azureSubscription: '$(AzureSubscription)' | ||
scriptLocation: inlineScript | ||
inlineScript: 'call az group delete -n BrowserBotTest --yes' | ||
condition: succeededOrFailed() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters