GithubHelp home page GithubHelp logo

Comments (26)

rochejul avatar rochejul commented on May 28, 2024

Hi

Could check if you have not a similar issue link this: #33 (comment)

Because the plugin stop the selenium server, not your application server

Regards

from gulp-angular-protractor.

kleinph avatar kleinph commented on May 28, 2024

Yes I saw issue #33, but I don't have another task dependency. The server needs to run for the tests and the tests are executed standalone with gulp test (e.g. from a terminal).

BTW thanks for the fast repsonse :)

from gulp-angular-protractor.

rochejul avatar rochejul commented on May 28, 2024

The application server is always running ? Or is launched with gulp ?
What is your process to run your functional tests ?

Because if you saw "[10:13:39] gulp-angular-protractor - Webdriver standalone server is stopped", that means we have killed the selenium server

And if you saw:
{ [Error: protractor exited with code 1]
message: 'protractor exited with code 1',
showStack: false,
showProperties: true,
plugin: 'gulp-angular-protractor',
__safety: { toString: [Function: bound ] } }

This is the error output from seleninum to explain the error (basically, it said "error code 1", so this is no really helpfull, but it means the tests are failed)

Could you give me a sample of your configuration to reproduce your issue ? And to check your gulp version, plugin version, node / npm version, etc ...

Many thanks

from gulp-angular-protractor.

kleinph avatar kleinph commented on May 28, 2024

Currently I am integrating the tests in our build chain, but at the moment the server is started from the IDE and I run the tests manually from commandline when the application is already running (in the future this should be integrated with a gradle task which starts the server first and then the tests via npm test which in turn runs gulp test).

Versions:

  • node : v8.2.1
  • npm: 5.3.0
  • gulp: 3.9.1
  • gulp-angular-protractor: 1.0.0

And this is my protractor conf:

let os = require('os');
let path = require('path');

let Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');

exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub',
    multiCapabilities: [{
        browserName: 'chrome',
        chromeOptions: {
            args: [
                '--disable-blink-features=BlockCredentialedSubresources', // needed for authentication
                '--headless', '--disable-gpu', '--window-size=1920x1040'
            ]
        }
    }],
    suites: {
        client: 'client/*.spec.js',
        widgets: 'widgets/*.spec.js',
        full: '**/*.spec.js'
    },
    params: {
        auth: {
            user: 'user',
            password: 'password'
        }
    },
    onPrepare: function () {
        // load page here to authenticate user
        browser.get(`http://${browser.params.auth.user}:${browser.params.auth.password}@localhost:8080/#/`);

        return browser.getCapabilities().then(capability => {
            let date = (new Date()).toISOString().replace(':', '.').slice(0, 16);
            let browserName = capability.get('browserName');
            jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({
                savePath: path.resolve(os.tmpdir(), 'htmlReports', `${browserName}_${date}`)
            }));
        });
    }
};

Many thanks!

from gulp-angular-protractor.

rochejul avatar rochejul commented on May 28, 2024

Hummm have you tried to run the examples from the plugin ? You can find the examples here: https://github.com/rochejul/gulp-angular-protractor/tree/master/examples

If it works on your side, could you create a sample project to illustrate your issue ? With similar package.json, protractor configuration and some similar tests ?

Many thanks

from gulp-angular-protractor.

kleinph avatar kleinph commented on May 28, 2024

So after intensive testing I can tell you, that the problem is the protractor version: if protractor 4.x is used the gulp task terminates normally, with protractor 5.x it hangs.

from gulp-angular-protractor.

rochejul avatar rochejul commented on May 28, 2024

Interesting

What kind of action can I bring ? To restrict the protractor dependency ?

Have you notice a specific event with protractor 5 ?

I think I have to investiguate to find why on protractor 5, it cannot terminate.

I will rename your issue name to specify that issue

Regards

from gulp-angular-protractor.

kleinph avatar kleinph commented on May 28, 2024

Hm good question. Protractor is not even a dependency of this plugin. At the moment I am fine with restricting the protractor dep in my own project, but maybe a hint in the Readme with a link to this issue would be a good idea.

What do you mean with specific event?

from gulp-angular-protractor.

Drarok avatar Drarok commented on May 28, 2024

I've been trying to work out what's causing this, but all I have to add so far is that selenium isn't terminated – I put in a process.exit() like so:

  return gulp
    .src()
    .pipe(protractor({}))
    .on('end', function () {
      setTimeout(() => process.exit(), 2500);
    });

After the node process ends, the selenium server is still there, listening on its port and blocking further runs.

from gulp-angular-protractor.

Drarok avatar Drarok commented on May 28, 2024

Hmm, further to that, if I manually kill the selenium process in another tab, the gulp process exits cleanly.

[14:06:58] Finished 'test-e2e' after 6.04 s
# I run `killall -9 java` in another terminal here
[14:07:01] gulp-angular-protractor - Webdriver standalone server will be closed

from gulp-angular-protractor.

rochejul avatar rochejul commented on May 28, 2024

Hi @Drarok

I think there is a new step onto the protractor selenium server to hang the end of the execution (I remember a similar issue for older versions).

I hope to find some time on the next week to look on it.

Regards

from gulp-angular-protractor.

guan01 avatar guan01 commented on May 28, 2024

Thanks, waiting for some good news. I have been manually killing the process since we decoupled the Protractor and Webdriver from the framework.

from gulp-angular-protractor.

rochejul avatar rochejul commented on May 28, 2024

Ok, it seems we are faced to an issue around the selenium server: angular/webdriver-manager#199

So protractor added this new issue: https://github.com/angular/webdriver-manager/blob/master/lib/cmds/shutdown.ts#L35 because their associated "webdriver shutdow" command is inefficient now

I try to find a workaround

Regards

from gulp-angular-protractor.

rochejul avatar rochejul commented on May 28, 2024

Okkkkkkkkkkkkkkkkkkkkkayyyyyyy

So, it seems this is not clear for the Selenium team since 3.X if we really could stop the server or not (arguments for security issues).

Maybe I should use instead something like that (to stop the webdriver-manager instance):

child.kill(); // because it was raised with spawn

I have to check this

Regards

from gulp-angular-protractor.

rochejul avatar rochejul commented on May 28, 2024

Was fixed in version 1.1.0.

There is an example folder "examples/example-06" to illustrate

Regards

from gulp-angular-protractor.

stasyasin avatar stasyasin commented on May 28, 2024

For me issue is still reproducible. I am using gulp-angular-protractor 1.1.1 ( tried 1.1.0, 0.4.0, 0.3.0, 1.0.0 also) and protractor 5.2.2.
When test finished it write
2 specs, 0 failures
Finished in 5.393 seconds

[11:18:11] I/launcher - 0 instance(s) of WebDriver still running
[11:18:11] I/launcher - chrome #1 passed
[11:18:11] gulp-angular-protractor - We will stop the Protractor engine
[11:18:11] Finished 'run:protractor' after 25 s

and then nothing. Process is not finished( this mean that jasmine html report is also not created).

my gulp task is
gulp.task('run:protractor', [], function (callback) {
var configFile = "qaprotractor.conf.js";

gulp
.src(qaconfigFile.config.specs)
.pipe(gulpProtractorAngular ({
configFile: configFile,
debug: false,
args: ['--baseUrl', 'http://localhost:8000'],
autoStartStopServer: true
}))
.on('error', function (e) {
console.log(e);
})
.on('end', function () {
callback();
});
});

Could you please help me with this?

from gulp-angular-protractor.

rochejul avatar rochejul commented on May 28, 2024

@stasyasin Hi, have you check the example folder "examples/example-06" on your machine ?
And compare the difference between your project and the example ?

Many thanks

from gulp-angular-protractor.

stasyasin avatar stasyasin commented on May 28, 2024

Hi @rochejul Yes, sure, I did it before. I have a little bit different gulp-task, but I made it like your in example-06. I have different protractor.conf.js ( you don't use arguments of chrome). But even when I deactivate them -> it didn't help.
Looks like selenium standalone is not killed. I need to kill java.exe each time between running tests, otherwise it saying that port 4444 (default one) is already in use.

from gulp-angular-protractor.

rochejul avatar rochejul commented on May 28, 2024

Could you provide an attachment with your configuration and your tests please ?

Many thanks

from gulp-angular-protractor.

stasyasin avatar stasyasin commented on May 28, 2024

I have attached conf file screenshots. For test it will be complicated, because I have complex page object module. But it is normal test like
describe('Test - ' + testName, () => {
this.pageSetup();
it('Perform Login actions', (done) => {
this.performLogin();
done();
});
});
prot_conf_2
prot_conf

from gulp-angular-protractor.

rochejul avatar rochejul commented on May 28, 2024

@stasyasin not very usefulle to copy / paste the configuration ...
Please try to create a tiny project to illustrate your issue. Otherwise, it will be very hard for me to try to reproduce it on my side
Thanks

from gulp-angular-protractor.

stasyasin avatar stasyasin commented on May 28, 2024

@rochejul Hi, I have added my conf file here

protractor_conf.txt

for a specs
describe('Test - ', () => {
browser.get('https://google.com'); //not sure if google is angular =)
it('Perform Login actions', (done) => {
//do nothing();
done();
});
});

from gulp-angular-protractor.

stasyasin avatar stasyasin commented on May 28, 2024

Ok, so I know how to finish the process,
.on('end', function () {
setTimeout(function() {
process.exit();
}, 2500);
});
this will exit the process after 2.5 sec. But issue that something( I think selenium-standalone) is still running and using port 4444... each time it is different PID(processID) , and each time I need to kill it manually. Even if I will write some function to kill process -> I don't want to kill the process because this is java.exe . I want that listening for 4444 stopped.
Otherwise I can't run the test again, because it says that port is busy
BTW: I am on jdk 1.8

from gulp-angular-protractor.

stasyasin avatar stasyasin commented on May 28, 2024

@rochejul Looks like I have found good workaround. But I hate you and all gulp-angular-protractor team =) I have tried to run my tests trough npm commands -> it was difficult to start webdriver and run tests in the same command. I wrote sh script that looking for process ID by port and killing it. But it was also ugly.
Best decision is to use process-finder module and kill process on the end of your task.
https://www.npmjs.com/package/process-finder

example of code:
var finder = require('process-finder');
gulp.task('run:protractor', function (callback) {
var configFile = "qaprotractor.conf.js";
var port = 4444;

gulp
.src(qaconfigFile.config.specs)
.pipe(gulpProtractorAngular ({
configFile: configFile,
debug: false,
args: ['--baseUrl', 'http://localhost:8000'],
autoStartStopServer: true
}))
.on('error', function (e) {
console.log(e);
finder.find(port, function(err, pids){
process.kill(pids[0]);
});
})
.on('end', function () {
finder.find(port, function(err, pids){
process.kill(pids[0]);
});
});
});

from gulp-angular-protractor.

rochejul avatar rochejul commented on May 28, 2024

@stasyasin There is no team : I am alone, with a job, a wifecand child.

I try to take some time for all my opensouce project and this is hard.

When I saw your comment, I think I will create now only private tools.

Regards

from gulp-angular-protractor.

stasyasin avatar stasyasin commented on May 28, 2024

@rochejul To be honest it was a joke =) I am very enjoying to use your tool(Adding it to each my framework, because of autoStartStopServer ). It's really good, no worries! Just spent a lot of time to understand how to kill the process correctly inside gulp task, anyway it was fun. Hope my comment help you to improve it

from gulp-angular-protractor.

Related Issues (20)

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.