Skip to content

Commit 5451050

Browse files
committed
Integration tests fist pass
port fastboot test into integration-tests package
1 parent bd49886 commit 5451050

70 files changed

Lines changed: 1245 additions & 127 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/fastboot/test/fastboot-test.js

Lines changed: 0 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -50,41 +50,6 @@ describe('FastBoot', function() {
5050
expect(fn).to.throw(/(.+)package.json was malformed or did not contain a fastboot config/);
5151
});
5252

53-
it('can render HTML', function() {
54-
var fastboot = new FastBoot({
55-
distPath: fixture('basic-app'),
56-
});
57-
58-
return fastboot
59-
.visit('/')
60-
.then(r => r.html())
61-
.then(html => {
62-
expect(html).to.match(/Welcome to Ember/);
63-
});
64-
});
65-
66-
it('can run multiple visits', async function() {
67-
this.timeout(3000);
68-
69-
var fastboot = new FastBoot({
70-
distPath: fixture('basic-app'),
71-
});
72-
73-
let result = await fastboot.visit('/');
74-
let html = await result.html();
75-
76-
expect(html).to.match(/Welcome to Ember/);
77-
78-
result = await fastboot.visit('/');
79-
html = await result.html();
80-
81-
expect(html).to.match(/Welcome to Ember/);
82-
83-
result = await fastboot.visit('/');
84-
html = await result.html();
85-
86-
expect(html).to.match(/Welcome to Ember/);
87-
});
8853

