-
-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy pathswitch-project-test.js
67 lines (55 loc) · 1.91 KB
/
switch-project-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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import {
visit,
click,
findAll,
find,
currentURL,
settled,
} from '@ember/test-helpers';
import { selectSearch } from 'ember-power-select/test-support';
import { timeout } from 'ember-concurrency';
async function waitForSettled() {
await settled();
await timeout(10);
await settled();
}
async function ensureVersionsExist(assert) {
await waitForSettled();
await selectSearch('.select-container', '2');
await settled();
assert.dom('.ember-power-select-options').exists({ count: 1 });
assert.ok(findAll('.ember-power-select-options')[0].children.length > 1);
}
module('Acceptance | Switch Project', function (hooks) {
setupApplicationTest(hooks);
test('Can switch projects back and forth', async function (assert) {
assert.expect(9);
await visit('/');
await click('.spec-ember-data');
await ensureVersionsExist(assert);
assert.dom(find('.spec-ember-data')).hasClass('active');
await click('.spec-ember');
await ensureVersionsExist(assert);
assert.dom(find('.spec-ember')).hasClass('active');
await click('.spec-ember-data');
await ensureVersionsExist(assert);
assert.dom(find('.spec-ember-data')).hasClass('active');
});
test('Can open class after switching projects back and forth', async function (assert) {
assert.expect(10);
await visit('/');
await ensureVersionsExist(assert);
assert.dom(find('.spec-ember')).hasClass('active');
await click('.spec-ember-data');
await ensureVersionsExist(assert);
assert.dom(find('.spec-ember-data')).hasClass('active');
await click('.spec-ember');
await ensureVersionsExist(assert);
assert.dom(find('.spec-ember')).hasClass('active');
await click('[data-test-class=EmberObject] > a');
await waitForSettled();
assert.equal(currentURL(), '/ember/release/classes/EmberObject');
});
});