Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] Get a simple fastboot smoke test working #6531

Merged
merged 9 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:
run: yarn test
- name: Encapsulation tests
run: yarn test:encapsulation
- name: Fastboot tests
run: yarn test:fastboot
- name: Production build
run: yarn test:production
- name: Docs tests
Expand Down
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ jobs:
install: yarn install
script: yarn test:docs

- name: 'Fastboot Tests'
install: yarn install
script: yarn test:fastboot

# runs tests against each supported Ember version
- stage: ember version tests
name: 'Ember LTS 3.8'
Expand Down
4 changes: 4 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ jobs:
yarn test:docs
displayName: 'Docs Tests'

- script: |
yarn test:fastboot
displayName: 'Fastboot Tests'

- script: |
yarn test:try-one with-ember-fetch
displayName: 'Basic Tests with ember-fetch'
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"test:try-one": "yarn workspace ember-data test:try-one",
"test:docs": "yarn workspace ember-data test:docs",
"test:encapsulation": "lerna run --scope='*-encapsulation-test-app' test",
"test:fastboot": "yarn workspace fastboot-test-app test",
"test:enabled-in-progress-features": "yarn workspace ember-data test:optional-features",
"test-external:ember-m3": "./bin/test-external-partner-project.js ember-m3 https://github.com/hjdivad/ember-m3.git",
"test-external:ember-data-change-tracker": "./bin/test-external-partner-project.js ember-data-change-tracker https://github.com/danielspaniel/ember-data-change-tracker.git",
Expand Down Expand Up @@ -73,6 +74,8 @@
"ember-cli-babel": "^7.12.0",
"ember-cli-blueprint-test-helpers": "^0.19.1",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-fastboot": "^2.2.1",
"ember-cli-fastboot-testing": "^0.2.2",
"ember-cli-htmlbars": "^4.0.3",
"ember-cli-htmlbars-inline-precompile": "^3.0.1",
"ember-cli-inject-live-reload": "^2.0.1",
Expand All @@ -84,6 +87,7 @@
"ember-cli-string-utils": "^1.1.0",
"ember-cli-template-lint": "^1.0.0-beta.1",
"ember-cli-test-loader": "^2.2.0",
"ember-cli-typescript": "^3.0.0",
"ember-cli-typescript-blueprints": "^3.0.0",
"ember-cli-uglify": "3.0.0",
"ember-cli-version-checker": "^3.1.2",
Expand All @@ -92,11 +96,13 @@
"ember-decorators-polyfill": "^1.0.6",
"ember-disable-prototype-extensions": "^1.1.3",
"ember-export-application-global": "^2.0.0",
"ember-fetch": "^6.7.1",
"ember-load-initializers": "^2.1.0",
"ember-maybe-import-regenerator": "^0.1.6",
"ember-qunit": "^4.5.1",
"ember-qunit-assert-helpers": "^0.2.2",
"ember-resolver": "^5.3.0",
"ember-simple-tree": "^0.7.0",
"ember-source": "^3.13.2",
"ember-source-channel-url": "^2.0.1",
"ember-try": "^1.2.1",
Expand Down
20 changes: 20 additions & 0 deletions packages/-fastboot-test-app/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.hbs]
insert_final_newline = false

[*.{diff,md}]
trim_trailing_whitespace = false
9 changes: 9 additions & 0 deletions packages/-fastboot-test-app/.ember-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
}
25 changes: 25 additions & 0 deletions packages/-fastboot-test-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/.env*
/.pnp*
/.sass-cache
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
5 changes: 5 additions & 0 deletions packages/-fastboot-test-app/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
extends: 'recommended',
};
3 changes: 3 additions & 0 deletions packages/-fastboot-test-app/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignore_dirs": ["tmp", "dist"]
}
57 changes: 57 additions & 0 deletions packages/-fastboot-test-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# fastboot-test-app

This README outlines the details of collaborating on this Ember application.
A short introduction of this app could easily go here.

## Prerequisites

You will need the following things properly installed on your computer.

