Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Isolated Mode #11242

Closed
Mpdreamz opened this issue Apr 16, 2013 · 3 comments
Closed

Isolated Mode #11242

Mpdreamz opened this issue Apr 16, 2013 · 3 comments
Labels

Comments

@Mpdreamz
Copy link

I want to run multiple tests in parallel using phantomjs tests (several of which register a random user and login/logout) which I am currently doing through the following nodejs script:

var processes = [];
async.eachLimit(files, 10, function(file, complete) 
{ 
    if (!file.match(/^(?!_).*(?:.coffee|.js)$/))
    {
        //only run files ending with .coffee or .js 
        //that do not start with an underscore
        complete();
        return;
    }
    var p = spawn('tools/phantomjs/phantomjs.exe', [
         "build/phantomjs/" + file, 
         "--host=" + host
    ], {
        cwd : "../.."
    });
    processes.push(p);
    p.on('error', function (data) {
        process.stderr.write(file + ':' + data);

        exitCode = 1; //force run failure 
        complete(data + '');
    });

    p.stdout.on('data', function (data) {
        process.stdout.write(file + ':' + data);
    });

    p.stderr.on('data', function (data) {
        process.stderr.write(file + ':' + data);
    });

    p.on('close', function (code) {
        if (code != 0)
        {
            //kill all the other phantomjs processes
            //otherwise they will keep running until completion
            _.each(processes, function(p) { p.kill(); });
            process.stderr.write("Exiting tests with exit code: " + code);
            process.exit(code);
        }
        console.log('child process exited with code ' + code);
        complete();
    });
});    

However I get random errors which I believe to be because all the phantomjs's share the same cookiejar?

If I change async's foreach to only run tests 1 at a time the tests always succeed.

What I'm looking for is to start phantomjs in isolated mode so that it won't get the cookies from other phantomjs processes. Maybe chrome profiles could come to the rescue here somehow?

Has anybody run into this before?

@JamesMGreene
Copy link
Collaborator

Have you tried using the --cookies-file=/path/to/cookies.txt command line option?

@Mpdreamz
Copy link
Author

Hey @JamesMGreene I indeed tried:

  var p = spawn('tools/phantomjs/phantomjs.exe', [
       "build/phantomjs/" + file, 
       "--host=" + host,
      "--cookies-file=" + file + ".txt"
  ], {
      cwd : "../.."
  });

but i do not see any files being generated, also tried running it like that while manually generating the cookie files to no avail.

@stale stale bot added the stale label Dec 27, 2019
@stale
Copy link

stale bot commented Dec 30, 2019

Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

@stale stale bot closed this as completed Dec 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants