51 Commits

Author SHA1 Message Date
Martin Raifer
95d34835e2 upgrade sinon, don't exclude it from dependabot anymore 2025-06-04 10:14:53 +02:00
Martin Raifer
a33c340356 adjust tests for new rate limit handling
see 91aa85a1c
2025-03-11 16:00:43 +01:00
Martin Raifer
91aa85a1c0 better handling of rate limited API map calls and other API errors
* retry all unsuccessful map calls after waiting 8 seconds (spinner continues to indicate loading state)
* also logged-in users can be rate limited: add dedicated error message
* don't log users out when requests return 401/403 (except on the _get own user data_ request, which would indicate that the oauth token was revoked): it's better to show the error message if a legitimate api call was actually unauthorized

closes #10299
2025-03-11 15:40:05 +01:00
Kyℓe Hensel
6f16060a78 mass-replace done() function with async/await (#10781) 2025-02-17 13:10:04 +01:00
Martin Raifer
121f3e2fb8 don't reauthenticate on HTTP 400 errors
since these are likely unrelated to authentication issues, but rather have to do with generic API errors or outages
2025-02-11 16:29:01 +01:00
Kyℓe Hensel
3011acc23c fix occasional test failures (#10690) 2025-01-22 15:16:45 +01:00
Kyle Hensel
7afecd39ec minor tweaks to make some tests pass 2024-09-03 19:23:21 +10:00
Martin Raifer
b2b3009a64 .env oauth2 config: drop client secret; use URL if API_URL is empty 2024-07-05 16:15:47 +02:00
Martin Raifer
87a05f5815 migrate to osm-auth 2.3 2023-11-14 08:13:44 +01:00
Martin Raifer
c4d1390270 use api.osm.org url for OSM API calls
see https://github.com/openstreetmap/operations/issues/951
2023-10-10 16:03:10 +02:00
Martin Raifer
280acfa661 Replace RapiD credentials with iD credentials 2022-06-02 14:46:11 +02:00
Bryan Housel
6058f89460 Upgrade to osm-auth v2 which uses OAuth2 to connect to OSM API 2022-06-02 13:07:50 +02:00
Wouter van der Plas
5305b4fb46 removed formatting 2021-10-25 00:50:53 +02: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
33fab5580b Before calling init() make sure the assetPath is set
init kicks off building the ui, which can fetch spritesheets for the <defs>
The assetPath needs to be set otherwise these files will not be found
2021-08-16 22:06:42 -04:00
Quincy Morgan
03ca12741f Make imageryBlocklists return regex objects instead of strings
Fix performance bug due to checking background source blocks too often
2020-09-04 10:09:47 -04:00
Quincy Morgan
a72a2bb860 Hide background sources from the list if they're blocked (close #7905) 2020-09-03 12:30:59 -04:00
Quincy Morgan
1e820b6980 Convert OSM API tests to simulate JSON responses (re: #7188) 2020-03-12 16:45:08 -07:00
Bryan Housel
e19bcb77d5 Require init() call before coreContext starts doing things
(closes #7304)
2020-01-29 19:27:12 -05:00
Bryan Housel
392a242c02 Upgrade to eslint v6.0.0
(closes #6567)
2019-06-29 11:35:57 -04:00
Bryan Housel
d0452e6be4 Convert fakeServer tests to use fakeFetch
- Many text expects are now wrapped in setTimeout, as the fetch
  promises settle async now.
- This makes the tests somewhat brittle, and we should maybe consider
  reworking some of them. For example it is very hard to perform
  a test like `expect(spy).to.have.not.been.called` in an async way.
  (We could instead inspect the fakeServer requests() to know this.)
- Also includes some trickery for osm.js, which uses d3-xml (fetch)
  now for unauthenticated calls and osmauth (xhr) for authenticated calls
2019-04-26 22:29:48 -04:00
Bryan Housel
36d1f3701f Allow osm service tests to work with deferred parsing 2019-04-12 12:11:35 -04:00
Bryan Housel
e30090996b Add loadTileAtLoc to fetch data tile for a specific location
(closes #4890)

This lets iD request needed tiles outside of the viewport, for example to
properly straighten lines or validate features that may have unloaded
connections.
2019-04-09 23:49:31 -04:00
Bryan Housel
2660a8554b Add isDataLoaded and tilecache rtree for testing
(re: #2248, #5938, maybe others)
2019-04-08 15:59:42 -04:00
Bryan Housel
492bb5b37e Eliminate magic scale numbers from tests, add loadNotes test xml 2019-02-07 11:31:32 -05:00
Bryan Housel
71b2d2c6b7 Upgrade legacy symbols in tests
- iD.Context -> iD.coreContext
- iD.Graph -> iD.coreGraph
- iD.Node -> iD.osmNode
- iD.Way -> iD.osmWay
- iD.Relation -> iD.osmRelation
2019-01-30 15:43:02 -05:00
Bryan Housel
0353b3110d Fix parse error in testing osm.js 2018-10-11 13:58:57 -04:00
Thomas Hervey
26f045b16c added/updated service/osm, osm/note, mode/add_note tests 2018-07-23 16:17:48 -04:00
Thomas Hervey
7ad765d408 added simple tests for loading and retrieving notes 2018-07-16 10:54:40 -04:00
Thomas Hervey
bd1586500e added tests for notes service 2018-07-13 15:01:43 -04:00
Bryan Housel
535208beb5 Move tests to spec/services/osm.js and remove old notes.js files 2018-07-01 23:35:10 -04:00
Bryan Housel
9b705a6375 Don't call async callbacks after connection resets/switches
(closes #4288)
2017-11-14 21:30:01 -05:00
Bryan Housel
b3842d97f4 Remove lodash from the test suite
(closes #4378)
2017-10-18 14:37:39 -04:00
Bryan Housel
b7d98b94fb loadEntity loadEntityVersion and loadMultiple all should ignore entityCache 2017-08-24 21:00:39 -04:00
Bryan Housel
cd05c51432 loadEntity can use entityCache, but loadEntityVersion should not 2017-08-24 15:02:12 -04: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
b6c2645409 Add history urls to osm service and more URL tests 2017-06-30 00:52:05 -04:00
Bryan Housel
1a8cfcc8b1 Changeset refactor
(closes #2633)

* move osmChangeJXON from osm service to osmChangeset
* cleanup putChangeset for code clarity
* adjust params for callbacks (pass changeset around instead of changeset_id)
* add commit.reset() to reset changeset object after successful save
* improve checks for changeset tags (trim whitespace, etc)
2017-03-15 11:03:43 -04:00
Bryan Housel
d1aac857a4 Ignore server changesets with missing comment tag or empty comment 2017-03-11 14:28:30 -05:00
mstn
05e5cf9030 add type information to references 2017-03-02 11:26:14 +01:00
mstn
3205650798 order to-be-created relations by dependencies in a changeset 2017-03-02 09:17:08 +01:00
Bryan Housel
a7ac44f6e8 Refactor imageryBlacklists so it can be called without triggering a GET
Previous code was problematic because we need the function to
to properly blacklist custom imagery passed in through the url hash,
before iD is completely initialized.  Triggering GET causes tests to
break because osm service testing has side effects :-/
2016-12-04 21:35:55 -05:00
Bryan Housel
b9888e45e4 Add imageryBlacklists function to get blacklists from OSM API
(for #3623)
2016-12-03 19:25:07 -05:00
Bryan Housel
f800e5afbc Remove unnecessary window parameter to Context 2016-11-10 15:19:03 -05:00
Bryan Housel
b8be480267 Tests for loadFromAPI, esp to cover retry and dispatch behaviors 2016-11-09 17:59:07 -05:00
Bryan Housel
9845f0594e Don't rely on test side effects to init() osm service 2016-11-09 11:41:19 -05:00
Bryan Housel
16ada1f29a Better error handling for common osm api error conditions
* if 509 Bandwidth Exceeded / 429 Too Many Requests, prompt for login
(closes #2262)
* if 400 Bad Request / 401 Unauthorized / 403 Forbidden - logout and retry
(closes #3546)
2016-11-08 21:43:27 -05:00
Bryan Housel
73d7fca095 Test should logout after authenticating with test credentials 2016-10-31 15:04:46 -04:00
Bryan Housel
0066204cfa Fix tests for iD.Connection -> iD.services.osm 2016-10-25 21:33:13 -04:00