protractor-flake icon indicating copy to clipboard operation
protractor-flake copied to clipboard

protractor flake executing all suites mentioned instead of specific suite

Open ghost opened this issue 5 years ago • 2 comments

Hi

  • Operating system and version : Windows 7 Professional
  • Node.js version : 10.15.1
  • Protractor version : 5.4.2
  • Protractor flake version : 4.0.0
  • Protractor configuration file :
import {Config,browser} from "protractor";
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
import protractorFlake = require('protractor-flake')

export let config: Config = {
   directConnect:true,
 
    capabilities: {
      browserName: 'chrome',
      restartBrowserBetweenTests: true
    },
    specs: ['./src/test/com/test/*/*.js'],
    suites :
        {
          RegressionTest : [
            './src/test/nonAngularApp/nonAngularTest.js',
            './src/test/calculator/calculatorTest.js'
          ],
          NonAngularTest : './src/test/nonAngularApp/nonAngularTest.js',
        },
    onPrepare:()=>{
      browser.manage().window().maximize();
      jasmine.getEnv().addReporter(
        new Jasmine2HtmlReporter({
          takeScreenshots: true,
          takeScreenshotsOnlyOnFailures: true,
          savePath: 'target/screenshots'
        })
      );
    },
    jasmineNodeOpts: {
      showColors: true, // Use colors in the command line report.
    }
  };
  • package.json file :
{
  "name": "protractortypescriptjasmine",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "CombinedTest": "protractor-flake --parser multi  --max-attempts=2 --suite RegressionTest -- ./JSFiles/configuration.js",
    "NonAngularTest": "protractor-flake --parser multi  --max-attempts=2 --suite NonAngularTest -- ./JSFiles/configuration.js",
    "NonAngular": "protractor JSFiles/configuration.js --suite NonAngularTest",
    "pretest": "tsc",
    "protractor": "./node_modules/protractor/built/cli.js",
    "webdriver-update": "./node_modules/.bin/webdriver-manager update"
  },
  "author": "User",
  "license": "ISC",
  "dependencies": {
    "protractor": "^5.4.2",
    "typescript": "~3.2.2",
    "jasmine": "~3.3.1",
    "@types/jasmine": "^3.3.5",
    "@types/jasminewd2": "2.0.6",
    "ts-node": "7.0.1",
    "@types/node": "10.12.18",
    "jasmine-data-provider": "^2.2.0",
    "protractor-jasmine2-html-reporter": "^0.0.7",
    "protractor-flake": "^4.0.0"
  }
}
  • Output from your test suite I am executing command npm run NonAngularTest and this should execute only NonAngularTest testsuite that contains only 1 test file but it in actual case it is executing all the test files mentioned in the suites in Protractor configuration file i.e nonAngularTest.js and calculatorTest.js but is should execute only nonAngularTest.js .

Please have a look and provide the solution.

Thanks!!!

ghost avatar Apr 02 '19 12:04 ghost

According to the Caveats section:

Tests will not re-run properly (all tests will run each time) if you use a custom reporter that does not log stacktraces for failed tests. For example, if you are using jasmine-spec-reporter with Jasmine 2.0, make sure to set displayStacktrace: 'specs' or displayStacktrace: 'all'.

Looks like the problem is in

jasmine.getEnv().addReporter(
        new Jasmine2HtmlReporter({
          takeScreenshots: true,
          takeScreenshotsOnlyOnFailures: true,
          savePath: 'target/screenshots'
        })
      );

Enable stacktrace displaying.

tymfear avatar Apr 30 '19 14:04 tymfear

Hi, I'm commenting because I'm affected by this. @tymfear, I don't think your answer addressed the question: this is not about retrying, but about running a single suite.

Using --suite with protractor-flake still runs all e2e tests.

Do you know if it's possible to run a single suite?

siovene avatar Jun 05 '20 09:06 siovene