Giter Site home page Giter Site logo

codeceptjs / codeceptjs Goto Github PK

View Code? Open in Web Editor NEW
4.1K 97.0 717.0 55.96 MB

Supercharged End 2 End Testing Framework for NodeJS

Home Page: http://codecept.io

License: MIT License

JavaScript 71.15% PHP 0.78% Shell 0.07% Gherkin 0.28% Dockerfile 0.08% Hack 2.16% TypeScript 1.72% HTML 23.78%
codeceptjs webdriverio selenium-webdriver acceptance-testing end-to-end-testing nodejs pageobject graphql-testing e2e-tests playwright

codeceptjs's Issues

Can I grab text from the browser without using the yield?

Can I grab text from the browser without using the yield? I need to grab the value of many div's and add them up and then test against the result of the addition to see if its working well. Is there a way to grab text without using the yield? I don't like the yield because it terminates my script and the rest of the test don't get executed.

done() invoked with non-Error

Hi guys,

I got an issue when using grabTextFrom followed by a click which always return the following error done() invoked with non-Error: {"status":0,"sessionId":"9458f069-1907-4362-b66f-012a6259a75d","state":"success","value":null,"class":"org.openqa.selenium.remote.Response","hCode":385625253}

Example:

Scenario.only ('scenario test', function*(I) {
    I.amOnPage('my url');
    var checked = yield I.grabTextFrom('input[type="password"]');
    I.click('Create my account');
});

Is there anything I'm doing wrong in my example? Did anyone already face the same issue?

Thanks,

How to run many different Scenario() without closing the browser?

How to run many different Scenario() without closing the browser? This is my code:

Before((I) => {
    I.amOnPage('/');
    I.fillField('email', '[email protected]');
    I.fillField('password', '123456');
    I.click('Sign in');
});

Scenario('Check to see if it has landing page and welcome msg', (I) => {
    I.see('Welcome to Casefriend Version 1.0');
    I.amOnPage('http://cflocal/#landing');


});

Scenario('Logining into Casefriend', (I) => {
    I.click('Users');
    I.click('New User');
});

This code passes correctly but it opens firefox, test Scenario 1 then closes firefox, opens again, and tests second Scenario. I want it to do everything on one single firefox instance. How can I do?

I.AcceptPopup not working

Hi
I have a problem with accepting a popup. I don't think that this is an issue with CodeceptJS directly, but more an issue with PhantomJS. I have built a simple test page:

<html>
  <body>
    <h2> Hello </h2>
    <div>
      <p> This is a random text! </p>
      <script>
        var val = confirm('Are you sure?');
        if (val) document.write('good job');
      </script>
    </div>
  </body>
</html>

As you can see after accepting the popup there should be a change in the DOM. But when calling I.seeInPopup('Are you sure') I get the following error:

TypeError: Cannot read property 'indexOf' of undefined
      at Object.InclusionAssertion.haystack (/usr/lib/node_modules/codeceptjs/lib/assert/include.js:18:22)
      at InclusionAssertion.assert (/usr/lib/node_modules/codeceptjs/lib/assert.js:41:34)
      at Object.<anonymous> (/usr/lib/node_modules/codeceptjs/lib/helper/WebDriverIO.js:815:39)
      at Object.<anonymous> (/usr/lib/node_modules/codeceptjs/node_modules/webdriverio/lib/webdriverio.js:369:37)
      at Object.safeExecute (/usr/lib/node_modules/codeceptjs/node_modules/webdriverio/lib/utils/safeExecute.js:19:24)
      at Object.WebdriverIO.resolve (/usr/lib/node_modules/codeceptjs/node_modules/webdriverio/lib/webdriverio.js:87:29)
      at /usr/lib/node_modules/codeceptjs/node_modules/webdriverio/lib/webdriverio.js:227:32
      at _rejected (/usr/lib/node_modules/codeceptjs/node_modules/q/q.js:830:24)
      at /usr/lib/node_modules/codeceptjs/node_modules/q/q.js:856:30
      at Promise.when (/usr/lib/node_modules/codeceptjs/node_modules/q/q.js:1108:31)

How can I handle popups in CodeceptJS?

Exit with code 1 when tests fail (for CI purposes)

Hi guys

In order to use codeceptjs for Continuous Integration, it needs to exit with code 1 when the tests fail. Unfortunately at this point it always exits with code 0 whether the tests pass or fail, thus CI assumes the tests are always successful. This makes codeceptjs useless for CI purposes unfortunately.

