-
Notifications
You must be signed in to change notification settings - Fork 6
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
Support for running tests without a browser (OSOE-365) #79
Comments
ScrapySharp is built on HTML Agility Pack (see dependencies tab here), which is excellent. I have used HAP for years so you will hear no complaints about it from me. But OC already references AngleSharp which is its competitor, so aren't we supposed to use that?
We could make CLI based setup an option? |
Afair, we used ScrapySharp for scraping back in discoverize. Really liked it. |
CLI-based setup can work too. We allow something like that with Setup Extensions since you only have to access a RESTful API there (i.e. no browser needed). Or, we could do some magic in This might actually be preferable for setting up the site in every case, unless we specifically want to test the setup screen. No opinion on HAP vs AngleSharp, though having a different dependency than OC wouldn't really matter. |
With |
The security scanning that was implemented in #322 would greatly benefit from this. It's already using its own internal crawler for the scan so the browser just takes up RAM and does nothing after setup. So now even a very stripped-down version of this feature would be beneficial. As for the setup, consider adding a configuration to make it automatic/browserless even if the rest of the test uses a browser. I mean if the site uses auto-setup or stock unaltered OC setup, then we are UI testing the same stock features again and again. (the same situation as login was before the |
With However, for security scanning tests yes, not running a browser at all would be beneficial. |
I know. But spinning up a Chrome process for the setup and using Selenium to type in the values to each field one by one still takes some time. I understand that it's not a huge cost, but on large projects it still adds up to machine time that could've been spent more productively. |
Sure. |
Yevgeniy told that in |
@wAsnk @sarahelsaig if you need this, it should be really easy now, with just a config bool and see my previous comment. |
That sounds exciting! It will be sufficient for testing a REST API and for reducing overhead during security scanning. Although for anything more complicated I'd still like a custom |
Yep! If you'd utilize this in the project whose PR this was linked from above, then please take on it. |
ScrapySharp, with no release since 2018 and no code changes since 2020 seems to be dead, unfortunately. I didn't find an JavasScript can supposedly be disabled in all the browsers we use by changing their configs, what's possible from consumer code today via var prefs = new Dictionary<string, object>
{
{ "webkit.webprefs.javascript_enabled", false },
{ "profile.content_settings.exceptions.javascript.*.setting", 2 },
{ "profile.default_content_setting_values.javascript", 2 },
{ "profile.managed_default_content_settings.javascript", 2 },
};
chromeConfig.Options.AddUserProfilePreference("prefs", prefs);
// Add the disable-javascript argument
chromeConfig.Options.AddArgument("--disable-javascript");
if (configuration.Headless) chromeConfig.Options.AddArgument("headless=new"); But this didn't disable JS, But more to the point of running tests without a browser: It turns out that what's even better than I guess we'd need to use the BTW a browser-less setup can be simply utilizing Auto Setup too. |
After some refactoring, we can have on-demand driver creation and thus browser launch. However, these are still using it even for security scans: 3da1e43 I'll need to think about this. BTW on my machine, not opening a browser brings about a two-second gain for a test, which is actually significant (and even more if it's done a lot more, on a slower machine). |
Well, this was a bit more than a bool config but I think it's now done properly. |
This doesn't look so bad.
The difference is also impactful in terms of RAM use, which can become a bottleneck for parallel testing. In a previous gig where we tested remote servers (on not very powerful machines), this was a major problem. We always groaned when a site couldn't run without JS, because it meant interacting with it would need a real browser and it would max out the machine while running. |
Yeah, memory is perhaps a bigger concern for the runtime of a workflow overall. I've opened #399 about this. |
In certain cases, we need a running app but not a browser (or at least not a full one), like for testing web APIs. For such cases, we could start tests without a browser and then use something like RestEase for APIs or ScrapySharp as a barebone browser. The browser is launched when
AtataFactory.CreateDriver()
runs, this is the only thing necessary to switch off. However, a browser would still sometimes be needed for the initial setup (though we could add a feature to only open a browser when the setup is run but not for the test itself, or utilize Auto Setup).Jira issue
The text was updated successfully, but these errors were encountered: