Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing configuration options to reporter (closes #5088) #5096

Merged
merged 3 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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', () => {
]
}
}
]
],
wentwrong marked this conversation as resolved.
Show resolved Hide resolved
// 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