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

npm error after first feature test #405

Closed
mario737 opened this issue Jan 22, 2020 · 5 comments
Closed

npm error after first feature test #405

mario737 opened this issue Jan 22, 2020 · 5 comments
Labels

Comments

@mario737
Copy link

@mario737 mario737 commented Jan 22, 2020

Can not run tests with multiple (3) feature files. If only one of the three feature files is specified in protractor conf file, then the test runs successfully.

npm version 6.12.0

@mario737
Copy link
Author

@mario737 mario737 commented Jan 22, 2020

here the errors from console output:

[10:03:54] E/launcher - Error: VError: an AfterAll hook errored, process exiting: node_modules\@serenity-js\cucumber\src\listeners\cucumber-4.ts:12: Some of the async operations have failed:
[ArtifactArchiver] Saving 'photo-windows-chrome-79.0.3945.117-james-ensures-that-the-administrator-list-value-does-become-selected-e34d6449ca.png'... - TypeError: Cannot read property 'screenshots' of undefined
    at C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\@serenity-js\serenity-bdd\src\stage\crew\serenity-bdd-reporter\reports\SceneReport.ts:228:71
    at SceneReport.withMutated (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\@serenity-js\serenity-bdd\src\stage\crew\serenity-bdd-reporter\reports\SceneReport.ts:328:9)
    at SceneReport.photoTaken (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\@serenity-js\serenity-bdd\src\stage\crew\serenity-bdd-reporter\reports\SceneReport.ts:227:21)
    at MatchesIdentical.transformation (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\@serenity-js\serenity-bdd\src\stage\crew\serenity-bdd-reporter\strategies\SceneReportingStrategy.ts:51:57)
    at MatchesIdentical.MatcherRule.execute (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\tiny-types\src\pattern-matching\rules\MatcherRule.ts:13:21)
    at IdentityMatcher.PatternMatcher.else (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\tiny-types\src\pattern-matching\PatternMatcher.ts:17:71)
    at MatchesObjectsWithCommonPrototype.transformation (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\@serenity-js\serenity-bdd\src\stage\crew\serenity-bdd-reporter\strategies\SceneReportingStrategy.ts:52:22)
    at MatchesObjectsWithCommonPrototype.MatcherRule.execute (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\tiny-types\src\pattern-matching\rules\MatcherRule.ts:13:21)
    at ObjectMatcher.PatternMatcher.else (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\tiny-types\src\pattern-matching\PatternMatcher.ts:17:71)
    at SingleSceneReportingStrategy.SceneReportingStrategy.handle (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\@serenity-js\serenity-bdd\src\stage\crew\serenity-bdd-reporter\strategies\SceneReportingStrategy.ts:53:18)
    at MatchesAnything.transformation (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\@serenity-js\serenity-bdd\src\stage\crew\serenity-bdd-reporter\strategies\SingleSceneReportingStrategy.ts:26:36)
    at MatchesAnything.MatcherRule.execute (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\tiny-types\src\pattern-matching\rules\MatcherRule.ts:13:21)
    at ObjectMatcher.PatternMatcher.else (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\tiny-types\src\pattern-matching\PatternMatcher.ts:17:71)
    at SingleSceneReportingStrategy.handle (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\@serenity-js\serenity-bdd\src\stage\crew\serenity-bdd-reporter\strategies\SingleSceneReportingStrategy.ts:26:18)
    at MatchesAnything.transformation (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\@serenity-js\serenity-bdd\src\stage\crew\serenity-bdd-reporter\SerenityBDDReporter.ts:43:62)
    at MatchesAnything.MatcherRule.execute (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\tiny-types\src\pattern-matching\rules\MatcherRule.ts:13:21)
---

    at C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\cucumber\lib\runtime\index.js:68:19
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\cucumber\lib\runtime\index.js:26:103)
    at _next (C:\workspace0056\Dev\tm4j2git\tm4j2git-frontend\node_modules\cucumber\lib\runtime\index.js:28:194)
[10:03:54] E/launcher - Process exited with error code 100
npm ERR! code ELIFECYCLE
npm ERR! errno 100
npm ERR! tm4j2git@ test:local: `protractor ./protractor_local.conf.js`
npm ERR! Exit status 100
npm ERR!
npm ERR! Failed at the tm4j2git@ test:local script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\tgdbamaw\AppData\Roaming\npm-cache\_logs\2020-01-22T09_03_54_218Z-debug.log

@mario737
Copy link
Author

@mario737 mario737 commented Jan 22, 2020

package.json:

