[WV-2665] Add Google Drive OAuth utility for Cordova app download and BrowserStack video upload#4725
Open
tarunramireddy wants to merge 5 commits intowevote:developfrom
Conversation
…ack video upload - Add shared googleDriveOAuth.js helper with cached token and interactive first-run browser flow - Add downloadAppsFromDriveApi.js to download APK/IPA from a Drive folder to the local apps directory - Add uploadVideosToDriveFromBrowserStack.js to fetch a BrowserStack session video and upload to a Drive folder - Refactor DownloadVideo.browser.js to delegate to the shared upload utility - Add googleDriveOAuth.config.template.js and googleDriveOAuthToken.template.js for setup guidance - Add drive:download and drive:upload-video npm scripts - Update .gitignore to cover OAuth config and token files
There was a problem hiding this comment.
Pull request overview
This PR adds Google Drive OAuth-based utilities under tests/browserstack_automation/ to (1) download Cordova app binaries (APK/IPA) from a Drive folder and (2) upload BrowserStack session videos to a Drive folder, replacing prior service-account based access patterns.
Changes:
- Introduces a shared Google Drive OAuth helper with local-browser auth and cached token persistence.
- Adds CLI utilities to download APK/IPA files from a Drive folder and upload BrowserStack session videos to Drive.
- Refactors the existing
DownloadVideo.browser.jsscript to delegate to the new upload utility; updates repo ignore rules and package scripts.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/browserstack_automation/utils/googleDriveOAuth.js | New OAuth helper for authenticated Google Drive API client creation + token caching. |
| tests/browserstack_automation/utils/downloadAppsFromDriveApi.js | New CLI utility to list a Drive folder and download APK/IPA to apps/. |
| tests/browserstack_automation/utils/uploadVideosToDriveFromBrowserStack.js | New CLI utility to fetch BrowserStack session video and upload to Drive. |
| tests/browserstack_automation/utils/testOAuth.js | Manual smoke-test script for OAuth helper. |
| tests/browserstack_automation/specs/DownloadVideo.browser.js | Refactored to call shared upload utility instead of inlining Drive/BrowserStack logic. |
| tests/browserstack_automation/config/googleDriveOAuth.config.template.js | Template for OAuth client credentials config. |
| tests/browserstack_automation/config/googleDriveOAuthToken.template.js | Documentation template describing generated token JSON shape/location. |
| tests/browserstack_automation/config/googleDrive.config.template.js | Template for Drive folder IDs/paths and listing tunables used by the utilities. |
| package.json | Adds drive:download and drive:upload-video scripts. |
| .gitignore | Ignores Drive config/token files and downloaded apps directory contents. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/browserstack_automation/utils/downloadAppsFromDriveApi.js
Outdated
Show resolved
Hide resolved
tests/browserstack_automation/utils/downloadAppsFromDriveApi.js
Outdated
Show resolved
Hide resolved
tests/browserstack_automation/utils/uploadVideosToDriveFromBrowserStack.js
Show resolved
Hide resolved
tests/browserstack_automation/config/googleDrive.config.template.js
Outdated
Show resolved
Hide resolved
…download utilities - Restrict OAuth token file permissions to owner-readable only (mode 0o600) - Validate REDIRECT_URI config before use to avoid low-level TypeError - Sort APK/IPA candidates by modifiedTime (newest first) instead of arbitrary ordering
Change FOLDER_URL from '-' to empty string so that missing config produces the intended 'Provide --folder=...' error instead of a confusing 'Could not extract folder ID' error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary:
What
Adds a shared OAuth 2.0 utility for Google Drive access and two reusable CLI utilities built on top of it:
apps/directory for use with BrowserStack Cordova testing.How to use
Files changed
utils/googleDriveOAuth.js— new shared OAuth helperutils/downloadAppsFromDriveApi.js— new download utilityutils/uploadVideosToDriveFromBrowserStack.js— new upload utilityspecs/DownloadVideo.browser.js— refactored to delegate to shared utilityconfig/googleDriveOAuth.config.template.js— setup template (credentials not included)config/googleDriveOAuthToken.template.js— documents auto-generated token shapedrive:downloadanddrive:upload-videoscripts