angular - Trying to run some slow tests concurrently - Stack Overflow

I'm testing a datetime UI widget that lets you roll individual digits up or down by using either

I'm testing a date/time UI widget that lets you roll individual digits up or down by using either arrow keys or by clicking on graphical up/down arrows. If you press a key and hold it, or click/tap an arrow without immediately letting go, you get an auto-repeating effect until the key/mouse button/tap is released.

In testing this I'm simulating letting the auto-repeat run for two seconds each time – which takes two seconds of real time to do. Before I add more tests of this nature, however, I'd love to figure out how to make such tests run concurrently rather than consecutively.

I've followed all the instructions I could find online for getting this to work, but no change yet in how long it takes for the complete set of tests to run. Execution remains consecutive rather than parallel.

Here's my karma.conf.js:

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-parallel'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage'),
      require('@angular-devkit/build-angular/plugins/karma')
    ],
    parallelOptions: {
      executors: (require('os').cpus().length),
      shardStrategy: 'round-robin'
    },
    client: {
      jasmine: {},
    },
    jasmineHtmlReporter: {
      suppressAll: true
    },
    coverageReporter: {
      dir: require('path').join(__dirname, './coverage/temp'),
      subdir: '.',
      reporters: [
        { type: 'html' },
        { type: 'text-summary' }
      ]
    },
    reporters: ['progress', 'kjhtml'],
    browsers: ['Chrome'],
    restartOnFileChange: true
  });
};

The relevant portion of my angular.json:

        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "tsConfig": "projects/tubular-ng-widgets/tsconfig.spec.json",
            "polyfills": [
              "zone.js",
              "zone.js/testing"
            ],
            "karmaConfig": "karma.conf.js"
          }
        }

And the tests themselves:

  it('should do upward auto-repeated digit rolling', async () => {
    await clickDigit(digits.length - 1); // Roll one second forward repeatedly
    await sendKey('ArrowUp', 2000);
    expect(timeEditor.value - (sampleTimeMs + 17000)).toBeLessThan(3000);
  });

  it('should do downward auto-repeated digit rolling', async () => {
    await clickDigit(digits.length - 2); // Roll ten seconds backward repeatedly
    await sendKey('ArrowDown', 2000);
    expect(timeEditor.value - (sampleTimeMs - 170000)).toBeLessThan(30000);
  });

  it('should do upward auto-repeated digit rolling via up-arrow icon', async () => {
    await clickDigit(digits.length - 1); // Roll one second forward repeatedly
    await sendTestClick(upArrow, fixture, 2000);
    expect(timeEditor.value - (sampleTimeMs + 17000)).toBeLessThan(3000);
  });

Can anyone see anything obvious I'm missing?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744601998a4583237.html

相关推荐

  • angular - Trying to run some slow tests concurrently - Stack Overflow

    I'm testing a datetime UI widget that lets you roll individual digits up or down by using either

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信