diff options
author | Alex Moon <moonmeister@users.noreply.github.com> | 2017-09-06 13:23:14 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-09-06 13:23:14 -0700 |
commit | cb266eb942789dc60e6b61ec9c7f2e35e43de0ce (patch) | |
tree | ac936afb13ea394199495d3463d697887c24879d /web/web_test.go | |
parent | 66a4d0112587608533aa744578d2db18bd88db56 (diff) | |
download | chat-cb266eb942789dc60e6b61ec9c7f2e35e43de0ce.tar.gz chat-cb266eb942789dc60e6b61ec9c7f2e35e43de0ce.tar.bz2 chat-cb266eb942789dc60e6b61ec9c7f2e35e43de0ce.zip |
[PLT-959] Browser Compatibility (#6945)
* Error page implimentation
* Update Browser Compatibility check to check Chrome, FF, IE, Edge, and Safai
* Update strings with proper edge version
* undo uneeded changes and move to go template.
* more unneeded additions
* eliminate js and add local triangle
* fix typo
* Correct debug logging of browser version
* Modify Browser Check to pass user_agent object only and write test.
* Fix chrome version typo and correct testing change that broke chrome UA chack
* simplity browser version detection by using maps instead of string splitting
Diffstat (limited to 'web/web_test.go')
-rw-r--r-- | web/web_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/web/web_test.go b/web/web_test.go index e1cdb0714..4ea7cd8ee 100644 --- a/web/web_test.go +++ b/web/web_test.go @@ -13,6 +13,7 @@ import ( "github.com/mattermost/platform/model" "github.com/mattermost/platform/store" "github.com/mattermost/platform/utils" + "github.com/mssola/user_agent" ) var ApiClient *model.Client @@ -120,3 +121,31 @@ func TestZZWebTearDown(t *testing.T) { time.Sleep(2 * time.Second) TearDown() } + +func TestCheckBrowserCompatability(t *testing.T) { + + //test should fail browser compatibility check with Mozilla FF 40.1 + ua := "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1" + t.Logf("Checking Mozzila 40.1 with U.A. String: \n%v", ua) + if result := CheckBrowserCompatability(user_agent.New(ua)); result == true { + t.Error("Fail: should have failed browser compatibility") + } else { + t.Log("Pass: User Agent correctly failed!") + } + + ua = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36" + t.Logf("Checking Chrome 60 with U.A. String: \n%v", ua) + if result := CheckBrowserCompatability(user_agent.New(ua)); result == false { + t.Error("Fail: should have passed browser compatibility") + } else { + t.Log("Pass: User Agent correctly passed!") + } + + ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393" + t.Logf("Checking Edge 14.14393 with U.A. String: \n%v", ua) + if result := CheckBrowserCompatability(user_agent.New(ua)); result == true { + t.Log("Warning: Edge should have failed browser compatibility. It is probably still detecting as Chrome.") + } else { + t.Log("Pass: User Agent correctly failed!") + } +} |