Below given are some of the most common errors while using the Text verification NLP Grammar in Testsigma or any of the Test Automation Platform.
Actual Text is present or not
CSS Text Transformation
White spaces in Text
Comparison with incorrect Case
1. Actual Text is present or not
The very first step would be to check if the text is actually present on the page or not. You may enable the Screenshot for Test Steps if not already done.
2. CSS Text Transformation
Given below is an example for CSS Text Styling. Check the actual text inside the HTML Code(left pane) for corresponding visualization of Text(right pane).
As you can see, the actual text in the Div element is all in lowercase. Developers can use CSS Transformation to represent the text in different ways in the UI.
While automating your application, if you are facing an erorr with Text Verification, please check and use the actual text contained inside the HTML Code instead of the visual representation.
2. White spaces in Text
Given below is an example for White spaces within Text inside HTML. Check the actual text inside the HTML Code(left pane) for corresponding visualization of Text(right pane).
As you can see, the HTML text contains white-spaces and if we don't use the exact text in Test Step, it might fail while comparing.
Use the Text Verification NLP Grammar using 'contains text' such as:
- Verify that the current page title contains test data
- Verify that the current page URL contains test data
- Verify that the element ui identifier displays text contains test data
If the Grammar you are using doesn't have a 'contains' counterpart, please use the contains function in the XPath for the element - XPath String Functions
3. Comparison with incorrect Case
Text Comparison templates on Testsigma are case sensitive. Please check and confirm that the Verification Text test data is exactly the same case as the Text on the Web page.
For example, if the page displays text as "DashBoard" and user is giving the test data as "Dashboard" in the Test step, the step will fail due to the text mismatch.
Therefore, copy the text on page or better yet from the page HTML Source Code so as to get the correct Text.