Skip to content

Commit 13e8535

Browse files
bors[bot]bidoubiwa
andauthored
Merge #256
256: Add angular playground r=bidoubiwa a=bidoubiwa Co-authored-by: Charlotte Vermandel <[email protected]> Co-authored-by: cvermand <[email protected]>
2 parents a9c7f6d + 5a51bb7 commit 13e8535

27 files changed

+9482
-12
lines changed

.eslintrc.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,16 @@ module.exports = {
4242
es2020: true,
4343
'jest/globals': true,
4444
node: true,
45+
jasmine: true,
4546
},
4647
globals: {
4748
instantsearch: true,
4849
instantMeiliSearch: true,
49-
page: true, // for jest/puppeteer tests in examples/express
50-
browser: true, // for jest/puppeteer tests in examples/express
51-
context: true, // for jest/puppeteer tests in examples/express
52-
jestPuppeteer: true, // for jest/puppeteer tests in examples/express
50+
page: true, // for jest/puppeteer tests in tests/env/express
51+
browser: true, // for jest/puppeteer tests in tests/env/express
52+
context: true, // for jest/puppeteer tests in tests/env/express
53+
jestPuppeteer: true, // for jest/puppeteer tests in tests/env/express
54+
jasmine: true, // for angular e2e tests in playground/angular
5355
},
5456
extends: [
5557
'standard',
@@ -100,12 +102,14 @@ module.exports = {
100102
browser: true,
101103
es2020: true,
102104
'jest/globals': true,
105+
jasmine: true,
103106
},
104107
globals: {
105-
page: true, // for jest/puppeteer tests in examples/express
106-
browser: true, // for jest/puppeteer tests in examples/express
107-
context: true, // for jest/puppeteer tests in examples/express
108-
jestPuppeteer: true, // for jest/puppeteer tests in examples/express
108+
page: true, // for jest/puppeteer tests in tests/env/express
109+
browser: true, // for jest/puppeteer tests in tests/env/express
110+
context: true, // for jest/puppeteer tests in tests/env/express
111+
jestPuppeteer: true, // for jest/puppeteer tests in tests/env/express
112+
jasmine: true, // for angular e2e tests in playground/angular
109113
},
110114
extends: [
111115
'standard',

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
run: yarn build
2727
- name: Run env tests
2828
run: yarn test:env
29+
- name: Run env tests
30+
run: yarn test:env
2931

3032

3133
style:

jest.config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@ module.exports = {
77
// We are using jest-environment-jsdom 25 until we stop supporting node 10
88
// jest-environment-jsdom 25 uses jsdom 15 which still supports node 10
99
testEnvironment: 'jest-environment-jsdom',
10-
testPathIgnorePatterns: ['<rootDir>/tests/env/express'],
10+
testPathIgnorePatterns: [
11+
'<rootDir>/tests/env/express',
12+
'<rootDir>/playgrounds/angular',
13+
],
1114
},
1215
{
1316
preset: 'ts-jest',
1417
displayName: 'node',
1518
testEnvironment: 'node',
16-
testPathIgnorePatterns: ['<rootDir>/tests/env/express'],
19+
testPathIgnorePatterns: [
20+
'<rootDir>/tests/env/express',
21+
'<rootDir>/playgrounds/angular',
22+
],
1723
},
1824
],
1925
}

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,25 @@
66
"scripts": {
77
"cleanup": "shx rm -rf dist/",
88
"test": "yarn build && jest",
9-
"test:all": "yarn test && yarn test:env && yarn test:playgrounds",
9+
"test:all": "yarn test && yarn test:env && yarn test:playgrounds && yarn test:e2e",
1010
"test:env": "yarn build && yarn test:env:browser && yarn test:env:nodejs && yarn test:env:esm && yarn test:env:ts",
1111
"test:env:browser": "yarn --cwd tests/env/express && yarn --cwd tests/env/express test",
1212
"test:env:nodejs": "node tests/env/node/index.js",
1313
"test:env:esm": "yarn --cwd tests/env/esm && yarn --cwd tests/env/esm start",
1414
"test:env:ts": "yarn --cwd tests/env/typescript-node && yarn --cwd tests/env/typescript-node start",
15-
"test:playgrounds": "yarn build:playground:vue && yarn build:playground:react && yarn build:playground:javascript && yarn build:playground:html",
15+
"test:playgrounds": "yarn build:playground:vue && yarn build:playground:react && yarn build:playground:javascript && yarn build:playground:html && yarn build:playground:angular",
1616
"build:playground:vue": "yarn --cwd ./playgrounds/vue && yarn --cwd ./playgrounds/vue build",
1717
"build:playground:react": "yarn --cwd ./playgrounds/react && yarn --cwd ./playgrounds/react build",
1818
"build:playground:javascript": "yarn --cwd ./playgrounds/javascript && yarn --cwd ./playgrounds/javascript build",
1919
"build:playground:html": "yarn --cwd ./playgrounds/html && yarn --cwd ./playgrounds/html build",
20+
"build:playground:angular": "yarn --cwd ./playgrounds/angular && yarn --cwd ./playgrounds/angular build",
2021
"playground:vue": "yarn --cwd ./playgrounds/vue && yarn --cwd ./playgrounds/vue serve",
2122
"playground:react": "yarn --cwd ./playgrounds/react && yarn --cwd ./playgrounds/react start",
2223
"playground:javascript": "yarn --cwd ./playgrounds/javascript && yarn --cwd ./playgrounds/javascript start",
2324
"playground:html": "yarn --cwd ./playgrounds/html && yarn --cwd ./playgrounds/html start",
25+
"playground:angular": "yarn --cwd ./playgrounds/angular && yarn --cwd ./playgrounds/angular start",
26+
"test:e2e": "yarn e2e:angular",
27+
"e2e:angular": "yarn --cwd ./playgrounds/angular && yarn --cwd ./playgrounds/angular e2e",
2428
"postbuild": "yarn typingsheader",
2529
"typingsheader": "node scripts/build.js",
2630
"build": "yarn cleanup && rollup -c rollup.config.js && rollup --environment NODE_ENV:production -c rollup.config.js ",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
8+
# You can see what browsers were selected by your queries by running:
9+
# npx browserslist
10+
11+
last 1 Chrome version
12+
last 1 Firefox version
13+
last 2 Edge major versions
14+
last 2 Safari major versions
15+
last 2 iOS major versions
16+
Firefox ESR
17+
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

playgrounds/angular/.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
# Only exists if Bazel was run
8+
/bazel-out
9+
10+
# dependencies
11+
/node_modules
12+
13+
# profiling files
14+
chrome-profiler-events*.json
15+
speed-measure-plugin*.json
16+
17+
# IDEs and editors
18+
/.idea
19+
.project
20+
.classpath
21+
.c9/
22+
*.launch
23+
.settings/
24+
*.sublime-workspace
25+
26+
# IDE - VSCode
27+
.vscode/*
28+
!.vscode/settings.json
29+
!.vscode/tasks.json
30+
!.vscode/launch.json
31+
!.vscode/extensions.json
32+
.history/*
33+
34+
# misc
35+
/.sass-cache
36+
/connect.lock
37+
/coverage
38+
/libpeerconnection.log
39+
npm-debug.log
40+
yarn-error.log
41+
testem.log
42+
/typings
43+
44+
# System Files
45+
.DS_Store
46+
Thumbs.db

playgrounds/angular/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Angular Playground
2+
3+
## Project setup
4+
```
5+
yarn install
6+
```
7+
8+
### Compiles and hot-reloads for development
9+
```
10+
yarn start
11+
```
12+
13+
### Compiles and minifies for production
14+
```
15+
yarn build
16+
```
17+
18+
## Running end-to-end tests
19+
20+
```
21+
yarn e2e
22+
```
23+
24+
Run `yarn e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).

playgrounds/angular/angular.json

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"angular": {
7+
"projectType": "application",
8+
"schematics": {},
9+
"root": "",
10+
"sourceRoot": "src",
11+
"prefix": "app",
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:browser",
15+
"options": {
16+
"outputPath": "dist/angular",
17+
"index": "src/index.html",
18+
"main": "src/main.ts",
19+
"polyfills": "src/polyfills.ts",
20+
"tsConfig": "tsconfig.app.json",
21+
"aot": true,
22+
"assets": [
23+
"src/favicon.ico",
24+
"src/assets"
25+
],
26+
"styles": [
27+
"node_modules/angular-instantsearch/bundles/instantsearch-theme-algolia.min.css",
28+
29+
"src/styles.css"
30+
],
31+
"scripts": []
32+
},
33+
"configurations": {
34+
"production": {
35+
"fileReplacements": [
36+
{
37+
"replace": "src/environments/environment.ts",
38+
"with": "src/environments/environment.prod.ts"
39+
}
40+
],
41+
"optimization": true,
42+
"extractCss": true,
43+
"outputHashing": "all",
44+
"sourceMap": false,
45+
"namedChunks": false,
46+
"extractLicenses": true,
47+
"vendorChunk": false,
48+
"buildOptimizer": true,
49+
"budgets": [
50+
{
51+
"type": "initial",
52+
"maximumWarning": "2mb",
53+
"maximumError": "5mb"
54+
},
55+
{
56+
"type": "anyComponentStyle",
57+
"maximumWarning": "6kb",
58+
"maximumError": "10kb"
59+
}
60+
]
61+
}
62+
}
63+
},
64+
"serve": {
65+
"builder": "@angular-devkit/build-angular:dev-server",
66+
"options": {
67+
"browserTarget": "angular:build"
68+
},
69+
"configurations": {
70+
"production": {
71+
"browserTarget": "angular:build:production"
72+
}
73+
}
74+
},
75+
"extract-i18n": {
76+
"builder": "@angular-devkit/build-angular:extract-i18n",
77+
"options": {
78+
"browserTarget": "angular:build"
79+
}
80+
},
81+
"e2e": {
82+
"builder": "@angular-devkit/build-angular:protractor",
83+
"options": {
84+
"protractorConfig": "e2e/protractor.conf.js",
85+
"devServerTarget": "angular:serve"
86+
},
87+
"configurations": {
88+
"production": {
89+
"devServerTarget": "angular:serve:production"
90+
}
91+
}
92+
}
93+
}
94+
}
95+
},
96+
"defaultProject": "angular"
97+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// @ts-check
2+
// Protractor configuration file, see link for more information
3+
// https://github.com/angular/protractor/blob/master/lib/config.ts
4+
5+
const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter')
6+
7+
/**
8+
* @type { import("protractor").Config }
9+
*/
10+
exports.config = {
11+
allScriptsTimeout: 11000,
12+
specs: ['./src/**/*.e2e-spec.ts'],
13+
capabilities: {
14+
browserName: 'chrome',
15+
},
16+
directConnect: true,
17+
SELENIUM_PROMISE_MANAGER: false,
18+
baseUrl: 'http://localhost:4200/',
19+
framework: 'jasmine',
20+
jasmineNodeOpts: {
21+
showColors: true,
22+
defaultTimeoutInterval: 30000,
23+
print: function () {},
24+
},
25+
onPrepare() {
26+
require('ts-node').register({
27+
project: require('path').join(__dirname, './tsconfig.json'),
28+
})
29+
jasmine.getEnv().addReporter(
30+
new SpecReporter({
31+
spec: {
32+
displayStacktrace: StacktraceOption.PRETTY,
33+
},
34+
})
35+
)
36+
},
37+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { browser, logging } from 'protractor'
2+
import { AppPage } from './app.po'
3+
4+
describe('workspace-project App', () => {
5+
let page: AppPage
6+
7+
beforeEach(() => {
8+
page = new AppPage()
9+
})
10+
11+
it('First game should be counter strike', async () => {
12+
await page.navigateTo()
13+
expect(await page.getFirstGame()).toEqual('Counter-Strike')
14+
})
15+
16+
it('First facet value of first facet should be Action', async () => {
17+
await page.navigateTo()
18+
expect(await page.getFirstFacetValueOfFirstFacet()).toEqual('Action')
19+
})
20+
21+
it('Clear refinement should exist', async () => {
22+
await page.navigateTo()
23+
expect(await page.getClearRefinementText()).toEqual('Clear refinements')
24+
})
25+
26+
afterEach(async () => {
27+
// Assert that there are no errors emitted from the browser
28+
const logs = await browser.manage().logs().get(logging.Type.BROWSER)
29+
expect(logs).not.toContain(
30+
jasmine.objectContaining({
31+
level: logging.Level.SEVERE,
32+
} as logging.Entry)
33+
)
34+
})
35+
})

0 commit comments

Comments
 (0)