* [Git](https://git-scm.com/)
* [Node.js](https://nodejs.org/) (with npm)
* [Ember CLI](https://ember-cli.com/)
* [Google Chrome](https://google.com/chrome/)

## Installation

* `git clone <repository-url>` this repository
* `cd fastboot-test-app`
* `npm install`

## Running / Development

* `ember serve`
* Visit your app at [http://localhost:4200](http://localhost:4200).
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).

### Code Generators

Make use of the many generators for code, try `ember help generate` for more details

### Running Tests

* `ember test`
* `ember test --server`

### Linting

* `npm run lint:hbs`
* `npm run lint:js`
* `npm run lint:js -- --fix`

### Building

* `ember build` (development)
* `ember build --environment production` (production)

### Deploying

Specify what it takes to deploy your app.

## Further Reading / Useful Links

* [ember.js](https://emberjs.com/)
* [ember-cli](https://ember-cli.com/)
* Development Browser Extensions
* [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
* [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
6 changes: 6 additions & 0 deletions packages/-fastboot-test-app/app/adapters/application.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import RESTAdapter from '@ember-data/adapter/rest';

export default class ApplicationAdapter extends RESTAdapter {
defaultSerializer = 'application';
namespace = 'api';
}
14 changes: 14 additions & 0 deletions packages/-fastboot-test-app/app/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Application from '@ember/application';
import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

const App = Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver,
});

loadInitializers(App, config.modulePrefix);

export default App;
16 changes: 16 additions & 0 deletions packages/-fastboot-test-app/app/config/environment.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export default config;

/**
* Type declarations for
* import config from './config/environment'
*
* For now these need to be managed by the developer
* since different ember addons can materialize new entries.
*/
declare const config: {
environment: any;
modulePrefix: string;
podModulePrefix: string;
locationType: string;
rootURL: string;
};
Empty file.
25 changes: 25 additions & 0 deletions packages/-fastboot-test-app/app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Ember Data</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for "head"}}

<link rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link rel="stylesheet" href="{{rootURL}}assets/dummy.css">

{{content-for "head-footer"}}
</head>
<body>
{{content-for "body"}}

<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/dummy.js"></script>

{{content-for "body-footer"}}
</body>
</html>
Empty file.
21 changes: 21 additions & 0 deletions packages/-fastboot-test-app/app/models/person.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Model, { attr, hasMany, belongsTo } from '@ember-data/model';

export default class Person extends Model {
@attr()
name;

@hasMany('person', { async: true, inverse: 'parent' })
children;

@belongsTo('person', { async: true, inverse: 'children' })
parent;

get parentId() {
return this.parent.get('id');
}

toNode() {
const { id, name, parentId } = this;
return { id, name, parentId };
}
}
3 changes: 3 additions & 0 deletions packages/-fastboot-test-app/app/resolver.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Resolver from 'ember-resolver';

export default Resolver;
11 changes: 11 additions & 0 deletions packages/-fastboot-test-app/app/router.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import EmberRouter from '@ember/routing/router';
import config from './config/environment';

const Router = EmberRouter.extend({
location: config.locationType,
rootURL: config.rootURL,
});

Router.map(function() {});

export default Router;
Empty file.
13 changes: 13 additions & 0 deletions packages/-fastboot-test-app/app/routes/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Route from '@ember/routing/route';
import { buildTree } from 'ember-simple-tree/utils/tree';

export default class IndexRoute extends Route {
model() {
return this.store.findAll('person');
}

setupController(controller, model) {
let tree = buildTree(model.map(person => person.toNode()));
super.setupController(controller, tree);
}
}
4 changes: 4 additions & 0 deletions packages/-fastboot-test-app/app/serializers/application.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import JSONSerializer from '@ember-data/serializer/json';
import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';

export default JSONSerializer.extend(EmbeddedRecordsMixin, {});
Empty file.
Empty file.
5 changes: 5 additions & 0 deletions packages/-fastboot-test-app/app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h1>Ember Data</h1>

{{outlet}}

<a href="/tests">Tests</a>
10 changes: 10 additions & 0 deletions packages/-fastboot-test-app/app/templates/index.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{#x-tree
model=this.model
checkable=true
expandDepth=-1
as |node|
}}
{{node.toggle}}
{{node.checkbox}}
{{node.model.name}}
{{/x-tree}}
51 changes: 51 additions & 0 deletions packages/-fastboot-test-app/config/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
'use strict';

module.exports = function(environment) {
let ENV = {
modulePrefix: 'fastboot-test-app',
environment,
rootURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
},
EXTEND_PROTOTYPES: {
// Prevent Ember Data from overriding Date.parse.
Date: false,
},
},

APP: {
// Here you can pass flags/options to your application instance
// when it is created
},
};

if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
}

if (environment === 'test') {
// Testem prefers this...
ENV.locationType = 'none';

// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;

ENV.APP.rootElement = '#ember-testing';
ENV.APP.autoboot = false;
}

if (environment === 'production') {
// here you can enable a production-specific feature
}

return ENV;
};
3 changes: 3 additions & 0 deletions packages/-fastboot-test-app/config/optional-features.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"jquery-integration": false
}
Loading