I'm using codeceptjs 0.2.4 with webdriverIO and chrome.

A possible solution would be to add process.exit(1); at the end of the tests if tests failed. I see that an event is emitted when the tests end (event.dispatcher.emit(event.all.result, this);) so maybe this could be done with a listener?

Best regards

Assert.equal not returning properly

Hi @DavertMik!

Since updating to v0.3.0 I am having problems with assert.equal when the assert fails:

Here a little code snippet to show what I mean:

Before((I) => {
I.amOnPage('/');
});

 Scenario.only(
   'Navigating to prev week check date picker value',
    function* prev(I, actionBarTop, appointmentPage) {
    assert.equal(true, false);
});
Navigation --
 Navigating to prev week check date picker value
 • I am on page "https://www.test.com"

and after that the test just finishes, without failing properly

On the otherhand with assert.equal(true, true) the tests passes

Is there some problem with assert?

UPDATE:
I have got the impression that is has to do with your new handling of errors in the scenario.js:
Line 22: recorder.add(() => done(err), true);

Might be the issue?

Nested test structures?

Trying to play around with CodeceptJS, having never actually used Mocha or anything similar before. Mocha's docs seem to indicate that you can set up nested tests using describe() and it(). It looks like Codecept's Feature() and Scenario() are an alternative method to setting up Mocha's Suites. Is there a similar way to set up nested tests using CodeceptJS? For example, something vaguely like:

Feature('Test1');

Before((I) => { // or Background
  I.amOnPage('/');
});

Scenario('Interact with the login page ', (I) => {
  Feature("Test 1 - Part 1");

  Scenario("Filling in login form shows consent banner", () => {
    I.see('Username');
    I.dontSee("You are accessing");
    I.fillField("httpd_username", "user1");
    I.fillField("httpd_password", "pw1");
    I.see("You are accessing");
  });

  Feature("Test 1 - Part 2");

  Scenario('Can log in successfully', () => {
    I.see('Username');
    I.fillField("httpd_username", "user1");
    I.fillField("httpd_password", "pw1");
    I.click('Agree and Log In');
    I.wait(1);
    I.dontSee("Username");
  });
});

codeceptJS / webdriverIO exits script with grab commands

codeceptJS / webdriverIO exits script with grab commands

Somehow my post ended up in the codeception list so posting again here in hopes that it will be in the correct place...

I'm new to codeceptJS but best I can tell it simply does not work with yield.

'use strict';
Feature('Testing Begins');
Before((I) => {
  I.resizeWindow(1500, 1000);
  I.amOnPage('http://absolutenet.com');
});

Scenario('ANI testing', function*(I){
  I.waitForText('bring your site to life');
  I.amOnPage('http://www.absolutenet.com/');
  let title = yield I.grabTitle();
  console.info(title);
  I.see('bogus text that is not there');
});

I have tried several of the grab commands as well as executeScript. I know the commands are working because for some reason one or two lines do execute after the yield so I can output the variable I am assigning. However, I can never use it because the browser closes and the script terminates. Even worse, I can put in a test that is obviously invalid (I.see('some bogus non existent text');) and the Scenario exits with a Success!

The above is live so you can execute it to see the problem. This happens with Firefox and Chrome on Linux and Mac.

Cannot find module 'codeceptjs/actor'

Going through the Quickstart from the website, ran into the following error when running codeceptjs run --steps:

└─[$] codeceptjs run --steps                                                             ◈ (ruby-2.2.1) ⧂ (go1.4) ⬡ (node-4.2.3) [9:12:59]
CodeceptJS v0.2.1
Test root is assumed to be /Users/therebelrobot/git/path/to/project
/Users/therebelrobot/.nvm/versions/node/v4.2.3/lib/node_modules/codeceptjs/lib/container.js:45
      throw new Error(`Initialization failed for ${objects[name]}\n${err.message}`);
      ^

