Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Test cafe - Page Object - Consume Modules

I've been working mainly with selenium (java) and espresso as automation tools. I'm pretty new to test cafe and liking it so far. I came across this specific situation and was wondering what would be the best way to solve it using javascript or test cafe.

I am using Page Object design on my suite. In addition, I would like those pages to be able to consume many modules that can also be consumed from many other pages.

As an example, let's say I have a Home page that has a Header and Footer modules and I also have a listing page that has a Header, a Footer, and a carousel that shows items (This carrousel also appears on other pages). I was thinking of creating something like a generic page but not sure if it was the best solution. Any thoughts?

like image 247
ainafuku Avatar asked Mar 01 '26 07:03

ainafuku


1 Answers

For generic items, create Page object class separately. For example in your case create page object for header/ footer, carousel area and place them in the generic package for better classification.

Invoke them where ever required (i.e. invoke header/ footer in homepage as well as in listing page).

like image 74
Dinesh Kumar Avatar answered Mar 04 '26 06:03

Dinesh Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!