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

Don't warn in recursive context settings toProxy #58

Closed
maraisr opened this issue Nov 2, 2020 · 1 comment
Closed

Don't warn in recursive context settings toProxy #58

maraisr opened this issue Nov 2, 2020 · 1 comment

Comments

@maraisr
Copy link
Sponsor Contributor

maraisr commented Nov 2, 2020

Currently Im putting a playwright Browser and Page instances onto the context in a .before into a context:

myTest.before(async (context) => {
        context.browser = await chromium.launch({
		headless: false,
	});
	const browsingContext = await context.browser.newContext({
		bypassCSP: true,
	});
	context.page = await browsingContext.newPage();
});

and then later reading that like:

myTest('open's website', async (context) => {
	await context.page.goto(context.baseUrl); // Note this comes statically when I created the `suite`.
	assert.ok(/test for something/.test((await context.page.content())));
});

but this seems to mutate the page object in someway—probably Playwright internals. And for this my console is littered with:

[WARN] Cannot modify context within tests!

My plan is to still echo that these objects should be immutable but perhaps only on key? Or a config to say "i know what im doing", as I assume these need to stay immutable so tests could be ran in parallel in the future? (but on that, with e2e's you'd want them in-series).

@lukeed
Copy link
Owner

lukeed commented Nov 2, 2020

There's some related discussion in #39 which steers me towards completely removing the "immutability guard" that uvu provides right now. Not doing anything is the simplest approach by far, and I trust users will be aware of what they're doing/modifying

@lukeed lukeed closed this as completed in 3d3076d Nov 3, 2020
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

No branches or pull requests

2 participants