-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d07fef
commit aed0797
Showing
5 changed files
with
88 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
**提Bug需要注意的事项** | ||
**看完请删掉该内容** | ||
|
||
尽可能详细的信息。For example: | ||
|
||
- [ ] 版本号(`pip show uiautomator2`) | ||
- [ ] 手机截图 | ||
- [ ] 相关日志 | ||
- [ ] 最好能附上可能复现问题的代码。 | ||
>*提Bug需要注意的事项* | ||
> | ||
>尽可能详细的信息。For example: | ||
> | ||
>- 版本号(`pip show uiautomator2`) | ||
>- 手机截图 | ||
>- 相关日志 | ||
>- 最好能附上可能复现问题的代码。 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# coding: utf-8 | ||
|
||
import uiautomator2 as u2 | ||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def d(): | ||
return u2.connect() | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def sess(d) -> u2.Session: | ||
with d.session("io.appium.android.apis") as s: | ||
yield s |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# coding: utf-8 | ||
# | ||
|
||
import uiautomator2 as u2 | ||
import pytest | ||
|
||
# def setup_function(): | ||
|
||
|
||
def test_get_text(sess: u2.Session): | ||
assert sess.xpath("App").get_text() == "App" | ||
|
||
|
||
def test_click(sess: u2.Session): | ||
sess.xpath("App").click() | ||
assert sess.xpath("Alarm").wait() | ||
assert sess.xpath("Alarm").exists | ||
|
||
|
||
def test_all(sess: u2.Session): | ||
app = sess.xpath('//*[@text="App"]') | ||
assert app.wait() | ||
assert len(app.all()) == 1 | ||
assert app.exists |
This file contains 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
This file contains 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