8954
it('can render HTML with array of app files defined in package.json', function() {
9055
var fastboot = new FastBoot({
@@ -99,21 +64,6 @@ describe('FastBoot', function() {
9964
});
10065
});
10166

102-
it('cannot not render app HTML with shouldRender set as false', function() {
103-
var fastboot = new FastBoot({
104-
distPath: fixture('basic-app'),
105-
});
106-
107-
return fastboot
108-
.visit('/', {
109-
shouldRender: false,
110-
})
111-
.then(r => r.html())
112-
.then(html => {
113-
expect(html).to.not.match(/Welcome to Ember/);
114-
});
115-
});
116-
11767
it('outputs html attributes from the fastboot app', function() {
11868
var fastboot = new FastBoot({
11969
distPath: fixture('custom-html-attrs'),
@@ -168,33 +118,6 @@ describe('FastBoot', function() {
168118
});
169119
});
170120

171-
it('can serialize the head and body', function() {
172-
var fastboot = new FastBoot({
173-
distPath: fixture('basic-app'),
174-
});
175-
176-
return fastboot.visit('/').then(r => {
177-
let contents = r.domContents();
178-
179-
expect(contents.head).to.equal('');
180-
expect(contents.body).to.match(/Welcome to Ember/);
181-
});
182-
});
183-
184-
it('can forcefully destroy the app instance using destroyAppInstanceInMs', function() {
185-
var fastboot = new FastBoot({
186-
distPath: fixture('basic-app'),
187-
});
188-
189-
return fastboot
190-
.visit('/', {
191-
destroyAppInstanceInMs: 5,
192-
})
193-
.catch(e => {
194-
expect(e.message).to.equal('App instance was forcefully destroyed in 5ms');
195-
});
196-
});
197-
198121
it('can render HTML when a custom set of sandbox globals is provided', function() {
199122
var fastboot = new FastBoot({
200123
distPath: fixture('custom-sandbox'),
@@ -264,56 +187,6 @@ describe('FastBoot', function() {
264187
});
265188
});
266189

267-
it('can reload the distPath', function() {
268-
var fastboot = new FastBoot({
269-
distPath: fixture('basic-app'),
270-
});
271-
272-
return fastboot
273-
.visit('/')
274-
.then(r => r.html())
275-
.then(html => expect(html).to.match(/Welcome to Ember/))
276-
.then(hotReloadApp)
277-
.then(() => fastboot.visit('/'))
278-
.then(r => r.html())
279-
.then(html => expect(html).to.match(/Goodbye from Ember/));
280-
281-
function hotReloadApp() {
282-
fastboot.reload({
283-
distPath: fixture('hot-swap-app'),
284-
});
285-
}
286-
});
287-
288-
it('can reload the app using the same buildSandboxGlobals', function() {
289-
var fastboot = new FastBoot({
290-
distPath: fixture('basic-app'),
291-
buildSandboxGlobals(globals) {
292-
return Object.assign({}, globals, {
293-
foo: 5,
294-
myVar: 'undefined',
295-
});
296-
},
297-
});
298-
299-
return fastboot
300-
.visit('/')
301-
.then(r => r.html())
302-
.then(html => expect(html).to.match(/Welcome to Ember/))
303-
.then(hotReloadApp)
304-
.then(() => fastboot.visit('/foo'))
305-
.then(r => r.html())
306-
.then(html => {
307-
expect(html).to.match(/foo from sandbox: 5/);
308-
});
309-
310-
function hotReloadApp() {
311-
fastboot.reload({
312-
distPath: fixture('custom-sandbox'),
313-
});
314-
}
315-
});
316-
317190
it('reads the config from package.json', function() {
318191
var fastboot = new FastBoot({
319192
distPath: fixture('config-app'),
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.hbs]
16+
insert_final_newline = false
17+
18+
[*.{diff,md}]
19+
trim_trailing_whitespace = false
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
/**
3+
Ember CLI sends analytics information by default. The data is completely
4+
anonymous, but there are times when you might want to disable this behavior.
5+
6+
Setting `disableAnalytics` to true will prevent any data from being sent.
7+
*/
8+
"disableAnalytics": false
9+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# unconventional js
2+
/blueprints/*/files/
3+
/vendor/
4+
5+
# compiled output
6+
/dist/
7+
/tmp/
8+
9+
# dependencies
10+
/bower_components/
11+
/node_modules/
12+
13+
# misc
14+
/coverage/
15+
!.*
16+
17+
# ember-try
18+
/.node_modules.ember-try/
19+
/bower.json.ember-try
20+
/package.json.ember-try
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
'use strict';
2+
3+
module.exports = {
4+
root: true,
5+
parser: 'babel-eslint',
6+
parserOptions: {
7+
ecmaVersion: 2018,
8+
sourceType: 'module',
9+
ecmaFeatures: {
10+
legacyDecorators: true
11+
}
12+
},
13+
plugins: [
14+
'ember'
15+
],
16+
extends: [
17+
'eslint:recommended',
18+
'plugin:ember/recommended'
19+
],
20+
env: {
21+
browser: true
22+
},
23+
rules: {},
24+
overrides: [
25+
// node files
26+
{
27+
files: [
28+
'.eslintrc.js',
29+
'.template-lintrc.js',
30+
'ember-cli-build.js',
31+
'testem.js',
32+
'blueprints/*/index.js',
33+
'config/**/*.js',
34+
'lib/*/index.js',
35+
'server/**/*.js'
36+
],
37+
parserOptions: {
38+
sourceType: 'script'
39+
},
40+
env: {
41+
browser: false,
42+
node: true
43+
},
44+
plugins: ['node'],
45+
extends: ['plugin:node/recommended'],
46+
rules: {
47+
// this can be removed once the following is fixed
48+
// https://github.com/mysticatea/eslint-plugin-node/issues/77
49+
'node/no-unpublished-require': 'off'
50+
}
51+
}
52+
]
53+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist/
5+
/tmp/
6+
7+
# dependencies
8+
/bower_components/
9+
/node_modules/
10+
11+
# misc
12+
/.env*
13+
/.pnp*
14+
/.sass-cache
15+
/connect.lock
16+
/coverage/
17+
/libpeerconnection.log
18+
/npm-debug.log*
19+
/testem.log
20+
/yarn-error.log
21+
22+
# ember-try
23+
/.node_modules.ember-try/
24+
/bower.json.ember-try
25+
/package.json.ember-try
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
module.exports = {
4+
extends: 'octane'
5+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
language: node_js
3+
node_js:
4+
- "10"
5+
6+
dist: xenial
7+
8+
addons:
9+
chrome: stable
10+
11+
cache:
12+
yarn: true
13+
14+
env:
15+
global:
16+
# See https://git.io/vdao3 for details.
17+
- JOBS=1
18+
19+
branches:
20+
only:
21+
- master
22+
23+
before_install:
24+
- curl -o- -L https://yarnpkg.com/install.sh | bash
25+
- export PATH=$HOME/.yarn/bin:$PATH
26+
27+
install:
28+
- yarn install --non-interactive
29+
30+
script:
31+
- yarn test
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ignore_dirs": ["tmp", "dist"]
3+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# custom-sandbox-app
2+
3+
This README outlines the details of collaborating on this Ember application.
4+
A short introduction of this app could easily go here.
5+
6+
## Prerequisites
7+
8+
You will need the following things properly installed on your computer.
9+
10+
* [Git](https://git-scm.com/)
11+
* [Node.js](https://nodejs.org/)
12+
* [Yarn](https://yarnpkg.com/)
13+
* [Ember CLI](https://ember-cli.com/)
14+
* [Google Chrome](https://google.com/chrome/)
15+
16+
## Installation
17+
18+
* `git clone <repository-url>` this repository
19+
* `cd custom-sandbox-app`
20+
* `yarn install`
21+
22+
## Running / Development
23+
24+
* `ember serve`
25+
* Visit your app at [http://localhost:4200](http://localhost:4200).
26+
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).
27+
28+
### Code Generators
29+
30+
Make use of the many generators for code, try `ember help generate` for more details
31+
32+
### Running Tests
33+
34+
* `ember test`
35+
* `ember test --server`
36+
37+
### Linting
38+
39+
* `yarn lint:hbs`
40+
* `yarn lint:js`
41+
* `yarn lint:js --fix`
42+
43+
### Building
44+
45+
* `ember build` (development)
46+
* `ember build --environment production` (production)
47+
48+
### Deploying
49+
50+
Specify what it takes to deploy your app.
51+
52+
## Further Reading / Useful Links
53+
54+
* [ember.js](https://emberjs.com/)
55+
* [ember-cli](https://ember-cli.com/)
56+
* Development Browser Extensions
57+
* [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
58+
* [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)

0 commit comments

Comments
 (0)