Error: Initialization failed for function () {
  return require('codeceptjs/actor')({

    // Define custom steps here, use 'this' to access default methods of I.
    // It is recommended to place a general 'login' function here.

  });
}
Cannot find module 'codeceptjs/actor'
    at createSupportObjects (/Users/therebelrobot/.nvm/versions/node/v4.2.3/lib/node_modules/codeceptjs/lib/container.js:45:13)
    at Object.module.exports.create (/Users/therebelrobot/.nvm/versions/node/v4.2.3/lib/node_modules/codeceptjs/lib/container.js:62:15)
    at Codecept.init (/Users/therebelrobot/.nvm/versions/node/v4.2.3/lib/node_modules/codeceptjs/lib/codecept.js:38:15)
    at Command.module.exports (/Users/therebelrobot/.nvm/versions/node/v4.2.3/lib/node_modules/codeceptjs/lib/command/run.js:11:12)
    at Command.listener (/Users/therebelrobot/.nvm/versions/node/v4.2.3/lib/node_modules/codeceptjs/node_modules/commander/index.js:301:8)
    at emitTwo (events.js:87:13)
    at Command.emit (events.js:172:7)
    at Command.parseArgs (/Users/therebelrobot/.nvm/versions/node/v4.2.3/lib/node_modules/codeceptjs/node_modules/commander/index.js:615:12)
    at Command.parse (/Users/therebelrobot/.nvm/versions/node/v4.2.3/lib/node_modules/codeceptjs/node_modules/commander/index.js:458:21)
    at Object.<anonymous> (/Users/therebelrobot/.nvm/versions/node/v4.2.3/lib/node_modules/codeceptjs/bin/codecept.js:75:9)

Environment:

  • Mac OS X Yosemite 10.5.5
  • Node v4.2.3
  • Selenium v2.48.2

Tried repeating steps in Node v0.12.x (threw an ES6 error) and v5.3.0 (same error as above), with no luck.

EDIT: After looking through the PRs I found one that looks related: #28

Init test folder not working

When I try to configure:

image

I get

  {
    "tests": "./*_test.js",
    "timeout": ...
  }

Output and Include are working fine.

Using chrome driver

Does codeceptjs support alternate webdrivers. I tried starting selenium with the chrome driver. I'm on a mac (10.11). I downloaded the chromedriver, downloaded the selenium jar file.

Starting selenium like this:

java -Dwebdriver.chrome.driver="./chromedriver" -jar selenium-server-standalone-2.48.2.jar

Then my codecept.json file

{
  "tests": "./*_test.js",
  "timeout": 10000,
  "output": "./output",
  "helpers": {
    "WebDriverIO": {
      "url": "http://test.localhost",
      "browser": "chrome"
    }
  },
  "include": {},
  "mocha": {},
  "name": "Testing"
}

However when I run $ codeceptjs run it complains about firefox not being installed. I presume selenium by default ships with the firefox driver.

Sorry I am completely new to selenium.

Leon

Create StackoverFlow wiki page

I've recently added CodeceptJS as a tag on SO.

The tag is still in the review period, namely if no one else tags a question with it, it'll be removed.

To help it remain, the tag could do with more info.

Tags can have an associated wiki page. This consists of an excerpt and the main body of the page.

See jQuery's one for an example. The excerpt is in the box at the top.

I have added an excerpt to the CodeceptJS tag, not visible until it's approved. If/When it is, it'll be available here.

This is what I added:

CodeceptJS is a modern end to end testing framework with a special BDD-style syntax. The test is written as a linear scenario of user's action on a site. The use of generator functions allows asynchronous tests to be written in synchronous way.

So this issue is a request for a wiki page, to be added on SO.

CSS3 selectors

Why are CSS 3 selectors like :contains not working?

Also the within() can only handle true css, for instance .class:first is not working in within()

Wrong 'require' for custom helpers

It seems like there is a bug in code which allows to use custom helpers. I suppose this config codecept.json was planned to work nice

{
  "helpers": {
    "MyCustomWebdriver": {
        "require": "my-custom-webdriver"
     }
  }
}

but now it seeks require key in main helpers config.

Also, it would be nice if require path here is resolved relatively to codecept.json location, like

{
  "helpers": {
    "MyCustomWebdriver": {
        "require": "./lib/my-custom-webdriver"
     }
  }
}

because now it will work only with

{
  "helpers": {
    "MyCustomWebdriver": {
        "require": "./../../../lib/my-custom-webdriver"
     }
  }
}

I am ready to make PR, but I wonder why there are no tests here, are they not written yet, because I feel wrong to write PR without tests 😃

Can not execute pressKey for down arrow

Hello,
I am able to use I.pressKey('Tab') or I.pressKey('Enter') and it works fine, but I have not been able to use for down arrow key? What is the correct parameter to pass in for this to work? Or there is a bug. I have tried everything and read all the documentation, including this website: https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value

