Skip to content

Commit

Permalink
bump: [#4684] Upgrade Nighwatch (#4768)
Browse files Browse the repository at this point in the history
* Upgrade Nighwatch

* Add Microsoft header

* Fix yarn.lock
  • Loading branch information
sw-joelmut authored Oct 30, 2024
1 parent dccf589 commit 2bdedaa
Show file tree
Hide file tree
Showing 14 changed files with 1,050 additions and 726 deletions.
26 changes: 17 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@
"private": true,
"name": "botbuilder-js",
"version": "4.13.0",
"workspaces": [
"libraries/*",
"libraries/functional-tests/dialogToDialog/*",
"libraries/testskills/*",
"testing/*",
"testing/browser-functional/browser-echo-bot",
"tools",
"transcripts"
],
"workspaces": {
"packages": [
"libraries/*",
"libraries/functional-tests/dialogToDialog/*",
"libraries/testskills/*",
"testing/*",
"testing/browser-functional/browser-echo-bot",
"tools",
"transcripts"
],
"nohoist": [
"**/@types/selenium-webdriver"
],
"nohoistComments": {
"**/@types/selenium-webdriver": "This package is excluded from the root @types folder as it requires ES2015+, whereas some BotBuilder libraries support ES5+."
}
},
"scripts": {
"browser-functional-test": "yarn workspace browser-functional-tests test",
"build": "wsrun -e -m -t build",
Expand Down
18 changes: 5 additions & 13 deletions testing/browser-functional/browser-tests-build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,7 @@ steps:
inputs:
versionSpec: 20.x

- script: |
mkdir "testing/browser-functional/drivers"
cp "%CHROMEWEBDRIVER%/chromedriver.exe" "testing/browser-functional/drivers"
cp "%GECKOWEBDRIVER%/geckodriver.exe" "testing/browser-functional/drivers"
displayName: use browser drivers

- script: yarn --network-timeout 600000
- script: yarn install --network-timeout 600000
displayName: yarn install

- script: yarn build
Expand Down Expand Up @@ -78,17 +72,15 @@ steps:
echo "# Deploy source code"
call az webapp deployment source config-zip --resource-group "$(TestResourceGroup)" --name "$(TestWebApp)" --src "$(System.DefaultWorkingDirectory)/testing/browser-functional/browser-echo-bot/browser-echo-bot.zip"
- script: yarn browser-functional-test chrome
displayName: run chrome tests

- script: yarn browser-functional-test firefox
displayName: run firefox tests
- script: yarn browser-functional-test
env:
TestURI: $(TESTURI)
displayName: Run tests

- task: AzureCLI@1
displayName: 'Delete Resource Group'
inputs:
azureSubscription: '$(AzureSubscription)'
scriptLocation: inlineScript
inlineScript: 'call az group delete -n $(TestResourceGroup) --yes'

condition: succeededOrFailed()
113 changes: 0 additions & 113 deletions testing/browser-functional/globals.js

This file was deleted.

58 changes: 0 additions & 58 deletions testing/browser-functional/nightwatch.conf.js

This file was deleted.

1 change: 0 additions & 1 deletion testing/browser-functional/nightwatch.js

This file was deleted.

149 changes: 149 additions & 0 deletions testing/browser-functional/nightwatch/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/

// Refer to the online docs for more details:
// https://nightwatchjs.org/gettingstarted/configuration/
//

// _ _ _ _ _ _ _
// | \ | |(_) | | | | | | | |
// | \| | _ __ _ | |__ | |_ __ __ __ _ | |_ ___ | |__
// | . ` || | / _` || '_ \ | __|\ \ /\ / / / _` || __| / __|| '_ \
// | |\ || || (_| || | | || |_ \ V V / | (_| || |_ | (__ | | | |
// \_| \_/|_| \__, ||_| |_| \__| \_/\_/ \__,_| \__| \___||_| |_|
// __/ |
// |___/

const dotenv = require('dotenv');
dotenv.config();

const { DEFAULT_BROWSER, browsers } = require('./utils');
const { validate } = require('./requirements');

const config = {
// An array of folders (excluding subfolders) where your tests are located;
// if this is not specified, the test source must be passed as the second argument to the test runner.
src_folders: ['nightwatch/tests'],

// See https://nightwatchjs.org/guide/concepts/page-object-model.html
page_objects_path: ['nightwatch/pages'],

// See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-commands.html
custom_commands_path: [],

// See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-assertions.html
custom_assertions_path: [],

// See https://nightwatchjs.org/guide/extending-nightwatch/adding-plugins.html
plugins: [],

// See https://nightwatchjs.org/guide/concepts/test-globals.html
// globals_path: './globals.js',
globals: {
asyncHookTimeout: 10 * 60 * 1000, // 10 minutes
async before() {
const valid = await validate();
if (!valid) {
process.exit(1);
}
},
},

webdriver: {},

test_workers: {
enabled: true,
},

test_settings: {
default: {
disable_error_log: false,
launch_url: process.env.TestURI,

screenshots: {
enabled: false,
path: 'screens',
on_failure: true,
},

desiredCapabilities: {
browserName: DEFAULT_BROWSER,
},

webdriver: {
start_process: true,
server_path: '',
},
},

[browsers.firefox.key]: {
desiredCapabilities: {
browserName: browsers.firefox.id,
alwaysMatch: {
acceptInsecureCerts: true,
'moz:firefoxOptions': {
args: [
// '-headless',
// '-verbose'
],
},
},
},
webdriver: {
start_process: true,
server_path: '',
cli_args: [
// very verbose geckodriver logs
// '-vv'
],
},
},

[browsers.chrome.key]: {
desiredCapabilities: {
browserName: browsers.chrome.id,
'goog:chromeOptions': {
// More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
args: [
//'--no-sandbox',
//'--ignore-certificate-errors',
//'--allow-insecure-localhost',
//'--headless=new'
],
},
},

webdriver: {
start_process: true,
server_path: '',
cli_args: [
// --verbose
],
},
},

[browsers.edge.key]: {
desiredCapabilities: {
browserName: browsers.edge.id,
'ms:edgeOptions': {
// More info on EdgeDriver: https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/capabilities-edge-options
args: [
//'--headless=new'
],
},
},

webdriver: {
start_process: true,
server_path: '',
cli_args: [
// --verbose
],
},
},
},
};

module.exports = config;
Loading

0 comments on commit 2bdedaa

Please sign in to comment.