Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #615 #619

Merged
merged 1 commit into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,22 @@ Describe "Scheduled Endpoint" {
$Cache:EverySecondNumber = Get-Random
}

$dashboard = New-UDDashboard -Title "Test" -Content {
New-UDCounter -Title "Test" -Id "Counter" -Endpoint {
$Cache:EverySecondNumber
} -AutoRefresh -RefreshInterval 1
}
$Endpoint = New-UDEndpoint -Url "test" -Endpoint {
$Cache:EverySecondNumber
}

$Server = Start-UDDashboard -Port 10001 -Dashboard $dashboard -Endpoint $EverySecond
$Driver = Start-SeFirefox
Enter-SeUrl -Driver $Driver -Url "http://localhost:$BrowserPort"
Start-Sleep 2
$Server = Start-UDRestApi -Endpoint @($Endpoint, $EverySecond) -Port 10001

It "should update number in background" {
$Element = Find-SeElement -Driver $Driver -Id 'Counter'
$Text = $Element.Text

$Result = Invoke-RestMethod http://localhost:10001/api/test
Start-Sleep 2
$Result2 = Invoke-RestMethod http://localhost:10001/api/test

(Find-SeElement -Driver $Driver -Id 'Counter').Text | Should not be $Text
$Result | Should not be $Result2
}

Stop-SeDriver $Driver
Stop-UDDashboard -Server $Server
Stop-UDRestApi -Server $Server
}

}
7 changes: 5 additions & 2 deletions src/UniversalDashboard/Cmdlets/NewEndpointCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ protected override void EndProcessing()

callback.SessionId = SessionState.PSVariable.Get(Constants.SessionId)?.Value as string;

Execution.EndpointService.Instance.Register(callback);

if (callback.Schedule == null)
{
Execution.EndpointService.Instance.Register(callback);
}

WriteObject(callback);
}
}
Expand Down