You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a Selenium Grid (managed by Zalenium) on which our tests run. The current problem is that the build passes when the grid is not reachable (and no tests acutally run).
Jul 13, 2018 3:03:54 PM org.openqa.selenium.remote.DesiredCapabilities firefox
INFORMATION: Using new FirefoxOptions() is preferred to DesiredCapabilities.firefox()
Jul 13, 2018 3:03:54 PM org.openqa.selenium.remote.DesiredCapabilities firefox
INFORMATION: Using new FirefoxOptions() is preferred to DesiredCapabilities.firefox()
[pool-1-thread-1] WARN net.thucydides.core.pages.Pages - Failed to instantiate page of type class pages.LoginPage (net.serenitybdd.core.exceptions.SerenityManagedException: zalenium.domain could not be reached)
net.thucydides.core.pages.WrongPageError: The page object class pages.LoginPage looks dodgy:
Failed to instantiate page (net.serenitybdd.core.exceptions.SerenityManagedException: zalenium.domain could not be reached)
at net.thucydides.core.pages.Pages.thisPageObjectLooksDodgy(Pages.java:293)
at net.thucydides.core.pages.Pages.getCurrentPageOfType(Pages.java:219)
at net.thucydides.core.pages.Pages.getPage(Pages.java:90)
at net.thucydides.core.steps.PageObjectDependencyInjector.instantiatePageObjectIfNotAssigned(PageObjectDependencyInjector.java:55)
at net.thucydides.core.steps.PageObjectDependencyInjector.injectDependenciesInto(PageObjectDependencyInjector.java:33)
at net.thucydides.core.steps.StepFactory.injectOtherDependenciesInto(StepFactory.java:166)
at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:156)
at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:139)
at net.thucydides.core.steps.StepFactory.getNewStepLibraryFor(StepFactory.java:86)
at net.thucydides.core.steps.IndividualInstancesByDefaultStepCreationStrategy.initiateStepsFor(IndividualInstancesByDefaultStepCreationStrategy.java:16)
at net.thucydides.core.steps.StepAnnotations.instantiateAnyUnitiaializedSteps(StepAnnotations.java:76)
at net.thucydides.core.steps.StepAnnotations.instanciateScenarioStepFields(StepAnnotations.java:60)
at net.thucydides.core.steps.StepAnnotations.injectScenarioStepsInto(StepAnnotations.java:42)
at net.serenitybdd.junit.runners.SerenityRunner.injectScenarioStepsInto(SerenityRunner.java:593)
at net.serenitybdd.junit.runners.SerenityRunner.methodInvoker(SerenityRunner.java:557)
at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:273)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at net.serenitybdd.junit.runners.SerenityRunner.performRunChild(SerenityRunner.java:460)
at net.serenitybdd.junit.runners.SerenityRunner.runChild(SerenityRunner.java:435)
at net.serenitybdd.junit.runners.SerenityRunner.runChild(SerenityRunner.java:42)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:387)
at org.apache.maven.surefire.junitcore.pc.InvokerStrategy.schedule(InvokerStrategy.java:54)
at org.apache.maven.surefire.junitcore.pc.Scheduler.schedule(Scheduler.java:346)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at net.serenitybdd.junit.runners.SerenityRunner.run(SerenityRunner.java:239)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:387)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Running test.LoginLogoutTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in test.LoginLogoutTest
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
The LoginPage:
public LoginPage(WebDriver driver) throws IOException {
super(driver);
Properties properties = new Properties();
properties.load(getClass().getResourceAsStream("/profile.properties"));
driver.get(properties.getProperty("url"));//navigate to the main page
}
I didn't expect that the framework simply logs a WARN message when a Page object could not be instantiated and considers it success.
How can one get access to a property defined in maven's pom.xml? (we would like to avoid the profile.properties file where maven resource plugin replaces placeholders)
One can argue that it is not a good idea to navigate to a certain page in the page constructor. The wanted effect was to always and as early as possible load the LoginPage. Are there good workarounds for this so that tests fail when Selenium is not reachable and still load the LoginPage as early as possible?
The text was updated successfully, but these errors were encountered:
You should not invoke the driver during the constructor, as you have little control when the constructor is invoked. The failure may happen outside of the normal Serenity lifecycle, and may not be reported correctly. Best practice is to call the open() method at the start of your test.
I will try to remain organized with the discussion and stick to the numbering in my original question.
Can we count on a fix in one of the next minor releases? The problem seems bigger than this: if any exceptions occur during constructor (any means everything from NoSuchMethodException to any exceptions).
Any ideas here?
OK: best practice is to call WebDriver.open() at the test start.
I am using Serenity in my Automation project, While implementing Grid I initiated Remote driver but Inbuilt method of BDD getDriver() method is used in scripts. Remote Driver initiated in Hooks is getting overridden by getDriver() method in Pages.class (inbuilt method from serenity).
We have a Selenium Grid (managed by Zalenium) on which our tests run. The current problem is that the build passes when the grid is not reachable (and no tests acutally run).
The LoginPage:
profile.properties
file where maven resource plugin replaces placeholders)The text was updated successfully, but these errors were encountered: