This repository has been archived by the owner on Jan 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixes #1292 * Add Set-UDClipboard examples on demo site and tests * finish fixes #1292 * Fix package.lock.json. Co-authored-by: Adam Driscoll <[email protected]>
- Loading branch information
1 parent
39b50ec
commit 50d6aa8
Showing
10 changed files
with
4,357 additions
and
4,909 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
src/UniversalDashboard.UITest/Integration/Clipboard.Test.ps1
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,63 @@ | ||
param([Switch]$Release) | ||
|
||
Import-Module "$PSScriptRoot\..\TestFramework.psm1" -Force | ||
$ModulePath = Get-ModulePath -Release:$Release | ||
$BrowserPort = Get-BrowserPort -Release:$Release | ||
|
||
Import-Module $ModulePath -Force | ||
|
||
Get-UDDashboard | Stop-UDDashboard | ||
|
||
$Driver = Start-SeFirefox | ||
$Server = Start-UDDashboard -Port 10001 | ||
|
||
function Set-TestDashboard { | ||
param($Dashboard) | ||
|
||
$Server.DashboardService.SetDashboard($Dashboard) | ||
Enter-SeUrl -Url "http://localhost:$BrowserPort" -Driver $Driver | ||
} | ||
|
||
Describe "Set-UDClipboard" { | ||
|
||
Context "set the clipboard by button click" { | ||
$dashboard = New-UDDashboard -Title "Test" -Content { | ||
New-UDButton -Id 'btnClipboard' -Floating -Icon clipboard -OnClick { | ||
Set-UDClipboard -Data 'You just copy me!!' | ||
} | ||
} | ||
|
||
Set-TestDashboard -Dashboard $dashboard | ||
|
||
It "should set clipboard with You just copy me!! text" { | ||
Find-SeElement -Driver $Driver -Id "btnClipboard" | Invoke-SeClick | ||
Start-Sleep 2 | ||
Get-Clipboard | Should be 'You just copy me!!' | ||
} | ||
} | ||
|
||
Context "set the clipboard with text box value by button click" { | ||
$dashboard = New-UDDashboard -Title "Test" -Content { | ||
New-UDTextbox -Label "Textbox" -Placeholder "Enter your name" -Id 'textToCopy1' | ||
New-UDButton -Id 'btnClipboard' -Icon clipboard -OnClick { | ||
$Element = Get-UDElement -Id 'textToCopy1' | ||
$text = $Element.Attributes.value | ||
Set-UDClipboard -Data $text | ||
} | ||
} | ||
|
||
Set-TestDashboard -Dashboard $dashboard | ||
|
||
It "should set clipboard with hello text" { | ||
$Element = Find-SeElement -Id "textToCopy1" -Driver $Driver | ||
Send-SeKeys -Element $Element -Keys "hello" | ||
Start-Sleep 2 | ||
Find-SeElement -Driver $Driver -Id "btnClipboard" | Invoke-SeClick | ||
Start-Sleep 2 | ||
Get-Clipboard | Should be 'hello' | ||
} | ||
} | ||
|
||
Stop-SeDriver $Driver | ||
Stop-UDDashboard $Server | ||
} |
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
Oops, something went wrong.