and I still haven't been able to find the correct parameter to pass in to get a down key press. Please help!

I.waitWhileVisible

Hi
I wanted to ask if it is possible to add a function I.waitWhileVisible that waits as long as a given selector is visible in the DOM. It would be really awesome!

session data exists after rerun tests

Hi,

there must be an issue with terminating the data of the used session. If I run my tests once and rerun them, the second run has data of the first run. How can I disable this behavior or is it a bug?

I am using webdriverio helper with phantomjs.

Check AJAX/Javascript requests?

Is there a way to check invisible things going on on the page?

For example if I have a webpage that sends a tracking pixel request (not adding the to the DOM) / AJAX request can I run checks on the requested URL?

If not, are you thinking about adding that as a feature?

Can't start interactive shell

Newly installed version (2.7) from NPM crashes on $ codeceptjs shell with error:

String interactive shell for current suite...
/usr/lib/node_modules/codeceptjs/lib/command/interactive.js:18
recorder.finishHandler(() => event.dispatcher.emit(event.test.teardown));
         ^
TypeError: recorder.finishHandler is not a function
...

Docs for cloud testing

This looks great. Are there any docs for cloud testing using services like Sauce Labs, Browser Stack, & Testling?

If not, there should be. Maintaining your own test lab is prohibitively expensive for most... =)

WebDriverIO Helper _failed not called

Hello, i'm currently running some tests with the webdriverIO helper at crossbrowsertesting.com. I got the problem, that the _failed method within WebDricverIO.js isn't called. I played around a little bit inside the codeceptjs code and it looks like there is a problem with calling the _failed hooks in general. In listeners/helper.js line 36 the runAsyncHelpersHook doesn't call the hook within the helper. It tried to use runHelpersHook instead of runAsyncHelpersHook and it worked - but i don't know whether this is a good solution or not.

Besides this error i also noticed that there might be another problem within WebDriverIO.js, it looks like there should be test.title used instead of test.name for the filename creation (for my test run test.name isn't defined).

Beside these problem i also got some other problems:

saveScreenshot doesn't create any screenshots, but currently i assume that this is a problem with my configuration and/or using crossbrowsertesting.com via webdriverIO.

After a test failed, the remotely running test/instance via webdriverIO at crossbrowsertesting.com isn't stopped - i haven't found the reason yet and keep on looking for the solution, but maybe you have already heard of any similar problems.

thank you in advance & best regards

Using within() causes an error on 0.2.5

Hi

It seems like using a within() clause will cause an error on codeceptjs 0.2.5
Error: done() invoked with non-Error: 1

I also noticed that a Scenario with a failing assertion and a within() clause will fail twice, with the error done() called multiple times

I'm using CodeceptJs 0.2.5, with WebdriverIO and Chrome

Best regards

Run tests in parallel

In WebdriverIO you can specify maxInstances and run tests in parallel. How is this configured in CodeceptJS?

Codecept config should be JS not JSON

@DavertMik I think it would be more useful to load the config as a .js file rather than .json.
I would be happy to chat about this and submit a pull request for this feature if I can get some direction on developing on codeceptjs. I don't like wondering in the dark trying to figure out where everything lives :)

You get some beneifits in doing this.

  • environemtnal variables can be controlled outside so you don't have to configure a seperate config per environment
  • it can be better controlled programatically
  • you can check everything into source control without exposing secrets.
/**
 * CodeCeptJS Config
 */

module.exports = {
  tests: './tests/*_test.js',
  timeout: 10000,
  output: './tests/reports/',
  helpers: {
    WebDriverIO: {

      // load variables from the environment and provide defaults
      url: process.env.CODECEPT_URL || 'http://localhost:3000',
      browser: 'chrome',

      user: process.env.CLOUDSERVICE_USER,
      key: process.env.CLOUDSERVICE_KEY,

      desiredCapabilities: {
        'browserstack.local': true,
        'browserstack.debug': true
      },

      capabilities: [{
        browserName: 'chrome',
        'browserstack.local': true,
        'browserstack.debug': true
      }],

      logLevel: process.env.WEBDRIVERIO_LOG_LEVEL || 'warn',
      coloredLogs: true,
      waitforTimeout: 10000
    }
  },
  include: {},
  bootstrap: false,

  // don't build monolithic configs
  mocha: require('./tests/mocha_config.js') || {},
  name: 'vortex'
};

Cannot find module 'codeceptjs/helper'

I tried to create an helper with the command 'codeceptjs gh'.
I immediatelly run 'codeceptjs run --steps' and I get the following error : Cannot find module 'codeceptjs/helper'
This require was generated by the 'gh' command.

I really just did what's on the website, any idea why it doesn't work as expected ?

Additionnal info :
I installed codecept globally as done in the quickstart.
I use node 4.2.2
I use codecept 0.2.4

Add full eslint integration

There is a .eslintrc file inside project, but code does not follow its rules. I suggest to fix code to satisfy rules and add lint step to test script.

Multiremote in options

Is-it possible to implement the multiremote inside the WebDriverIO helpers options ?
WebdriverIO allows you to run multiple Selenium sessions in a single test.

Maybe, something like:

"helpers": {
    "WebDriverIO": {
      "url": "http://localhost:3000/#",
      "multiremote": {
        "myChromeBrowser": {
          "desiredCapabilities": {
            "browserName": "chrome"
          }
        },
        "myFirefoxBrowser": {
          "desiredCapabilities": {
            "browserName": "firefox"
          }
        }
      }
    }
  },

Thanks a lot for your work.

I is not defined

Hi,
I'm trying to get the "Quickstart" working but I can't manage to get a simple example working. The global helper I seems to be an empty object.

[~/Projects/webapp]$ codeceptjs run --steps                                                                                                                                                                       *[test/codeceptjs] 
CodeceptJS v0.2.7
Test root is assumed to be /home/me/Projects/webapp

Test --
 test something
 ✖ FAILED in 1ms


-- FAILURES:

  1) Test test something:
     I.amOnPage is not a function

  TypeError: I.amOnPage is not a function
      at Test.<anonymous> (Test_test.js:5:7)
      at Context.test.fn (/usr/local/lib/node_modules/codeceptjs/lib/scenario.js:27:24)

