simpleanalytics / roadmap

File you bugs and feature requests here
23 stars 2 forks source link

Add tests for subdomains in our public script #536

Open adriaandotcom opened 3 years ago

adriaandotcom commented 3 years ago

On our automated tests we run in a few situation where we can't test certain features. For example when we detect a unique page view we compare the referrer with the current hostname. We need to test if that works with www subdomains. In BrowserStack we can only run the tests from localhost. To fix this we need to overwrite the readonly variables:

Object.defineProperty(document, "referrer", { get: () => "https://www.duckduckgo.com" });

Although this does not work for hostname:

Object.defineProperty(location, "hostname", { get: () => "www.example.com" });
image