Commit Graph

58 Commits

Author SHA1 Message Date
Noenandre 255c80d341 Test for init and reset methods on service.
Bugfix for reset.
Adjusted expectation of number of svg layers.
2023-03-03 16:43:54 +01:00
Martin Raifer 94db5c23b8 Merge remote-tracking branch 'wvanderp/switchToKarma' into develop 2021-12-07 19:59:16 +01:00
Thomas Petillon e1898e5c56 Add the utilOldestID() function 2021-12-06 21:23:38 +01:00
John Firebaugh 053b652548 More typos 2021-10-24 11:06:26 -07:00
Wouter van der Plas 4a8f423997 taginfo 2021-10-23 17:50:18 +02:00
Wouter van der Plas 83ff3c4f5e first setup 2021-10-23 17:50:18 +02:00
Bryan Housel 08c765236f Force tests to use mouse events instead of pointer events
The pointer events use a different mechanism for counting clicks that doesn't
work when the tests are run in a real browser like Chrome. This change forces
iD to always use mouse events during testing, even in a real browser.
2021-08-18 18:58:30 -04:00
Bryan Housel 003628d6b0 Try not to load imagery when running tests
By default, the `rendererBackground` code will choose an initial imagery based on what
sources are available at the given map location. It looks like this code will fallback
to "custom" _before_ "none", and I noticed that in some cases it was trying to fetch
whatever source happened to be stored in the "custom" template in localStorage.

This commit adds an explicit window.location.hash in a few places to encourage the
background layer to be "none". Some tests do change the hash, so this isn't perfect.
2021-08-16 22:51:39 -04:00
Bryan Housel 5aee120a86 Prefill the locale_tagging_en with fake string data
This avoids the numerous "missing translation" errors filling up the console
2021-08-16 14:02:25 -04:00
Milos Brzakovic (E-Search) d2036996e3 Merge conflicts resolved 2021-07-05 10:26:44 +02:00
Bryan Housel 1f6a2121c4 Move all of NSI into a service, rewrite matcher code 2021-03-03 12:04:37 -05:00
Quincy Morgan 13ddeecfa7 Fix code tests for #8276 for real this time
Add utilFetchJson to get around some quirks of d3.json and use it for coreFileFetcher
Load real general English locale strings at the beginning of code tests
2021-02-23 11:50:00 -05:00
Bryan Housel d3fb8c60f9 Upgrade validations outdated_tags, suspicious_names to NSI v5 2021-01-13 13:46:00 -05:00
Quincy Morgan 7a3a84b7b2 Remove broken "tail" functionality (close #7560) 2020-05-07 10:26:50 -07:00
Quincy Morgan ca3a0f9dbc Fix lint warnings 2020-04-02 11:12:10 -07:00
Quincy Morgan a1af118f0e Ensure locales and presets are loaded before the UI loads (close #7406)
Consolidate localization behavior and init to a coreLocalizer function and singleton
Explicitly support `en-US` locale
Rename coreData to coreFileFetcher and export a singleton rather than using a property of coreContext
Add `apiConnections` property of coreContext to simplify adding a source switcher
Replace some init functions with re-callable, promise-supporting `ensureLoaded` functions
Make coreContext itself load the UI if a container has been specified at init time
Fix code tests
2020-03-31 12:23:31 -07:00
Quincy Morgan 72a99673a0 Revert #7428 2020-03-20 09:59:30 -07:00
Bryan Housel dbe643aeac Switch from bundled editor-layer-index to fetched imagery-index 2020-03-12 14:27:49 -04:00
Bryan Housel 4d0ef1bafc Export only the d3 functions we use in tests
(re: #4379)

This trims a bit more off the iD bundle size
2020-02-22 15:07:09 -05:00
Bryan Housel b12c30461b Don't bundle the locales anymore, load first in context init
(re: #4994)
2020-02-21 12:24:08 -05:00
Bryan Housel dc7fba4bf8 Have utilStringQs advance past any leading '?' or '#' characters
This lets us remove a bunch of substring(1) and +1 from the code.
2020-02-20 17:09:54 -05:00
Bryan Housel 12e3b7df6d Setup fake data so that coreUploader doesn't fire off requests 2020-02-06 14:06:40 -05:00
Bryan Housel 147af19626 Seed presetIndex collection with fallback presets
- amazingly, this passes all tests, but iD ends up pretty non-functional
2020-02-05 12:21:33 -05:00
Bryan Housel 0fe766d9a4 WIP on external presets
- preset data is no longer bundled into iD.js
- some code pathways commented out re: external presets
- many changes so that tests can run without presets at start, or async
- still need to make sure fallbacks are always there (point, line, area, etc)
2020-02-05 09:38:26 -05:00
Bryan Housel 4aa4686e7f Fix test failures in localized and suspicious_names 2020-02-03 12:38:17 -05:00
Bryan Housel 06eac7c9d0 Don't bundle the nsi brands anymore, fetch from CDN at runtime
(re: #4994)
2020-02-01 17:40:56 -05:00
Bryan Housel 743dc0a83a Don't bundle the nsi brands anymore, fetch from CDN at runtime
(re: #4994)
2020-01-31 22:07:21 -05:00
Bryan Housel 567eeac587 Make several data external instead of bundled:
Also dist/data/* contains minified files now

These are now external and will fetch as needed:
-export { dataAddressFormats } from './address-formats.json';
-export { dataDeprecated } from './deprecated.json';
-export { dataDiscarded } from './discarded.json';
-export { dataLanguages } from './languages.json';
-export { dataPhoneFormats } from './phone-formats.json';
-export { dataShortcuts } from './shortcuts.json';
-export { dataTerritoryLanguages } from './territory-languages.json';
2020-01-28 22:21:31 -05:00
Bryan Housel b9f41bb48c Add workaround for missing ArrayBuffer.isView in PhantomJS
(closes #7072)
2019-11-27 10:53:24 -05:00
Bryan Housel e6dde01264 What will make you happy, mocha? 2019-05-19 21:51:33 -04:00
Bryan Housel d68c49e66d Async tests running on dodgy Travis containers are not my friends
(closes #6391)

Default timeout of 2000 regularly exceeded, causing spurious test failures.
Even a random garbage collection pause can take more than 2 seconds.
2019-05-19 21:35:16 -04:00
Bryan Housel af31b84b1d Keep track of whether requests have been processed
This lets us call `respond` multiple times, which is useful for the
tests which fetch data in pages.
2019-04-29 13:03:01 -04:00
Bryan Housel 552ea46c43 Wrap the fake-fetch methods with sinon.fakeServer-like interface
This mimics `respondWith` and `respond` to keep the tests mostly
similar between `FakeFetch` and `sinon.fakeServer`

Major difference is that all the fakeServer tests which were sync
are now async and this is probably unavoidable.
2019-04-26 22:25:57 -04:00
Bryan Housel 3e363fed8b Make sure to return a new Response each time, not the same one
You can only consume a response once - thereafter the response
body becomes "locked" and will throw an error if you try.
https://stackoverflow.com/questions/53511974/javascript-fetch-failed-to-execute-json-on-response-body-stream-is-locked
2019-04-25 19:22:11 -04:00
Bryan Housel 6f31062d32 Add support for sinon-stubbing fetch API to spec_helpers 2019-04-25 14:13:08 -04:00
Bryan Housel daaab30d13 Add workaround for Array.from when running in PhantomJS
https://github.com/openstreetmap/iD/issues/6087#issuecomment-476219308

Also added `npm run phantom` to test workarounds like this quickly
2019-03-25 12:47:55 -04:00
Bryan Housel 26113d0e25 Remove unneeded getOwnPropertySymbols polyfill 2019-03-24 01:48:36 -04:00
Bryan Housel 11bfeaabfc Add browser-polyfills, remove lodash assign, compact, values
(re: #6087)
2019-03-22 17:14:41 -04:00
Bryan Housel 322951bdc0 Add polyfill for Object.getOwnPropertySymbols for sinon
(closes #6001)
2019-03-02 18:18:44 -05:00
Quincy Morgan 8a9399edb7 Add line geometry to traffic_calming=island preset (re: #5945)
Add more unit tests for tag_suggests_area
Replace "finds" with "flags" in validation unit test labels
2019-02-26 11:30:03 -05:00
Bryan Housel 15c0b82eb2 First attempt to run tests with minimal preset config 2019-01-30 10:25:40 -05:00
Max Grossman f168f85496 passing mapcss test w/out parser, use that on sever
ref #remote-presets
2018-08-10 09:16:59 -04:00
Bryan Housel b3842d97f4 Remove lodash from the test suite
(closes #4378)
2017-10-18 14:37:39 -04:00
Bryan Housel b5168c1070 Restore the global d3 (needed so tests use the same d3.event as iD?) 2017-09-27 10:39:03 -04:00
Bryan Housel 9f1d476594 Attempt to remove d3, lodash from bundle, but leave available for tests 2017-09-26 14:19:14 -04:00
john gravois 5f341366e7 display additional metadata from Esri World Imagery
* getVintage() becomes getMetadata()
* ignore a couple unrelated lint nags
* add source description, resolution and accuracy info to debug panel
2017-09-11 09:51:07 -07:00
Bryan Housel 99a3741b0c Better isolation of services, to avoid hitting network during test runs
1. All services are disabled in testing now to prevent network accesses
2. Only services are enabled when needed to test something
3. Many changes throughout code to allow iD to run with services disabled
   (e.g. check for osm service instead of assuming context.connection() will work)
4. Actually export the services so we can disable and enable them
2017-08-09 22:04:09 -04:00
Bryan Housel d07d20cba7 Drop custom "classed" chai assertation and just use d3 2017-04-24 10:27:29 -04:00
Bryan Housel 93d50b4e87 Use live bound object for imagery array, remove context.imagery() accessor
Also update documentation, closes #3359
2016-11-14 11:16:45 -05:00
Bryan Housel 07fa5fcc34 Refactor Entity, Node, Relation, Tags, Way from core to osm 2016-10-11 22:41:24 -04:00