[ci] Fix Appium provisioning when no global npm exists #29607
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
This pull request updates the Appium provisioning logic in
Provisioning.csproj
to handle errors more gracefully when checking the installed Appium version. The most important changes include adding error detection for thenpm list
output and ensuring a fallback mechanism to force installation if an error is detected.When no global file is found it was throwing a error like so :
Error handling improvements:
_AppiumNpmListHasError
to detect if thenpm list
output contains an error. This property is set toTrue
when an error is found. ([src/Provisioning/Provisioning.csprojL168-R182](https://github.com/dotnet/maui/pull/29607/files#diff-7b9d0c8e6acc03936bbba9421e02c53277575ad074bee658e94b87b4011f8c66L168-R182)
)JsonPeek
task to conditionally extract the Appium version only if no error is detected in thenpm list
output. ([src/Provisioning/Provisioning.csprojL168-R182](https://github.com/dotnet/maui/pull/29607/files#diff-7b9d0c8e6acc03936bbba9421e02c53277575ad074bee658e94b87b4011f8c66L168-R182)
)_AppiumNpmListVersion
to an empty value when an error is detected, ensuring that Appium will be reinstalled. ([src/Provisioning/Provisioning.csprojL168-R182](https://github.com/dotnet/maui/pull/29607/files#diff-7b9d0c8e6acc03936bbba9421e02c53277575ad074bee658e94b87b4011f8c66L168-R182)
)Issues Fixed
Provisioning appium on new windows machine