Skip to content

Commit c41ee23

Browse files
committed
Auto merge of #4296 - Turbo87:dev-mode, r=Turbo87
Add "Development Mode" application test This can be used during development of pages that are only available if authenticated.
2 parents 5515e00 + d0c4f1d commit c41ee23

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/acceptance/dev-mode-test.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { module, test } from 'qunit';
2+
3+
import { setupApplicationTest } from 'cargo/tests/helpers';
4+
5+
import { visit } from '../helpers/visit-ignoring-abort';
6+
7+
let s = new URLSearchParams(window.location.search);
8+
if (s.has('devmode')) {
9+
/**
10+
* This module will only be available if the "Development Mode" option of QUnit is chosen
11+
* @link http://localhost:4200/tests/?notrycatch&devmode&filter=Development%20Mode
12+
*/
13+
module('Development Mode', function (hooks) {
14+
setupApplicationTest(hooks);
15+
16+
test('authenticated', async function () {
17+
let user = this.server.create('user');
18+
this.authenticateAs(user);
19+
20+
let crate = this.server.create('crate', { name: 'foo' });
21+
this.server.create('version', { crate, num: '0.1.0' });
22+
this.server.create('crate-ownership', { crate, user });
23+
24+
crate = this.server.create('crate', { name: 'bar' });
25+
this.server.create('version', { crate, num: '1.0.0' });
26+
27+
let router = this.owner.lookup('service:router');
28+
router.on('routeDidChange', () => {
29+
console.log(`URL: ${router.currentURL}`);
30+
});
31+
32+
await visit('/');
33+
// eslint-disable-next-line ember/no-pause-test
34+
await this.pauseTest();
35+
});
36+
});
37+
}

0 commit comments

Comments
 (0)