-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Replace Jest runner with Wdio runner E2E #41218
base: main
Are you sure you want to change the base?
Changes from all commits
0484f3c
ada6a34
49a00f2
a354699
27fdd78
9932eda
3b83c61
e8d76fa
06b08b0
2ba9442
8d82d7d
f41c4d0
b20667d
28cb6a9
350880c
a3849db
4309e0c
1fcce98
255b327
4c79fec
3cad9b3
8348cb3
b7b0076
f455d50
86c99b3
1e18464
0fd1213
12f5e13
03bc5dd
7e6427c
55ed02b
10789f7
596fb91
c23d4d2
69c7e54
471a522
3753306
36ca1bb
7fcfb38
d17b9be
f2497e6
cda30a1
40e52c7
eda6752
c2c9f4f
339ef7d
8211365
71c00c2
bd1fccb
e0ca2c8
ef80314
b3f7823
906f8df
7a62a0a
cd3dee3
3165959
4aa3771
d8a408f
85aff57
e2ef1ba
91cc9e2
d643913
d26c6b0
2d6d890
05fa408
d9763b5
aa35261
588288d
9d15557
84688cb
e954979
cc010b9
9405126
ba4b18c
ba85414
b68ffb4
ab0a31e
ca84525
d5cc3b2
1579c4c
be2119b
5cbf257
650b71a
5a29713
49da014
ba322e7
7c311bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
SOURCE_DIR=../../../node_modules | ||
DEST_DIR=../node_modules | ||
|
||
# List of package directories to copy | ||
PACKAGES=("appium" "appium-uiautomator2-driver" "appium-xcuitest-driver" "@wdio") | ||
|
||
# Copy each package directory | ||
for PACKAGE in "${PACKAGES[@]}"; do | ||
echo "Copying $PACKAGE..." | ||
cp -R "$SOURCE_DIR/$PACKAGE" "$DEST_DIR" | ||
done | ||
|
||
echo "Copying completed." |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,40 +8,42 @@ | |
* @format | ||
*/ | ||
|
||
import {driver} from '../../jest.setup'; | ||
|
||
type PlatformsReference = { | ||
ios: string, | ||
android: string, | ||
}; | ||
|
||
class Utils { | ||
async checkElementExistence(locator: string): Promise<boolean> { | ||
await driver.$(locator).waitForDisplayed(); | ||
return driver.$(locator).isDisplayed(); | ||
await $(locator).waitForDisplayed(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: In all these helper methods, I suggest utilizing the For example, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It helps debugging a ton |
||
return $(locator).isDisplayed(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can just return waitForDisplayed throws an error if it fails, or returns true if it succeeds. Adding |
||
} | ||
|
||
async clickElement(locator: string): Promise<void> { | ||
await driver.$(locator).waitForDisplayed(); | ||
await driver.$(locator).click(); | ||
await $(locator).waitForDisplayed(); | ||
await $(locator).click(); | ||
} | ||
|
||
async getElementText(locator: string): Promise<string> { | ||
await driver.$(locator).waitForDisplayed(); | ||
return driver.$(locator).getText(); | ||
await $(locator).waitForDisplayed(); | ||
return $(locator).getText(); | ||
} | ||
|
||
async setElementText(locator: string, text: string): Promise<void> { | ||
await $(locator).waitForDisplayed(); | ||
return $(locator).setValue(text); | ||
} | ||
|
||
platformSelect(platforms: PlatformsReference): string { | ||
// if something goes wrong, we fallback to ios. But it should never happent, the process will fail way earlier. | ||
return platforms[process?.env?.E2E_DEVICE || 'ios']; | ||
return platforms[browser.capabilities.platformName.toLowerCase()]; | ||
} | ||
|
||
async scrollToElement(locator: string): Promise<void> { | ||
let {width, height} = await driver.getWindowSize(); | ||
let elementIsFound; | ||
try { | ||
elementIsFound = await driver.$(locator).isDisplayed(); | ||
while (!elementIsFound) { | ||
elementIsFound = await $(locator).isClickable(); | ||
while (!(await elementIsFound)) { | ||
driver.touchPerform([ | ||
{ | ||
action: 'press', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest changing this scroll logic completely. Taking the window size and performing mathematical operations on it to determine touches is prone to error. Here's a better way:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've tried to change scroll logic with your or similar solutions, but after testing, the current implementation is less flak, at least in the local environment. |
||
|
@@ -67,7 +69,7 @@ class Utils { | |
action: 'release', | ||
}, | ||
]); | ||
elementIsFound = await driver.$(locator).isDisplayed(); | ||
elementIsFound = await $(locator).isClickable(); | ||
} | ||
} catch (err) { | ||
console.log('Element is not found'); | ||
|
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.
You can also include the error screenshots here. That way, the engineer can see a screenshot of the failure.