Skip to content

Commit

Permalink
Passing configuration options to reporter (closes #5088) (#5096)
Browse files Browse the repository at this point in the history
  • Loading branch information
wentwrong committed May 28, 2020
1 parent 58ac9ed commit 64cf617
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/reporter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,11 @@ export default class Reporter {
const startTime = new Date();
const userAgents = task.browserConnectionGroups.map(group => group[0].userAgent);
const first = this.reportQueue[0];
const taskProperties = {
configuration: task.opts
};

await this.plugin.reportTaskStart(startTime, userAgents, this.testCount, task.testStructure);
await this.plugin.reportTaskStart(startTime, userAgents, this.testCount, task.testStructure, taskProperties);
await this.plugin.reportFixtureStart(first.fixture.name, first.fixture.path, first.fixture.meta);
});

Expand Down
2 changes: 1 addition & 1 deletion src/reporter/plugin-host.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default class ReporterPluginHost {


// Abstract methods implemented in plugin
async reportTaskStart (/* startTime, userAgents, testCount */) {
async reportTaskStart (/* startTime, userAgents, testCount, testStructure, taskProperties */) {
throw new Error('Not implemented');
}

Expand Down
63 changes: 61 additions & 2 deletions test/server/reporter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,38 @@ describe('Reporter', () => {
}
}

const taskOptions = {
allowMultipleWindows: false,
appInitDelay: 1000,
assertionTimeout: 3000,
browsers: ['chrome', 'firefox'],
concurrency: 1,
debugMode: false,
debugOnFail: false,
developmentMode: false,
disablePageCaching: false,
disablePageReloads: false,
disableScreenshots: false,
hostname: 'localhost',
pageLoadTimeout: 3000,
port1: 1337,
port2: 1338,
quarantineMode: false,
reporter: [{ name: 'customReporter' }],
retryTestPages: false,
screenshots: { path: '/path/to/screenshots' },
selectorTimeout: 10000,
skipJsErrors: false,
skipUncaughtErrors: false,
speed: 1,
src: ['test.js'],
stopOnFirstFail: false,
takeScreenshotsOnFails: false
};

class TaskMock extends Task {
constructor () {
super(testMocks, chunk(browserConnectionMocks, 1), {}, { stopOnFirstFail: false });
super(testMocks, chunk(browserConnectionMocks, 1), {}, taskOptions);

this.screenshots = new ScreenshotsMock();

Expand Down Expand Up @@ -529,7 +557,38 @@ describe('Reporter', () => {
]
}
}
]
],
// NOTE: task properties
{
configuration: {
allowMultipleWindows: false,
appInitDelay: 1000,
assertionTimeout: 3000,
browsers: ['chrome', 'firefox'],
concurrency: 1,
debugMode: false,
debugOnFail: false,
developmentMode: false,
disablePageCaching: false,
disablePageReloads: false,
disableScreenshots: false,
hostname: 'localhost',
pageLoadTimeout: 3000,
port1: 1337,
port2: 1338,
quarantineMode: false,
reporter: [{ name: 'customReporter' }],
retryTestPages: false,
screenshots: { path: '/path/to/screenshots' },
selectorTimeout: 10000,
skipJsErrors: false,
skipUncaughtErrors: false,
speed: 1,
src: ['test.js'],
stopOnFirstFail: false,
takeScreenshotsOnFails: false
}
}
]
},
{
Expand Down

0 comments on commit 64cf617

Please sign in to comment.