Verifying toast message in Tosca - testing

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

Related

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.

Handling alert/dialogue box when you are not sure about their time of occurrence

Is there a way to handle dialogue box that are displayed due to some background check the system keeps doing.
Ex: I have a async job that is running and on its completion it throws an alert that its done and it blocks the rest of the window until I click ok on it, because of this my rest of the tests starts to fail.
Looking for something like if you don’t find the element you are looking for , for more than 3 secs then check if some alert box is present.

Match two strings in automation testing UI - iOS

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}

Error in Selenium testcases while running

Using Selenium IDE, I recorded one testcase that contained a click url, then give the username and password and clicked the button to navigate to next page.
In the render page, if I click any link the error is shown as Element link=linkname not found.
Why does this error occur?
Page is fully loaded when that command is executing?
If not just put waitForPageToLoad or pause command.
waitForPageToLoad | timeout
Or
pause | 5000
Also you can use command clickAndWait for button after entering username and password
There are different ways via which you can handle such issues. The issues can be of rendering as username and password click is fine as you will rest on same page when you enter values in these test boxes.
But as soon as you click on submit button then application has to load a new page with the credentials you have just added.
So this requires some time in terms selenium. What you can do is you can put some waits just after this action. So far selenium provides two types of waits Explicit and Implicit waits.
And you can try thread.sleep() , its a java type of method which is also a kind of wait. But implicit and explicit waits are highly recommended in Selenium coding.
You can refer to this blog for more knowledge on waits (http://khyatisehgal.wordpress.com/2013/05/09/how-to-handle-timeouts-implicit-and-explicit-waits-in-selenium/)
Khyati Sehgal

How to handle popup messages thrown from web applications in vb.net?

I am developing a tool to automate testing of a web application. I want to handle the popup messages thrown in error scenarios. The problem am facing is after a button click a popup message is thrown, but only after a response is given to the message box(ie clicking on any buttons in the message box) the execution continues, till then the web browser is busy waiting for a response. Please suggest.
You could have your application inject some javascript into the page that overrides the default alert/confirm function. This would allow you to run code before the alert is shown or completely override the functionality so that the alert isn't shown at all.
See this custom alert demonstration for an easy example of how to override the default alert function.