Skip to content

Commit

Permalink
Removing the experimental Jasmine support. With Jasmine, the reporter…
Browse files Browse the repository at this point in the history
…s (such as Serenity) are forced to be synchronous and there seems to be no easy way around it until angular/protractor#1938 gets fixed.
  • Loading branch information
jan-molak committed Aug 16, 2016
1 parent 5163580 commit b3c002b
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 246 deletions.
8 changes: 0 additions & 8 deletions examples/todomvc-protractor-jasmine/.gitignore

This file was deleted.

38 changes: 0 additions & 38 deletions examples/todomvc-protractor-jasmine/package.json

This file was deleted.

29 changes: 0 additions & 29 deletions examples/todomvc-protractor-jasmine/protractor.conf.js

This file was deleted.

21 changes: 0 additions & 21 deletions examples/todomvc-protractor-jasmine/spec/record_todos.ts

This file was deleted.

5 changes: 0 additions & 5 deletions examples/todomvc-protractor-jasmine/src/expect.ts

This file was deleted.

3 changes: 0 additions & 3 deletions examples/todomvc-protractor-jasmine/src/text.ts

This file was deleted.

16 changes: 0 additions & 16 deletions examples/todomvc-protractor-jasmine/tsconfig.json

This file was deleted.

15 changes: 0 additions & 15 deletions examples/todomvc-protractor-jasmine/typings.json

This file was deleted.

1 change: 0 additions & 1 deletion src/serenity-jasmine/index.ts

This file was deleted.

103 changes: 0 additions & 103 deletions src/serenity-jasmine/jasmine_serenity_notifier.ts

This file was deleted.

33 changes: 26 additions & 7 deletions src/serenity-protractor/adapter/serenity_protractor_plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Deferred } from '../../serenity/recording/async';
import { FileSystemOutlet } from '../../serenity/reporting/outlet';
import { RehearsalReport, Scribe } from '../../serenity/reporting/scribe';
import { EventLog, RehearsalReport, Scribe } from '../../serenity/reporting/scribe';
import { Serenity } from '../../serenity/serenity';
import { ProtractorPlugin } from 'protractor/built/plugins';
import { Md5 } from 'ts-md5/dist/md5';
Expand All @@ -12,32 +13,50 @@ export interface TestInfo {
export class SerenityProtractorPlugin extends ProtractorPlugin {

private reporter = new RehearsalReport();
// private debug = new EventLog();
private debug = new EventLog();

private printEvents = true;

private scribe;
private id = 'serenity-protractor-plugin';

private allDone = new Deferred();

setup() {
// todo: the path should be configurable
this.scribe = new Scribe(new FileSystemOutlet(`${process.cwd()}/target/site/serenity`));
};

postTest(passed: boolean, info: TestInfo): Promise<any> {
// todo: the reporters should be configurable
return Promise.all([
this.reporter.of(Serenity.readNewJournalEntriesAs(this.id)).then( (reports) => {
this.scribe.write(reports.pop(), `${this.hash(info.category, info.name)}.json`);
}),
// this.debug.of(Serenity.readNewJournalEntriesAs('debug')).then( entries => {
// entries.forEach(entry => console.log(entry));
// }),
]);
this.printEvents ? this.printAll() : Promise.resolve(),
])
.then(() => {
console.log('finished writing the reports'); // tslint:disable-line:no-console

this.allDone.resolve();
});
}

postResults(): Promise<void> {
return Promise.resolve();
}

teardown(): Promise<any> {
// https://github.com/angular/protractor/issues/1938

return this.allDone.promise;
}

private printAll(): Promise<void> {
return this.debug.of(Serenity.readNewJournalEntriesAs('debug')).then( entries => {
entries.forEach(entry => console.log(entry)); // tslint:disable-line:no-console
});
}

private hash(...values: string[]): string {
return <string> Md5.hashAsciiStr(values.join(':'));
}
Expand Down

0 comments on commit b3c002b

Please sign in to comment.