Skip to content

protractor-flake finds the typescript file (not the compiled file) on retry #107

@mathpunk

Description

@mathpunk

This might be a documentation problem rather than a parser problem. I discovered that protractor-flake was rerunning all of my tests rather than the failed ones, so I tried a small test with one spec deliberately set to fail. Here was the command and the resultant output:

$ ./node_modules/protractor-flake/bin/protractor-flake --max-attempts=3 -- e2e/dist/e2e/conf.js --capabilities.chromeOptions.args=[] --suite login

[12:09:20] I/launcher - Running 1 instances of WebDriver
[12:09:20] I/direct - Using ChromeDriver directly...
Started
problem trying to remove a folder:./reports/
.F

Failures:
1) LogicGate landing page allows an admin to log in
  Message:
    Expected true to be falsy.
  Stack:
    Error: Failed expectation
        at UserContext.<anonymous> (/home/man/logicgate/dev/logicgate/platform/client/e2e/specs/access/login.spec.ts:25:48)
        at /home/man/logicgate/dev/logicgate/platform/client/node_modules/jasminewd2/index.js:112:25
        at new ManagedPromise (/home/man/logicgate/dev/logicgate/platform/client/node_modules/selenium-w
ebdriver/lib/promise.js:1077:7)
        at ControlFlow.promise (/home/man/logicgate/dev/logicgate/platform/client/node_modules/selenium-webdriver/lib/promise.js:2505:12)
        at schedulerExecute (/home/man/logicgate/dev/logicgate/platform/client/node_modules/jasminewd2/index.js:95:18)
        at TaskQueue.execute_ (/home/man/logicgate/dev/logicgate/platform/client/node_modules/selenium-webdriver/lib/promise.js:3084:14)
        at TaskQueue.executeNext_ (/home/man/logicgate/dev/logicgate/platform/client/node_modules/selenium-webdriver/lib/promise.js:3067:27)
        at asyncRun (/home/man/logicgate/dev/logicgate/platform/client/node_modules/selenium-webdriver/lib/promise.js:2974:25)
        at /home/man/logicgate/dev/logicgate/platform/client/node_modules/selenium-webdriver/lib/promise.js:668:7

2 specs, 1 failure
Finished in 39.771 seconds


[12:10:03] I/launcher - 0 instance(s) of WebDriver still running
[12:10:03] I/launcher - chrome #01 failed 1 test(s)
[12:10:03] I/launcher - overall: 1 failed spec(s)
[12:10:03] E/launcher - Process exited with error code 1

Using standard to parse output
Re-running tests: test attempt 2

So far so good. But check this out: Continuing,

Re-running the following test files:
/home/man/logicgate/dev/logicgate/platform/client/e2e/specs/access/login.spec.ts
[12:10:03] I/launcher - Running 1 instances of WebDriver
[12:10:03] I/direct - Using ChromeDriver directly...
[12:10:05] E/launcher - Error: /home/man/logicgate/dev/logicgate/platform/client/e2e/specs/access/login.spec.ts:1
(function (exports, require, module, __filename, __dirname) { import { Timings } from '../../models/timings';
                                                                     ^

SyntaxError: Unexpected token {
    at new Script (vm.js:84:7)
    at createScript (vm.js:264:10)
    at Object.runInThisContext (vm.js:312:10)
    at Module._compile (internal/modules/cjs/loader.js:696:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:747:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:568:12)
    at Function.Module._load (internal/modules/cjs/loader.js:560:3)
    at Module.require (internal/modules/cjs/loader.js:665:17)
    at require (internal/modules/cjs/helpers.js:20:18)
[12:10:05] E/launcher - Process exited with error code 100

Using standard to parse output
Re-running tests: test attempt 3

Tests failed but no specs were found. All specs will be run again.

[12:10:06] I/launcher - Running 1 instances of WebDriver
[12:10:06] I/direct - Using ChromeDriver directly...
Started....

My read is, it looks like the first run correctly used my compiled conf.js to find the paths for the tests it needed to run, but on the subsequent run, it picked up the typescript file instead. Did I miss a flag somewhere in my command, or is this a genuine bug?

===============================================

  • OS: 4.14.98-1-MANJARO x86_64 GNU/Linux
  • Node: v11.8.0
  • "protractor": "^5.4.1",
  • "protractor-flake": "^4.0.0",
  • Protractor configuration file:
import { browser, Config } from 'protractor';

export let config: Config = {
  baseUrl: process.env.BASE_URL,
  capabilities: {
    browserName: 'chrome',
    chromeOptions: {
      args: ['--headless', '--disable-gpu', '--window-size=800,600'],
    },
  },
  directConnect: true,
  jasmineNodeOpts: {
    defaultTimeoutInterval: 260000,
    includeStackTrace: true,
    isVerbose: true,
    showColors: true,
  },
  onPrepare: () => {
    const Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
    const jasmineReporters = require('jasmine-reporters');

    return browser.getProcessedConfig().then(() => {
      jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
        consolidateAll: true,
        displayStacktrace: 'specs',
        savePath: './reports/e2e/',
      }));

      jasmine.getEnv().addReporter(
        new Jasmine2HtmlReporter({
          displayStacktrace: 'specs',
          fileNameDateSuffix: true,
          fixedScreenshotName: true,
          savePath: './reports/',
          screenshotsFolder: 'screenshots',
          takeScreenshots: true,
          takeScreenshotsOnlyOnFailures: true,
        }),
      );

      browser.credentials = {
        email: process.env.ADMIN_ID,
        firstName: process.env.ADMIN_FIRSTNAME,
        lastName: process.env.ADMIN_LASTNAME,
        password: process.env.ADMIN_PASSWORD,
      };
      browser.waitForAngularEnabled(false);
      browser.manage().deleteAllCookies();
    });
  },
  suites: {
    access: 'specs/app/build/access/*.spec.js',
    fields: ['specs/app/build/processes/node/form/field/*.spec.js',
      'specs/app/build/processes/node/form/field/**/*.spec.js'],
    forms: 'specs/app/build/processes/node/form/*.spec.js',
    login: 'specs/access/login.spec.js',
    nodes: 'specs/app/build/processes/node/*.spec.js',
    paths: 'specs/app/build/processes/node/path/*.spec.js',
    processes: 'specs/app/build/processes/process/*.spec.js',
    queue: 'specs/app/main/queue/incident-management/*.spec.js',
    users: 'specs/app/admin/users/*.js',
  },
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions