-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathperformance-test.js
43 lines (27 loc) · 1.02 KB
/
performance-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { module, test } from 'qunit';
import { visit, click } from '@ember/test-helpers';
import { setupApplicationTest } from 'dummy/tests/helpers';
module('Acceptance | performance', function (hooks) {
setupApplicationTest(hooks);
hooks.beforeEach(function () {
this.startTimer = () => (this.startTime = Date.now());
this.stopTimer = () => (this.stopTime = Date.now());
this.timeTaken = () => this.stopTime - this.startTime;
});
test('rendering options', async function (assert) {
await visit('/performance');
assert.dom('.select-box__option').doesNotExist();
this.startTimer();
await click('.select-box__trigger');
this.stopTimer();
assert.dom('.select-box__option').exists({ count: 10000 });
assert.ok(this.timeTaken() > 500);
assert.ok(this.timeTaken() < 2000);
this.startTimer();
await click('h1');
this.stopTimer();
assert.dom('.select-box__option').doesNotExist();
assert.ok(this.timeTaken() > 500);
assert.ok(this.timeTaken() < 2000);
});
});