From b97b55b718602083b1c1400d7a0ec031d700a9f1 Mon Sep 17 00:00:00 2001 From: redth Date: Tue, 21 May 2024 11:12:57 -0400 Subject: [PATCH 01/22] Update appium/drivers versions --- eng/scripts/appium-install.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index 9d4829f14d0b..ed31095f4667 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -40,11 +40,11 @@ Find the script for that on the DevDiv Azure DevOps instance, Engineering team, param ( - [string] $appiumVersion = '2.1.1', - [string] $windowsDriverVersion = '2.10.1', - [string] $androidDriverVersion = '2.29.4', - [string] $iOSDriverVersion = '5.2.0', - [string] $macDriverVersion = '1.7.2' + [string] $appiumVersion = '2.5.4', + [string] $windowsDriverVersion = '2.12.23', + [string] $androidDriverVersion = '3.5.1', + [string] $iOSDriverVersion = '7.16.1', + [string] $macDriverVersion = '1.17.3' ) Write-Output "Welcome to the Appium installer" From 52148c8253a2e98283e1cace9092ff68c4ef1f90 Mon Sep 17 00:00:00 2001 From: redth Date: Tue, 21 May 2024 12:31:48 -0400 Subject: [PATCH 02/22] Use newer .NET SDK --- eng/pipelines/common/variables.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/common/variables.yml b/eng/pipelines/common/variables.yml index 53556c9d981a..f0c4d0a1c2af 100644 --- a/eng/pipelines/common/variables.yml +++ b/eng/pipelines/common/variables.yml @@ -6,7 +6,7 @@ variables: - name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE value: true - name: DOTNET_VERSION - value: 8.0.101 + value: 8.0.300 - name: REQUIRED_XCODE value: 15.2.0 - name: DEVICETESTS_REQUIRED_XCODE From 506d5babe70d2e38fab961bb5bc86665f5162305 Mon Sep 17 00:00:00 2001 From: redth Date: Tue, 21 May 2024 15:19:39 -0400 Subject: [PATCH 03/22] Try to uninstall appium / cleanup first --- eng/scripts/appium-install.ps1 | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index ed31095f4667..f2c029bcc64b 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -52,15 +52,35 @@ Write-Output "Welcome to the Appium installer" Write-Output "Node version" node -v -Write-Output "Installing appium $appiumVersion" -npm install -g appium@$appiumVersion +# If there's a ~/.appium folder, remove it as it can cause issues from v1 +# it might also generally have caching issues for us with our runs +$appiumUserData = "$env:USERPROFILE/.appium" +if (Test-Path $appiumUserData) { + Write-Output "Removing $appiumUserData" + Remove-Item -Path $appiumUserData -Force -Recurse +} -write-Output "Installed appium" -appium -v +# Check for an existing appium install version +$appiumCurrentVersion = appium -v | Out-String +if ($appiumCurrentVersion) { + Write-Output "Existing Appium version $appiumCurrentVersion" +} else { + Write-Output "No Appium version installed" +} -Write-Output "Installing appium doctor" -npm install -g appium-doctor +# If current version does not match the one we want, uninstall and install the new version +if ($appiumCurrentVersion -ne $appiumVersion) { + Write-Output "Uninstalling appium $appiumCurrentVersion" + npm uninstall -g appium + Write-Output "Uninstalled appium $appiumCurrentVersion" + Write-Output "Installing appium $appiumVersion" + npm install -g appium@$appiumVersion + write-Output "Installed appium $appiumVersion" +} + +Write-Output "Installing appium doctor" +npm install -g @appium/doctor Write-Output "Installed appium doctor" $existingDrivers = appium driver list --installed --json | ConvertFrom-Json From b38539d98e0bd1d527c3ca893f4b58d195382346 Mon Sep 17 00:00:00 2001 From: redth Date: Tue, 21 May 2024 16:35:27 -0400 Subject: [PATCH 04/22] Invoke appium -v in try/catch --- eng/scripts/appium-install.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index f2c029bcc64b..fc3783dbfc91 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -61,7 +61,9 @@ if (Test-Path $appiumUserData) { } # Check for an existing appium install version -$appiumCurrentVersion = appium -v | Out-String +$appiumCurrentVersion = "" +try { $appiumCurrentVersion = appium -v | Out-String } catch { } + if ($appiumCurrentVersion) { Write-Output "Existing Appium version $appiumCurrentVersion" } else { From 27e6715694ade009568e3c6fa5a18b0a0ce71b79 Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 09:43:13 -0400 Subject: [PATCH 05/22] Log npm into LogDirectory and verbose --- .../common/ui-tests-legacy-steps.yml | 15 +++++++++- eng/pipelines/common/ui-tests-steps.yml | 2 +- eng/scripts/appium-install.ps1 | 30 ++++++++++++------- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/eng/pipelines/common/ui-tests-legacy-steps.yml b/eng/pipelines/common/ui-tests-legacy-steps.yml index 45f154de55a4..d2525a5e5b80 100644 --- a/eng/pipelines/common/ui-tests-legacy-steps.yml +++ b/eng/pipelines/common/ui-tests-legacy-steps.yml @@ -86,11 +86,24 @@ steps: displayName: "Delete temp .appium-???????? and .appium-doctor-???????? folders" continueOnError: true - - pwsh: ./eng/scripts/appium-install.ps1 + - pwsh: ./eng/scripts/appium-install.ps1 -logsDir $(LogDirectory)/npm/ displayName: "Install Appium (Drivers)" continueOnError: false retryCountOnTaskFailure: 1 + + - task: PublishBuildArtifacts@1 + displayName: Publish npm logs + condition: always() + inputs: + PathtoPublish: $(LogDirectory)/npm/ + ArtifactName: npm-logs + publishLocation: Container + + +/Users/builder/.npm/_logs + + - pwsh: ./build.ps1 --target=dotnet --configuration="${{ parameters.configuration }}" --verbosity=diagnostic displayName: 'Install .NET' retryCountOnTaskFailure: 2 diff --git a/eng/pipelines/common/ui-tests-steps.yml b/eng/pipelines/common/ui-tests-steps.yml index 40123cbf9e68..36443d5b8b7d 100644 --- a/eng/pipelines/common/ui-tests-steps.yml +++ b/eng/pipelines/common/ui-tests-steps.yml @@ -85,7 +85,7 @@ steps: displayName: "Delete temp .appium-???????? and .appium-doctor-???????? folders" continueOnError: true - - pwsh: ./eng/scripts/appium-install.ps1 + - pwsh: ./eng/scripts/appium-install.ps1 -logsDir $(LogDirectory)/npm/ displayName: "Install Appium (Drivers)" continueOnError: false retryCountOnTaskFailure: 1 diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index fc3783dbfc91..e8f768cd1c91 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -44,7 +44,8 @@ param [string] $windowsDriverVersion = '2.12.23', [string] $androidDriverVersion = '3.5.1', [string] $iOSDriverVersion = '7.16.1', - [string] $macDriverVersion = '1.17.3' + [string] $macDriverVersion = '1.17.3', + [string] $logsDir = '../appium-logs' ) Write-Output "Welcome to the Appium installer" @@ -52,6 +53,13 @@ Write-Output "Welcome to the Appium installer" Write-Output "Node version" node -v +$npmLogLevel = 'verbose' + +# Create logs directory for npm logs if it doesn't exist +if (!Test-Path $logsDir) { + Create-Item -Path $logsDir -ItemType Directory +} + # If there's a ~/.appium folder, remove it as it can cause issues from v1 # it might also generally have caching issues for us with our runs $appiumUserData = "$env:USERPROFILE/.appium" @@ -73,11 +81,11 @@ if ($appiumCurrentVersion) { # If current version does not match the one we want, uninstall and install the new version if ($appiumCurrentVersion -ne $appiumVersion) { Write-Output "Uninstalling appium $appiumCurrentVersion" - npm uninstall -g appium + npm uninstall -g appium --logs-dir=$logsDir --loglevel $npmLogLevel Write-Output "Uninstalled appium $appiumCurrentVersion" Write-Output "Installing appium $appiumVersion" - npm install -g appium@$appiumVersion + npm install -g appium@$appiumVersion --logs-dir=$logsDir --loglevel $npmLogLevel write-Output "Installed appium $appiumVersion" } @@ -89,25 +97,25 @@ $existingDrivers = appium driver list --installed --json | ConvertFrom-Json Write-Output "List of installed drivers $existingDrivers" if ($existingDrivers.windows) { Write-Output "Uninstalling appium driver windows" - appium driver uninstall windows + appium driver uninstall windows --logs-dir=$logsDir --loglevel $npmLogLevel Write-Output "Uninstalled appium driver windows" } if ($existingDrivers.uiautomator2) { Write-Output "Uninstalling appium driver uiautomator2" - appium driver uninstall uiautomator2 + appium driver uninstall uiautomator2 --logs-dir=$logsDir --loglevel $npmLogLevel Write-Output "Uninstalled appium driver uiautomator2" } if ($existingDrivers.xcuitest) { Write-Output "Uninstalling appium driver xcuitest" - appium driver uninstall xcuitest + appium driver uninstall xcuitest --logs-dir=$logsDir --loglevel $npmLogLevel Write-Output "Uninstalled appium driver xcuitest" } if ($existingDrivers.mac2) { Write-Output "Uninstalling appium driver mac2" - appium driver uninstall mac2 + appium driver uninstall mac2 --logs-dir=$logsDir --loglevel $npmLogLevel Write-Output "Uninstalled appium driver mac2" } @@ -117,19 +125,19 @@ Write-Output "List of installed drivers after cleaup $drivers" Write-Output "We will now install the appium drivers windows $windowsDriverVersion, uiautomator2 $androidDriverVersion, xcuitest $iOSDriverVersion and mac2 $macDriverVersion" Write-Output "Installing appium driver windows $windowsDriverVersion" -appium driver install --source=npm appium-windows-driver@$windowsDriverVersion +appium driver install --source=npm appium-windows-driver@$windowsDriverVersion --logs-dir=$logsDir --loglevel $npmLogLevel Write-Output "Installed appium driver windows" Write-Output "Installing appium driver uiautomator2 $androidDriverVersion" -appium driver install uiautomator2@$androidDriverVersion +appium driver install uiautomator2@$androidDriverVersion --logs-dir=$logsDir --loglevel $npmLogLevel Write-Output "Installed appium driver uiautomator2" Write-Output "Installing appium driver xcuitest $iOSDriverVersion" -appium driver install xcuitest@$iOSDriverVersion +appium driver install xcuitest@$iOSDriverVersion --logs-dir=$logsDir --loglevel $npmLogLevel Write-Output "Installed appium driver xcuitest" Write-Output "Installing appium driver mac2 $macDriverVersion" -appium driver install mac2@$macDriverVersion +appium driver install mac2@$macDriverVersion --logs-dir=$logsDir --loglevel $npmLogLevel Write-Output "Installed appium driver mac2" Write-Output "Check everything is installed correctly with appium doctor" From d603a2068c07dcc4d84c916a23d494d28edb084c Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 09:46:52 -0400 Subject: [PATCH 06/22] Use newer appium doctor commands The separate doctor package is deprecated and now appium contains doctor commands for drivers and plugins: --- eng/scripts/appium-install.ps1 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index e8f768cd1c91..8bda2a40beeb 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -89,10 +89,6 @@ if ($appiumCurrentVersion -ne $appiumVersion) { write-Output "Installed appium $appiumVersion" } -Write-Output "Installing appium doctor" -npm install -g @appium/doctor -Write-Output "Installed appium doctor" - $existingDrivers = appium driver list --installed --json | ConvertFrom-Json Write-Output "List of installed drivers $existingDrivers" if ($existingDrivers.windows) { @@ -141,6 +137,9 @@ appium driver install mac2@$macDriverVersion --logs-dir=$logsDir --loglevel $npm Write-Output "Installed appium driver mac2" Write-Output "Check everything is installed correctly with appium doctor" -appium-doctor +appium driver doctor appium-windows-driver --logs-dir=$logsDir --loglevel $npmLogLevel +appium driver doctor uiautomator2 --logs-dir=$logsDir --loglevel $npmLogLevel +appium driver doctor xcuitest --logs-dir=$logsDir --loglevel $npmLogLevel +appium driver doctor mac2 --logs-dir=$logsDir --loglevel $npmLogLevel Write-Output "Done, thanks!" From 50210f6e1635c56445b6e5f2284129c3692f1c38 Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 12:22:17 -0400 Subject: [PATCH 07/22] Remove added artifact stage These will get picked up by virtue of being placed in $(LogDirectory) now --- eng/pipelines/common/ui-tests-legacy-steps.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/eng/pipelines/common/ui-tests-legacy-steps.yml b/eng/pipelines/common/ui-tests-legacy-steps.yml index d2525a5e5b80..3e732d1060d6 100644 --- a/eng/pipelines/common/ui-tests-legacy-steps.yml +++ b/eng/pipelines/common/ui-tests-legacy-steps.yml @@ -91,19 +91,6 @@ steps: continueOnError: false retryCountOnTaskFailure: 1 - - - task: PublishBuildArtifacts@1 - displayName: Publish npm logs - condition: always() - inputs: - PathtoPublish: $(LogDirectory)/npm/ - ArtifactName: npm-logs - publishLocation: Container - - -/Users/builder/.npm/_logs - - - pwsh: ./build.ps1 --target=dotnet --configuration="${{ parameters.configuration }}" --verbosity=diagnostic displayName: 'Install .NET' retryCountOnTaskFailure: 2 From 0e256cb307e684cca1716680c7c3b5cff7b6c57c Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 12:29:54 -0400 Subject: [PATCH 08/22] Fix logic syntax --- eng/scripts/appium-install.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index 8bda2a40beeb..2074e831865a 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -56,8 +56,8 @@ node -v $npmLogLevel = 'verbose' # Create logs directory for npm logs if it doesn't exist -if (!Test-Path $logsDir) { - Create-Item -Path $logsDir -ItemType Directory +if (!(Test-Path $logsDir -PathType Container)) { + Create-Item -ItemType Directory -Path $logsDir } # If there's a ~/.appium folder, remove it as it can cause issues from v1 From 938d7581b4098161e56321751366049993b25dae Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 12:41:47 -0400 Subject: [PATCH 09/22] Fix ps command for create dir --- eng/scripts/appium-install.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index 2074e831865a..6654c7c73167 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -57,7 +57,7 @@ $npmLogLevel = 'verbose' # Create logs directory for npm logs if it doesn't exist if (!(Test-Path $logsDir -PathType Container)) { - Create-Item -ItemType Directory -Path $logsDir + New-Item -ItemType Directory -Path $logsDir } # If there's a ~/.appium folder, remove it as it can cause issues from v1 From aabcea1af367cfe095f90ee192b863c1fcca4b8a Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 13:15:55 -0400 Subject: [PATCH 10/22] Fix path combine for logs --- eng/pipelines/common/ui-tests-legacy-steps.yml | 4 +++- eng/pipelines/common/ui-tests-steps.yml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/ui-tests-legacy-steps.yml b/eng/pipelines/common/ui-tests-legacy-steps.yml index 3e732d1060d6..256e3369bb6f 100644 --- a/eng/pipelines/common/ui-tests-legacy-steps.yml +++ b/eng/pipelines/common/ui-tests-legacy-steps.yml @@ -86,7 +86,9 @@ steps: displayName: "Delete temp .appium-???????? and .appium-doctor-???????? folders" continueOnError: true - - pwsh: ./eng/scripts/appium-install.ps1 -logsDir $(LogDirectory)/npm/ + - pwsh: | + $fullLogsDir = Join-Path "$(LogDirectory)" "npm" + ./eng/scripts/appium-install.ps1 -logsDir "$fullLogsDir" displayName: "Install Appium (Drivers)" continueOnError: false retryCountOnTaskFailure: 1 diff --git a/eng/pipelines/common/ui-tests-steps.yml b/eng/pipelines/common/ui-tests-steps.yml index 36443d5b8b7d..97925252bb9e 100644 --- a/eng/pipelines/common/ui-tests-steps.yml +++ b/eng/pipelines/common/ui-tests-steps.yml @@ -85,7 +85,9 @@ steps: displayName: "Delete temp .appium-???????? and .appium-doctor-???????? folders" continueOnError: true - - pwsh: ./eng/scripts/appium-install.ps1 -logsDir $(LogDirectory)/npm/ + - pwsh: | + $fullLogsDir = Join-Path "$(LogDirectory)" "npm" + ./eng/scripts/appium-install.ps1 -logsDir "$fullLogsDir" displayName: "Install Appium (Drivers)" continueOnError: false retryCountOnTaskFailure: 1 From 6c04bacce801fe8b3f0c6b875b696b5ca47361bc Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 13:30:30 -0400 Subject: [PATCH 11/22] Fix logging options --- eng/scripts/appium-install.ps1 | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index 6654c7c73167..814ac8df9f3f 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -55,6 +55,9 @@ node -v $npmLogLevel = 'verbose' +# globally set npm loglevel +npm config set loglevel $npmLogLevel + # Create logs directory for npm logs if it doesn't exist if (!(Test-Path $logsDir -PathType Container)) { New-Item -ItemType Directory -Path $logsDir @@ -81,11 +84,11 @@ if ($appiumCurrentVersion) { # If current version does not match the one we want, uninstall and install the new version if ($appiumCurrentVersion -ne $appiumVersion) { Write-Output "Uninstalling appium $appiumCurrentVersion" - npm uninstall -g appium --logs-dir=$logsDir --loglevel $npmLogLevel + npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium Write-Output "Uninstalled appium $appiumCurrentVersion" Write-Output "Installing appium $appiumVersion" - npm install -g appium@$appiumVersion --logs-dir=$logsDir --loglevel $npmLogLevel + npm install --logs-dir=$logsDir --loglevel $npmLogLevel -g appium@$appiumVersion write-Output "Installed appium $appiumVersion" } @@ -93,25 +96,25 @@ $existingDrivers = appium driver list --installed --json | ConvertFrom-Json Write-Output "List of installed drivers $existingDrivers" if ($existingDrivers.windows) { Write-Output "Uninstalling appium driver windows" - appium driver uninstall windows --logs-dir=$logsDir --loglevel $npmLogLevel + appium driver uninstall windows Write-Output "Uninstalled appium driver windows" } if ($existingDrivers.uiautomator2) { Write-Output "Uninstalling appium driver uiautomator2" - appium driver uninstall uiautomator2 --logs-dir=$logsDir --loglevel $npmLogLevel + appium driver uninstall uiautomator2 Write-Output "Uninstalled appium driver uiautomator2" } if ($existingDrivers.xcuitest) { Write-Output "Uninstalling appium driver xcuitest" - appium driver uninstall xcuitest --logs-dir=$logsDir --loglevel $npmLogLevel + appium driver uninstall xcuitest Write-Output "Uninstalled appium driver xcuitest" } if ($existingDrivers.mac2) { Write-Output "Uninstalling appium driver mac2" - appium driver uninstall mac2 --logs-dir=$logsDir --loglevel $npmLogLevel + appium driver uninstall mac2 Write-Output "Uninstalled appium driver mac2" } @@ -121,25 +124,25 @@ Write-Output "List of installed drivers after cleaup $drivers" Write-Output "We will now install the appium drivers windows $windowsDriverVersion, uiautomator2 $androidDriverVersion, xcuitest $iOSDriverVersion and mac2 $macDriverVersion" Write-Output "Installing appium driver windows $windowsDriverVersion" -appium driver install --source=npm appium-windows-driver@$windowsDriverVersion --logs-dir=$logsDir --loglevel $npmLogLevel +appium driver install --source=npm appium-windows-driver@$windowsDriverVersion Write-Output "Installed appium driver windows" Write-Output "Installing appium driver uiautomator2 $androidDriverVersion" -appium driver install uiautomator2@$androidDriverVersion --logs-dir=$logsDir --loglevel $npmLogLevel +appium driver install uiautomator2@$androidDriverVersion Write-Output "Installed appium driver uiautomator2" Write-Output "Installing appium driver xcuitest $iOSDriverVersion" -appium driver install xcuitest@$iOSDriverVersion --logs-dir=$logsDir --loglevel $npmLogLevel +appium driver install xcuitest@$iOSDriverVersion Write-Output "Installed appium driver xcuitest" Write-Output "Installing appium driver mac2 $macDriverVersion" -appium driver install mac2@$macDriverVersion --logs-dir=$logsDir --loglevel $npmLogLevel +appium driver install mac2@$macDriverVersion Write-Output "Installed appium driver mac2" Write-Output "Check everything is installed correctly with appium doctor" -appium driver doctor appium-windows-driver --logs-dir=$logsDir --loglevel $npmLogLevel -appium driver doctor uiautomator2 --logs-dir=$logsDir --loglevel $npmLogLevel -appium driver doctor xcuitest --logs-dir=$logsDir --loglevel $npmLogLevel -appium driver doctor mac2 --logs-dir=$logsDir --loglevel $npmLogLevel +appium driver doctor appium-windows-driver +appium driver doctor uiautomator2 +appium driver doctor xcuitest +appium driver doctor mac2 Write-Output "Done, thanks!" From 58a59573c56b2a1c818fd84a5a09d293bb0fa5be Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 13:49:11 -0400 Subject: [PATCH 12/22] Try ignoring appium doctor exit code --- eng/scripts/appium-install.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index 814ac8df9f3f..713ee3458efc 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -140,9 +140,9 @@ appium driver install mac2@$macDriverVersion Write-Output "Installed appium driver mac2" Write-Output "Check everything is installed correctly with appium doctor" -appium driver doctor appium-windows-driver -appium driver doctor uiautomator2 -appium driver doctor xcuitest -appium driver doctor mac2 +appium driver doctor appium-windows-driver || & { "ignore failure"; $global:LASTEXITCODE = 0 } +appium driver doctor uiautomator2 || & { "ignore failure"; $global:LASTEXITCODE = 0 } +appium driver doctor xcuitest || & { "ignore failure"; $global:LASTEXITCODE = 0 } +appium driver doctor mac2 || & { "ignore failure"; $global:LASTEXITCODE = 0 } Write-Output "Done, thanks!" From 8696369036eddfe06e598197dbaf9bc1046f2d77 Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 14:38:30 -0400 Subject: [PATCH 13/22] Try driver uninstall directly with npm --- eng/scripts/appium-install.ps1 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index 713ee3458efc..88a48be93de6 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -96,25 +96,29 @@ $existingDrivers = appium driver list --installed --json | ConvertFrom-Json Write-Output "List of installed drivers $existingDrivers" if ($existingDrivers.windows) { Write-Output "Uninstalling appium driver windows" - appium driver uninstall windows + # appium driver uninstall windows + npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-windows-driver Write-Output "Uninstalled appium driver windows" } if ($existingDrivers.uiautomator2) { Write-Output "Uninstalling appium driver uiautomator2" - appium driver uninstall uiautomator2 + # appium driver uninstall uiautomator2 + npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-uiautomator2-driver Write-Output "Uninstalled appium driver uiautomator2" } if ($existingDrivers.xcuitest) { Write-Output "Uninstalling appium driver xcuitest" - appium driver uninstall xcuitest + # appium driver uninstall xcuitest + npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-xcuitest-driver Write-Output "Uninstalled appium driver xcuitest" } if ($existingDrivers.mac2) { Write-Output "Uninstalling appium driver mac2" - appium driver uninstall mac2 + # appium driver uninstall mac2 + npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-mac2-driver Write-Output "Uninstalled appium driver mac2" } From 62c64eee381b99f0c10002c845b788abbca914d3 Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 14:54:24 -0400 Subject: [PATCH 14/22] Try using update/install --- eng/scripts/appium-install.ps1 | 70 +++++++++++++++++----------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index 88a48be93de6..5858d4db18bb 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -92,57 +92,59 @@ if ($appiumCurrentVersion -ne $appiumVersion) { write-Output "Installed appium $appiumVersion" } +# Try to clean up old npm packages +npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-windows-driver +npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-xcuitest-driver +npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-uiautomator2-driver +npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-mac2-driver + + $existingDrivers = appium driver list --installed --json | ConvertFrom-Json Write-Output "List of installed drivers $existingDrivers" + if ($existingDrivers.windows) { - Write-Output "Uninstalling appium driver windows" - # appium driver uninstall windows - npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-windows-driver - Write-Output "Uninstalled appium driver windows" + Write-Output "Updating appium driver windows" + appium driver update windows + Write-Output "Updated appium driver windows" +} else { + Write-Output "Installing appium driver windows" + appium driver install windows + Write-Output "Installed appium driver windows" } if ($existingDrivers.uiautomator2) { - Write-Output "Uninstalling appium driver uiautomator2" - # appium driver uninstall uiautomator2 - npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-uiautomator2-driver - Write-Output "Uninstalled appium driver uiautomator2" + Write-Output "Updating appium driver uiautomator2" + appium driver update uiautomator2 + Write-Output "Updated appium driver uiautomator2" +} else { + Write-Output "Installing appium driver uiautomator2" + appium driver install uiautomator2 + Write-Output "Installed appium driver uiautomator2" } if ($existingDrivers.xcuitest) { - Write-Output "Uninstalling appium driver xcuitest" - # appium driver uninstall xcuitest - npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-xcuitest-driver - Write-Output "Uninstalled appium driver xcuitest" + Write-Output "Updating appium driver xcuitest" + appium driver update xcuitest + Write-Output "Updated appium driver xcuitest" +} else { + Write-Output "Installing appium driver xcuitest" + appium driver install xcuitest + Write-Output "Installed appium driver xcuitest" } if ($existingDrivers.mac2) { - Write-Output "Uninstalling appium driver mac2" - # appium driver uninstall mac2 - npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-mac2-driver - Write-Output "Uninstalled appium driver mac2" + Write-Output "Updating appium driver mac2" + appium driver update mac2 + Write-Output "Updated appium driver mac2" +} else { + Write-Output "Installing appium driver mac2" + appium driver install mac2 + Write-Output "Installed appium driver mac2" } $drivers = appium driver list --installed --json | ConvertFrom-Json Write-Output "List of installed drivers after cleaup $drivers" -Write-Output "We will now install the appium drivers windows $windowsDriverVersion, uiautomator2 $androidDriverVersion, xcuitest $iOSDriverVersion and mac2 $macDriverVersion" - -Write-Output "Installing appium driver windows $windowsDriverVersion" -appium driver install --source=npm appium-windows-driver@$windowsDriverVersion -Write-Output "Installed appium driver windows" - -Write-Output "Installing appium driver uiautomator2 $androidDriverVersion" -appium driver install uiautomator2@$androidDriverVersion -Write-Output "Installed appium driver uiautomator2" - -Write-Output "Installing appium driver xcuitest $iOSDriverVersion" -appium driver install xcuitest@$iOSDriverVersion -Write-Output "Installed appium driver xcuitest" - -Write-Output "Installing appium driver mac2 $macDriverVersion" -appium driver install mac2@$macDriverVersion -Write-Output "Installed appium driver mac2" - Write-Output "Check everything is installed correctly with appium doctor" appium driver doctor appium-windows-driver || & { "ignore failure"; $global:LASTEXITCODE = 0 } appium driver doctor uiautomator2 || & { "ignore failure"; $global:LASTEXITCODE = 0 } From 2b266cd10d7343305c857f6cb253e22b634a02ce Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 15:21:48 -0400 Subject: [PATCH 15/22] Use same npm command appium does to install driver --- eng/scripts/appium-install.ps1 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index 5858d4db18bb..87f0078df931 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -108,13 +108,15 @@ if ($existingDrivers.windows) { Write-Output "Updated appium driver windows" } else { Write-Output "Installing appium driver windows" - appium driver install windows + #appium driver install windows + npm install --logs-dir=$logsDir --loglevel $npmLogLevel --save-dev --no-progress --no-audit --omit=peer --save-exact --global-style --no-package-lock appium-windows-driver@$windowsDriverVersion --json Write-Output "Installed appium driver windows" } if ($existingDrivers.uiautomator2) { Write-Output "Updating appium driver uiautomator2" - appium driver update uiautomator2 + #appium driver update uiautomator2 + npm install --logs-dir=$logsDir --loglevel $npmLogLevel --save-dev --no-progress --no-audit --omit=peer --save-exact --global-style --no-package-lock appium-uiautomator2-driver@$androidDriverVersion --json Write-Output "Updated appium driver uiautomator2" } else { Write-Output "Installing appium driver uiautomator2" @@ -128,7 +130,8 @@ if ($existingDrivers.xcuitest) { Write-Output "Updated appium driver xcuitest" } else { Write-Output "Installing appium driver xcuitest" - appium driver install xcuitest + #appium driver install xcuitest + npm install --logs-dir=$logsDir --loglevel $npmLogLevel --save-dev --no-progress --no-audit --omit=peer --save-exact --global-style --no-package-lock appium-xcuitest-driver@$iOSDriverVersion --json Write-Output "Installed appium driver xcuitest" } @@ -138,7 +141,8 @@ if ($existingDrivers.mac2) { Write-Output "Updated appium driver mac2" } else { Write-Output "Installing appium driver mac2" - appium driver install mac2 + #appium driver install mac2 + npm install --logs-dir=$logsDir --loglevel $npmLogLevel --save-dev --no-progress --no-audit --omit=peer --save-exact --global-style --no-package-lock appium-mac2-driver@$macDriverVersion --json Write-Output "Installed appium driver mac2" } From 921e6d82b1ca3e40ff23932790cb8df27fd81162 Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 16:04:22 -0400 Subject: [PATCH 16/22] Install drivers based on platform --- eng/scripts/appium-install.ps1 | 93 +++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 42 deletions(-) diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index 87f0078df931..3de2aceaa88b 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -65,7 +65,7 @@ if (!(Test-Path $logsDir -PathType Container)) { # If there's a ~/.appium folder, remove it as it can cause issues from v1 # it might also generally have caching issues for us with our runs -$appiumUserData = "$env:USERPROFILE/.appium" +$appiumUserData = (Join-Path $env:USERPROFILE ".appium") if (Test-Path $appiumUserData) { Write-Output "Removing $appiumUserData" Remove-Item -Path $appiumUserData -Force -Recurse @@ -93,30 +93,56 @@ if ($appiumCurrentVersion -ne $appiumVersion) { } # Try to clean up old npm packages -npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-windows-driver -npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-xcuitest-driver -npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-uiautomator2-driver -npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-mac2-driver - +# if ($IsWindows) { +# npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-windows-driver +# } +# if ($IsMacOS) { +# npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-xcuitest-driver +# npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-mac2-driver +# } +# npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-uiautomator2-driver $existingDrivers = appium driver list --installed --json | ConvertFrom-Json Write-Output "List of installed drivers $existingDrivers" -if ($existingDrivers.windows) { - Write-Output "Updating appium driver windows" - appium driver update windows - Write-Output "Updated appium driver windows" -} else { - Write-Output "Installing appium driver windows" - #appium driver install windows - npm install --logs-dir=$logsDir --loglevel $npmLogLevel --save-dev --no-progress --no-audit --omit=peer --save-exact --global-style --no-package-lock appium-windows-driver@$windowsDriverVersion --json - Write-Output "Installed appium driver windows" +if ($IsWindows) { + if ($existingDrivers.windows) { + Write-Output "Updating appium driver windows" + appium driver update windows + Write-Output "Updated appium driver windows" + } else { + Write-Output "Installing appium driver windows" + appium driver install --source=npm appium-windows-driver + Write-Output "Installed appium driver windows" + } +} + +if ($IsMacOS) { + + if ($existingDrivers.xcuitest) { + Write-Output "Updating appium driver xcuitest" + appium driver update xcuitest + Write-Output "Updated appium driver xcuitest" + } else { + Write-Output "Installing appium driver xcuitest" + appium driver install xcuitest + Write-Output "Installed appium driver xcuitest" + } + + if ($existingDrivers.mac2) { + Write-Output "Updating appium driver mac2" + appium driver update mac2 + Write-Output "Updated appium driver mac2" + } else { + Write-Output "Installing appium driver mac2" + appium driver install mac2 + Write-Output "Installed appium driver mac2" + } } if ($existingDrivers.uiautomator2) { Write-Output "Updating appium driver uiautomator2" - #appium driver update uiautomator2 - npm install --logs-dir=$logsDir --loglevel $npmLogLevel --save-dev --no-progress --no-audit --omit=peer --save-exact --global-style --no-package-lock appium-uiautomator2-driver@$androidDriverVersion --json + appium driver update uiautomator2 Write-Output "Updated appium driver uiautomator2" } else { Write-Output "Installing appium driver uiautomator2" @@ -124,35 +150,18 @@ if ($existingDrivers.uiautomator2) { Write-Output "Installed appium driver uiautomator2" } -if ($existingDrivers.xcuitest) { - Write-Output "Updating appium driver xcuitest" - appium driver update xcuitest - Write-Output "Updated appium driver xcuitest" -} else { - Write-Output "Installing appium driver xcuitest" - #appium driver install xcuitest - npm install --logs-dir=$logsDir --loglevel $npmLogLevel --save-dev --no-progress --no-audit --omit=peer --save-exact --global-style --no-package-lock appium-xcuitest-driver@$iOSDriverVersion --json - Write-Output "Installed appium driver xcuitest" -} - -if ($existingDrivers.mac2) { - Write-Output "Updating appium driver mac2" - appium driver update mac2 - Write-Output "Updated appium driver mac2" -} else { - Write-Output "Installing appium driver mac2" - #appium driver install mac2 - npm install --logs-dir=$logsDir --loglevel $npmLogLevel --save-dev --no-progress --no-audit --omit=peer --save-exact --global-style --no-package-lock appium-mac2-driver@$macDriverVersion --json - Write-Output "Installed appium driver mac2" -} - $drivers = appium driver list --installed --json | ConvertFrom-Json Write-Output "List of installed drivers after cleaup $drivers" Write-Output "Check everything is installed correctly with appium doctor" -appium driver doctor appium-windows-driver || & { "ignore failure"; $global:LASTEXITCODE = 0 } + +if ($IsWindows) { + appium driver doctor windows || & { "ignore failure"; $global:LASTEXITCODE = 0 } +} +if ($IsMacOS) { + appium driver doctor xcuitest || & { "ignore failure"; $global:LASTEXITCODE = 0 } + appium driver doctor mac2 || & { "ignore failure"; $global:LASTEXITCODE = 0 } +} appium driver doctor uiautomator2 || & { "ignore failure"; $global:LASTEXITCODE = 0 } -appium driver doctor xcuitest || & { "ignore failure"; $global:LASTEXITCODE = 0 } -appium driver doctor mac2 || & { "ignore failure"; $global:LASTEXITCODE = 0 } Write-Output "Done, thanks!" From 0d4b4f2eeb90ac08acdfc406677292686be27dcb Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 16:16:55 -0400 Subject: [PATCH 17/22] Remove clearing .appium user folder --- eng/scripts/appium-install.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index 3de2aceaa88b..fe3c57686a8c 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -65,11 +65,11 @@ if (!(Test-Path $logsDir -PathType Container)) { # If there's a ~/.appium folder, remove it as it can cause issues from v1 # it might also generally have caching issues for us with our runs -$appiumUserData = (Join-Path $env:USERPROFILE ".appium") -if (Test-Path $appiumUserData) { - Write-Output "Removing $appiumUserData" - Remove-Item -Path $appiumUserData -Force -Recurse -} +# $appiumUserData = (Join-Path $env:USERPROFILE ".appium") +# if (Test-Path $appiumUserData) { +# Write-Output "Removing $appiumUserData" +# Remove-Item -Path $appiumUserData -Force -Recurse +# } # Check for an existing appium install version $appiumCurrentVersion = "" From 05541a30743e0a201f31eb6da3d15f4ac32f292a Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 16:34:51 -0400 Subject: [PATCH 18/22] Try setting APPIUM_HOME to a local folder --- eng/pipelines/common/ui-tests-legacy-steps.yml | 16 +++++++++++++++- eng/pipelines/common/ui-tests-steps.yml | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/ui-tests-legacy-steps.yml b/eng/pipelines/common/ui-tests-legacy-steps.yml index 256e3369bb6f..c8b1bc628809 100644 --- a/eng/pipelines/common/ui-tests-legacy-steps.yml +++ b/eng/pipelines/common/ui-tests-legacy-steps.yml @@ -10,6 +10,9 @@ parameters: targetSample: "dotnet-legacy-controlgallery" configuration : "Release" +variables: + APPIUM_HOME: $(System.DefaultWorkingDirectory)/.appium/ + steps: - ${{ if eq(parameters.platform, 'ios')}}: - bash: | @@ -60,6 +63,10 @@ steps: ls -al $(npm root -g)/appium echo "##[endgroup]" + echo "##[group]Running ls -al $(npm root -g)/.appium" + ls -al $(npm root -g)/.appium + echo "##[endgroup]" + echo "##[group]Running ls -al $(npm root -g)/.appium-????????" ls -al $(npm root -g)/.appium-???????? echo "##[endgroup]" @@ -81,10 +88,13 @@ steps: # Clean up any leftover cached folders of appium and appium-doctor node modules - bash: | + rm -rf $(npm root -g)/.appium rm -rf $(npm root -g)/.appium-???????? rm -rf $(npm root -g)/.appium-doctor-???????? - displayName: "Delete temp .appium-???????? and .appium-doctor-???????? folders" + displayName: "Delete temp .appium and .appium-???????? and .appium-doctor-???????? folders" continueOnError: true + env: + APPIUM_HOME: $(APPIUM_HOME) - pwsh: | $fullLogsDir = Join-Path "$(LogDirectory)" "npm" @@ -92,6 +102,8 @@ steps: displayName: "Install Appium (Drivers)" continueOnError: false retryCountOnTaskFailure: 1 + env: + APPIUM_HOME: $(APPIUM_HOME) - pwsh: ./build.ps1 --target=dotnet --configuration="${{ parameters.configuration }}" --verbosity=diagnostic displayName: 'Install .NET' @@ -120,6 +132,8 @@ steps: displayName: $(Agent.JobName) ${{ if ne(parameters.platform, 'android')}}: retryCountOnTaskFailure: 1 + env: + APPIUM_HOME: $(APPIUM_HOME) - bash: | suffix=$(date +%Y%m%d%H%M%S) diff --git a/eng/pipelines/common/ui-tests-steps.yml b/eng/pipelines/common/ui-tests-steps.yml index 97925252bb9e..b696dbe993ee 100644 --- a/eng/pipelines/common/ui-tests-steps.yml +++ b/eng/pipelines/common/ui-tests-steps.yml @@ -9,6 +9,9 @@ parameters: agentPoolAccessToken: '' configuration : "Release" +variables: + APPIUM_HOME: $(System.DefaultWorkingDirectory)/.appium/ + steps: - ${{ if eq(parameters.platform, 'ios')}}: - bash: | @@ -59,6 +62,10 @@ steps: ls -al $(npm root -g)/appium echo "##[endgroup]" + echo "##[group]Running ls -al $(npm root -g)/.appium" + ls -al $(npm root -g)/.appium + echo "##[endgroup]" + echo "##[group]Running ls -al $(npm root -g)/.appium-????????" ls -al $(npm root -g)/.appium-???????? echo "##[endgroup]" @@ -80,10 +87,13 @@ steps: # Clean up any leftover cached folders of appium and appium-doctor node modules - bash: | + rm -rf $(npm root -g)/.appium rm -rf $(npm root -g)/.appium-???????? rm -rf $(npm root -g)/.appium-doctor-???????? - displayName: "Delete temp .appium-???????? and .appium-doctor-???????? folders" + displayName: "Delete temp .appium and .appium-???????? and .appium-doctor-???????? folders" continueOnError: true + env: + APPIUM_HOME: $(APPIUM_HOME) - pwsh: | $fullLogsDir = Join-Path "$(LogDirectory)" "npm" @@ -91,6 +101,8 @@ steps: displayName: "Install Appium (Drivers)" continueOnError: false retryCountOnTaskFailure: 1 + env: + APPIUM_HOME: $(APPIUM_HOME) - pwsh: ./build.ps1 --target=dotnet --configuration="${{ parameters.configuration }}" --verbosity=diagnostic displayName: 'Install .NET' @@ -119,6 +131,8 @@ steps: displayName: $(Agent.JobName) ${{ if ne(parameters.platform, 'android')}}: retryCountOnTaskFailure: 1 + env: + APPIUM_HOME: $(APPIUM_HOME) - bash: | suffix=$(date +%Y%m%d%H%M%S) From 40ca01049114332a79555f410d4b11068e160ead Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 17:03:58 -0400 Subject: [PATCH 19/22] Move variables --- eng/pipelines/common/ui-tests-legacy-steps.yml | 3 --- eng/pipelines/common/ui-tests-steps.yml | 3 --- eng/pipelines/common/ui-tests.yml | 7 +++++++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/eng/pipelines/common/ui-tests-legacy-steps.yml b/eng/pipelines/common/ui-tests-legacy-steps.yml index c8b1bc628809..3f08bb8d1441 100644 --- a/eng/pipelines/common/ui-tests-legacy-steps.yml +++ b/eng/pipelines/common/ui-tests-legacy-steps.yml @@ -10,9 +10,6 @@ parameters: targetSample: "dotnet-legacy-controlgallery" configuration : "Release" -variables: - APPIUM_HOME: $(System.DefaultWorkingDirectory)/.appium/ - steps: - ${{ if eq(parameters.platform, 'ios')}}: - bash: | diff --git a/eng/pipelines/common/ui-tests-steps.yml b/eng/pipelines/common/ui-tests-steps.yml index b696dbe993ee..c2212263b41c 100644 --- a/eng/pipelines/common/ui-tests-steps.yml +++ b/eng/pipelines/common/ui-tests-steps.yml @@ -9,9 +9,6 @@ parameters: agentPoolAccessToken: '' configuration : "Release" -variables: - APPIUM_HOME: $(System.DefaultWorkingDirectory)/.appium/ - steps: - ${{ if eq(parameters.platform, 'ios')}}: - bash: | diff --git a/eng/pipelines/common/ui-tests.yml b/eng/pipelines/common/ui-tests.yml index 8865a818f0fa..dff176c43c35 100644 --- a/eng/pipelines/common/ui-tests.yml +++ b/eng/pipelines/common/ui-tests.yml @@ -48,6 +48,7 @@ stages: pool: ${{ parameters.androidPool }} variables: REQUIRED_XCODE: $(DEVICETESTS_REQUIRED_XCODE) + APPIUM_HOME: $(System.DefaultWorkingDirectory)/.appium/ steps: - template: ui-tests-steps.yml parameters: @@ -78,6 +79,7 @@ stages: pool: ${{ parameters.iosPool }} variables: REQUIRED_XCODE: $(DEVICETESTS_REQUIRED_XCODE) + APPIUM_HOME: $(System.DefaultWorkingDirectory)/.appium/ steps: - template: ui-tests-steps.yml parameters: @@ -107,6 +109,8 @@ stages: clean: all displayName: ${{ coalesce(project.desc, project.name) }} pool: ${{ parameters.windowsPool }} + variables: + APPIUM_HOME: $(System.DefaultWorkingDirectory)\.appium\ steps: - template: ui-tests-steps.yml parameters: @@ -132,6 +136,7 @@ stages: pool: ${{ parameters.macosPool }} variables: REQUIRED_XCODE: $(DEVICETESTS_REQUIRED_XCODE) + APPIUM_HOME: $(System.DefaultWorkingDirectory)/.appium/ steps: - template: ui-tests-steps.yml parameters: @@ -229,6 +234,7 @@ stages: pool: ${{ parameters.androidLegacyPool }} variables: REQUIRED_XCODE: $(DEVICETESTS_REQUIRED_XCODE) + APPIUM_HOME: $(System.DefaultWorkingDirectory)/.appium/ steps: - template: ui-tests-legacy-steps.yml parameters: @@ -260,6 +266,7 @@ stages: pool: ${{ parameters.iosLegacyPool }} variables: REQUIRED_XCODE: $(DEVICETESTS_REQUIRED_XCODE) + APPIUM_HOME: $(System.DefaultWorkingDirectory)/.appium/ steps: - template: ui-tests-legacy-steps.yml parameters: From a99468121472fa404794e0aa2d6db20686929481 Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 20:00:31 -0400 Subject: [PATCH 20/22] Remove old appium cleanup We now are setting APPIUM_HOME which will point appium to where we want our drivers/plugins saved, and this directory will be inside the CI/CD working directory so it should be 'clean' every time we run this. We shouldn't ever see the uninstall driver commands run, and we shouldn't need to touch any ~/.appium* folders from other pipelines. --- .../common/ui-tests-legacy-steps.yml | 43 +------------------ eng/pipelines/common/ui-tests-steps.yml | 43 +------------------ eng/scripts/appium-install.ps1 | 18 +++++--- 3 files changed, 13 insertions(+), 91 deletions(-) diff --git a/eng/pipelines/common/ui-tests-legacy-steps.yml b/eng/pipelines/common/ui-tests-legacy-steps.yml index 3f08bb8d1441..129f16fa26b8 100644 --- a/eng/pipelines/common/ui-tests-legacy-steps.yml +++ b/eng/pipelines/common/ui-tests-legacy-steps.yml @@ -50,52 +50,11 @@ steps: inputs: version: "20.3.1" displayName: "Install node" - - - bash: | - echo "##[group]Running ls -al $(npm root -g)" - ls -al $(npm root -g) - echo "##[endgroup]" - - echo "##[group]Running ls -al $(npm root -g)/appium" - ls -al $(npm root -g)/appium - echo "##[endgroup]" - - echo "##[group]Running ls -al $(npm root -g)/.appium" - ls -al $(npm root -g)/.appium - echo "##[endgroup]" - - echo "##[group]Running ls -al $(npm root -g)/.appium-????????" - ls -al $(npm root -g)/.appium-???????? - echo "##[endgroup]" - - echo "##[group]Running ls -al $(npm root -g)/appium-doctor" - ls -al $(npm root -g)/appium-doctor - echo "##[endgroup]" - - echo "##[group]Running ls -al $(npm root -g)/.appium-doctor-????????" - ls -al $(npm root -g)/.appium-doctor-???????? - echo "##[endgroup]" - - echo "##[group]Running ps aux" - ps aux - echo "##[endgroup]" - displayName: "Debugging output" - continueOnError: true - condition: startsWith(variables['Agent.Name'], 'XAMBOT') - - # Clean up any leftover cached folders of appium and appium-doctor node modules - - bash: | - rm -rf $(npm root -g)/.appium - rm -rf $(npm root -g)/.appium-???????? - rm -rf $(npm root -g)/.appium-doctor-???????? - displayName: "Delete temp .appium and .appium-???????? and .appium-doctor-???????? folders" - continueOnError: true - env: - APPIUM_HOME: $(APPIUM_HOME) - pwsh: | $fullLogsDir = Join-Path "$(LogDirectory)" "npm" ./eng/scripts/appium-install.ps1 -logsDir "$fullLogsDir" + Dir -Recurse $fullLogsDir | Get-Childitem | Select Fullname displayName: "Install Appium (Drivers)" continueOnError: false retryCountOnTaskFailure: 1 diff --git a/eng/pipelines/common/ui-tests-steps.yml b/eng/pipelines/common/ui-tests-steps.yml index c2212263b41c..f6e0fe0fd267 100644 --- a/eng/pipelines/common/ui-tests-steps.yml +++ b/eng/pipelines/common/ui-tests-steps.yml @@ -49,52 +49,11 @@ steps: inputs: version: "20.3.1" displayName: "Install node" - - - bash: | - echo "##[group]Running ls -al $(npm root -g)" - ls -al $(npm root -g) - echo "##[endgroup]" - - echo "##[group]Running ls -al $(npm root -g)/appium" - ls -al $(npm root -g)/appium - echo "##[endgroup]" - - echo "##[group]Running ls -al $(npm root -g)/.appium" - ls -al $(npm root -g)/.appium - echo "##[endgroup]" - - echo "##[group]Running ls -al $(npm root -g)/.appium-????????" - ls -al $(npm root -g)/.appium-???????? - echo "##[endgroup]" - - echo "##[group]Running ls -al $(npm root -g)/appium-doctor" - ls -al $(npm root -g)/appium-doctor - echo "##[endgroup]" - - echo "##[group]Running ls -al $(npm root -g)/.appium-doctor-????????" - ls -al $(npm root -g)/.appium-doctor-???????? - echo "##[endgroup]" - - echo "##[group]Running ps aux" - ps aux - echo "##[endgroup]" - displayName: "Debugging output" - continueOnError: true - condition: startsWith(variables['Agent.Name'], 'XAMBOT') - - # Clean up any leftover cached folders of appium and appium-doctor node modules - - bash: | - rm -rf $(npm root -g)/.appium - rm -rf $(npm root -g)/.appium-???????? - rm -rf $(npm root -g)/.appium-doctor-???????? - displayName: "Delete temp .appium and .appium-???????? and .appium-doctor-???????? folders" - continueOnError: true - env: - APPIUM_HOME: $(APPIUM_HOME) - pwsh: | $fullLogsDir = Join-Path "$(LogDirectory)" "npm" ./eng/scripts/appium-install.ps1 -logsDir "$fullLogsDir" + Dir -Recurse $fullLogsDir | Get-Childitem | Select Fullname displayName: "Install Appium (Drivers)" continueOnError: false retryCountOnTaskFailure: 1 diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index fe3c57686a8c..21d5fdd6812a 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -63,13 +63,17 @@ if (!(Test-Path $logsDir -PathType Container)) { New-Item -ItemType Directory -Path $logsDir } -# If there's a ~/.appium folder, remove it as it can cause issues from v1 -# it might also generally have caching issues for us with our runs -# $appiumUserData = (Join-Path $env:USERPROFILE ".appium") -# if (Test-Path $appiumUserData) { -# Write-Output "Removing $appiumUserData" -# Remove-Item -Path $appiumUserData -Force -Recurse -# } +# Get our path to APPIUM_HOME +$AppiumHome = $env:APPIUM_HOME +Write-Output "APPIUM_HOME: $AppiumHome" + +if (Test-Path $AppiumHome) { + Write-Output "Removing existing APPIUM_HOME Cache..." + Remove-Item -Path $AppiumHome -Recurse -Force +} + +# Create the directory for appium home +New-Item -ItemType Directory -Path $AppiumHome # Check for an existing appium install version $appiumCurrentVersion = "" From 025d6681e280902423b7a0289783d9dc80e9da66 Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 20:00:42 -0400 Subject: [PATCH 21/22] Install explicit versions --- eng/scripts/appium-install.ps1 | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index 21d5fdd6812a..8099a2596377 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -96,16 +96,6 @@ if ($appiumCurrentVersion -ne $appiumVersion) { write-Output "Installed appium $appiumVersion" } -# Try to clean up old npm packages -# if ($IsWindows) { -# npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-windows-driver -# } -# if ($IsMacOS) { -# npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-xcuitest-driver -# npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-mac2-driver -# } -# npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium-uiautomator2-driver - $existingDrivers = appium driver list --installed --json | ConvertFrom-Json Write-Output "List of installed drivers $existingDrivers" @@ -116,7 +106,7 @@ if ($IsWindows) { Write-Output "Updated appium driver windows" } else { Write-Output "Installing appium driver windows" - appium driver install --source=npm appium-windows-driver + appium driver install --source=npm appium-windows-driver@$windowsDriverVersion Write-Output "Installed appium driver windows" } } @@ -129,7 +119,7 @@ if ($IsMacOS) { Write-Output "Updated appium driver xcuitest" } else { Write-Output "Installing appium driver xcuitest" - appium driver install xcuitest + appium driver install xcuitest@$iOSDriverVersion Write-Output "Installed appium driver xcuitest" } @@ -139,7 +129,7 @@ if ($IsMacOS) { Write-Output "Updated appium driver mac2" } else { Write-Output "Installing appium driver mac2" - appium driver install mac2 + appium driver install mac2@$macDriverVersion Write-Output "Installed appium driver mac2" } } @@ -150,7 +140,7 @@ if ($existingDrivers.uiautomator2) { Write-Output "Updated appium driver uiautomator2" } else { Write-Output "Installing appium driver uiautomator2" - appium driver install uiautomator2 + appium driver install uiautomator2@$androidDriverVersion Write-Output "Installed appium driver uiautomator2" } From 05f70e03077fe4d377cb21d65355262a22aa1145 Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 22 May 2024 20:06:00 -0400 Subject: [PATCH 22/22] List out appium home dir, not npm logs --- eng/pipelines/common/ui-tests-legacy-steps.yml | 2 +- eng/pipelines/common/ui-tests-steps.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/ui-tests-legacy-steps.yml b/eng/pipelines/common/ui-tests-legacy-steps.yml index 129f16fa26b8..ecf009a4dc4a 100644 --- a/eng/pipelines/common/ui-tests-legacy-steps.yml +++ b/eng/pipelines/common/ui-tests-legacy-steps.yml @@ -54,7 +54,7 @@ steps: - pwsh: | $fullLogsDir = Join-Path "$(LogDirectory)" "npm" ./eng/scripts/appium-install.ps1 -logsDir "$fullLogsDir" - Dir -Recurse $fullLogsDir | Get-Childitem | Select Fullname + Dir -Recurse $(APPIUM_HOME) | Get-Childitem | Select Fullname displayName: "Install Appium (Drivers)" continueOnError: false retryCountOnTaskFailure: 1 diff --git a/eng/pipelines/common/ui-tests-steps.yml b/eng/pipelines/common/ui-tests-steps.yml index f6e0fe0fd267..37edc0526431 100644 --- a/eng/pipelines/common/ui-tests-steps.yml +++ b/eng/pipelines/common/ui-tests-steps.yml @@ -53,7 +53,7 @@ steps: - pwsh: | $fullLogsDir = Join-Path "$(LogDirectory)" "npm" ./eng/scripts/appium-install.ps1 -logsDir "$fullLogsDir" - Dir -Recurse $fullLogsDir | Get-Childitem | Select Fullname + Dir -Recurse $(APPIUM_HOME) | Get-Childitem | Select Fullname displayName: "Install Appium (Drivers)" continueOnError: false retryCountOnTaskFailure: 1