fix(gates): select a character in connected graphical runs
This commit is contained in:
parent
7a5f96ede5
commit
0b6c6557a8
4 changed files with 107 additions and 2 deletions
|
|
@ -125,6 +125,8 @@ foreach ($name in $script:ConnectedGateEnvironmentNames) {{
|
|||
}}
|
||||
[Environment]::SetEnvironmentVariable('ACDREAM_FUTURE_GATE_KNOB', 'sentinel-future', 'Process')
|
||||
$state = New-ConnectedRenderPackGateState -Root {rootQuoted} -Preset medium
|
||||
$sessionConfigPath = New-ConnectedGraphicalSessionConfig -State $state -Account 'fixture-account'
|
||||
$sessionConfig = Get-Content -Raw -LiteralPath $sessionConfigPath | ConvertFrom-Json
|
||||
$isolated=@($state.PreviousEnvironment.Keys | Where-Object {{
|
||||
$_ -notin @('ACDREAM_CONFIG_DIR', 'ACDREAM_DATA_DIR', 'ACDREAM_CACHE_DIR') -and
|
||||
[Environment]::GetEnvironmentVariable($_, 'Process') -ne $null
|
||||
|
|
@ -141,11 +143,16 @@ $unsafeLeafRejected=$false
|
|||
try {{ Assert-ConnectedGateSafeLeafName '../escape' }} catch {{ $unsafeLeafRejected=$true }}
|
||||
$escapeRejected=$false
|
||||
try {{ Assert-ConnectedGateContainedPath {rootQuoted} (Join-Path {rootQuoted} '..\escape') }} catch {{ $escapeRejected=$true }}
|
||||
Remove-ConnectedGraphicalSessionConfig -State $state -Path $sessionConfigPath
|
||||
[pscustomobject]@{{
|
||||
Password=$env:ACDREAM_TEST_PASS; User=$env:ACDREAM_TEST_USER;
|
||||
Config=$env:ACDREAM_CONFIG_DIR; History=$env:ACDREAM_FRAME_HISTORY;
|
||||
Future=$env:ACDREAM_FUTURE_GATE_KNOB; Isolated=$isolated; Mismatches=$mismatches;
|
||||
UnsafeLeafRejected=$unsafeLeafRejected; EscapeRejected=$escapeRejected;
|
||||
SessionConfigRemoved=(-not (Test-Path -LiteralPath $sessionConfigPath));
|
||||
SessionCharacterIndex=$sessionConfig.sessions[0].character.index;
|
||||
SessionCredentialProvider=$sessionConfig.sessions[0].credential.provider;
|
||||
SessionCredentialReference=$sessionConfig.sessions[0].credential.reference;
|
||||
Settings=(Get-Content -Raw -LiteralPath (Join-Path $state.ConfigDirectory 'settings.json') | ConvertFrom-Json).display.renderPack.presetId
|
||||
}} | ConvertTo-Json -Compress";
|
||||
using JsonDocument result = JsonDocument.Parse(RunPowerShell(command));
|
||||
|
|
@ -159,11 +166,32 @@ try {{ Assert-ConnectedGateContainedPath {rootQuoted} (Join-Path {rootQuoted} '.
|
|||
Assert.Empty(rootElement.GetProperty("Mismatches").EnumerateArray());
|
||||
Assert.True(rootElement.GetProperty("UnsafeLeafRejected").GetBoolean());
|
||||
Assert.True(rootElement.GetProperty("EscapeRejected").GetBoolean());
|
||||
Assert.True(rootElement.GetProperty("SessionConfigRemoved").GetBoolean());
|
||||
Assert.Equal(0, rootElement.GetProperty("SessionCharacterIndex").GetInt32());
|
||||
Assert.Equal("Environment", rootElement.GetProperty("SessionCredentialProvider").GetString());
|
||||
Assert.Equal("ACDREAM_TEST_PASS", rootElement.GetProperty("SessionCredentialReference").GetString());
|
||||
Assert.Equal("medium", rootElement.GetProperty("Settings").GetString());
|
||||
}
|
||||
finally { Directory.Delete(root, recursive: true); }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ConnectedGraphicalGatesSelectTheFirstCharacterThroughSessionConfig()
|
||||
{
|
||||
foreach (string scriptName in new[] { LifecycleScript, SoakScript })
|
||||
{
|
||||
string source = ReadTool(scriptName);
|
||||
Assert.Contains("New-ConnectedGraphicalSessionConfig", source, StringComparison.Ordinal);
|
||||
Assert.Contains("-ArgumentList @('--session-config'", source, StringComparison.Ordinal);
|
||||
Assert.Contains("Remove-ConnectedGraphicalSessionConfig", source, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
string common = ReadTool(CommonScript);
|
||||
Assert.Contains("character = [ordered]@{ index = $CharacterIndex }", common, StringComparison.Ordinal);
|
||||
Assert.Contains("provider = 'Environment'", common, StringComparison.Ordinal);
|
||||
Assert.Contains("reference = $CredentialEnvironmentVariable", common, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EveryConnectedScreenshotMustProveExactFailureFreeActivation()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue