1
0
Fork 0

Client E2E tests first step

This commit is contained in:
Chocobozzz 2018-05-16 19:59:21 +02:00
parent 6200d8d917
commit 74af5a8361
No known key found for this signature in database
GPG key ID: 583A612D890159BE
19 changed files with 1502 additions and 99 deletions

View file

@ -50,6 +50,22 @@
"with": "src/environments/environment.prod.ts"
}
]
},
"hmr": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.hmr.ts"
}
]
},
"e2e": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.e2e.ts"
}
]
}
}
},
@ -61,6 +77,12 @@
"configurations": {
"production": {
"browserTarget": "PeerTube:build:production"
},
"hmr": {
"browserTarget": "PeerTube:build:hmr"
},
"e2e": {
"browserTarget": "PeerTube:build:e2e"
}
}
},
@ -102,15 +124,15 @@
}
},
"PeerTube-e2e": {
"root": "",
"root": "e2e/",
"sourceRoot": "",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "PeerTube:serve"
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "PeerTube:serve:e2e"
}
},
"lint": {

View file

@ -0,0 +1,29 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const {SpecReporter} = require('jasmine-spec-reporter')
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function () {}
},
onPrepare () {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
})
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}))
}
}

View file

@ -0,0 +1,14 @@
import { AppPage } from './app.po'
describe('PeerTube app', () => {
let page: AppPage
beforeEach(() => {
page = new AppPage()
})
it('should display the app title', () => {
page.navigateTo()
expect(page.getHeaderTitle()).toEqual('PeerTube')
})
})

12
client/e2e/src/app.po.ts Normal file
View file

@ -0,0 +1,12 @@
import { browser, by, element } from 'protractor'
export class AppPage {
navigateTo () {
browser.waitForAngularEnabled(false)
return browser.get('/')
}
getHeaderTitle () {
return element(by.css('.instance-name')).getText()
}
}

View file

@ -0,0 +1,9 @@
import { VideoUploadPage } from './video-upload.po'
describe('Video upload', () => {
let page: VideoUploadPage
beforeEach(() => {
page = new VideoUploadPage()
})
})

View file

@ -0,0 +1,7 @@
import { browser } from 'protractor'
export class VideoUploadPage {
navigateTo () {
return browser.get('/videos/upload')
}
}

View file

@ -0,0 +1,9 @@
import { VideoWatchPage } from './video-watch.po'
describe('Video watch', () => {
let page: VideoWatchPage
beforeEach(() => {
page = new VideoWatchPage()
})
})

View file

@ -0,0 +1,8 @@
import { browser } from 'protractor'
export class VideoWatchPage {
navigateTo () {
browser.waitForAngularEnabled(false)
return browser.get('/')
}
}

View file

@ -0,0 +1,13 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}

View file

@ -26,18 +26,18 @@
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.1",
"@angular/animations": "~6.0.1",
"@angular/animations": "~6.0.2",
"@angular/cli": "6.0.1",
"@angular/common": "~6.0.1",
"@angular/compiler": "~6.0.1",
"@angular/compiler-cli": "~6.0.1",
"@angular/core": "~6.0.1",
"@angular/forms": "~6.0.1",
"@angular/http": "~6.0.1",
"@angular/common": "~6.0.2",
"@angular/compiler": "~6.0.2",
"@angular/compiler-cli": "~6.0.2",
"@angular/core": "~6.0.2",
"@angular/forms": "~6.0.2",
"@angular/http": "~6.0.2",
"@angular/language-service": "^6.0.1",
"@angular/platform-browser": "~6.0.1",
"@angular/platform-browser-dynamic": "~6.0.1",
"@angular/router": "~6.0.1",
"@angular/platform-browser": "~6.0.2",
"@angular/platform-browser-dynamic": "~6.0.2",
"@angular/router": "~6.0.2",
"@angular/service-worker": "^6.0.1",
"@angularclass/hmr": "^2.1.3",
"@ngx-loading-bar/core": "^1.1.1",
@ -45,6 +45,8 @@
"@ngx-loading-bar/router": "^1.2.0",
"@ngx-meta/core": "^6.0.0-rc.1",
"@types/core-js": "^0.9.28",
"@types/jasmine": "^2.8.7",
"@types/jasminewd2": "^2.0.3",
"@types/lodash-es": "^4.17.0",
"@types/markdown-it": "^0.0.4",
"@types/node": "^9.3.0",
@ -62,6 +64,13 @@
"extract-text-webpack-plugin": "4.0.0-beta.0",
"file-loader": "^1.1.5",
"html-webpack-plugin": "^3.2.0",
"jasmine-core": "^3.1.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^2.0.2",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^1.4.2",
"karma-jasmine": "^1.1.2",
"karma-jasmine-html-reporter": "^1.1.0",
"linkifyjs": "^2.1.5",
"lodash-es": "^4.17.4",
"markdown-it": "^8.4.0",
@ -72,6 +81,7 @@
"node-sass": "^4.1.1",
"npm-font-source-sans-pro": "^1.0.2",
"primeng": "^5.2.6",
"protractor": "^5.3.2",
"purify-css": "^1.2.5",
"purifycss-webpack": "^0.7.0",
"raw-loader": "^0.5.1",

View file

@ -4,22 +4,22 @@ import { RouterModule, Routes } from '@angular/router'
import { PreloadSelectedModulesList } from './core'
const routes: Routes = [
{
path: 'admin',
loadChildren: './+admin/admin.module#AdminModule'
},
{
path: 'my-account',
loadChildren: './+my-account/my-account.module#MyAccountModule'
},
{
path: 'accounts',
loadChildren: './+accounts/accounts.module#AccountsModule'
},
{
path: 'video-channels',
loadChildren: './+video-channels/video-channels.module#VideoChannelsModule'
}
// {
// path: 'admin',
// loadChildren: './+admin/admin.module#AdminModule'
// },
// {
// path: 'my-account',
// loadChildren: './+my-account/my-account.module#MyAccountModule'
// },
// {
// path: 'accounts',
// loadChildren: './+accounts/accounts.module#AccountsModule'
// },
// {
// path: 'video-channels',
// loadChildren: './+video-channels/video-channels.module#VideoChannelsModule'
// }
]
@NgModule({

View file

@ -0,0 +1,5 @@
export const environment = {
production: false,
hmr: false,
apiUrl: 'http://localhost:9001'
}

View file

@ -0,0 +1,5 @@
export const environment = {
production: false,
hmr: true,
apiUrl: 'http://localhost:9000'
}

View file

@ -4,6 +4,6 @@
export const environment = {
production: false,
hmr: true,
hmr: false,
apiUrl: 'http://localhost:9000'
}

File diff suppressed because it is too large Load diff

View file

@ -17,6 +17,7 @@
"url": "git://github.com/Chocobozzz/PeerTube.git"
},
"scripts": {
"e2e": "scripty",
"build": "SCRIPTY_PARALLEL=true scripty",
"build:server": "scripty",
"build:client": "scripty",

11
scripts/e2e.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
set -eu
#npm run build:server
npm run clean:server:test
concurrently -k -s first \
"cd client && npm run ng -- e2e" \
"NODE_ENV=test NODE_APP_INSTANCE=1 npm start"

View file

@ -4,4 +4,4 @@ set -eu
cd client
npm run ng -- serve --hmr --host 0.0.0.0 --disable-host-check --port 3000
npm run ng -- serve --hmr --configuration hmr --host 0.0.0.0 --disable-host-check --port 3000

View file

@ -95,7 +95,7 @@ if (isTestInstance()) {
req.path.indexOf(STATIC_PATHS.WEBSEED) === -1
) {
return (cors({
origin: 'http://localhost:3000',
origin: '*',
exposedHeaders: 'Retry-After',
credentials: true
}))(req, res, next)