My test is copy/pasted from the doc


Feature('Test');

Scenario('test something', (I) => {
    I.amOnPage('/')
});

My environment:

  • Node 5.6.0 (I tried with 4.3.0, same result)
  • CodeceptJS 0.2.7
  • Ubuntu 12.04 LTS (actually ElementaryOS, based on Ubuntu 12.04, but shouldn't make a difference)

What am I doing wrong?

Error in version 0.2.6

@DavertMik
I get a very strange error in the current version
When I make a clean npm-install I get the following line in the lib/codecept.js

global.Helper = codecept_helper = require('./helper');

I have no Idea why. I checked your current master and the line should be:

global.codecept_helper = require('./helper');

Is it possible that some script of yours is causing this problem?

I fixed it locally with the following:

global.Helper = global.codecept_helper = require('./helper');

Helper loading issues

Hey,

I had some troubles with creating my own helper I’d like to share.

I created one with codeceptjs gh command and then run the whole suite with codeceptjs run --steps.

This is the error I got:

Error: Could not load helper UrlHelper from module './helper/UrlHelper'
Cannot find module './helper/UrlHelper'

The fix for this was changing this line in container.js to:

let HelperClass = require(helperModule = config[helperName].require || './helper/'+helperName);

After this, the error was:

Error: Could not load helper UrlHelper from module './url_helper.js'
Cannot find module './url_helper.js'

I had a feeling that it tried to look for my module in /usr/local/lib/node_modules/codeceptjs (where container.js is), so I replaced ./url_helper.js in my package.json with an absolute path to the file. The file was loaded correctly after doing this.

The next error was that it couldn’t find codeceptjs/helper module that I require in my url_helper.js file, so I replaced it with an ugly absolute path to it /usr/local/lib/node_modules/codeceptjs/lib/helper. The helper was loaded correctly after this.

While it all works now for me, relying on absolute paths isn’t really a solution so I think I must be doing something wrong. Any help will be appreciated! I’m on node v4.2.3 if that helps.

Thanks!

Using Jquery on codecept

Hello,

Is it posible to use Jquery in codecept to locate element. I personally don't like the yield I.grabTextFrom because it does not work inside a loop. I was wondering is jquery can be used here?

Thanks!

I.seeInField is not asserting value

I am trying to use I.seeInField to check the value of an input element, however regardless of what the value argument is, the assertion passes as long as the selector is valid.

I.seeInField('#supplierName', 'this can be anything')

I.see not working with grabbers

Hello,
I have not being able to make this simple example work:

Scenario('First Scenario', function* (I) {
let grabberResult = yield I.grabValueFrom('input[name=firstName]');
I.see('XKJSHJDSJXHJSKHXS');
});

The grabber works fine, then problem is the I.see('XKJSHJDSJXHJSKHXS'); even though there is no text
'XKJSHJDSJXHJSKHXS' it still passes OK.

Is this a bug?

Retrieve value from executeScript

Hi!

I have been trying to retrieve a value from the executeScript and so far I have not been able to do so.

Here is my code:

seeOptionIsSelectedForSelect2(selector, optionText) {
      selector = this._getSelector(selector);
      this._optionIsSelectedForSelect2(selector, optionText)
      .then((data) => {
        console.log('The value is ' + data.value);
        assert.equal(data.value, true);
      });
    },
​
_optionIsSelectedForSelect2(selector, optionText) {
      let value = false;
      selector = this._getSelector(selector);
      value = this.executeScript(function(selector) {
       return jQuery(selector).val();
      }, selector);
      return isSelected;
}

The strange thing is that the data.value has the correct value, so my code actually works

I got the impression that the assert statement just does not work in the callback.

is this a problem with WebdriverIO?

Post a request with parameters

Hello,

I was trying codeceptjs this days and I was trying to post a request to a url with 2 params. Is that possible?

What I want to do is something like:
I.amOnPage('/');
I.waitForElement('#login-page', 5); // secs
request
.post('http://0.0.0.0')
.type('form')
.set('Accept', 'application/json')
.send({ ssid: '#something', id: '#something'})
.end(function(err, res){
}

The request part is taken from Protractor code. Is it possible to do something similar in Codeceptjs?

Thank you.

Using 12 or more Within blocks causes event emitter memory leak

I am using several Within blocks in my tests, however i have noticed that once i use 12 of them i get this warning:

(node) warning: possible EventEmitter memory leak detected. 11 step.after listeners added. Use emitter.setMaxListeners() to increase limit.

The warning does not seem to cause the scenario to fail.

within() block does not end properly

There is an issue with the within() block

Although I end the within block after executing one function, the test runner still sees the within as active.

Here an example:

within(resourcesPage.resourcesList.tileItem.firstTile.css, () => {
      I.click(resourcesPage.resourcesList.tileItem.editBtn.css);
    });
    I.waitForVisible(resourcesPage.newResourceWidget.main, 5);
    I.fillField(resourcesPage.newResourceWidget.resourceInput, 'New-Name');

and then the output:

  15) Within #resources >:nth-child(1): I.fillField({"css":"#resource_name"}, "New-Name")
  14) Within #resources >:nth-child(1): I.waitForVisible({"css":".fancybox-opened"}, 5)
  13) Within #resources >:nth-child(1): I.click(".tile-list-item-actions a[title="Edit"]")

