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

protractor flake executing all suites mentioned instead of specific suite #109

Open
ghost opened this issue Apr 2, 2019 · 2 comments
Open

Comments

@ghost
Copy link

ghost commented Apr 2, 2019

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!!!

@tymfear
Copy link

tymfear commented Apr 30, 2019

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.

@siovene
Copy link

siovene commented Jun 5, 2020

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?

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

2 participants