{
  "name": "tm4j2git",
  "description": "A Vue.js project",
  "private": true,
  "scripts": {
    "dev": "cross-env NODE_ENV=development webpack-dev-server --open --inline --hot",
    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
    "postinstall": "serenity-bdd update",
    "clean": "rimraf target",
    "test": "npm-run-all clean test:execute test:report",
    "test:execute": "protractor ./protractor.conf.js",
    "test:execute:wip": "protractor ./protractor.conf.js --cucumberOpts.tags=@wip",
    "test:report": "serenity-bdd run --features ./features",
    "test:local": "protractor ./protractor_local.conf.js",
    "wip": "npm-run-all clean test:execute:wip test:report"
  },
  "engines": {
    "node": "10.16.3",
    "npm": "6.9.0"
  },
  "dependencies": {
    "axios": "^0.19.0",
    "bootstrap": "^3.3.7",
    "vue": "^2.6.10",
    "vue-router": "^2.0.1",
    "vuelidate": "^0.7.4",
    "synctractor": "^0.2.0",
    "typescript": "^3.7.3"
  },
  "devDependencies": {
    "babel-core": "^6.0.0",
    "babel-loader": "^6.0.0",
    "babel-preset-es2015": "^6.0.0",
    "cross-env": "^3.0.0",
    "css-loader": "^0.25.0",
    "file-loader": "^0.9.0",
    "vue-loader": "^9.7.0",
    "webpack": "2.1.0-beta.25",
    "webpack-dev-server": "2.1.0-beta.0",
    "npm-run-all": "^4.1.5",
    "@serenity-js/assertions": "next",
    "@serenity-js/core": "next",
    "@serenity-js/cucumber": "next",
    "@serenity-js/protractor": "next",
    "@serenity-js/rest": "next",
    "@serenity-js/serenity-bdd": "next",
    "@types/cucumber": "^4.0.7",
    "@types/node": "^10.17.5",
    "chromedriver": "^79.0.0",
    "cucumber": "^5.1.0",
    "is-ci": "^2.0.0",
    "npm-failsafe": "^0.4.1",
    "protractor": "^5.4.2",
    "rimraf": "^3.0.0",
    "ts-node": "^8.5.2",
    "vue-template-compiler": "^2.6.10"
  }
}

@mario737
Copy link
Author

@mario737 mario737 commented Jan 22, 2020

protractor conf:

const
    { ArtifactArchiver } = require('@serenity-js/core'),
    { Photographer, TakePhotosOfInteractions } = require('@serenity-js/protractor'),
    { SerenityBDDReporter } = require('@serenity-js/serenity-bdd'),
    isCI = require('is-ci');

exports.config = {
    //config for local test
    baseUrl: 'http://localhost:8080/login',
    chromeDriver: require(`chromedriver/lib/chromedriver`).path,

    SELENIUM_PROMISE_MANAGER: true,

    //when using selenium Grid false is required,
    directConnect: true,

    // https://github.com/angular/protractor/blob/master/docs/timeouts.md
    allScriptsTimeout: 110000,

    framework:      'custom',
    frameworkPath:  require.resolve('@serenity-js/protractor/adapter'),

    specs: [ 'features/**/*.feature' ],
    exclude: [ 'features/addAdministrator.feature',  'features/addSync.feature'],

    serenity: {
        runner: 'cucumber',
        crew: [
            ArtifactArchiver.storingArtifactsAt('./target/site/serenity'),
            Photographer.whoWill(TakePhotosOfInteractions),     // or Photographer.whoWill(TakePhotosOfFailures),
            new SerenityBDDReporter(),
        ]
    },

    /**
     * If you're interacting with a non-Angular application,
     * uncomment the below onPrepare section,
     * which disables Angular-specific test synchronisation.
     */

     // onPrepare: function() {
     //     browser.waitForAngularEnabled(false);
     // },

    cucumberOpts: {
        require: [ 'features/**/*.ts', ],
        'require-module':   [ 'ts-node/register'],
        tags:    ['~@wip'],
        strict:  false,
    },

    capabilities: {
        browserName: 'chrome',

        // see https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities#loggingpreferences-json-object
        loggingPrefs: {
            browser: 'SEVERE' // "OFF", "SEVERE", "WARNING", "INFO", "CONFIG", "FINE", "FINER", "FINEST", "ALL".
        },

        chromeOptions: {
            args: [
                '--no-sandbox',
                '--disable-infobars',
                '--disable-dev-shm-usage',
                '--disable-extensions',
                '--log-level=3',
                '--disable-gpu',
                '--window-size=1920,1080',
            ].concat(isCI ? ['--headless'] : [])    // run in headless mode on the CI server
        }
    }
};

@jan-molak jan-molak added the bug label Jan 22, 2020
jan-molak added a commit that referenced this issue Jan 23, 2020
This change ensures that any async events, such as storing the screenshots or restarting the
browser, complete before the scenario is marked as finished

re #405
jan-molak added a commit that referenced this issue Jan 23, 2020
This change ensures that any async events, such as storing the screenshots or restarting the
browser, complete before the scenario is marked as finished

re #405
jan-molak added a commit that referenced this issue Jan 23, 2020
…the test run finishes

SerenityBDDReporter emits reports after the test run completes

#405
jan-molak added a commit that referenced this issue Jan 23, 2020
…he test run finishes

SerenityBDDReporter emits reports after the test run completes

#405
@jan-molak
Copy link
Member

@jan-molak jan-molak commented Jan 23, 2020

Hey @mario737, could you please update to the latest version (2.0.1-alpha.109) and let me know if it helped to resolve the issue?

The best way to do it is to remove the package-lock.json and node_modules from your project then running npm install again.

@mario737
Copy link
Author

@mario737 mario737 commented Jan 23, 2020

Hi Jan,
Great, with latest version 2.0.1-alpha.109 works the test run with all features files!
Many thanks!

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

No branches or pull requests

2 participants