It should only be within in the line 13)

WebDriverIO helper option for window_size ignored

I have the following in my codecept.json file:

  "helpers": {
    "WebDriverIO": {
      "url": "url for site to test",
      "browser": "firefox",
      "window_size": "maximize"
    }

This running locally on a Mac (10.10.5) using both Chrome and Firefox.

The browser doesn't get maximised.

I.seeElement

I have a question regarding I.seeElement:
I find it quite strange that the I.seeElement method checks for the element in the DOM and not if the element is actually visible in the DOM, because the I.see method checks for the visiblity of the text and not its existance

Wouldn't it be better to implement the I.seeElement like this: Webdriver isVisible
And change the current I.seeElement to something like I.locateElement

Can't run Scenario.only: ReferenceError: escapeRe is not defined

Seems like something is missing when use Scenario.only

Scenario.only('something', () => {});

ReferenceError: escapeRe is not defined
    at Function.context.Scenario.only (
/tm-library/node_modules/codeceptjs/lib/interfaces/codeceptjs.js:90:28)
    at Object.<anonymous> (tm-library/mashups/RecentActivity/test/functional/mashup.js:3:10)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at //tm-library/node_modules/mocha/lib/mocha.js:216:27
    at Array.forEach (native)

https://github.com/Codeception/CodeceptJS/blob/master/lib/interfaces/codeceptjs.js#L90

TypeError: I.amOnPage is not a function

Going through the sample test in the quickstart still. When running the sample code, I get the following error which causes the test to fail:

└─[$] codeceptjs run --steps                                                             ◈ (ruby-2.2.1) ⧂ (go1.4) ⬡ (node-4.2.3) [9:40:42]
CodeceptJS v0.2.1
Test root is assumed to be /Users/therebelrobot/git/path/to/project

Testtest --
 test something
 ✖ FAILED in 221ms


-- FAILURES:

  1) Testtest test something:
     I.amOnPage is not a function

  TypeError: I.amOnPage is not a function
      at Test.<anonymous> (testtest.e2e.js:5:5)
      at Context.test.fn (/Users/therebelrobot/.nvm/versions/node/v4.2.3/lib/node_modules/codeceptjs/lib/scenario.js:30:24)


  FAIL  | 0 passed, 1 failed   // 240ms

