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
Health: Break 'page.spec.js' to smaller files #2218
Conversation
test/browser.spec.js
Outdated
*/ | ||
|
||
module.exports.addTests = function({ | ||
describe, xdescribe, fdescribe, it, fit, xit, beforeAll, beforeEach, afterAll, afterEach |
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.
nit: let's pass testrunner here and extract the DSL below. I think it'll look better.
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.
done (:
test/coverage.spec.js
Outdated
describe, xdescribe, fdescribe, it, fit, xit, beforeAll, beforeEach, afterAll, afterEach | ||
}, expect, defaultBrowserOptions, puppeteer, PROJECT_ROOT) { | ||
|
||
if (process.env.COVERAGE) { |
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'd move this into the test.js
; it's an infrastructure thing and tightly depends on helper.recordPublicAPICoverage()
call.
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.
done
test/page.spec.js
Outdated
describe, xdescribe, fdescribe, it, fit, xit, beforeAll, beforeEach, afterAll, afterEach | ||
}, | ||
expect, | ||
defaultBrowserOptions, |
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 think defaultBrowserOptions
and PROJECT_ROOT
are not needed for page subtests? Not sure what's the use of puppeteer
as well.
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.
we do use some of them. I removed unnecessary params...
test/test-driver.js
Outdated
* @param {number=} eventCount | ||
* @return {!Promise<!Object>} | ||
*/ | ||
module.exports.waitForEvents = function(emitter, eventName, eventCount = 1) { |
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.
let's call this file utils.js
and merge with frame-utils.js
.
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.
done. Side note: I like the name driver
better than utils
😃
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.
Thanks. driver
, and especially test-driver
, raises very strong associations in my head with webdriver
and chromedriver
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 is a long discussion 😄
We don't like the name utils
, it reminds us of a place you put stuff that you don't know what to do with. On the other hand, we use drivers to put common test stuff + encapsulate test logic / selectors. This way our tests are much more readable (they are written in "english") + they are not aware of selectors / dom implementation. If we change dom implementation, we will change selectors only in one place (and not in all tests). WDYT?
@aslushnikov - thanks for the review! All comments fixed. BTW - |
test/utils.js
Outdated
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2017 Google Inc. All rights reserved. | |||
* Copyright 2018 Google Inc. All rights reserved. |
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.
why's the change?
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.
fixed back to 2017
test/test-driver.js
Outdated
* @param {number=} eventCount | ||
* @return {!Promise<!Object>} | ||
*/ | ||
module.exports.waitForEvents = function(emitter, eventName, eventCount = 1) { |
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.
Thanks. driver
, and especially test-driver
, raises very strong associations in my head with webdriver
and chromedriver
@yanivefraim These look nice
Definitely. |
Started breaking page.spec.js to some small files, by subject.