Frameworkium / frameworkium-core

Framework for writing maintainable Selenium and REST API tests in Java.
https://frameworkium.github.io/
Apache License 2.0
160 stars 82 forks source link

BasePageExtended causing issue with wait #373

Closed sridharaiyer closed 2 years ago

sridharaiyer commented 2 years ago

Describe the Issue This is reopening the issue #357 I extended the BasePage as public class BasePageExtended<T extends BasePage> extends BasePage And extended this class for my page object class as: public class MyPage extends BasePageExtended<MyPage>

I am unable to use the wait.until methods in my page object as the compiler complains saying it is expecting a WebElement but getting an object instead

To Reproduce Steps to reproduce the behavior:

  1. Mentioned in description

Expected Behaviour Should be able to extend the BasePage as BasePageExtended and extend that for my pages without any issue.

Screen Shot 2022-04-18 at 11 07 51 AM Screen Shot 2022-04-18 at 10 55 30 AM
sridharaiyer commented 2 years ago

Hi I was able to overcome the Wait issue by instantiating the Wait like this -

public class BasePageExtended<T extends BasePage> extends BasePage {
    protected Wait<WebDriver> wait = new WebDriverWait(driver, 30);

But I am still seeing some warnings in terms of "generifying" my code, when my pages extend the BasePageExtended class. Screenshots below.

Screen Shot 2022-04-18 at 1 42 21 PM Screen Shot 2022-04-18 at 1 41 30 PM

Can you kindly help me get rid of these warnings?

Mjl33 commented 2 years ago

the correct extension is BasePageExtended<T extends BasePage<T>> extends BasePage<T>

sridharaiyer commented 2 years ago

Thank you team. The extension is working fine now. Closing this ticket.