ui-testing

What is the best practice to simulate an ENTER or RETURN using Selenium WebDriver

混江龙づ霸主 提交于 2019-12-01 13:28:38
I came across this solution to my initial problem, which was to simulate an ENTER or RETURN key press using Selenium WebDriver. However, in my code, I strictly want to use only one of the two WebElement.sendKeys(Keys.ENTER); vs WebElement.sendKeys(Keys.RETURN); . What is the best practice when doing the same, since there seems to be divided opinion about using enter or return, since both work MOST of the time? In what scenarios would one or the other not work, and is there one which would ALWAYS work? As a performancewise I do not get any change on both of these, But yes I know one difference

What is the best practice to simulate an ENTER or RETURN using Selenium WebDriver

孤街醉人 提交于 2019-12-01 11:43:35
问题 I came across this solution to my initial problem, which was to simulate an ENTER or RETURN key press using Selenium WebDriver. However, in my code, I strictly want to use only one of the two WebElement.sendKeys(Keys.ENTER); vs WebElement.sendKeys(Keys.RETURN); . What is the best practice when doing the same, since there seems to be divided opinion about using enter or return, since both work MOST of the time? In what scenarios would one or the other not work, and is there one which would

XCode 7 UI Testing: Dismissal of system-generated UIAlertController does not work

坚强是说给别人听的谎言 提交于 2019-12-01 10:11:57
I have a UI test which involves the dismissal of a system-generated UIAlertController . This alert asks the user for the permission to access the device's calendar. The objective of the test is the behaviour after a tap on the OK button: 1 let app = XCUIApplication() ... // this code was basically generated by the recording feature of XCode 7 2 app.alerts.elementBoundByIndex(0).collectionViews.buttons["OK"].tap() Now, instead of clicking the OK button, line 2 makes the simulator tap onto the first button which happens to be the Cancel button... Additionally, I found out that the testing

XCode 7 UI Testing: Dismissal of system-generated UIAlertController does not work

六月ゝ 毕业季﹏ 提交于 2019-12-01 08:52:03
问题 I have a UI test which involves the dismissal of a system-generated UIAlertController . This alert asks the user for the permission to access the device's calendar. The objective of the test is the behaviour after a tap on the OK button: 1 let app = XCUIApplication() ... // this code was basically generated by the recording feature of XCode 7 2 app.alerts.elementBoundByIndex(0).collectionViews.buttons["OK"].tap() Now, instead of clicking the OK button, line 2 makes the simulator tap onto the

Swift UITesting error: Invalid escape sequence in literal. \\U201c

你。 提交于 2019-11-30 18:54:49
I am building an automation suite using Xcode 7 with swift. My app loads with the following Alert View: Allow "Light Alarm" to access your location while you use the app? When I record with UI Testing and click this alert I get the following code: app.alerts["Allow \U201cLight Alarm\U201c to access your location while you use the app?"] Note: The quotes has been replaced with \U201c However, when I try and compile I get the following error: "Invalid escape sequence in literal" Anyone know how to get round this? Martin R This seems to be a bug in Xcode when generating code during UI recording.

How to test Dynamic Type (larger font sizes) in iOS Simulator

百般思念 提交于 2019-11-30 13:42:25
Changing Dynamic Type settings in iOS can be done manually (Settings > General > Accessibility > Larger Text). But this does not appear to work in the current Simulator (v9.3 at the time of writing), and doing so manually is not a solution where automation is required. Question: Is there a way to launch an app with Dynamic Type settings to launch an app with larger font sizes? Note: This is not only useful for UI testing, but also for the purpose of creating screenshots using Fastlane Snapshot with larger font sizes. As of Xcode 8, there is a better option than the undocumented launch

UITesting Xcode 7: How to tell if XCUIElement is visible?

女生的网名这么多〃 提交于 2019-11-30 13:31:17
I am automating an app using UI Testing in Xcode 7. I have a scrollview with XCUIElements (including buttons, etc) all the way down it. Sometimes the XCUIElements are visible, sometimes they hidden too far up or down the scrollview (depending on where I am on the scrollview). Is there a way to scroll items into view or maybe tell if they are visible or not? Thanks Unfortunately Apple hasn't provided any scrollTo method or a .visible parameter on XCUIElement . That said, you can add a couple helper methods to achieve some of this functionality. Here is how I've done it in Swift. First for

Xcode 7: is chasm between app tests and UI tests unbridgeable?

泄露秘密 提交于 2019-11-30 13:04:44
问题 Xcode 7† has a new way to test your UI directly, including a new testing target "iOS UI Testing Bundle" (or "OS X"). In the UI testing target, it appears there's no built-in access to the model or classes that comprise your App. E.g. [UIApplication sharedApplication] would not be callable from your UI tests. This implies that "app tests" and "UI tests" exist across a possibly unbridgeable chasm. As stated here: The problem is that Xcode’s UI testing does not allow access to the actual app.

Is there a way to find if the XCUIElement has focus or not?

若如初见. 提交于 2019-11-30 08:52:47
One of my screen has multiple text fields, I can land to this screen from different other screens. In each case I am making one or another text field as first responder. I am not able to write test to determine whether the desired textField has focus or not. When I print the textfield in console - Output: { TextField 0x131171d40: traits: 146031247360, Focused , {{6.0, 108.3}, {402.0, 35.0}}, value: ​ } But I could not find any focus/isFocus property on XCUIElement. Is there a way to achieve this ? hris.to I little bit late for the party :) However as far as I can see from dumping the variable

How to rotate activity, I mean: screen orientation change using Espresso?

喜欢而已 提交于 2019-11-30 06:41:31
I have decided that one of the testing criteria for my application tests with Google's Espresso is: Test should maintain Activity state after screen orientation rotation How do I rotate the screen when using Espresso? I have tried the following Robotium code (Yes I placed Robotium code in my Espresso test so sue me) solo.setActivityOrientation(solo.LANDSCAPE); solo.setActivityOrientation(solo.PORTRAIT); but It crashes the application when I run it within my Espresso test. Is there any way to do this? Thanks in advance for any help If you have the only Activity in your test case, you can do: 1.