-
Notifications
You must be signed in to change notification settings - Fork 129
Enable Browserstack iOS Tests #3537
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
base: main
Are you sure you want to change the base?
Conversation
|
Thanks! This looks fantastic!
What's the plan for adding this to to GitHub Actions workflow? That’s pretty critical. |
https://github.com/karunkop/em/blob/71bdda4b60bfad783a7daf6b6aae41f3594c6ddd/.github/workflows/ios.yml, I suppose running IOS tests in CI is pretty similar to how we run tests locally. We will need to comment out the disabled 'on: push' event in the yml file and remove the manual |
|
I pulled the PR, installed dependencies, and ran https://automate.browserstack.com/projects/em/builds/Local+rainerevere/3
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good! Just need your help getting them to pass on my end.
Please merge main and resolve merge conflicts when you get a chance.
| * Uses the global browser object from WDIO. | ||
| */ | ||
| const waitForElement = async (selector: string, { timeout = 5000 }: WaitForElementOptions = {}): Promise<Element> => { | ||
| await browser.waitUntil(async () => !!(await browser.$(selector)).elementId, { timeout }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a bit slow since it has to cross the API boundary twice. Does the global browser have a native way to wait for a selector? Otherwise we should probably do the polling in the inner await.
We can come back to this later as an optimization but I wanted to point it out.
| // Use browser.keys() which works better on iOS Safari than sendKeys | ||
| // Type each character individually for reliability | ||
| for (const char of value) { | ||
| await browser.keys(char) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might not be necessary to send the keys individually. After all, the native input event can even send multiple characters in a single event when typing quickly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can migrate this to directly imported helpers in another PR as we did with Puppeteer.
| getSelection, | ||
| hideKeyboardByTappingDone, | ||
| isKeyboardShown, | ||
| keyboard, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks for updating this to match our Puppeteer helper.
| ) | ||
|
|
||
| browser.pause(10000) | ||
| await browser.pause(10000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Change to wait until
|
I'm also seeing a few log files which maybe need to be added to the
|

Close #2127
Changes Made:
I have completely replaced the exisiting webdriverio infrastructure paired up with jest and
browserstack-locallib withWebdriverioown test runner@wdio/cliwhich does all the configuration, framework and service such asbrowserstackmanagement. Sincewdiohandles everything, i.e starting tunnel before tests, automatic stops after completion, we do not require manual tunnel setup like before. Alsowdiois built specifically for browser/app automation (unlike vitest/jest which is for unit testing).wdioexecutes test suites with nativeWebDriversupport via@wdio/mocha-frameworkand@wdio/browserstack-servicewhich is responsible for automatic tunnel, session, and credential management.wdioalso provides lifecycle hooks that are very helpful for initiating a session more effeciently.The configuration files are now divided as
wdio.base.conf.tswhich contains common settings for ios safari testing,wdio.browserstack.conf.tsusing@wdio/browserstack-servicethat creates a automatic tunnel with cloud browserstack service on the go, andwdio.local.conf.tsfor local Appium testing which is only used incase we need to run tests on local IOS simulator.Here is the relevant links to wdio documentation:
Running Tests:
Local Development
Prerequisites
Environment Variables:
Start the Dev Server:
Helpers Update:
tap.ts and gesture.ts:
Now updated to use
performActionsdirectly to avoid the automaticreleaseActionscall. Safari/XCUITest doesn't support the DELETE /actions endpoint (releaseActions) now which WebDriverIO's action().perform() calls automatically after performing. This was one of the main issues which was causing tests to fail. Minor adjustments/updates to some other helpers are also done along the way as per wdio browser API.As of now, running tests in CI is pretty straightforward. Although we need to do it manually for time-being as it is temporarily disabled expect when manually triggered. We can always check for builds in https://automation.browserstack.com/projects/em/builds. Local build and CI build are clearly identified because of their identifier. We can also walthrough the entire automation via https://automation.browserstack.com/projects/em/builds/CI/2?tab=tests&testListView=spec&details=2566272669 which was super helpful for debugging purpose :)