Skip to content

Commit

Permalink
Revert "feat: add find element e2e testing"
Browse files Browse the repository at this point in the history
This reverts commit 9d5b111.
  • Loading branch information
codeskyblue authored Mar 26, 2024
1 parent 7b1832a commit 9e6b8d2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 113 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct ListView: View {
var body: some View {
List(1...100, id: \.self) { number in
Text("Row\(number)")
}.accessibilityLabel("LIST_CONTAINER")
}
.navigationBarTitle("Numbers List", displayMode: .inline)
}
}
40 changes: 15 additions & 25 deletions e2e_benchmarks/test_element_commands.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'''
WDA Element Command Testing
source code here: https://github.com/appium/WebDriverAgent/blob/master/WebDriverAgentLib/Commands/FBElementCommands.m
WDA API document and example(not offical): https://documenter.getpostman.com/view/1837823/TVmMhJNB#f68f7fd9-3a08-4a0b-9253-f1bedf0ae926
WDA API document and example(not offical): https://documenter.getpostman.com/view/1837823/TVmMhJNBa17feaf2-237e-4fe7-8e2f-75f132420d26
'''
import os
import pytest
import unittest
import jsonschema
import wda
from .constant import *

Expand All @@ -24,7 +25,7 @@ def tearDown(self):
self.wda_client.close()
[os.remove(temp_file) for temp_file in [self.temp_file_pic] if os.path.exists(temp_file)]


'''
Method: GET
Endpoint: {{baseURL}}/session/{{sessionId}}/window/size
Expand All @@ -46,7 +47,6 @@ def test_btn_enable(self):
def test_btn_enable(self):
assert self.app(text='DISABLED_BTN').enabled == False


'''
Method: GET
Endpoint: {{baseURL}}/session/{{sessionId}}/element/{{uuid}}/rect
Expand All @@ -60,7 +60,6 @@ def test_rect(self):
hasattr(rect, 'height') and type(rect.height) == int,
])


'''
Method: GET
Endpoint: {{baseURL}}/session/{{sessionId}}/element/{{uuid}}/attribute/{{attribute_name}}
Expand Down Expand Up @@ -95,6 +94,7 @@ def test_attribute_btn_not_displayed(self):
self.assertEqual(self.app(text='HIDDEN_BTN').displayed, False)



'''
Method: GET
Endpoint: {{baseURL}}/session/{{sessionId}}/element/{{uuid}}/selected
Expand All @@ -105,7 +105,7 @@ def test_btn_selected(self):
def test_attribute_btn_not_displayed(self):
self.assertEqual(self.app(text='UNCHECKED_BTN').selected(), False)


'''
Method: GET
Endpoint: {{baseURL}}/session/{{sessionId}}/element/{{uuid}}/name
Expand All @@ -126,7 +126,6 @@ def test_input_text(self):
self.app(id='INPUT_FIELD').set_text('test')
self.assertEqual(self.app(id='INPUT_FIELD').value, 'test')


'''
Method: POST
Endpoint: {{baseURL}}/session/{{sessionId}}/element/{{uuid}}/click
Expand Down Expand Up @@ -159,15 +158,15 @@ def test_screenshot(self):
self.app.screenshot(png_filename=self.temp_file_pic)
assert os.path.exists(self.temp_file_pic)


'''
Method: POST
Endpoint: {{baseURL}}/session/{{sessionId}}/screenshot/{{uuid}}
Description: screenshot for target element.
'''
@pytest.mark.skip('NOT IMPLEMENTED')
def test_screenshot_element(self):
pass
...


'''
Expand All @@ -181,13 +180,11 @@ def test_ele_accessible_is_true(self):
self.assertTrue(self.app(text='ENABLED_BTN').accessible)



'''
Method: POST
Endpoint: {{baseURL}}/session/{{sessionId}}/wda/element/{{uuid}}/accessibilityContainer
NOTE Swift accessibility Container is not useful, always return false.
Example:
```
import SwiftUI
struct ContentView: View {
Expand All @@ -206,17 +203,14 @@ def test_ele_accessible_is_true(self):
static var previews: some View {
ContentView()
}
}
```
'''
}'''
@pytest.mark.skip('WDA API NOT USEFUL')
def test_ele_accessibilityContainer_is_true(self):
self.assertFalse(self.app(id='Combined Items').accessibility_container)

def test_ele_accessibilityContainer_is_false(self):
self.assertFalse(self.app(id='ENABLED_BTN').accessibility_container)


'''
Method: POST
Endpoint: {{baseURL}}/session/{{sessionId}}/wda/element/{{uuid}}/swipe
Expand All @@ -227,6 +221,7 @@ def test_ele_swipe_top(self):
self.app(text="Row1").click()



'''
Method: POST
Endpoint: {{baseURL}}/session/{{sessionId}}/wda/element/{{uuid}}/pinch
Expand All @@ -235,7 +230,6 @@ def test_ele_swipe_top(self):
def test_pinch(self):
...


'''
Method: POST
Endpoint: {{baseURL}}/session/{{sessionId}}/wda/element/{{uuid}}/touchAndHold
Expand All @@ -248,15 +242,13 @@ def test_touch_and_hold(self):
self.app(text='LONG_TAP_ALERT').tap_hold(duration=2)
self.assertTrue(self.app(text='LONG_TAP_ALERT_OK').get(timeout=1).displayed)


'''
Method: POST
Endpoint: {{baseURL}}/session/{{sessionId}}/wda/element/{{uuid}}/dragfromtoforduration
'''
@pytest.mark.skip('NOT IMPLEMENTED')
def test_drag_from_to_for_duration(self):
pass

...

'''
Method: POST
Expand All @@ -281,7 +273,6 @@ def test_app_drag_from_to_for_duration(self):
def test_ele_select(self):
pass


'''
Method: POST
Endpoint: {{baseURL}}/session/{{sessionId}}/wda/keys
Expand All @@ -290,16 +281,15 @@ def test_wda_keys(self):
self.app(text='INPUT_FIELD').click()
self.app.send_keys('hello world')
self.assertEqual(self.app(text='INPUT_FIELD').value, 'hello world')



'''
Method: POST
Endpoint: {{baseURL}}/session/{{sessionId}}/wda/element/{{uuid}}/forceTouch
'''
@pytest.mark.skip('NOT IMPLEMENTED')
def test_ele_force_touch(self):
pass


'''
Method: POST
Expand All @@ -312,14 +302,14 @@ def test_ele_touble_tap(self):
self.app.double_tap(x, y)
self.assertTrue(self.app(text='DOUBLE_TAP_ALERT_OK').get(timeout=1).displayed)


'''
Method: POST
Endpoint: {{baseURL}}/session/{{sessionId}}/wda/touchAndHold
'''
def test_wda_touch_and_hold(self):
def test_ele_touble_tap(self):
bounds = self.app(text='LONG_TAP_ALERT').bounds
x = int(bounds.x + bounds.width * 0.5)
y = int(bounds.y + bounds.height * 0.5)
self.app.tap_hold(x, y, duration=2)
self.assertTrue(self.app(text='LONG_TAP_ALERT_OK').get(timeout=1).displayed)

87 changes: 0 additions & 87 deletions e2e_benchmarks/test_find_element_commands.py

This file was deleted.

0 comments on commit 9e6b8d2

Please sign in to comment.