Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

Incorrect 2 test Mocha Example? #112

Open
micahgodbolt opened this issue Sep 3, 2015 · 5 comments
Open

Incorrect 2 test Mocha Example? #112

micahgodbolt opened this issue Sep 3, 2015 · 5 comments

Comments

@micahgodbolt
Copy link

I'm new to Mocha, so bare with me, but in trying to set up multiple webdrivercss tests inside of a mocha test I followed the example in the readme file

// Example using Mocha
it('should check the first page',function(done) {
  client
    .init()
    .url('https://example.com')
    // Make this name unique.
    .webdrivercss('page1', [
      {
        name: 'test',
        screenWidth: [320,480,640,1024]
      }, {
        name: 'test_two',
        screenWidth: [444,666]
      }
    ])
    .end()
    .call(done);
});

it('should check the second page',function(done) {
  client
    // ...
    // Make this name unique.
    .webdrivercss('page2', [
      // ..
    ])
    // ...
);

I continued to get the following errors on the second "should check the second page" test.

Uncaught RuntimeError
     (UnknownError:13) An unknown server-side error occurred while processing the command.
     Problem: POST /session//url

I was able to resolve the issue by removing the .end() function from the first test.

Is this the correct way to run tests? Does .end() tell webdriver to stop? Should we update the documentation?

@elicwhite
Copy link
Contributor

As a side note, is there any way we can improve the error message when this happens?

@amitaibu
Copy link
Contributor

amitaibu commented Sep 3, 2015

@micahgodbolt the end() should happen in a after() function so it won't close the connection. (unless if it's a single test you are running).

In a "shoovified" example you can see there's no end() inside the it()

@amitaibu
Copy link
Contributor

amitaibu commented Sep 3, 2015

As a side note, is there any way we can improve the error message when this happens?

The (cryptic) error message is coming from here

@christian-bromann
Copy link
Contributor

@amitaibu @TheSavior we used to check if a command requires a session id but this seems to not work anymore. I created an issue to tackle this

@christian-bromann
Copy link
Contributor

@micahgodbolt you didn't get a session ID so somehow the init function wasn't executed or at least not executed successfully

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants