I have two cucumber features. Only one of them is tagged by tag @maximize
which maximizes the browser window. I have also the hooks class which contains one @Before
hook which should run only for tag @maximize.
But as I see this hook runs always regardless of tag definition in @Before
annotation. If I remove the hook problem is gone. Here is the code of the hooks class:
package hooks;
import com.codeborne.selenide.Configuration;
import com.codeborne.selenide.WebDriverRunner;
import io.cucumber.java.After;
import io.cucumber.java.Before;
import org.openqa.selenium.WebDriver;
public class BaseHook
{
@Before(order = 1)
public void setup()
{
System.out.println("setup done");
}
// Also tried @Before(value="@maximize", order=2)
@Before("@maximize", order=2)
public void maximize()
{
Configuration.startMaximized = true;
}
@After
public void tearDown()
{
WebDriver driver = WebDriverRunner.getWebDriver();
driver.close();
driver.quit();
}
}