Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into southworks/update/fol…
Browse files Browse the repository at this point in the history
…low-redirects
  • Loading branch information
JhontSouth committed Jan 10, 2024
2 parents 4542477 + 8a30768 commit c37de18
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 187 deletions.
9 changes: 5 additions & 4 deletions libraries/botbuilder-core/src/botState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export class BotState implements PropertyManager {
/**
* Skips properties from the cached state object.
*
* @remarks Primarily used to skip properties before calculating the hash value in the calculateChangeHash function.
* @param state Dictionary of state values.
* @returns Dictionary of state values, without the skipped properties.
*/
Expand All @@ -217,23 +218,23 @@ export class BotState implements PropertyManager {
};

const inner = ([key, value], skip = []) => {
if (skip.includes(key)) {
if (value === null || value === undefined || skip.includes(key)) {
return;
}

if (Array.isArray(value)) {
return value.map((e) => inner([null, e], skip));
}

if (value === null || typeof value !== 'object') {
return value;
if (typeof value !== 'object') {
return value.valueOf();
}

return Object.entries(value).reduce((acc, [k, v]) => {
const skipResult = skipHandler(k) ?? [];
acc[k] = inner([k, v], [...skip, ...skipResult]);
return acc;
}, value);
}, {});
};

return inner([null, state]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ describe('ActionTests', function () {
const [, { state: beginSkillState }] = actionScope.dialogStack;
const options = beginSkillState['BeginSkill.dialogOptionsData'];

assert.equal(options.conversationIdFactory, null);
assert.equal(options.conversationState, null);
assert.notEqual(options.conversationIdFactory, null);
assert.notEqual(options.conversationState, null);
assert.notEqual(beginSkillDialog.dialogOptions.conversationIdFactory, null);
assert.notEqual(beginSkillDialog.dialogOptions.conversationState, null);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,9 @@ export class BeginSkill extends SkillDialog implements BeginSkillConfiguration {

// Store the initialized dialogOptions in state so we can restore these values when the dialog is resumed.
dc.activeDialog.state[this._dialogOptionsStateKey] = this.dialogOptions;
// Skip properties from the bot's state cache hash due to unwanted conversationState behavior.
const skipProperties = dc.context.turnState.get(CACHED_BOT_STATE_SKIP_PROPERTIES_HANDLER_KEY);
const props: (keyof SkillDialogOptions)[] = ['conversationIdFactory', 'conversationState'];
const props: (keyof SkillDialogOptions)[] = ['conversationIdFactory', 'conversationState', 'skillClient'];
skipProperties(this._dialogOptionsStateKey, props);

// Get the activity to send to the skill.
Expand Down
47 changes: 0 additions & 47 deletions testing/browser-functional/browser-tests-build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,53 +31,6 @@ steps:
displayName: 'Create DateTimeTag for Resource Group'
# Get-Date on Azure DevOps returns a datetime relative to UTC-0, so "Z" is being used instead of the dynamic "K".

- task: PowerShell@2
inputs:
targetType: inline
script: |
$packageName = "chromedriver";
Write-Host "Get $packageName second latest version from npmjs.com";
$versions = npm view $packageName versions | ConvertFrom-Json;
$versionToUse = $versions[-2];
Write-Host "$packageName second latest = $versionToUse";
" "
if ($null -ne $Env:ChromeDriverVersionOverride -and $Env:ChromeDriverVersionOverride.Trim() -ne '') {
Write-Host "Pipeline var ChromeDriverVersionOverride is set.";
$versionToUse = $Env:ChromeDriverVersionOverride;
Write-Host "Use override value = $versionToUse";
} else {
Write-Host "Pipeline var ChromeDriverVersionOverride is not set.";
Write-Host "Use value = $versionToUse";
}
"##vso[task.setvariable variable=DriverVersion;]$versionToUse";
displayName: 'Get chromedriver version number to use'

- task: PowerShell@2
inputs:
targetType: inline
script: |
# This lets the pipeline automatically keep up with Chrome browser upgrades.
# Chrome browser upgrades on ADO agents lag behind chromedriver upgrades, so
# if we use the second latest chromedriver, that should keep the tests working.
$path = "$(System.DefaultWorkingDirectory)/testing/browser-functional/package.json";
$package = 'chromedriver';
$newVersion = "$(DriverVersion)";
$find = "$package`": `"\S*`"";
$replace = "$package`": `"$newVersion`"";
Get-ChildItem -Path "$path" | % {
$_.FullName;
$content = Get-Content -Raw $_.FullName;
$content -Replace "$find", "$replace" | Set-Content $_.FullName;
'-------------'; get-content $_.FullName; '==================='
}
displayName: 'Upgrade chromedriver version reference'

- task: NodeTool@0
displayName: use node 16.x
inputs:
Expand Down
Binary file added testing/browser-functional/chromedriver.exe
Binary file not shown.
20 changes: 13 additions & 7 deletions testing/browser-functional/nightwatch.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const chromedriver = require('chromedriver');
const seleniumServer = require('selenium-server');
const geckodriver = require('geckodriver');

Expand All @@ -21,7 +20,6 @@ module.exports = {
server_path: seleniumServer.path,
cli_args: {
'webdriver.gecko.driver': geckodriver.path,
'webdriver.chrome.driver': chromedriver.path,
},
},
webdriver: {
Expand All @@ -30,14 +28,22 @@ module.exports = {
},

chrome: {
extends: 'selenium',
silent: true,
selenium: {
start_process: false,
},
webdriver: {
start_process: true,
//The tests with the chrome browser are performed with the chromedriver binary
//which in the future should be updated manually to maintain compatibility with the browser.
//Current version 120.0.6. Extract binary from: https://googlechromelabs.github.io/chrome-for-testing
server_path: "./chromedriver.exe",
port: 9515,
},
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
chromeOptions: {
w3c: false,
},
acceptSslCerts: true
},
},

Expand Down
1 change: 0 additions & 1 deletion testing/browser-functional/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"description": "Test to check browser compatibility",
"main": "",
"devDependencies": {
"chromedriver": "^100.0.0",
"dotenv": "^8.6.0",
"geckodriver": "^1.19.1",
"nightwatch": "^2.6.21",
Expand Down
Loading

0 comments on commit c37de18

Please sign in to comment.