Skip to content

Commit

Permalink
Run render tests in browser (internal-64)
Browse files Browse the repository at this point in the history
Co-authored-by: Asheem Mamoowala <asheem.mamoowala@mapbox.com>
Co-authored-by: Arindam Bose <arindam.bose@mapbox.com>
  • Loading branch information
3 people authored and karimnaaji committed Dec 7, 2020
1 parent 5ed472e commit cbf6229
Show file tree
Hide file tree
Showing 42 changed files with 877 additions and 834 deletions.
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ jobs:
- attach_workspace:
at: .
- run: yarn run test-render
- store_test_results:
path: test/integration/render-tests
- store_artifacts:
path: "test/integration/render-tests/index.html"

Expand Down
9 changes: 7 additions & 2 deletions build/rollup_plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,25 @@ import {terser} from 'rollup-plugin-terser';
import minifyStyleSpec from './rollup_plugin_minify_style_spec';
import {createFilter} from 'rollup-pluginutils';
import strip from '@rollup/plugin-strip';
import replace from 'rollup-plugin-replace';

// Common set of plugins/transformations shared across different rollup
// builds (main mapboxgl bundle, style-spec package, benchmarks bundle)

export const plugins = (minified, production) => [
export const plugins = (minified, production, test) => [
flow(),
minifyStyleSpec(),
json(),
production ? strip({
sourceMap: true,
functions: ['PerformanceUtils.*', 'Debug.*']
}) : false,
test ? replace({
'process.env.CI': JSON.stringify(process.env.CI),
'process.env.UPDATE': JSON.stringify(process.env.UPDATE)
}) : false,
glsl('./src/shaders/*.glsl', production),
buble({transforms: {dangerousForOf: true}, objectAssign: "Object.assign"}),
buble({transforms: {dangerousForOf: true, asyncAwait: !test}, objectAssign: "Object.assign"}),
minified ? terser({
compress: {
pure_getters: true,
Expand Down
2 changes: 1 addition & 1 deletion build/test/build-tape.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const fs = require('fs');
module.exports = function() {
return new Promise((resolve, reject) => {
browserify(require.resolve('../../test/util/tape_config.js'), { standalone: 'tape' })
.transform("babelify", {presets: ["@babel/preset-env"], global: true})
.transform("babelify", {presets: ["@babel/preset-env"], global: true, compact: true})
.bundle((err, buff) => {
if (err) { throw err; }

Expand Down
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
"nyc": "^13.3.0",
"pirates": "^4.0.1",
"pixelmatch": "^5.1.0",
"pngjs": "^3.4.0",
"postcss-cli": "^6.1.2",
"postcss-inline-svg": "^3.1.1",
"pretty-bytes": "^5.1.0",
Expand All @@ -110,7 +109,6 @@
"stylelint": "^9.10.1",
"stylelint-config-standard": "^18.2.0",
"tap": "~12.4.1",
"tap-parser": "^10.0.1",
"tape": "^4.13.2",
"tape-filter": "^1.0.4",
"testem": "^3.0.0"
Expand All @@ -127,7 +125,7 @@
"build-prod": "rollup -c --environment BUILD:production",
"build-prod-min": "rollup -c --environment BUILD:production,MINIFY:true",
"build-csp": "rollup -c rollup.config.csp.js",
"build-query-suite": "rollup -c test/integration/rollup.config.test.js",
"build-test-suite": "rollup -c test/integration/rollup.config.test.js",
"build-flow-types": "mkdir -p dist && cp build/mapbox-gl.js.flow dist/mapbox-gl.js.flow && cp build/mapbox-gl.js.flow dist/mapbox-gl-dev.js.flow",
"build-css": "postcss -o dist/mapbox-gl.css src/css/mapbox-gl.css",
"build-style-spec": "cd src/style-spec && npm run build && cd ../.. && mkdir -p dist/style-spec && cp src/style-spec/dist/* dist/style-spec",
Expand All @@ -136,9 +134,8 @@
"build-benchmarks": "BENCHMARK_VERSION=${BENCHMARK_VERSION:-\"$(git rev-parse --abbrev-ref HEAD) $(git rev-parse --short=7 HEAD)\"} rollup -c bench/versions/rollup_config_benchmarks.js",
"watch-benchmarks": "BENCHMARK_VERSION=${BENCHMARK_VERSION:-\"$(git rev-parse --abbrev-ref HEAD) $(git rev-parse --short=7 HEAD)\"} rollup -c bench/rollup_config_benchmarks.js -w",
"start-server": "st --no-cache -H 0.0.0.0 --port 9966 --index index.html .",
"start": "run-p build-token watch-css watch-query watch-benchmarks start-server",
"start": "run-p build-token watch-css watch-dev watch-benchmarks start-server",
"start-debug": "run-p build-token watch-css watch-dev start-server",
"start-tests": "run-p build-token watch-css watch-query start-server",
"start-bench": "run-p build-token watch-benchmarks start-server",
"start-release": "run-s build-token build-prod-min build-css print-release-url start-server",
"diff-tarball": "build/run-node build/diff-tarball && echo \"Please confirm the above is correct [y/n]? \"; read answer; if [ \"$answer\" = \"${answer#[Yy]}\" ]; then false; fi",
Expand All @@ -152,10 +149,10 @@
"test-unit": "build/run-tap --reporter classic --no-coverage test/unit",
"test-build": "build/run-tap --no-coverage test/build/**/*.test.js",
"test-browser": "build/run-tap --reporter spec --no-coverage test/browser/**/*.test.js",
"test-render": "node --max-old-space-size=2048 test/render.test.js",
"test-query-node": "node test/query.test.js",
"watch-query": "testem -f test/integration/testem.js",
"test-query": "testem ci -f test/integration/testem.js -R xunit > test/integration/query-tests/test-results.xml",
"watch-render": "SUITE_NAME=render testem -f test/integration/testem.js",
"watch-query": "SUITE_NAME=query testem -f test/integration/testem.js",
"test-render": "CI=true SUITE_NAME=render testem ci -f test/integration/testem.js",
"test-query": "CI=true SUITE_NAME=query testem ci -f test/integration/testem.js",
"test-expressions": "build/run-node test/expression.test.js",
"test-flow": "build/run-node build/generate-flow-typed-style-spec && flow .",
"test-cov": "nyc --require=@mapbox/flow-remove-types/register --reporter=text-summary --reporter=lcov --cache run-s test-unit test-expressions test-query test-render",
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {prewarm, clearPrewarmedResources} from './util/global_worker_pool';
import {clearTileCache} from './util/tile_request_cache';
import {PerformanceUtils} from './util/performance';
import {FreeCameraOptions} from './ui/free_camera';
import browser from './util/browser';

const exported = {
version,
Expand Down Expand Up @@ -176,7 +177,7 @@ const exported = {
};

//This gets automatically stripped out in production builds.
Debug.extend(exported, {isSafari, getPerformanceMetrics: PerformanceUtils.getPerformanceMetrics});
Debug.extend(exported, {isSafari, getPerformanceMetrics: PerformanceUtils.getPerformanceMetrics, setNow: browser.setNow, restoreNow: browser.restoreNow});

/**
* The version of Mapbox GL JS in use as specified in `package.json`,
Expand Down
8 changes: 8 additions & 0 deletions src/util/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ const exported = {
*/
now,

setNow(time: number) {
exported.now = () => time;
},

restoreNow() {
exported.now = now;
},

frame(fn: (paintStartTimestamp: number) => void): Cancelable {
const frame = raf(fn);
return {cancel: () => cancel(frame)};
Expand Down
133 changes: 0 additions & 133 deletions test/ajax_stubs.js

This file was deleted.

57 changes: 30 additions & 27 deletions test/ignores.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,48 @@
{
"query-tests/regressions/mapbox-gl-js#4494": "https://github.com/mapbox/mapbox-gl-js/issues/2716",
"render-tests/geojson/inline-linestring-fill": "current behavior is arbitrary",
"render-tests/line-dasharray/case/square": "https://github.com/mapbox/mapbox-gl-js/issues/9531",
"render-tests/debug/tile": "skip - inconsistent text rendering with canvas on different platforms",
"render-tests/debug/tile-overscaled": "skip - inconsistent text rendering with canvas on different platforms",
"render-tests/fill-extrusion-pattern/1.5x-on-1x-add-image": "skip - non-deterministic on AMD graphics cards",
"render-tests/fill-extrusion-pattern/multiple-layers-flat": "skip - https://github.com/mapbox/mapbox-gl-js-internal/issues/223",
"render-tests/fill-extrusion-pattern/opacity-terrain-flat-on-border": "skip - https://github.com/mapbox/mapbox-gl-js-internal/issues/223",
"render-tests/fill-extrusion-pattern/tile-buffer": "skip - not rendering correctly on CI",
"render-tests/fill-pattern/update-feature-state": "https://github.com/mapbox/mapbox-gl-js/issues/7207",
"render-tests/geojson/inline-linestring-fill": "skip - current behavior is arbitrary",
"render-tests/icon-image/icon-sdf-non-sdf-one-layer": "skip - render sdf icon and normal icon in one layer",
"render-tests/icon-text-fit/text-variable-anchor-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/line-dasharray/case/square": "skip - https://github.com/mapbox/mapbox-gl-js/issues/9531",
"render-tests/map-mode/static": "https://github.com/mapbox/mapbox-gl-js/issues/5649",
"render-tests/map-mode/tile": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/map-mode/tile-avoid-edges": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/mixed-zoom/z10-z11": "current behavior conflicts with https://github.com/mapbox/mapbox-gl-js/pull/6803. can be fixed when https://github.com/mapbox/api-maps/issues/1480 is done",
"render-tests/projection/axonometric": "axonometric rendering in gl-js tbd",
"render-tests/projection/axonometric-multiple": "axonometric rendering in gl-js tbd",
"render-tests/projection/skew": "axonometric rendering in gl-js tbd",
"render-tests/regressions/mapbox-gl-js#3682": "skip - true",
"render-tests/runtime-styling/image-update-icon": "skip - https://github.com/mapbox/mapbox-gl-js/issues/4804",
"render-tests/runtime-styling/image-update-pattern": "skip - https://github.com/mapbox/mapbox-gl-js/issues/4804",
"render-tests/mixed-zoom/z10-z11": "current behavior conflicts with https://github.com/mapbox/mapbox-gl-js/pull/6803. can be fixed when https://github.com/mapbox/api-maps/issues/1480 is done",
"render-tests/fill-extrusion-pattern/tile-buffer": "https://github.com/mapbox/mapbox-gl-js/issues/4403",
"render-tests/symbol-placement/line-center-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/symbol-placement/line-center-buffer-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/symbol-placement/line-center-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/symbol-sort-key/text-ignore-placement": "skip - text drawn over icons",
"render-tests/text-variable-anchor/remember-last-placement": "skip - not sure this is correct behavior",
"render-tests/icon-image/icon-sdf-non-sdf-one-layer": "skip - render sdf icon and normal icon in one layer",
"render-tests/text-variable-anchor/all-anchors-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/fill-pattern/update-feature-state": "https://github.com/mapbox/mapbox-gl-js/issues/7207",
"render-tests/text-size/zero": "https://github.com/mapbox/mapbox-gl-js/issues/9161",
"render-tests/text-variable-anchor/left-top-right-bottom-offset-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/tile-mode/streets-v11": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/within/paint-line": "https://github.com/mapbox/mapbox-gl-js/issues/7023",
"render-tests/icon-text-fit/text-variable-anchor-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/text-variable-anchor/all-anchors-labels-priority-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/fill-extrusion-pattern/1.5x-on-1x-add-image": "skip - non-deterministic on AMD graphics cards",
"render-tests/text-variable-anchor/avoid-edges-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/text-font-metrics/font-with-baseline-font-without-baseline": "https://github.com/mapbox/mapbox-gl-js-internal/issues/74",
"render-tests/text-font-metrics/font-with-image-vertical": "https://github.com/mapbox/mapbox-gl-js-internal/issues/75",
"render-tests/text-font-metrics/latin-alphabets-vertical": "https://github.com/mapbox/mapbox-gl-js-internal/issues/75",
"render-tests/text-font-metrics/latin-alphabets-vertical-no-ascender-descender": "https://github.com/mapbox/mapbox-gl-js-internal/issues/75",
"render-tests/text-font-metrics/line-placement-vertical-shaping-with-punctuations": "https://github.com/mapbox/mapbox-gl-js-internal/issues/76",
"render-tests/text-font-metrics/mixed-fonts-both-with-baseline": "https://github.com/mapbox/mapbox-gl-js-internal/issues/74",
"render-tests/text-font-metrics/mixed-fonts-with-image": "https://github.com/mapbox/mapbox-gl-js-internal/issues/74",
"render-tests/text-font-metrics/mixed-fonts-with-image-vertical": "https://github.com/mapbox/mapbox-gl-js-internal/issues/74",
"render-tests/text-font-metrics/mixed-fonts-with-scales": "https://github.com/mapbox/mapbox-gl-js-internal/issues/74",
"render-tests/text-font-metrics/font-with-image-vertical": "https://github.com/mapbox/mapbox-gl-js-internal/issues/75",
"render-tests/text-font-metrics/latin-alphabets-vertical-no-ascender-descender": "https://github.com/mapbox/mapbox-gl-js-internal/issues/75",
"render-tests/text-font-metrics/latin-alphabets-vertical": "https://github.com/mapbox/mapbox-gl-js-internal/issues/75",
"render-tests/text-font-metrics/mixed-fonts-with-images-vertical": "https://github.com/mapbox/mapbox-gl-js-internal/issues/75",
"render-tests/text-font-metrics/punctuations-vertical": "https://github.com/mapbox/mapbox-gl-js-internal/issues/75",
"render-tests/text-font-metrics/line-placement-vertical-shaping-with-punctuations": "https://github.com/mapbox/mapbox-gl-js-internal/issues/76",
"render-tests/text-font-metrics/mixed-fonts-with-scales": "https://github.com/mapbox/mapbox-gl-js-internal/issues/74",
"render-tests/text-font-metrics/multiline-point-placement-vertical-shaping-with-punctuations": "https://github.com/mapbox/mapbox-gl-js-internal/issues/76",
"render-tests/text-font-metrics/point-placement-vertical-shaping-with-punctuations": "https://github.com/mapbox/mapbox-gl-js-internal/issues/76",
"render-tests/text-font-metrics/vertical-shaping-with-ZWSP": "https://github.com/mapbox/mapbox-gl-js-internal/issues/76"
"render-tests/text-font-metrics/punctuations-vertical": "https://github.com/mapbox/mapbox-gl-js-internal/issues/75",
"render-tests/text-font-metrics/vertical-shaping-with-ZWSP": "https://github.com/mapbox/mapbox-gl-js-internal/issues/76",
"render-tests/text-variable-anchor/all-anchors-labels-priority-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/text-variable-anchor/all-anchors-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/text-variable-anchor/avoid-edges-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/text-variable-anchor/left-top-right-bottom-offset-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/text-variable-anchor/pitched-rotated-debug": "skip - non-deterministic when rendered in browser",
"render-tests/text-variable-anchor/pitched-with-map": "skip - non-deterministic when rendered in browser",
"render-tests/text-variable-anchor/remember-last-placement": "skip - not sure this is correct behavior",
"render-tests/text-size/zero": "https://github.com/mapbox/mapbox-gl-js/issues/9161",
"render-tests/tile-mode/streets-v11": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/within/paint-line": "https://github.com/mapbox/mapbox-gl-js/issues/7023"
}
Loading

0 comments on commit cbf6229

Please sign in to comment.