mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-23 05:04:42 +00:00
Improve tests when running outside of our test runner
We often verify the correctness of tests by loading them in an external browser, but some tests just don't run the same/correctly. For example, we used to hard- code the http://127.0.0.1:9582/ origin, but that would cause tests to fail if running from a different origin. This commit _begins_ the work of improving this. It introduces a testing.ORIGIN, testing.BASE_URL and testing.HOST which will work correctly in both our runner and an external browser. It also introduces `testing.IS_TEST_RUNNER` boolean flag so that tests which have no chance of working in an external browser (e.g. screen.width) can be skipped. The goal is to reduce/remove tests which fail in external browsers so that such failures aren't quickly written off as "just how it is".
This commit is contained in:
@@ -11,11 +11,11 @@
|
||||
<script id=empty_href>
|
||||
testing.expectEqual('', $('#a0').href);
|
||||
|
||||
testing.expectEqual('http://127.0.0.1:9582/src/browser/tests/element/anchor1.html', $('#a1').href);
|
||||
testing.expectEqual('http://127.0.0.1:9582/hello/world/anchor2.html', $('#a2').href);
|
||||
testing.expectEqual(testing.BASE_URL + 'element/anchor1.html', $('#a1').href);
|
||||
testing.expectEqual(testing.ORIGIN + 'hello/world/anchor2.html', $('#a2').href);
|
||||
testing.expectEqual('https://www.openmymind.net/Elixirs-With-Statement/', $('#a3').href);
|
||||
|
||||
testing.expectEqual('http://127.0.0.1:9582/src/browser/tests/element/html/foo', $('#link').href);
|
||||
testing.expectEqual(testing.BASE_URL + 'element/html/foo', $('#link').href);
|
||||
</script>
|
||||
|
||||
<script id=dynamic_anchor_defaults>
|
||||
@@ -129,7 +129,7 @@
|
||||
testing.expectEqual('https://foo.bar/?q=bar#frag', link.href);
|
||||
|
||||
link.href = 'foo';
|
||||
testing.expectEqual('http://127.0.0.1:9582/src/browser/tests/element/html/foo', link.href);
|
||||
testing.expectEqual(testing.BASE_URL + 'element/html/foo', link.href);
|
||||
|
||||
testing.expectEqual('', link.type);
|
||||
link.type = 'text/html';
|
||||
|
||||
Reference in New Issue
Block a user