Giter VIP home page Giter VIP logo

Comments (9)

axelssonHakan avatar axelssonHakan commented on May 12, 2024

Could you please specify what AW version you use and if possible the whole aw.config.js

from after-work.js.

PiotrNestor avatar PiotrNestor commented on May 12, 2024

AW version: 5.1.1
aw.config.js.txt

from after-work.js.

axelssonHakan avatar axelssonHakan commented on May 12, 2024

Getting it to work with something like below:


module.exports = function initConfig() {
  return {
    multiCapabilities: [
      {
        name: 'desktop',
        browserName: 'chrome',
        directConnect: true,
        chromeOptions: {
          args: ['--window-size=1024,768'],
        },
      },
      {
        name: 'mobile',
        browserName: 'chrome',
        directConnect: true,
        chromeOptions: {
          args: ['--window-size=375,667'],
        },
      },
    ],
    specs: [path.resolve(__dirname, 'test/*.spec.js')],
    mochaOpts: {
      reporter: 'spec',
    },
  };
};

from after-work.js.

PiotrNestor avatar PiotrNestor commented on May 12, 2024

No difference in my case if I try with the above 'aw.config.js' in my project code tree.
There could be some package.json dependency that uses the problematic JSON.stringify

from after-work.js.

PiotrNestor avatar PiotrNestor commented on May 12, 2024

OK, I have some progress ...

1. I removed node-modules
2. Cleared 'packages.json' --> "devDependencies": {},
3. npm install --save-dev @after-work.js/aw

Now I should have node-modules restored because we just use after-works.js

4. Run tests with: npx aw protractor -c test\integration\aw.config.js
Fails:

npx: installed 1 in 2.142s
command not found: prefix
index.js protractor

Run protractor

Options:
  --version                    Show version number                                                             [boolean]
  --presetEnv                  Preset the test environment with Sinon, Chai, Sinon-Chai, Chai as promised and Chai
                               subset                                                                 [string] [default:
  "...\node_modules\@after-work.js\aw\node_modules\@after-work.js\cli\src\preset-
                                                                                                                env.js"]
  --config, -c                 Path to config file                                              [string] [default: null]
  --glob                       Glob pattern                                                       [string] [default: []]
  --coverage                   Generate coverage                                              [boolean] [default: false]
  --require                    Require path                                                        [array] [default: []]
  --hookRequire                Hook require to be able to mock and transform files             [boolean] [default: true]
  --babel.enable               Enable babel                                                    [boolean] [default: true]
  --babel.core                 Path to babel core module                                          [string] [default: ""]
  --babel.babelPluginIstanbul  Path to babel plugin istanbul module          [string] [default: "babel-plugin-istanbul"]
  --babel.options              Babel options                                                               [default: {}]
  --typescript                 Path to typescript compiler module                       [string] [default: "typescript"]
  -h, --help                   Show help                                                                       [boolean]

Can not get babel core module

5. To satisfy after-work.js dependencies I've added then to our project's package.json all after-work.js 5.1.1 dependencies as in its github source

"devDependencies": {
    "@after-work.js/aw": "^5.1.1",
    "@babel/core": "7.1.5",
    "@babel/plugin-transform-react-jsx": "7.0.0",
    "@babel/preset-env": "7.1.5",
    "@types/chai": "4.1.7",
    "@types/mocha": "5.2.5",
    "babel-plugin-istanbul": "5.1.0",
    "coveralls": "3.0.2",
    "eslint": "5.9.0",
    "eslint-config-airbnb": "17.1.0",
    "eslint-plugin-import": "2.14.0",
    "eslint-plugin-jsx-a11y": "6.1.2",
    "eslint-plugin-react": "7.11.1",
    "globby": "8.0.1",
    "lerna": "3.4.3",
    "protractor": "5.4.1",
    "requirejs": "2.3.6",
    "typescript": "3.1.6",
    "yargs": "12.0.2"
  },

6. npm install
7. Run tests again with: npm run test:integration
Fails:

> aw protractor -c test/integration/aw.config.js

[16:29:49] W/launcher - You have specified both capabilities and multiCapabilities. This will result in capabilities being ignored
[16:29:49] I/launcher - Running 2 instances of WebDriver
[16:29:59] I/testLogger -
------------------------------------

[16:29:59] I/testLogger - [chrome #01] PID: 60972
[chrome #01] [16:29:50] I/local - Starting selenium standalone server...
[chrome #01] [16:29:52] I/local - Selenium standalone server started at http://172.20.46.209:52175/wd/hub
[chrome #01] [16:29:58] I/runnerCli - options.reporterPlugin.getBrowser is not a function

[16:29:59] I/testLogger -

[16:29:59] E/launcher - Runner process exited unexpectedly with error code: 1
[16:29:59] I/launcher - 1 instance(s) of WebDriver still running
[16:29:59] I/testLogger -
------------------------------------

[16:29:59] I/testLogger - [chrome #11] PID: 28356
[chrome #11] [16:29:50] I/local - Starting selenium standalone server...
[chrome #11] [16:29:52] I/local - Selenium standalone server started at http://172.20.46.209:50323/wd/hub
[chrome #11] [16:29:59] I/runnerCli - options.reporterPlugin.getBrowser is not a function

[16:29:59] I/testLogger -

[16:29:59] E/launcher - Runner process exited unexpectedly with error code: 1
[16:29:59] I/launcher - 0 instance(s) of WebDriver still running
[16:29:59] I/launcher - chrome #01 failed with exit code: 1
[16:29:59] I/launcher - chrome #11 failed with exit code: 1
[16:29:59] I/launcher - overall: 2 process(es) failed to complete
[16:29:59] E/launcher - Process exited with error code 100

from after-work.js.

axelssonHakan avatar axelssonHakan commented on May 12, 2024

Great progress!
Try to add a mocha.opts reporter (seems to be something with the default reporter then running multiCapabilities (will check it more on monday)

    mochaOpts: {
      reporter: 'spec',
    },

from after-work.js.

axelssonHakan avatar axelssonHakan commented on May 12, 2024

If just running chrome and locally you can try to add the directConnect: true option as well do avoid having selenium as a dependency

from after-work.js.

PiotrNestor avatar PiotrNestor commented on May 12, 2024

With the above suggestions:
1. Problems with 'chai':
ReferenceError: expect is not defined
2. I suppose we want the 'after-work' reporter

from after-work.js.

axelssonHakan avatar axelssonHakan commented on May 12, 2024

Sorry for not answering yesterday. Then using multiCapabilities protractor is spawning new processes per capability and the global is not "shared". This is making some of the features in AW to "brake". Chai etc is not exposed and the default mocha reporter doesn't pick up browsers correctly. ItΒ΄s still possible to use it but you have to require chai in your tests and if you want the default reporter you could first log to JSON and run the https://github.com/qlik-oss/after-work.js/blob/master/commands/protractor/src/plugins/reporter/aggregate.js afterwards.

For now I would suggest to run the test in parallel using different configs

from after-work.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.