Skip to content

[ci] Fix Appium provisioning when no global npm exists #29607

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

Merged
merged 1 commit into from
May 22, 2025
Merged

Conversation

rmarinho
Copy link
Member

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 the npm 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 :

PS C:\repos\dotnet\maui> npm list -g appium --json --depth 1 --loglevel error
npm error code ENOENT
npm error syscall lstat
npm error path Q:\.tools\.npm-global
npm error errno -4058
npm error enoent ENOENT: no such file or directory, lstat 'Q:\.tools\.npm-global'
npm error enoent This is related to npm not being able to find a file.
npm error enoent
{
  "error": {
    "code": "ENOENT",
    "summary": "ENOENT: no such file or directory, lstat 'Q:\\.tools\\.npm-global'",
    "detail": "This is related to npm not being able to find a file."
  }
}
npm error A complete log of this run can be found in: Q:\.tools\.npm\_logs\2025-05-21T11_45_26_019Z-debug-0.log

Error handling improvements:

  • Added a new property _AppiumNpmListHasError to detect if the npm list output contains an error. This property is set to True when an error is found. ([src/Provisioning/Provisioning.csprojL168-R182](https://github.com/dotnet/maui/pull/29607/files#diff-7b9d0c8e6acc03936bbba9421e02c53277575ad074bee658e94b87b4011f8c66L168-R182))
  • Modified the JsonPeek task to conditionally extract the Appium version only if no error is detected in the npm list output. ([src/Provisioning/Provisioning.csprojL168-R182](https://github.com/dotnet/maui/pull/29607/files#diff-7b9d0c8e6acc03936bbba9421e02c53277575ad074bee658e94b87b4011f8c66L168-R182))
  • Introduced a fallback mechanism to set _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

@Copilot Copilot AI review requested due to automatic review settings May 21, 2025 11:53
@rmarinho rmarinho requested a review from a team as a code owner May 21, 2025 11:53
@rmarinho rmarinho requested review from PureWeen and tj-devel709 May 21, 2025 11:53
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Files not reviewed (1)
  • src/Provisioning/Provisioning.csproj: Language not supported

@rmarinho rmarinho requested a review from mattleibow May 21, 2025 11:54
@rmarinho rmarinho added area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions testing-infrastructure Issue relating to testing infrastructure labels May 21, 2025
@rmarinho rmarinho changed the title [ci] Fix Appium provisioning when no global nom exists [ci] Fix Appium provisioning when no global npm exists May 21, 2025
@rmarinho rmarinho merged commit 5fc2590 into main May 22, 2025
129 of 132 checks passed
@rmarinho rmarinho deleted the fix-appium-prov branch May 22, 2025 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions testing-infrastructure Issue relating to testing infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants