Transcripted Summary

Tables and lists are pretty common UI artifacts in almost all applications.

The functional test here is to click on the “Rank” column header and make sure that it sorts the column in ascending order.

# In the legacy case, we open the app and click on the “rank” column using Selenium.

Then we use cssSelector to get access to all the DOM elements.

Then we looked through all the elements and store the data in an ArrayList.

Then we copied this data in another ArrayList so that we can compare it.

The idea is that if the originalList was already sorted, then the newly sorted data in the copiedList must remain the same and match it.

Now let's run this test and, as you can see, it actually works.

But notice that the app is actually sorting it incorrectly.

It has number 10 after number 1.

This is because, in the app, the developer has made a mistake and comparing them as Strings.

Even after all the coding, you are also doing the same mistake because you are just comparing the same String, but in this case, using Java.

So, I guess we need another QA team to test your code.

This is a problem with the legacy. It involves a lot of logic and it involves a lot of thinking, and you might still end up with your own bugs.

# In the modern way, you simply take a screenshot and literally see if things are okay.

public void loginTest() {

    //Start the test, "Table Sort App", "Number Column Sort Test", new RectangleSize(800, 800));

    //Take a screenshot so AI can analyze
    eyes.checkWindow("Window with Table");

    //End the test

If not, you simply file a bug and be done with it.

Pretty simple.

No complex coding, no CSS selectors. Nothing.

© 2022 Applitools. All rights reserved. Terms and Conditions Privacy Policy GDPR