Remove pre-made tests
parent
1f4be16a1d
commit
5195d402ce
|
@ -1,24 +0,0 @@
|
|||
import { browser, element, by } from 'protractor';
|
||||
|
||||
describe('Dashboard', function() {
|
||||
|
||||
beforeEach(() => {
|
||||
browser.get('/')
|
||||
});
|
||||
|
||||
it('should display the correct heading', () => {
|
||||
const heading = element(by.css('h1')).getText();
|
||||
const headings = element.all(by.css('h1')).getText();
|
||||
console.log(headings)
|
||||
heading.then((headingText) => {
|
||||
console.log(headingText);
|
||||
});
|
||||
expect(heading).toEqual('Dashboard');
|
||||
expect(headings).toContain('Dashboard');
|
||||
});
|
||||
|
||||
it('should redirect to /dashboard', () => {
|
||||
expect(browser.getCurrentUrl()).toContain('/dashboard');
|
||||
});
|
||||
|
||||
});
|
|
@ -1,12 +0,0 @@
|
|||
import { browser} from 'protractor';
|
||||
import * as fs from 'fs';
|
||||
|
||||
declare var Buffer, module: any;
|
||||
|
||||
export function takeScreenshot(filename: string) {
|
||||
return browser.takeScreenshot().then((data) => {
|
||||
const stream = fs.createWriteStream(filename);
|
||||
stream.write(new Buffer(data, 'base64'));
|
||||
stream.end();
|
||||
})
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
import {takeScreenshot} from '../helpers/take_screenshot';
|
||||
import { browser } from 'protractor';
|
||||
import {EditTaskPage} from './edit-task.po';
|
||||
|
||||
describe('Edit Tasks', function() {
|
||||
|
||||
let page: EditTaskPage;
|
||||
beforeEach(() => {
|
||||
page = new EditTaskPage();
|
||||
page.navigateToNewPage();
|
||||
});
|
||||
|
||||
it('should change page when accepting alert', () => {
|
||||
page.fillForm('New Task', 'BACKLOG');
|
||||
page.cancel();
|
||||
page.getAlert().accept(); // Klick auf OK
|
||||
expect(browser.getCurrentUrl()).not.toContain(page.newUrl);
|
||||
});
|
||||
|
||||
it('should stay on page when discarding alert', () => {
|
||||
page.fillForm('New Task', 'IN_PROGRESS');
|
||||
page.cancel();
|
||||
page.getAlert().dismiss(); // Klick auf Abbrechen
|
||||
expect(browser.getCurrentUrl()).toContain(page.newUrl);
|
||||
});
|
||||
});
|
|
@ -1,34 +0,0 @@
|
|||
import { browser, element, by, protractor} from 'protractor';
|
||||
|
||||
export class EditTaskPage {
|
||||
newUrl = '/tasks/new';
|
||||
navigateToNewPage() {
|
||||
return browser.get(this.newUrl);
|
||||
}
|
||||
|
||||
navigateToEditPage(id: number) {
|
||||
return browser.get(`tasks/edit/${id}`);
|
||||
}
|
||||
|
||||
fillForm(title: string, state: string) {
|
||||
element(by.name('title')).sendKeys(title);
|
||||
element(by.name('state')).element(by.css(`[value="${state}"]`))
|
||||
.click();
|
||||
//Firefox HACK:
|
||||
browser.actions().sendKeys( protractor.Key.ENTER ).perform();
|
||||
}
|
||||
|
||||
save() {
|
||||
element(by.id('save')).click();
|
||||
}
|
||||
|
||||
cancel() {
|
||||
return element(by.id('cancel')).click();
|
||||
}
|
||||
|
||||
getAlert() {
|
||||
return browser.switchTo().alert();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
import { browser, element, by } from 'protractor';
|
||||
import {takeScreenshot} from '../helpers/take_screenshot';
|
||||
|
||||
describe('Task List (without Page Object)', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
browser.get('/tasks')
|
||||
});
|
||||
|
||||
it('should allow searching for tasks', () => {
|
||||
element(by.css('#search-tasks')).sendKeys('Ersten');
|
||||
browser.sleep(500);
|
||||
const count = element.all(by.className('task-list-entry')).count();
|
||||
expect(count).toEqual(1);
|
||||
});
|
||||
|
||||
it('should work with no search results', () => {
|
||||
element(by.css('#search-tasks')).sendKeys('Ich existiere nicht');
|
||||
browser.sleep(500);
|
||||
const count = element.all(by.className('task-list-entry')).count();
|
||||
expect(count).toEqual(0);
|
||||
});
|
||||
|
||||
|
||||
});
|
|
@ -1,54 +0,0 @@
|
|||
|
||||
import {takeScreenshot} from '../helpers/take_screenshot';
|
||||
import {TaskListPage} from './task-list.po';
|
||||
import { browser } from 'protractor';
|
||||
|
||||
|
||||
describe('TaskList', function () {
|
||||
|
||||
let page: TaskListPage;
|
||||
beforeEach(() => {
|
||||
page = new TaskListPage();
|
||||
page.navigateTo();
|
||||
});
|
||||
|
||||
xit('should allow to create new tasks (forgot to press save)', () => {
|
||||
|
||||
const editPage = page.gotoNewTaskView();
|
||||
editPage.fillForm('New Task', 'BACKLOG');
|
||||
// editPage.save();
|
||||
|
||||
expect(page.checkTaskDisplayed('New Task')).not.toBeNull();
|
||||
|
||||
});
|
||||
|
||||
it('should allow searching for tasks', () => {
|
||||
page.searchForTasks('Ersten');
|
||||
expect(page.getTaskCount()).toEqual(1);
|
||||
});
|
||||
|
||||
it('should work with no search results', () => {
|
||||
page.searchForTasks('Ich existiere nicht.');
|
||||
expect(page.getTaskCount()).toEqual(0);
|
||||
});
|
||||
|
||||
|
||||
it('should allow to create new tasks', () => {
|
||||
const taskTitle = `New Task ${new Date().getTime()}`;
|
||||
const editPage = page.gotoNewTaskView();
|
||||
editPage.fillForm(taskTitle, 'IN_PROGRESS');
|
||||
editPage.save();
|
||||
takeScreenshot('createTaskFailure.png');
|
||||
page.checkTaskDisplayed(taskTitle);
|
||||
});
|
||||
|
||||
it('should add new tasks to the displayed list', () => {
|
||||
page.getTaskCount().then(count => {
|
||||
const editPage = page.gotoNewTaskView();
|
||||
editPage.fillForm('New Task', 'IN_PROGRESS');
|
||||
editPage.save();
|
||||
expect(page.getTaskCount()).toEqual(count + 1);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
|
@ -1,32 +0,0 @@
|
|||
import { browser, element, by} from 'protractor';
|
||||
import { ExpectedConditions as EC} from 'protractor';
|
||||
import {EditTaskPage} from './edit-task.po';
|
||||
|
||||
export class TaskListPage {
|
||||
|
||||
navigateTo() {
|
||||
return browser.get('/tasks');
|
||||
}
|
||||
|
||||
searchForTasks(term: string) {
|
||||
element(by.css('#search-tasks')).sendKeys(term);
|
||||
browser.sleep(500);
|
||||
}
|
||||
|
||||
getTaskCount() {
|
||||
return element.all(by.className('task-list-entry')).count();
|
||||
}
|
||||
|
||||
gotoNewTaskView() {
|
||||
element(by.linkText('Neue Aufgabe anlegen')).click();
|
||||
return new EditTaskPage();
|
||||
}
|
||||
|
||||
checkTaskDisplayed(text: string) {
|
||||
const taskLink = element(by.linkText(text));
|
||||
browser.wait(EC.presenceOf(taskLink), 10000);
|
||||
return taskLink.isDisplayed();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"declaration": false,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../dist/out-tsc-e2e",
|
||||
"sourceMap": true,
|
||||
"target": "es5",
|
||||
"typeRoots": [
|
||||
"../node_modules/@types"
|
||||
],
|
||||
"types": [
|
||||
"jasmine", "node"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/0.13/config/configuration-file.html
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', 'angular-cli'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-remap-istanbul'),
|
||||
require('karma-spec-reporter'),
|
||||
require('angular-cli/plugins/karma')
|
||||
],
|
||||
files: [
|
||||
{ pattern: './src/test.ts', watched: false }
|
||||
],
|
||||
preprocessors: {
|
||||
'./src/test.ts': ['angular-cli']
|
||||
},
|
||||
mime: {
|
||||
'text/x-typescript': ['ts','tsx']
|
||||
},
|
||||
remapIstanbulReporter: {
|
||||
reports: {
|
||||
html: 'coverage',
|
||||
lcovonly: './coverage/coverage.lcov'
|
||||
}
|
||||
},
|
||||
angularCli: {
|
||||
config: './angular-cli.json',
|
||||
environment: 'dev'
|
||||
},
|
||||
reporters: config.angularCli && config.angularCli.codeCoverage
|
||||
? ['spec', 'karma-remap-istanbul']
|
||||
: ['spec'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false
|
||||
});
|
||||
};
|
|
@ -1,52 +0,0 @@
|
|||
// Protractor configuration file, see link for more information
|
||||
// https://github.com/angular/protractor/blob/master/docs/referenceConf.js
|
||||
|
||||
/*global jasmine */
|
||||
var SpecReporter = require('jasmine-spec-reporter');
|
||||
//var ScreenshotProcessor = require('./e2e/helpers/screen_shot_reporter.ts');
|
||||
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
|
||||
|
||||
var reporter = new HtmlScreenshotReporter({
|
||||
dest: 'tmp/screenshots',
|
||||
filename: 'test-report.html',
|
||||
cleanDestination: true,
|
||||
ignoreSkippedSpecs: true,
|
||||
captureOnlyFailedSpecs: false
|
||||
});
|
||||
|
||||
|
||||
exports.config = {
|
||||
allScriptsTimeout: 11000,
|
||||
specs: [
|
||||
'./e2e/**/*.e2e-spec.ts'
|
||||
],
|
||||
capabilities: {
|
||||
'browserName': 'firefox'
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:4200/',
|
||||
framework: 'jasmine',
|
||||
jasmineNodeOpts: {
|
||||
showColors: true,
|
||||
defaultTimeoutInterval: 30000,
|
||||
print: function() {}
|
||||
},
|
||||
useAllAngular2AppRoots: true,
|
||||
beforeLaunch: function() {
|
||||
require('ts-node').register({
|
||||
project: 'e2e'
|
||||
});
|
||||
return new Promise(function(resolve){
|
||||
reporter.beforeLaunch(resolve);
|
||||
});
|
||||
},
|
||||
afterLaunch: function(exitCode) {
|
||||
return new Promise(function(resolve){
|
||||
reporter.afterLaunch(resolve.bind(this, exitCode));
|
||||
});
|
||||
},
|
||||
onPrepare: function() {
|
||||
jasmine.getEnv().addReporter(reporter);
|
||||
jasmine.getEnv().addReporter(new SpecReporter());
|
||||
},
|
||||
};
|
|
@ -1,32 +0,0 @@
|
|||
// Protractor configuration file, see link for more information
|
||||
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
||||
|
||||
/*global jasmine */
|
||||
var SpecReporter = require('jasmine-spec-reporter');
|
||||
|
||||
exports.config = {
|
||||
allScriptsTimeout: 11000,
|
||||
specs: [
|
||||
'./e2e/**/*.e2e-spec.ts'
|
||||
],
|
||||
capabilities: {
|
||||
'browserName': 'chrome'
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:4200/',
|
||||
framework: 'jasmine',
|
||||
jasmineNodeOpts: {
|
||||
showColors: true,
|
||||
defaultTimeoutInterval: 30000,
|
||||
print: function() {}
|
||||
},
|
||||
useAllAngular2AppRoots: true,
|
||||
beforeLaunch: function() {
|
||||
require('ts-node').register({
|
||||
project: 'e2e'
|
||||
});
|
||||
},
|
||||
onPrepare: function() {
|
||||
jasmine.getEnv().addReporter(new SpecReporter());
|
||||
}
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
|
||||
export function dispatchEvent(element: any, eventType: any) {
|
||||
getDOM().dispatchEvent(element, getDOM().createEvent(eventType));
|
||||
}
|
||||
|
||||
export function setInputValue(input: any, value: any) {
|
||||
input.value = value;
|
||||
dispatchEvent(input, 'input');
|
||||
dispatchEvent(input, 'blur');
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
import './polyfills.ts';
|
||||
|
||||
import 'zone.js/dist/long-stack-trace-zone';
|
||||
import 'zone.js/dist/proxy.js';
|
||||
import 'zone.js/dist/sync-test';
|
||||
import 'zone.js/dist/jasmine-patch';
|
||||
import 'zone.js/dist/async-test';
|
||||
import 'zone.js/dist/fake-async-test';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
import 'rxjs/Rx';
|
||||
|
||||
|
||||
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
|
||||
declare var __karma__: any;
|
||||
declare var require: any;
|
||||
|
||||
// Prevent Karma from running prematurely.
|
||||
__karma__.loaded = function () {};
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
// Finally, start Karma to run the tests.
|
||||
__karma__.start();
|
Loading…
Reference in New Issue