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 2 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
2 changes: 1 addition & 1 deletion src/reporter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default class Reporter {
const userAgents = task.browserConnectionGroups.map(group => group[0].userAgent);
const first = this.reportQueue[0];

await this.plugin.reportTaskStart(startTime, userAgents, this.testCount, task.testStructure);
await this.plugin.reportTaskStart(startTime, userAgents, this.testCount, task.testStructure, task.opts);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to pass an object with the configuration field, not a configuration object: ``. It will help us prevent breaking changes if we need to add a new argument in the future.

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, options */) {
throw new Error('Not implemented');
}

Expand Down
61 changes: 59 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 configurationOptions = {
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), {}, configurationOptions);

this.screenshots = new ScreenshotsMock();

Expand Down Expand Up @@ -529,7 +557,36 @@ describe('Reporter', () => {
]
}
}
]
],
wentwrong marked this conversation as resolved.
Show resolved Hide resolved
// NOTE: configuration options
{
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