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

test: introduce global setup #3544

Merged
merged 1 commit into from
Aug 20, 2020
Merged

Conversation

pavelfeldman
Copy link
Member

No description provided.

* limitations under the License.
*/

matrix({
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a strange api. It can only be called once, and its mostly used for non-matrixed values.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, let's iterate on it.

@@ -31,10 +31,13 @@ type ItFunction<STATE> = ((name: string, inner: (state: STATE) => Promise<void>)
repeat(n: number): ItFunction<STATE>;
};

interface WorkerState {
interface FixtureParameters {
Copy link
Contributor

Choose a reason for hiding this comment

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

Somebody needs to put the matrix options in here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really, fixtures do that.

test/types.d.ts Outdated
}

interface FixtureState {
interface WorkerState extends FixtureParameters {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can registerWorkerFixture override fixture parameters? If not, WorkerState shouldn't extend FixtureParameters.

Copy link
Member Author

Choose a reason for hiding this comment

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

It can't, but they are defined on the same level. I'll remove inheritance!

@@ -38,11 +38,9 @@ declare global {
defaultBrowserOptions: LaunchOptions;
golden: (path: string) => string;
playwright: typeof import('../index');
browserType: BrowserType<Browser>;
Copy link
Contributor

Choose a reason for hiding this comment

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

This one is missing and lint complains.

Copy link
Member Author

Choose a reason for hiding this comment

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

ouch

@@ -52,6 +50,9 @@ declare global {
}
interface FixtureParameters {
browserName: string;
headless: boolean;
wire: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this? Can we use parameters object instead? Or options?

@@ -24,7 +24,7 @@ import { Connection } from '../lib/rpc/client/connection';
import { Transport } from '../lib/rpc/transport';
import { setUnderTest } from '../lib/helper';
import { installCoverageHooks } from './coverage';
import { parameters, registerFixture, registerWorkerFixture, registerParameter } from './runner';
import { parameters, registerFixture, registerWorkerFixture } from './runner';
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 parameters and matrix should be named similarly, otherwise it's not clear parameters come from matrix.

Copy link
Member Author

Choose a reason for hiding this comment

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

They aren't in any of the CIs, so let's follow up.

matrix({
'browserName': process.env.BROWSER ? [process.env.BROWSER] : ['chromium', 'webkit', 'firefox'],
'headless': [!!valueFromEnv('HEADLESS', true)],
'wire': [!!process.env.PWWIRE],
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we make this into actual parameter?

process.env.PWWIRE ? [true] : [true, false]

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, because you don't want to run both by default?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants