Search code examples
javascriptautomated-testscodeceptjs

Why isn't CodeceptJS executing the steps in my test? And why can I not see the test being executed?


I've recently come across CodeceptJS and I thought of giving it a try. I was following the tutorial on the CodeceptJS's QuickStart page but now I'm facing two issues:

  1. The test seems to execute only the first step
  2. I don't see the execution of the test

The following is when I run codeceptjs init:

enter image description here

The following when I run codeceptjs run --steps:

enter image description here

The following is my test (Test101_test.js):

Feature('Google search');

Scenario('test something', (I) => {
    I.amOnPage('/');
    I.fillField('q', 'Codeception');
    I.see('YAY');
});

Log from selenium server:

17:29:38.490 INFO - Executing: [new session: Capabilities [{rotatable=true, locationContextEnabled=true, loggingPrefs=org.openqa.selenium.logging.LoggingPreferences@35f1c325, browserName=firefox, javascriptEnabled=true, handlesAlerts=true, requestOrigins={name=webdriverio, version=4.6.2, url=http://webdriver.io}}]]) 17:29:38.496 INFO - Creating a new session for Capabilities [{rotatable=true, locationContextEnabled=true, loggingPrefs=org.openqa.selenium.logging.LoggingPreferences@35f1c325, browserName=firefox, javascriptEnabled=true, handlesAlerts=true, requestOrigins={name=webdriverio, version=4.6.2, url=http://webdriver.io}}] 17:29:38.871 WARN - Exception thrown java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700' System info: host: 'My-Mac-mini.local', ip: '172.20.4.68', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.1', java.version: '1.8.0_91' Driver info: driver.version: unknown at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183) at org.openqa.selenium.remote.server.DefaultSession.(DefaultSession.java:119) at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95) at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:131) at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59) at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:36) at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111) at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:189) at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:222) at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:184) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:150) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:808) at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:587) at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.seleniumhq.jetty9.server.Server.handle(Server.java:499) at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:310) at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:257) at org.seleniumhq.jetty9.io.AbstractConnection$2.run(AbstractConnection.java:540) at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:745) Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700' System info: host: 'My-Mac-mini.local', ip: '172.20.4.68', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.1', java.version: '1.8.0_91' Driver info: driver.version: unknown at org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:96) at org.openqa.selenium.remote.server.FirefoxDriverProvider.newInstance(FirefoxDriverProvider.java:64) at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60) at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222) at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:209) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ... 1 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:86) ... 9 more Caused by: java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases at com.google.common.base.Preconditions.checkState(Preconditions.java:199) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109) at org.openqa.selenium.firefox.GeckoDriverService.access$000(GeckoDriverService.java:37) at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:95) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296) at org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(FirefoxDriver.java:277) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:247) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:242) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:135) ... 14 more 17:29:38.875 WARN - Exception: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases

Could someone help me find what I might be doing wrong?


Solution

  • I just encountered the EXACT SAME problem, I had to type "Selenium-standalone install" and then "selenium-standalone start" in my command prompt. I then opened another command prompt and typed "codeceptjs run --steps" and this time the tests all ran properly, instead of just running the first one, as happened to you. I hope this helps, I found this issue very frustrating!