Environment:

  • Mac OS X Yosemite 10.5.5
  • Node v4.2.3
  • Selenium v2.48.2

Aren't I and I.amOnPage() defined by codeceptjs? Or do I need to define those myself in steps file?

Possibly related, since I is defined by actor.js: #31

Unexpected strict mode reserved word on init

Hi
I've done sudo npm install -g codeceptjs, now when I am doing codeceptjs init in my project's root folder I get:

/usr/local/lib/node_modules/codeceptjs/lib/config.js:2
let fs = require('fs');
^^^
SyntaxError: Unexpected strict mode reserved word
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/codeceptjs/bin/codecept.js:6:14)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

Some env info

$ npm -v
3.3.12
$ node -v
v0.12.0

If the output folder exists, an exception is thrown

If we run codeceptjs init, then remove the created codecept.json file and run again codeceptjs init.

Then an error is thrown

readline.js:924
            throw err;
            ^

Error: EEXIST: file already exists, mkdir '/Users/<YOUR_USER>/Documents/<YOUR_PROJECT>/output'
    at Error (native)
    at Object.fs.mkdirSync (fs.js:799:18)
    at null.completed (/Users/<YOUR_USER>/.nvm/versions/node/v4.2.1/lib/node_modules/codeceptjs/lib/command/init.js:155:14)
    at PromptUI.onCompletion (/Users/<YOUR_USER>/.nvm/versions/node/v4.2.1/lib/node_modules/codeceptjs/node_modules/inquirer/lib/ui/prompt.js:57:10)
    at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.completed (/Users/<YOUR_USER>/.nvm/versions/node/v4.2.1/lib/node_modules/codeceptjs/node_modules/rx-lite/rx.lite.js:1550:12)
    at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/Users/<YOUR_USER>/.nvm/versions/node/v4.2.1/lib/node_modules/codeceptjs/node_modules/rx-lite/rx.lite.js:1489:14)
    at Subject.Rx.Subject.addProperties.onCompleted (/Users/<YOUR_USER>/.nvm/versions/node/v4.2.1/lib/node_modules/codeceptjs/node_modules/rx-lite/rx.lite.js:5871:19)
    at Subject.tryCatcher (/Users/<YOUR_USER>/.nvm/versions/node/v4.2.1/lib/node_modules/codeceptjs/node_modules/rx-lite/rx.lite.js:63:31)
    at AutoDetachObserverPrototype.completed (/Users/<YOUR_USER>/.nvm/versions/node/v4.2.1/lib/node_modules/codeceptjs/node_modules/rx-lite/rx.lite.js:5796:56)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/Users/<YOUR_USER>/.nvm/versions/node/v4.2.1/lib/node_modules/codeceptjs/node_modules/rx-lite/rx.lite.js:1489:14)

codeceptjs init - ReferenceError: helpers is not defined

Getting the following error off a fresh install:

npm install -g codeceptjs
codeceptjs init

Test root is assumed to be <directory>

  Welcome to CodeceptJS initialization tool
  It will prepare and configure a test environment for you

Installing to <directory>
C:\Users\user_name\AppData\Roaming\npm\node_modules\codeceptjs\lib\command\init
.js:79
        choices: Object.keys(helpers),
                             ^

ReferenceError: helpers is not defined
    at Command.module.exports.inquirer.prompt.result.helpers.forEach.result.help
ers.forEach.packages.forEach (C:\Users\user_name\AppData\Roaming\npm\node_modul
es\codeceptjs\lib\command\init.js:79:30)
...

npm -v = 3.8.2
node -v = 4.3.1
codeceptjs 0.3.0

Also did npm install -g webdriverio & npm install -g selenium-webdriver to see if that might magically fix it, but no luck.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.