diff --git a/package.json b/package.json index d6f4d265e..28b0ffe62 100644 --- a/package.json +++ b/package.json @@ -34,9 +34,8 @@ "lint": "eslint scripts test/spec modules", "start": "npm-run-all -s build start:server", "start:server": "node scripts/server.js", - "test": "npm-run-all -s lint build:css build:data build:legacy test:**", - "test:phantom": "phantomjs --web-security=no node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/phantom.html spec", - "test:iD": "phantomjs --web-security=no node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html spec", + "test": "npm-run-all -s lint build:css build:data build:legacy test:spec", + "test:spec": "phantomjs --web-security=no node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html spec", "translations": "node scripts/update_locales.js" }, "dependencies": { diff --git a/test/index.html b/test/index.html index 6c5640719..8ef4f63b8 100644 --- a/test/index.html +++ b/test/index.html @@ -24,147 +24,172 @@ } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + var scripts = [ + 'spec/actions/add_entity.js', + 'spec/actions/add_member.js', + 'spec/actions/add_midpoint.js', + 'spec/actions/change_member.js', + 'spec/actions/change_preset.js', + 'spec/actions/change_tags.js', + 'spec/actions/circularize.js', + 'spec/actions/connect.js', + 'spec/actions/copy_entities.js', + 'spec/actions/delete_member.js', + 'spec/actions/delete_multiple.js', + 'spec/actions/delete_node.js', + 'spec/actions/delete_relation.js', + 'spec/actions/delete_way.js', + 'spec/actions/discard_tags.js', + 'spec/actions/disconnect.js', + 'spec/actions/join.js', + 'spec/actions/merge.js', + 'spec/actions/merge_nodes.js', + 'spec/actions/merge_polygon.js', + 'spec/actions/merge_remote_changes.js', + 'spec/actions/move.js', + 'spec/actions/move_node.js', + 'spec/actions/noop.js', + 'spec/actions/orthogonalize.js', + 'spec/actions/restrict_turn.js', + 'spec/actions/reverse.js', + 'spec/actions/revert.js', + 'spec/actions/split.js', + 'spec/actions/straighten_nodes.js', + 'spec/actions/straighten_way.js', + 'spec/actions/unrestrict_turn.js', + 'spec/actions/reflect.js', + 'spec/actions/extract.js', + 'spec/actions/upgrade_tags.js', + 'spec/behavior/hash.js', + 'spec/behavior/hover.js', + 'spec/behavior/select.js', + 'spec/behavior/lasso.js', + + 'spec/core/context.js', + 'spec/core/data.js', + 'spec/core/difference.js', + 'spec/core/graph.js', + 'spec/core/history.js', + 'spec/core/tree.js', + 'spec/core/validator.js', + + 'spec/geo/extent.js', + 'spec/geo/geo.js', + 'spec/geo/geom.js', + 'spec/geo/vector.js', + + 'spec/lib/locale.js', + + 'spec/modes/add_point.js', + 'spec/modes/add_note.js', + + 'spec/operations/extract.js', + 'spec/operations/straighten.js', + + 'spec/osm/changeset.js', + 'spec/osm/entity.js', + 'spec/osm/intersection.js', + 'spec/osm/multipolygon.js', + 'spec/osm/lanes.js', + 'spec/osm/node.js', + 'spec/osm/note.js', + 'spec/osm/relation.js', + 'spec/osm/way.js', + + 'spec/presets/category.js', + 'spec/presets/collection.js', + 'spec/presets/index.js', + 'spec/presets/preset.js', + + 'spec/renderer/background_source.js', + 'spec/renderer/features.js', + 'spec/renderer/map.js', + 'spec/renderer/tile_layer.js', + + 'spec/services/mapillary.js', + 'spec/services/maprules.js', + 'spec/services/nominatim.js', + 'spec/services/openstreetcam.js', + 'spec/services/osm.js', + 'spec/services/osm_wikibase.js', + 'spec/services/streetside.js', + 'spec/services/taginfo.js', + + 'spec/svg/areas.js', + 'spec/svg/data.js', + 'spec/svg/icon.js', + 'spec/svg/layers.js', + 'spec/svg/lines.js', + 'spec/svg/midpoints.js', + 'spec/svg/osm.js', + 'spec/svg/points.js', + 'spec/svg/svg.js', + 'spec/svg/tag_classes.js', + 'spec/svg/vertices.js', + + 'spec/ui/cmd.js', + 'spec/ui/combobox.js', + 'spec/ui/confirm.js', + 'spec/ui/flash.js', + 'spec/ui/inspector.js', + 'spec/ui/modal.js', + 'spec/ui/raw_tag_editor.js', + + 'spec/ui/fields/access.js', + 'spec/ui/fields/localized.js', + 'spec/ui/fields/wikipedia.js', + + 'spec/util/array.js', + 'spec/util/clean_tags.js', + 'spec/util/keybinding.js', + 'spec/util/object.js', + 'spec/util/session_mutex.js', + 'spec/util/util.js', + + 'spec/validations/almost_junction.js', + 'spec/validations/crossing_ways.js', + 'spec/validations/disconnected_way.js', + 'spec/validations/incompatible_source.js', + 'spec/validations/mismatched_geometry.js', + 'spec/validations/missing_role.js', + 'spec/validations/missing_tag.js', + 'spec/validations/outdated_tags.js', + 'spec/validations/private_data.js', + 'spec/validations/suspicious_name.js' + ]; + + var isPhantomJS = !!(navigator.userAgent.match(/PhantomJS/)); + var isIE11 = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/)); + + // Prepend scripts to run at the beginning. + + // Third Script? PhantomJS can test some other capabilities + if (isPhantomJS) scripts.unshift('spec/phantom.js'); + + // Second Script: Always run spec helpers + scripts.unshift('spec/spec_helpers.js'); + + // First script: Choose either modern or legacy iD build.. + scripts.unshift((isPhantomJS || isIE11) ? '../dist/iD.legacy.js' : '../dist/iD.js'); + + + // Create and execute all scripts in specified order.. + (function nextScript() { + if (!scripts.length) { + window.mocha.run(); + return; + } + var src = scripts.shift(); + var newScript; + newScript = document.createElement('script'); + newScript.type = 'text/javascript'; + newScript.src = src; + newScript.onload = nextScript; + document.getElementsByTagName('body')[0].appendChild(newScript); + })(); + + + diff --git a/test/phantom.html b/test/phantom.html deleted file mode 100644 index 21149e5bc..000000000 --- a/test/phantom.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - Mocha Tests - - - - - - -
- - - - - - - - - - - - - - - - - - - -