-
Notifications
You must be signed in to change notification settings - Fork 311
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 sandbox #6
Comments
@csnover I wondered if you had advice on this for users if it doesn't make it into intern?
Is there a pattern end users can implement to achieve this (without teardown)? Would the test fixture need to create the iframe? If so how could topics from the test be published to ClientSuite? e.g. |
See theintern/intern#6. Even if we made a dui/register.clear() method, we still couldn't use the same widget name in different test files because the native document.register() call throws an exception if you try to register the same name twice. Therefore, our only option is to make widget names unique across all the test files.
I've ran into a fundamental problem due to there being no sandboxing in intern. see https://dvcs.w3.org/hg/webcomponents/raw-file/d7d1b718de45/spec/custom/index.html#terminology
Whilst name spacing the elements will work, it's more than cumbersome and sand boxing via an iframe would seem a much safer option all round |
The asymmetrical registration API in Web Components is probably a spec bug. Also, it’s kind of a bad spec. Inflexible, high risk of collisions (as you see). |
I don't agree it's a spec bug, it's clearly written in the draft; it is still draft though so could change but I wouldn't expect it to e.g. you wouldn't expect 2 HTMLElement elements defined in a document What would be helpful, if you could give me any pointers to implement sandboxing in intern unit tests whether it's an iframe or otherwise & I'm happy to do the work & submit a PR |
See theintern/intern#6. Even if we made a dui/register.clear() method, we still couldn't use the same widget name in different test files because the native document.register() call throws an exception if you try to register the same name twice. Therefore, our only option is to make widget names unique across all the test files.
See theintern/intern#6. Even if we made a dui/register.clear() method, we still couldn't use the same widget name in different test files because the native document.register() call throws an exception if you try to register the same name twice. Therefore, our only option is to make widget names unique across all the test files.
Definitely a +1 from me. In DOH, I addressed this issue by writing a wrapper page to test invididual tests. In Intern, I'm finding it very difficult. Manually tearing down tests is a pain, particularly when you've done some DOM manipulations, or altered some global state of your app. I'd hope to see this configurable on both suite and test function levels. |
See theintern/intern#6. Even if we made a dui/register.clear() method, we still couldn't use the same widget name in different test files because the native document.register() call throws an exception if you try to register the same name twice. Therefore, our only option is to make widget names unique across all the test files.
@jason0x43 @dylans I'm very interested to work for solving this issue as my GSoC 2016 project. I'll apply, but I have several questions.
Thanks. |
@hakatashi To answer the second question, there is a fairly substantial work in progress towards Intern 4 that is rewritten in TypeScript at https://github.com/theintern/intern/tree/experimental-ts |
@hakatashi for the first point, I am not sure we would want to pre-suppose a solution. For Node.js I suspect running scripts in a sandbox context as a core API would produce better results. Also with browsers, an iFrame wouldn't be wholly different than loading a page in Selinium. I would expect that a part of the proposal would be to assess what different methods might work in discussion with the mentor/team, because I suspect there maybe challenges with any approach. I think the main thing would be focusing on making the consumable API as transparent as possible for the end user to not have to do a lot of work to "sandbox" themselves. As @dylans says, I think we would consider supporting development of this feature in TypeScript even if we aren't quite ready with the rest of Intern being on TS. |
@hakatashi feel free to jump to conclusions! I am really glad to see interest. |
I really like WebComponentTester's setup, in which they run each module its own iFrame and allow you to navigate over to the individual page. |
Provide an opt-in sandbox interface for tests that gives them a fresh window context to do things to.
The text was updated successfully, but these errors were encountered: