Match two strings in automation testing UI - iOS - automation

I am writing automation test scripts using Automation tool in instruments for my iPad app. In the login screen, when user taps on login button without entering any information, I display an error message. This error message is displayed on a label which is initially invisible and when the error message has to be displayed, it is made visible and the error is shown in that label. I want to check if the error message displayed in that label is the same as the one I am expecting to receive. How do I do that ?

First write the script so that error message appears on screen and then write
target.logElementTree();
So you will be able to see its element hierarchy and then just compare it with your expected error message like
if (mainWindow.staticTexts()[0].name() == "expected_alert_message") {log_Pass} else {log_Fail}

Related

Verifying toast message in Tosca

I scanned toast message object in Tosca and I used it in my test cases.that same popup will appear twice in the flow.
First time Tosca is able to validate the popup but for second one I'm getting error as container was not found.
If I run the 2nd popup flow seperately Tosca is able to validate it.but if i run the whole flow it fails with the mentioned error.
Need some help here .....
I want Tosca to identify and validate the toast popup without any error

Insight tool shows error icon, but shows message "No failure was detected"

I am using a tool for verifying if app is compliant with windows accessibility feature
Tool web link - https://accessibilityinsights.io/downloads/
Test tool have simple MFC combo box .
Tool says "No Failure was detected",
Insight tool shows a error icon.
Below are steps to get above state.
Launch app
Launch Insight tool
select what to test = element
Mouse hover on combo box
expand the combobox
mouse hover on item
click on brush icon on right
It will enter the state described abovewith no error but with error icon
Isolation:
Issue doesn't repro when "Entire App" is selected.
When "Entire App" is selected, tool does not show any error or any error icon. App pass accessiblity
Question is if this tool is reporting valid error ?
What is the error as tool says " No failure was detected."
What you're seeing here is an artifact of trying to capture a transient state. Combobox content goes away when the combobox closes, and that happens as soon as you start the scan. Accessibility Insights for Windows allows you to trigger a scan using a timer, as documented at https://accessibilityinsights.io/docs/windows/getstarted/automatedchecks/#running-automated-checks-with-a-timer. The "short version" is that you start the timer, then open the combobox while the timer is counting down, and the checks will run when the timer reaches zero. The combobox will still be fully opened at this point, so the tests will apply to the combobox contents.
My personal recommendation is to set the scope to the entire application when using the timer, just because transient controls sometimes have multiple layers and trying to have the scope of just the element can tend to hide children of the layers in question.
Thanks for using Accessibility Insights
--DaveTryon
Accessibility Insights team

How to handle dynamic error messages coming in an application

I am facing an issue while automating a web application at my work-place, and need helping advise to resolve the issue.
The application which I am testing is having a dynamic error popup screen which loads from the top whenever any error comes in the application. To be more clearer, let's say I am entering Username and password to login into application, and I took wrong username and password combination. Now, due to this a dynamic error drop down comes from the top. I am saying it dynamic because, as soon as I am trying to inspect the element, the error screen fades away. Now, due to this, I am not able to locate the element.
Sometimes, I got lucky and was able to inspect the element by right-clicking on that element. But then as soon as I reach to element tab, Error screen fades away, and not able to inspect the element.
So, I need help here to know how can I handle this dynamic error screen.
Any help will be appreciated. :-)
You can use devtools to pause:
1. Open app in chrome
2. Open devtools
3. Go to Sources tab
4. Trigger error and press F8 to pause
5. Go to Elements tab and locate error html
Two quick ways :
When you get lucky to reach until the elements tab after inspecting
the error, just copy the total div/span/error element's html code.
Paste it in a Notepad to locate the element with any strategy [like
xpath/css].
If the above could not help, then ask the dev to make the dynamic
error message to appear some more time and then you could locate
them correctly.

Error detection in AS400

I now basics of VBA and use it to send or get data in AS 400, but I am not so advanced to understand documentation of IBM "Host Access Class Library". I want to know how can I detect error in AS400 for now I am using script below or skip errors by self, outside of running macro.
Sub check_error()
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLPS.wait 100
autECLSession.autECLPS.SendKeys "[reset]"
End Sub
When error appear I cannot use some commands like autECLOIA.WaitForInputReady, So instead I use 'wait 100' in my 'check_error' but it not always work. So how can I detect error, is there any command to do that? Or a method to handle it?
This is a massive topic that, unfortunately, depends on the application. There are so many ways that errors can be presented to the user on a 5250 display that one method can not fit all circumstances. It might be best to just ask us about your specific use case rather than all use cases.
However, let me give you a high level view of some of the ways errors can be presented.
External Message Queue
This is when the program sends a status message to the *EXT message Queue. These messages are displayed on the last line of the display. They do not appear in the job log, and are typically not used for exceptions, but they also do not end the program.
Program Message Queue
An application can define a message subfile which is a record format that displays on the screen between lines 1 and 24 on an 80x24 screen, or between lines 1 and 27 on a 132x27 screen. Where it appears, and the number of display lines it uses are defined in the display file DDS. The appearance of a message in this message subfile may be the only indication of an error, but it may contain informational messages as well. You are going to have to determine which it is by the text of the message. In conjunction with the message, a field may also be reverse imaged, or colored in a way that indicates an error, but the keyboard is not locked, and there is no audible indication that there is a problem.
DDS Error Messages
DDS error messages can be defined that lock the keyboard, reverse image the field, and display an error message. These messages can be displayed on any line as well, which is configurable in the DDS. In addition to the typical display lines, there is an addition line: 25 on a 80x24 screen, and 28 on a 132x27 screen, that is accessible to these messages.
Custom Error Messages
And sometimes an error is indicated in a completely custom way, for example by populating a text field somewhere on the screen.
The point is that you need to know your application, and how it provides user feedback, and without that knowledge, we can't help you.

How to Click on pop up text using Robotium

I am getting an expected pop up, I know what text it will have and
what buttons will it have. I want to click on one of the buttons.
Once I get to the pop up screen, I see some text and 3 buttons. My
test passes if I use
Solo.searchButton("Text")
or
Solo.searchText("Text").
The problem is when I do Solo.ClickOnButton ("Text") or
solo.clickOnText("Text").
I tried using solo.getViews(); but still
running into same error.
No button or text with "Text" is found.
I was able to overcome this by using solo.getView()
View donebtn = solo.getView(R.id.pop_up_button);
solo.clickOnView(donebtn);
Try using longclick instead of just clickonbutton.
And is the message that pops up within the same package as your activity thats under test?