Regression testing for styling and layout of web applications

前端 未结 5 413
-上瘾入骨i
-上瘾入骨i 2021-02-04 10:55

I realise this is a non-trivial task, but is there a way to regression test the styling and rendered layout of a web application?

I\'ve found it straightforward to unit t

5条回答
  •  逝去的感伤
    2021-02-04 11:28

    There is a way to test the layout of a web application using Galen Framework. This tool has its own language and is very easy to learn and understand. It is a Selenium-based and you can run tests in Selenium Grid, (Sauce Labs) if you want to test your application in different browsers.

    This tool gets the location of a specified element on the page and check them relatively to each other.

    Example: if you want to check that a menu pane is below the header and stretches to the width of a browser and has 50 pixels height, you can do it like this:

    menu
        below: header 5px
        width: 100% of screen/width
        height: 50px
    

    This tool can also be used to test responsive designs.

    You can find complete documentation on the official website, http://galenframework.com.

    The best part is you can even create Java tests. The Galen JavaScript API is also available along with the sample projects on GitHub.

    Again, test(s) written once can be used at multiple phases of the application life cycle.

提交回复
热议问题