Canonical way to define page objects in Protractor

前端 未结 2 1605
我在风中等你
我在风中等你 2021-01-11 11:38

We\'ve been using the Page Object pattern for quite a while. It definitely helps to organize the end-to-end tests and makes tests more readable and clean.

As Using P

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-11 11:56

    Ultimately, I think it is a question of personal preference.

    Yes, you can use the constructor pattern and instantiate a singleton in each test suite... yes you could use a simple object literal as above... yes you could use a factory function...

    Structuring code using inheritance via "classes" (whether pseudo- or ES2015 syntax) vs objects extended via mixins is a much wider debate within application development in general, never mind e2e tests!

    The main thing is clear, consistent practice across your test suites and promoting code reusability wherever possible.

提交回复
热议问题