-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat: support playwright in gui mode #571
Conversation
} | ||
|
||
export const DEFAULT_BROWSER_ID = 'chromium'; | ||
const DEFAULT_SNAPSHOT_PATH_TEMPLATE = '{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{-snapshotSuffix}{ext}'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This default value I get from pwt source code. And it is not exported outside.
|
||
constructor(config: PwtConfig) { | ||
this._config = config; | ||
this._browserIds = _.isEmpty(this._config.projects) ? [DEFAULT_BROWSER_ID] : this._config.projects.map(prj => prj.name).filter(Boolean); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the user does not specify the browser in the projects
section then chromium
will be used by default. So I support this behaviour.
} | ||
|
||
get tolerance(): number { | ||
return 2.3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default value in order to use in looks-same (when click on Find same diffs
in UI)
} | ||
|
||
get antialiasingTolerance(): number { | ||
return 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same as above
return new Promise((resolve, reject) => { | ||
const args = ([] as string[]).concat(prepareRunArgs(tests, this._configPath, this._haveProjectsInConfig), runArgs); | ||
const child = spawn(this._pwtBinaryPath, args, { | ||
stdio: ['inherit', 'inherit', 'inherit', 'ipc'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ipc in order to communicate between special reporter which is started inside pwt and html-reporter process.
browserNames.add(browserName); | ||
} | ||
|
||
const args = ['test', '--reporter', path.resolve(__dirname, './reporter'), '--config', configPath]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use my custom reporter to handle results from pwt.
titlePath: string[]; | ||
}; | ||
|
||
export default class MyReporter implements Reporter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter which is used to get info about test results
@@ -0,0 +1,36 @@ | |||
import stringify from 'json-stringify-safe'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Data from pwt has circular links which I can't pass between processes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me! Can't imagine what you had to go through to make this work, respect =)
Ideally, it would be really nice and I think logical to turn on the same GUI tests that we have for testplane for playwright also: https://github.com/gemini-testing/html-reporter/tree/master/test/func/tests/common-gui
const args = ['test', '--reporter', path.resolve(__dirname, './reporter'), '--config', configPath]; | ||
|
||
if (testNames.size > 0) { | ||
args.push('--grep', Array.from(testNames).join('|')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work fine if test name contains brackets, etc or do we need additional escaping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I forgot to check it. I will fix it.
d3afe96
to
882ad47
Compare
What is done