-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
configurable browser name parsing (feature) #373
Comments
I don't think this needs to be configurable. What about just adding more userAgent strings to the list maintained by karma. Maybe we could use something like : 3rd-Eden/useragent |
Yep, let's just add all the browser agent strings out there. No reason for making this configurable... |
Fair point. I suppose this configuration idea is a bit of an overkill. Just updating ua strings is ok by me. |
By using the module 3rd-Eden/useragent instead of a homegrown solution we are able to parse a much wider range of useragent strings. Fixes karma-runner#373.
I've created a version using said module that should solve this problem :) |
By using the module 3rd-Eden/useragent instead of a homegrown solution we are able to parse a much wider range of useragent strings. Fixes karma-runner#373, karma-runner#318.
It would be nice to be able to customise how testacular outputs the browser name
One way to do this would be to allow setting of a
browserNamePaser
function as part oftestacular.conf.js
that overrideshelper.browserFullNameToShort
.It would also be better to provide this functionality as part of the helper module rather than overriding the function externally.
Although this would work ok it does not seem correct to have/allow functions in the testacular.conf.js file.
Maybe providing a regular expression and some sort of template for the output would be a better solution.
I'd be interested to hear what everyone thinks about this and hopefully come up with a cleaner solution than I have suggested :-)
Example use case:
When testacular runs inside an iOS WebView (e.g. When running inside a Cordova app) the format of the userAgent string does not match the expected pattern used by the
helper.browserFullNameToShort
method.This results in the entire userAgent string being output and so makes it hard to distinguish between multiple iOS devices
e.g. difference between userAgent strings from Safari vs WebView on simulator:
Having had a brief play around with the testacular code I was able to get this functionality by ammending lib\config.js:
added
browserNameParser
property to config object inparseConfig
function (default to null)added the following code if statement
// merge options from cli
config = util.merge(config, cliOptions || {})
// allow custom brower name (userAgent) parsing
if (typeof config.browserNameParser === 'function') {
util.browserFullNameToShort = config.browserNameParser;
}
As mentioned previously I don't suggest that this is the way to do it but was just a proof of concept for my own temporary use.
The text was updated successfully, but these errors were encountered: