Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test description not passed to baseFileName variable #3

Open
tediroca opened this issue Sep 14, 2016 · 6 comments
Open

Test description not passed to baseFileName variable #3

tediroca opened this issue Sep 14, 2016 · 6 comments

Comments

@tediroca
Copy link

I've created the folling test:

var sgpt = require('sg-protractor-tools');

describe('Memory Test', function () {
    it('should allow me to measure memory', function () {
        var iterations = 250;
        sgpt.memory.runTestFunction(this, iterations, function () {
            console.log("Testing");
        });
    });
});

If I try to execute this single spec (named test.spec.js) this produces the following error:

C:\Users\tedi\git\proj\e2e-tests>protractor protractor-int.conf.js --specs=test.spec.js
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
Spec started

  Memory Test
    × should allow me to measure memory
      - Failed: Cannot read property 'replace' of undefined
          at C:\Users\tedi\git\proj\node_modules\sg-protractor-tools\lib\memory.js:67:74
          at Object.module.exports.startMemoryMeasurement (C:\Users\tedi\git\proj\node_modules\sg-protractor-tools\lib\memory.js:119:6)
          at Object.module.exports.runTestFunction (C:\Users\tedi\git\proj\node_modules\sg-protractor-tools\lib\memory.js:173:40)
          at Object.<anonymous> (C:\Users\tedi\git\proj\e2e-tests\test.spec.js:11:21)
          at wrappedCtr.constructor (C:/Users/tedi/AppData/Roaming/npm/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1056:7)
          at new wrappedCtr (C:\Users\tedi\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:2468:26)
          at wrappedCtr.execute_ (C:/Users/tedi/AppData/Roaming/npm/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2776:14)
          at wrappedCtr.executeNext_ (C:/Users/tedi/AppData/Roaming/npm/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2758:21)
      From: Task: Run it("should allow me to measure memory") in control flow
      From asynchronous test:
      Error
          at Suite.<anonymous> (C:\Users\tedi\git\proj\e2e-tests\test.spec.js:7:5)
          at Object.<anonymous> (C:\Users\tedi\git\proj\e2e-tests\test.spec.js:4:1)
          at Module._compile (module.js:556:32)
          at Object.Module._extensions..js (module.js:565:10)
          at Module.load (module.js:473:32)
          at tryModuleLoad (module.js:432:12)

I'm using Protractor 3.0.0 and Jasmine 2.5.1

@cawo
Copy link
Contributor

cawo commented Sep 15, 2016

Hi
Can you confirm that you have run your test by running the server and the test in a second console As describer here : https://github.com/SunGard-Labs/sg-protractor-tools/tree/master/example

Thanks

@tediroca
Copy link
Author

Hi,

I'm running the tests by directly invokating protractor and using the config below:

exports.config = {
    allScriptsTimeout: 1000000,
    directConnect: true,
    specs: ['*.spec.js'],
    capabilities: {
        'browserName': 'chrome',
        'chromeOptions': {'args': ['lang=en-GB', 'enable-precise-memory-info', 'js-flags=--expose-gc', 'no-sandbox']}
    },
    baseUrl: 'https://mytestenvironment.com',
    framework: 'jasmine2',
    restartBrowserBetweenTests: false,
    onPrepare: function () {
        browser.manage().window().setSize(1600, 1000);
        var jasmineReporters = require('jasmine-reporters');
        jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
            consolidateAll: true,
            filePrefix: 'results',
            savePath: 'reports/xml'
        }));
        var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
        jasmine.getEnv().addReporter(new HtmlScreenshotReporter({
            dest: 'reports/html',
            filename: 'results.html'
        }));
        var SpecReporter = require('jasmine-spec-reporter');
        jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
    },
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 1050000,
        isVerbose: true,
        includeStackTrace: true,
        print: function () {}
    }
};

In my case the application is already deployed and running in an external server and I'm invoking each of the specs individually in order to have a more granular control of the execution results.

Thanks.

@nicolasletoublon
Copy link

I got exactly the same problem, running a simple test, with the server external also ..
Do that library still supported ??

@beatakru
Copy link

beatakru commented Feb 21, 2019

  1. line from memory.js is:
    var baseFileName = path.join(options.dir, 'M_' + test.description.replace(/\W/gi, '-') + '_' + time);

So you need to declare your it in the same "test" way:
const test = it('Memory Test', () => {
var memoryMeasure = sgpt.memory.startMemoryMeasurement(test);
}

@SubJunk
Copy link

SubJunk commented Sep 16, 2019

I got this too, and I am using names for the describe and it blocks.

@AravindKumar3992
Copy link

Issue got resolved?? If its resolved please pine me the solution

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

No branches or pull requests

6 participants