Commit Graph

85 Commits

Author SHA1 Message Date
renovate[bot]
9c0fd964ee chore(deps): update selenium/standalone-firefox docker tag to v20210422 [skip netlify] (#2999)
* chore(deps): update selenium/standalone-firefox docker tag to v20210422 [skip netlify]

* test(screenshotter): update screenshots

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Young Min Kin <mail@ylem.kim>
2021-05-20 01:51:25 +09:00
renovate[bot]
2f2636805f chore(deps): update selenium/standalone-chrome docker tag to v20210422 [skip netlify] (#2997)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-05-20 01:40:11 +09:00
Erik Demaine
93b56cfb0b chore(screenshotter): Improve screenshotter for Safari (#3015)
* Fix when Docker returns IPv4 and IPv6 addresses

* Ensure images load before screenshotting

* Fix bugs from review

* Update test/screenshotter/test.html

Co-authored-by: ylemkimon <y@ylem.kim>
2021-05-17 22:45:11 +00:00
Erik Demaine
7377fea33a chore(screenshotter): modernize calls to NodeJS Buffer interface (#2962)
Avoid DeprecationWarning during screenshotting

Co-authored-by: ylemkimon <y@ylem.kim>
2021-04-30 20:06:04 +00:00
renovate[bot]
1927f51353 chore(deps): update ubuntu docker tag to v14.04.5 [skip netlify] (#2871)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-03-31 22:48:49 +00:00
ylemkimon
266fcb046c build: move font generation to the main repo (#2837)
* build: move font generation to the main repo

* Update fonts

* chore: remove submodules

* Update paths

* Update fonts.yml

Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
2021-03-30 03:21:59 +09:00
renovate[bot]
a8c22652c9 chore(deps): update selenium/standalone-firefox docker tag to v3.141.59-20210311 [skip netlify] (#2841)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-03-15 17:55:18 +00:00
renovate[bot]
3eb9b4c1f6 chore(deps): update selenium/standalone-chrome docker tag to v3.141.59-20210311 [skip netlify] (#2840)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-03-15 14:51:51 +00:00
ylemkimon
c0a9a6d961 chore(deps): update to webpack 5 (#2664)
Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
2020-12-28 22:45:05 -05:00
ylemkimon
8803649179 ci: run screenshotter in container (#2644)
* ci: run screenshotter in container

Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
2020-12-19 09:16:34 +09:00
renovate[bot]
5f701de72d chore(deps): update selenium/standalone-firefox docker tag to v3.141.59-20201119 [skip netlify] (#2656)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-11-20 21:39:57 +00:00
renovate[bot]
d485edad43 chore(deps): update selenium/standalone-chrome docker tag to v3.141.59-20201119 [skip netlify] (#2655)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-11-20 19:48:49 +00:00
renovate[bot]
9e91bd0dd8 chore(deps): update selenium/standalone-firefox docker tag to v3.141.59-20201117 [skip netlify] (#2649)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-11-19 06:30:45 +00:00
renovate[bot]
c576058380 chore(deps): update selenium/standalone-chrome docker tag to v3.141.59-20201117 [skip netlify] (#2648)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-11-18 20:28:10 +00:00
renovate[bot]
960a8ceeaa chore(deps): update selenium/standalone-firefox docker tag to v3.141.59-20201010 [skip netlify] (#2579)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-10-12 11:44:03 +00:00
renovate[bot]
ff7e80f65d chore(deps): update selenium/standalone-chrome docker tag to v3.141.59-20201010 [skip netlify] (#2578)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-10-12 10:45:51 +00:00
renovate[bot]
7418057e3a chore(deps): update selenium/standalone-firefox docker tag to v3.141.59-20200826 [skip netlify] (#2544)
* chore(deps): update selenium/standalone-firefox docker tag to v3.141.59-20200826 [skip netlify]

* Update screenshots

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: ylemkimon <y@ylem.kim>
2020-09-26 02:53:23 +09:00
renovate[bot]
94c374c7c1 chore(deps): update selenium/standalone-chrome docker tag to v3.141.59-20200826 [skip netlify] (#2543)
* chore(deps): update selenium/standalone-chrome docker tag to v3.141.59-20200826 [skip netlify]

* Update screenshots

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: ylemkimon <y@ylem.kim>
2020-09-26 02:04:28 +09:00
ylemkimon
2d484a9769 ci(renovate): update screenshotter browser, .flowconfig, editor SDKs, and Actions (#2516)
* ci(renovate): update screenshotter browser image

* ci(renovate): update .flowconfig and Yarn editor SDKs

* ci(renovate): remove unnecessary option

* ci(renovate): do not skip netlify for website updates

* ci(renovate): update GitHub Actions in workflows

* ci(renovate): fix skip netlify
2020-09-22 13:43:28 +09:00
ylemkimon
221042be86 ci: migrate to GitHub Actions from CircleCI, allow running Browserstack on forked repo via label (#2417)
* Remove CircleCI and codecov

* Add GitHub Actions workflow

* Add Browserstack credentials

* Skip tests if ci skip or skip ci is in commit messages

* Update and rename test.yml to ci.yml

* Postfix artifacts name with browser

* Disable proxy on chrome

* Update dockers/screenshotter/screenshotter.js

* Add status badge

* Set directory option in codecov action

* Run Browserstack on forked repo via label

* Print Docker logs

* Disable GPU on ChromeDriver

* Add comments

* Add comments
2020-08-18 04:58:08 +09:00
ylemkimon
36f9788cd6 chore(screenshotter): support Browserstack and test on Safari 13.1 (#2306)
* Support Browserstack in screenshotter

* Support Browserstack in CircleCI

* Test screenshots on Safari 13.1

* Don't run Safari screenshotter on forked PRs

* Update a screenshot

* Ignore *.log in .gitignore
2020-08-04 01:45:10 +09:00
ylemkimon
f97c5454f8 chore: migrate to Yarn 2 (#2316)
* chore: migrate to Yarn 2

* Update config.yml
2020-08-03 18:24:56 +09:00
ylemkimon
8a24907518 build(deps): update dependencies (#2301)
* Bump flow version

* Bump jest version

* Bump eslint version

* Bump rollup version

* Bump webpack version

* Bump misc dependencies and update lockfile

* Update lockfile

* Bump commander version

* Bump misc dependencies

* Bump istanbul version

* Bump docusaurus version

* Update lockfile

* Explicitly declare dependencies

* Bump caniuse-lite version

* Update lockfile

* Bump commander version

* Bump webpack and css-loader version

* Bump flow version
2020-07-25 11:38:29 -07:00
ylemkimon
3272472ffe Use babel-plugin-preval instead of own unicodeMake for unicodeSymbols (#2153)
* Use babel-plugin-preval instead of own unicodeMake for unicodeSymbols

* Fix circular dependency transpiling issue

* Flow type unicodeSymbols.js

Co-authored-by: Erik Demaine <edemaine@mit.edu>
2020-07-08 17:58:11 -04:00
ylemkimon
b9deec098f Load fonts before running screenshotter (#1891) 2019-04-07 18:15:05 +09:00
ylemkimon
11490b5e0b Allow screenshotter to be run on IE, Edge, Safari and remote, e.g., BrowserStack (#1661)
* Allow screenshotter on IE, Edge, and Safari

* Set Firefox options only on Firefox

* Add --selenium-capabilities option to support setting capabilities

* Quit web driver after test finishes

* Upgrade to style-loader 0.22.1 for IE compatability
2018-10-28 17:34:17 +09:00
ylemkimon
cb89a9e5d0 Fix screenshotter race conditions (#1643)
* Fix screenshotter race conditions

* Update screenshotter.js

* Update screenshotter.js
2018-08-21 13:04:05 +09:00
ylemkimon
41a43974ce Collect code coverage in screenshotter tests (#1644)
* Collect code coverage in screenshotter tests

* Using instanbul, no additional dependencies required as they are part 
of jest
* Collect in CircleCI builds and upload to Codecov

* Remove clover report
2018-08-21 12:09:29 +09:00
Kevin Barabash
b2432e8ad2 make all classes in domTree.js PascalCase and make them named exports (#1636)
* make all classes in domTree.js PascalCase and make them named exports

* add eslint rule to enforce capitalization, fix failures

* address feedback
2018-08-19 23:49:21 +09:00
ylemkimon
f829ebc692 Improve prestart and tests (#1610)
* screenshotter: replace promisify(fs) and mkdirp with fs-extra

* screenshotter: replace selenium.promise with builtin Promise

* Lint all JavaScript files in the root

* unicodeMake: replace console.log with writeFile(string)

* unicodeMake: check timestamp, do not build if up-to-date

* Replace check-dependencies with yarn check

* Exclude src/unicodeMake.js from coverage

* Add (missing) dependencies

* Skip CircleCI if only unrelated has been changed

* Fix commit range

* Use fs-extra in update-sri
2018-08-17 16:29:27 +09:00
Erik Demaine
881d780287 Rename Screenshotter -> screenshotter (#1573)
Fix #1570
2018-08-10 19:29:16 +09:00
ylemkimon
c06b36cb6a Replace yarn run and yarn install with yarn, remove building with npm instructions (#1528)
* Replace `yarn run` with `yarn`

* Replace `yarn install` with `yarn`

* Remove building using `npm` from node.md
2018-07-30 14:31:25 +09:00
ylemkimon
a76c4b9a2f Switch npm to Yarn (#1522)
* Add testUrl to jest config

* Switch npm to Yarn
2018-07-29 11:36:27 -07:00
ylemkimon
83e8eac0a5 Add test job to CircleCI (#1235)
* Do not compile contrib when running screenshotter

* Add test job to CircleCI

* Update config.yml

* Fail if PR exists but running on the forked repo

* Update Screenshotter README.md

* Store artifact at the root

* Add CircleCI badge

* Add `codecov` to CircleCI

* Change build directory to `dist`
2018-07-26 18:50:51 -07:00
Erik Demaine
e454eb3b3e Screenshotter chdir to KaTeX root directory (#1502)
* Screenshotter chdir to KaTeX root directory

Fix #1501.  This seems to be required for webpack, specifically
`babel-plugin-version-inline`, to run correctly.

* lint fix
2018-07-25 03:32:01 +09:00
Erik Demaine
9fe5e221e5 Switch from nomnom to commander (#1496)
* Switch from nomnom to commander

* Fix #1489
* --macro repeatable option replaced with single --macros option with ";"
  separator (until https://github.com/tj/commander.js/issues/674)
* Add missing --max-expand option
* Replace expired --unicode-text-in-math-mode option with --strict
  (https://github.com/Khan/KaTeX/issues/1483#issuecomment-405108291)
* Add instructions for how to run in the opening comments
* Clean up option doc strings

* Implement @ylemkimon's comments

* Fix try/const bug

* Fix use of --selenium-ip

It was a quirk that --seleniumIP worked.  --help lists --selenium-ip.

* Implement comments, restore --macro repeatable argument

* Cleanup

* Restore 0 default for maxExpand

* Fix more comments from @ylemkimon

* npm run dist -> npm run build

In preparation for #1500

* Fix line length error
2018-07-23 13:16:45 -04:00
Kevin Barabash
e1614995e3 enforce consistent object brace spacing (#1376) 2018-05-28 23:31:44 +02:00
ylemkimon
74e84e72d2 Add regenerate option to the screenshotter (#1220)
* Add regenerate option to the screenshotter

Save new screenshot when match fails

* Ignore Chrome debug log file

* CircleCI: Generate only failed screenshots

* CircleCI Test

* Revert "CircleCI Test"

This reverts commit 5d3afb2602f32470eeba7767748faba177ba933e.

* Rename `regenerate` to `new`

* Add ` /test/screenshotter/new/` to .gitignore
2018-05-21 08:06:50 -04:00
Erik Demaine
2ee5c684ee Update texcmp (#1297)
* Update texcmp

I found that the existing docker rules for texcmp did not make a working
installation of LaTeX; in particular, it was missing a lot of the recently
added packages.  I updated to Ubuntu 17.10 and tweaked the package listings
until things compiled again.  Now I can run texcmp again.

* texlive-font-utils not necessary
2018-05-09 09:34:47 -04:00
ylemkimon
06e0393abc Online screenshot diff/generation using CircleCI (#1187)
* Add CircleCI config for online screenshot verification/generation

* Remove `Checkout unicode fonts` step

Unicode-fonts are now a submodule, which is checked out in `Checkout submodule` step.

* Always generate new screenshots
2018-03-06 00:47:41 -05:00
ylemkimon
96ad6e0f4f Add unicode-fonts as submodule (#1182)
* Add unicode-fonts as submodule

Removed checkout process from screenshotter.sh.

* Rename test-fonts submodule and update repo URL
2018-03-05 23:29:19 -05:00
ylemkimon
3f69de5036 Update NPM scripts and documentation (#1146)
* Group more test npm scripts into `test:`

* Update documentations on the development workflow

* Update .travis.yml to match updated NPM scripts

* Run npm install in Travis
2018-02-11 16:11:59 -05:00
ylemkimon
d82424c618 Fix undefined devServer.app in screenshotter (#1085)
Fixes #1082, `TypeError: Cannot read property 'get' of undefined` on
Docker for Mac.
2018-01-23 11:58:07 -05:00
ylemkimon
5f32b71c85 Use webpack to build files and webpack-dev-server for testing (#1068)
* Create a separate entry point for webpack

Created a webpack entry point for KaTeX, which imports katex.less. As
flow[1] and jest[2] doesn't support CSS modules natively, a separate
entry point is used and it is not flowtyped.

[1] https://gist.github.com/lambdahands/d19e0da96285b749f0ef
[2] https://facebook.github.io/jest/docs/en/webpack.html

* Use webpack to build files

* Made webpack.config.js export valid webpack configuration
* Use:
browserify -> webpack
babelify -> babel-loader
UglifyJS CLI -> UglifyJsPlugin
Less CLI -> less-loader
cleancss -> cssnano in css-loader
build/fonts -> file-loader
* Inline CSS(Less) using style-loader and export them using
ExtractTextPlugin
* Add `watch` npm script calling `webpack --watch`

* Improve local testing(webpack-dev-server)

* Made webpackDevServer export a valid webpack configuration
* Compile Less and inline CSS using less-loader and style-loader
* Instead of copying files serve files from /static and use file-loader
* Remove old server.js and its dependencies

* Use webpack-dev-server in Screenshotter

* Include contrib in webpack-dev-server

+ Moved common configurations to webpack.common.js

* Rename webpackDevServer.js to webpack.dev...

to be consistent, avoid confusion with webpack-dev-server and follow
webpack configuration naming convention.

* Remove unnecessary conditional output.path

* Use map instead of reduce

+ Add comments regarding function arguments

* Remove unnecessary mkdir and clean build/* before build

* Use katex as external dependency instead of global variable in contrib

Fixes #692.

* Unblock codes as they are built as a module

* Update package-lock.json

* Add comments regarding devServer option

* Lint renamed webpack.dev.js

a0d8b33

* Export ES6 module and expose its default export

* Revert "Browserify hotfix (#1057)"

This reverts commit f6b509123b.

* Enables colors on the console when running the dev server in Screenshotter

* Add context to webpack configuration

Allows webpack to be run from other directories

* Move `rm -rf build/*` to npm scripts

* Check dependencies before build

* Move UglifyJsPlugin into config creation

* Let webpack handle ES6 modules

Do not transform modules to commonjs in Babel. However Jest doesn't not
support ES6 modules, so transfrom modules to commonjs when NODE_ENV is
`test`.

* Add documentation on testing in IE 9 and 10 using webpack-dev-server

Changed version range to include IE-compatible version
2018-01-21 19:48:25 -05:00
Kevin Barabash
9e6eb3a219 replace dockers/MathJaxFonts with KaTeX/katex-fonts submodule (#891) 2017-11-28 07:25:03 -05:00
Martin von Gagern
a9708a25f2 Modernize font creation (#624)
* Modernize font creation

* Automate the build process, instead of writing a complicated manual
* Update sources used by the docker image away from google code
* Exclude MathJax-dev checkout from docker image, to allow image reuse
* Try to keep the individual image layers small by combining RUN commands
  and removing temporary files used only during each individual step

* Allow creating fonts from local directory

Also use hash of Dockerfile to compute image tag, in order to ensure
creation of a new image if the Dockerfile changes.

* make glob syntax work on MacOS
2017-08-20 01:45:34 -04:00
Kevin Barabash
1e148746f8 Revert "Make KaTeX work in Quirks mode (#608)" (#777)
This reverts commit d93a958379.
2017-07-30 23:28:58 -04:00
Emily Eisenberg
d93a958379 Make KaTeX work in Quirks mode (#608)
* Make KaTeX work in Quirks mode

Summary: In issue #601, it was noticed that the KaTeX bug with the fraction
bars overlapping the text was occuring with an XHTML doctype. This indicated
that the bug we were seeing was caused by both quirks mode and limited-quirks
mode (which is a version of quirks mode with fewer quirks and is enabled for
various doctypes including some XHTML ones).

Based on the [quirks spec](https://quirks.spec.whatwg.org/), it appears that
there are only two quirks in limited-quirks mode, both having to do with a
line-height calculation. @gagern figured out that if we added some zero-width
spaces in our elements, we would stop triggering the quirk, which would make
our fractions render correctly in limited-quirks mode.

I implemented that change, and ran the screenshotter in limited-quirks mode.
There were several other places that suffered from the same quirk, but were
also easily fixed via adding zero-width spaces. I then ran the screenshotter in
quirks mode, and discovered that (once an appropriate meta charset was added),
everything looked correct still.

So, this diff fixes all of the places that the limited-quirks mode quirks
affect our rendering, and removes the warning about rendering in quirks mode.

I also added support to our screenshotter to render things in both no-quirks
and quirks mode, to ensure that things don't break in the future. I copied the
non-quirks images to the quirks images, and ran the screenshotter with
`--verify` to make sure that they look the same.

I have some thoughts that I'd like to hear opinions about:
 - I'm not super happy with how the screenshot tests work. Ideally we'd test
   both quirks mode and non-quirks mode against the same images, since we'd
   like them to be the same. I'm not sure how to make that work well, though,
   since then people wouldn't be able to tell if it's a quirks-mode problem or
   not.
 - I removed the doctype in the testing page file, so all testing would now be
   done in quirks-mode. Not sure if we really want that.
 - I need to test this in IE, but it looks like the trailing commas change we
   made with eslinting is causing problems (cause IE doesn't like trailing
   commas).

Test Plan:
 - `./dockers/Screenshotter/screenshotter.sh --verify`

* Compare quirks mode against same screenshot files

Now the screenshotter itself can run more than one mode.  It does serve the
HTML file from its own JavaScript code now, so that it can include different
doctype headers without needing distinct files for each.  There is a
provision to mark specific tests as quirky in case they produce different
results depending on the mode.

* Some cleaning up and comments

* Restore access to the babelified version of the HTML page for screenshots

* Reference unicode fonts using absolute path names

This avoids issues caused by the fact that the dynamically generated
ss-render.html is mounted to a different location than the test.html from
which it is derived.

* do chrome screenshots first

* remove commented out code, simplify hadle_search_string call
2017-07-30 22:41:37 -04:00
Eddie Kohler
32c7fc47d1 Ensure screenshotter runs *all* tests. (#769)
Previously, we added a `oneDone` promise *every time a test attempt
failed*. This decremented the count of remaining tests once per
failed attempt. As a result, Chrome tests didn't run to the end.
2017-07-29 21:27:26 -04:00
Eddie Kohler
f43b00b50f Screenshotter: Add --diff and --attempts options. (#736)
--diff produces a texcmp-like diff in test/screenshotter/diff.
2017-07-06 08:49:34 -04:00