You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Run this test only on macOS because redirecting stderr of 'xdg-open' results in weird behavior in our Linux CI,
32
106
## causing this test to fail or the build to not respond.
33
-
It "Should invoke text file '<TestFile>' without error on Mac"-Skip:(!$IsMacOS)-TestCases $textFileTestCases {
107
+
It "Should invoke text file '<Name>' without error on Mac"-Pending-TestCases $textFileTestCases {
34
108
param($TestFile)
35
109
36
110
$expectedTitle=Split-Path$TestFile-Leaf
37
111
open -F-a TextEdit
38
-
$beforeCount=[int]('tell application "TextEdit" to count of windows'| osascript)
112
+
$beforeCount=Get-WindowCountMacOS-Name TextEdit
39
113
Invoke-Item-Path $TestFile
40
114
$startTime=Get-Date
41
115
$title= [String]::Empty
42
116
while (((Get-Date) -$startTime).TotalSeconds -lt30-and ($title-ne$expectedTitle))
43
117
{
44
118
Start-Sleep-Milliseconds 100
45
-
$title='tell application "TextEdit" to get name of front window'| osascript
119
+
$title=Get-WindowsTitleMacOS-name TextEdit
46
120
}
47
-
$afterCount=[int]('tell application "TextEdit" to count of windows'| osascript)
48
-
$afterCount| Should -Be ($beforeCount+1)
121
+
$afterCount=Get-WindowCountMacOS-Name TextEdit
122
+
$afterCount| Should -Be ($beforeCount+1)-Because "There should be one more 'textEdit' windows open than when the tests started and there was $beforeCount"
49
123
$title| Should -Be $expectedTitle
50
-
"tell application ""TextEdit"" to close window ""$expectedTitle"""| osascript
51
-
'tell application "TextEdit" to quit'| osascript
124
+
Invoke-AppleScript-Script ('tell application "{0}" to close window "{1}"'-f'TextEdit',$expectedTitle)
52
125
}
53
126
}
54
127
@@ -122,6 +195,22 @@ Categories=Application;
122
195
}
123
196
}
124
197
198
+
BeforeEach {
199
+
200
+
if($IsMacOS)
201
+
{
202
+
Get-Process-Name Finder |Stop-Process-Force
203
+
}
204
+
}
205
+
206
+
AfterAll{
207
+
if($IsMacOS)
208
+
{
209
+
Stop-ProcessMacOs-Name Finder
210
+
}
211
+
}
212
+
213
+
125
214
It "Should invoke a folder without error"-Skip:(!$supportedEnvironment) {
126
215
if ($IsWindows)
127
216
{
@@ -150,8 +239,9 @@ Categories=Application;
150
239
}
151
240
else
152
241
{
242
+
Set-TestInconclusive-Message "AppleScript is not currently reliable on Az Pipelines"
153
243
# validate on MacOS by using AppleScript
154
-
$beforeCount=[int]('tell application "Finder" to count of windows'| osascript)
0 commit comments