Skip to content
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

feat: let usePrebuiltWDA run prebuild when the given derivedDataPath has no directories, or no this.wda.retrieveDerivedDataPath present #2374

Closed
wants to merge 7 commits into from

Conversation

KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented Mar 30, 2024

Helps appium/appium#19923

This PR lets give prebuildWDA flag. If the flag is true, WebDriverAgent will run build only xcodebuild command with build-for-testing. Then, the WDA instance starts a xcodebuild WDA session with test-without-building.

With appium:derivedDataPath, the xcodebuild sets the derived data path with it. If the path already has Build directory, it will skip the prebuildWDA step to keep the backward compatibility.
If no appium:derivedDataPath, the path will depends on xcodebuild. By the prebuildWDA flag, both cases will not require prebuild project environment.

Below is an example with prebuildWDA. At least with prebuildWDA (which is only for WDA instance argument), the usePrebuiltWDA works even it is an initial time.

2024-03-30 18:07:13:611 - [WebDriverAgent] 'pgrep -if B19C41AA-E682-4F8B-8EF4-383D58AECFC0.*XCTRunner' didn't detect any matching processes. Return code: 1
2024-03-30 18:07:13:932 - [XCUITestDriver@b842 (7dcc15e1)] Pre-building WDA before launching test
2024-03-30 18:07:13:933 - [XCUITestDriver@b842 (7dcc15e1)] Beginning build with command 'xcodebuild build-for-testing -project /Users/kazu/GitHub/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /Users/kazu/Library/Developer/Xcode/DerivedData/WebDriverAgent-atimlzuvtuknvqeejmpxrcbxprgc -destination id=B19C41AA-E682-4F8B-8EF4-383D58AECFC0 IPHONEOS_DEPLOYMENT_TARGET=17.2 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO' in directory '/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/appium-webdriveragent'
2024-03-30 18:07:13:934 - [XCUITestDriver@b842 (7dcc15e1)] Output from xcodebuild will only be logged if any errors are present there. To change this, use 'showXcodeLog' desired capability
2024-03-30 18:07:15:060 - [Xcode] xcodebuild exited with code '0' and signal 'null'
2024-03-30 18:07:15:061 - [XCUITestDriver@b842 (7dcc15e1)] Beginning test with command 'xcodebuild test-without-building -project /Users/kazu/GitHub/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /Users/kazu/Library/Developer/Xcode/DerivedData/WebDriverAgent-atimlzuvtuknvqeejmpxrcbxprgc -destination id=B19C41AA-E682-4F8B-8EF4-383D58AECFC0 IPHONEOS_DEPLOYMENT_TARGET=17.2 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO' in directory '/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/appium-webdriveragent'
2024-03-30 18:07:15:062 - [XCUITestDriver@b842 (7dcc15e1)] Output from xcodebuild will only be logged if any errors are present there. To change this, use 'showXcodeLog' desired capability
2024-03-30 18:07:15:560 - [XCUITestDriver@b842 (7dcc15e1)] Waiting up to 60000ms for WebDriverAgent to start
2024-03-30 18:07:15:560 - [XCUITestDriver@b842 (7dcc15e1)] Matched '/status' to command name 'getStatus'```

This would fail when the `appium:derivedDataPath` or `await this.wda.retrieveDerivedDataPath()` is broken. So, I also wondered if we should enable `prebuildWDA` every time for `this.opts.usePrebuiltWDA`. As the above log with timestamp, if the directory already has proper built, `xcodebuild build-for-testing` ends pretty fast.

@KazuCocoa KazuCocoa changed the title chore: let usePrebuiltWDA run prebuild when the given derivedDataPath has no directories, or no this.wda.retrieveDerivedDataPath present feat: let usePrebuiltWDA run prebuild when the given derivedDataPath has no directories, or no this.wda.retrieveDerivedDataPath present Mar 30, 2024
@mykola-mokhnach
Copy link
Contributor

I am not quite sure we should complicate this (already complicated) logic further. If one would like to prebuild WDA using the default or a custom derived data path then they could use the build-wda driver script (similarly to what we do in the java-client CI).
Eventually, this scenario is for advanced users who know what they do.

@KazuCocoa
Copy link
Member Author

yea. For now, I think giving prebuildWDA: this.opts.usePrebuiltWDA would be more original intention. I found #374, which introduced prebuildWDA. Then, it looks like initially it wanted to run rebuild every time with prebuildWDA

@KazuCocoa
Copy link
Member Author

mm, no. we just need to address prebuildWDA in the caps. maybe that's it.

@KazuCocoa KazuCocoa closed this Mar 31, 2024
@KazuCocoa KazuCocoa deleted the tune-useprebuiltwda branch March 31, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants