[ADF-2240] fix e2e and test in demo shell (#3035)

* fix e2e and test in demo shell

* test single run demo shell conf

* fix script e2e

* fix test lint problems

* remove async from nested test

* fix pdf test

* modify url load pdf strategy test

* SimpleChange import

* pdf viewer test fix

* remove force closing

* refactor pdf viewer
-remove promise approach
-add event rendered
-add destroy worker

* increment timeout

* use proxy files

* remove require

* fix viewer component test

* remove last require

* prefer use of done for txt viewer test
This commit is contained in:
Eugenio Romano
2018-03-09 12:16:05 +00:00
committed by GitHub
parent 606009cac2
commit ae489f6737
21 changed files with 566 additions and 503 deletions

View File

@@ -149,14 +149,6 @@
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**/*"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**/*"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**/*"
}
],
"test": {

View File

@@ -1,14 +1,14 @@
import { MyappPage } from './app.po';
describe('myapp App', () => {
let page: MyappPage;
let page: MyappPage;
beforeEach(() => {
page = new MyappPage();
});
beforeEach(() => {
page = new MyappPage();
});
it('should display message saying app works', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('app works!');
});
it('should display toolbar', () => {
page.navigateTo();
expect(page.getToolbar()).toBeDefined();
});
});

View File

@@ -1,11 +1,11 @@
import { browser, element, by } from 'protractor';
export class MyappPage {
navigateTo() {
return browser.get('/');
}
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
}
getToolbar() {
return element(by.tagName('adf-toolbar'));
}
}

View File

@@ -14,7 +14,7 @@
"build:dist": "npm run validate-config && npm run style:dev && npm run server-versions && rimraf dist && node --max_old_space_size=30000 node_modules/.bin/ng build --prod --build-optimizer=false --aot=false --app dist",
"style:dev": "npm run webpack -- --config config/webpack.style.js --progress --profile --bail",
"copy:dev": "node ./config/dev-copy-watch.js",
"test": "ng test",
"test": " npm run clean-lib-angular && ng test --single-run",
"lint": "ng lint",
"e2e": "ng e2e",
"validate-config": "ajv validate -s ../lib/core/app-config/schema.json -d ./src/app.config.json --errors=text --verbose",

View File

@@ -1,32 +1,25 @@
import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AdfModule } from './adf.module';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
}));
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule,
AdfModule
],
declarations: [
AppComponent
]
}).compileComponents();
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app works!'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app works!');
}));
it('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('app works!');
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
});

View File

@@ -60,6 +60,10 @@ import 'zone.js/dist/zone'; // Included with Angular CLI.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/
import 'intl'; // Run `npm install --save intl`.
/**
* Need to import at least one locale-data with intl.
*/
import 'intl/locale-data/jsonp/en';
/**
* Support custom event in IE11

View File

@@ -2,19 +2,41 @@
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"module": "commonjs",
"target": "es5",
"baseUrl": "",
"module": "es2015",
"rootDir": "..",
"baseUrl": ".",
"skipLibCheck": false,
"types": [
"jasmine",
"node"
]
],
"paths": {
"alfresco-js-api": [
"../node_modules/alfresco-js-api/dist/alfresco-js-api.js"
],
"rxjs/*": [
"../node_modules/rxjs/*"
],
"@angular/*": [
"../node_modules/@angular/*"
],
"@alfresco/adf-core": [
"../../lib/core"
],
"@alfresco/adf-content-services": [
"../../lib/content-services"
],
"@alfresco/adf-process-services": [
"../../lib/process-services"
],
"@alfresco/adf-insights": [
"../../lib/insights"
]
}
},
"files": [
"test.ts"
"exclude": [
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
"angularCompilerOptions": {
"skipTemplateCodegen": false
}
}

View File

@@ -99,7 +99,6 @@
"variable-declaration": "nospace"
}
],
"typeof-compare": true,
"unified-signatures": true,
"variable-name": false,
"whitespace": [