Isn't as easy as I thought it would be, this installs the deps:
# Install puppeteer dependencies
# Source: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
RUN apt-get install apt-transport-https
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
But then you run into issues with the root user being used, adding --no-sandbox to the launch args to get around the user issues leads to Error: net::ERR_CONNECTION_REFUSED at http://127.0.0.1:3000/test. And I don't think we can add the user setup to the Dockerfile as /workspaces is added after the Dockerfile executes.
I can mostly get it to work with devcontainer:
83 passing (3m)
8 pending
8 failing
1) Mouse Tracking Tests
DECSET 9 (X10)
default encoding:
AssertionError: expected [] to deeply equal [ Array(1) ]
+ expected - actual
-[]
+[
+ {
+ "col": 95
+ "row": 50
+ "state": {
+ "action": "press"
+ "button": "left"
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+]
at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:216:32)
at Suite. (out-test/api/MouseTracking.api.js:387:32)
at step (out-test/api/MouseTracking.api.js:33:23)
at Object.next (out-test/api/MouseTracking.api.js:14:53)
at fulfilled (out-test/api/MouseTracking.api.js:5:58)
2) Mouse Tracking Tests
DECSET 9 (X10)
SGR encoding:
AssertionError: expected [] to deeply equal [ Array(1) ]
+ expected - actual
-[]
+[
+ {
+ "col": 260
+ "row": 50
+ "state": {
+ "action": "press"
+ "button": "left"
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+]
at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:216:32)
at Suite. (out-test/api/MouseTracking.api.js:885:32)
at step (out-test/api/MouseTracking.api.js:33:23)
at Object.next (out-test/api/MouseTracking.api.js:14:53)
at fulfilled (out-test/api/MouseTracking.api.js:5:58)
3) Mouse Tracking Tests
DECSET 1000 (VT200 mouse)
default encoding:
AssertionError: expected [] to deeply equal [ Array(2) ]
+ expected - actual
-[]
+[
+ {
+ "col": 95
+ "row": 50
+ "state": {
+ "action": "press"
+ "button": "left"
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+ {
+ "col": 95
+ "row": 50
+ "state": {
+ "action": "release"
+ "button": ""
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+]
at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:216:32)
at Suite. (out-test/api/MouseTracking.api.js:1394:28)
at step (out-test/api/MouseTracking.api.js:33:23)
at Object.next (out-test/api/MouseTracking.api.js:14:53)
at fulfilled (out-test/api/MouseTracking.api.js:5:58)
4) Mouse Tracking Tests
DECSET 1000 (VT200 mouse)
SGR encoding:
AssertionError: expected [] to deeply equal [ Array(2) ]
+ expected - actual
-[]
+[
+ {
+ "col": 260
+ "row": 50
+ "state": {
+ "action": "press"
+ "button": "left"
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+ {
+ "col": 260
+ "row": 50
+ "state": {
+ "action": "release"
+ "button": "left"
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+]
at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:216:32)
at Suite. (out-test/api/MouseTracking.api.js:1956:28)
at step (out-test/api/MouseTracking.api.js:33:23)
at Object.next (out-test/api/MouseTracking.api.js:14:53)
at fulfilled (out-test/api/MouseTracking.api.js:5:58)
5) Mouse Tracking Tests
DECSET 1002 (xterm with drag)
default encoding:
AssertionError: expected [] to deeply equal [ Array(2) ]
+ expected - actual
-[]
+[
+ {
+ "col": 95
+ "row": 50
+ "state": {
+ "action": "press"
+ "button": "left"
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+ {
+ "col": 95
+ "row": 50
+ "state": {
+ "action": "release"
+ "button": ""
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+]
at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:216:32)
at Suite. (out-test/api/MouseTracking.api.js:2520:28)
at step (out-test/api/MouseTracking.api.js:33:23)
at Object.next (out-test/api/MouseTracking.api.js:14:53)
at fulfilled (out-test/api/MouseTracking.api.js:5:58)
6) Mouse Tracking Tests
DECSET 1002 (xterm with drag)
SGR encoding:
AssertionError: expected [] to deeply equal [ Array(2) ]
+ expected - actual
-[]
+[
+ {
+ "col": 260
+ "row": 50
+ "state": {
+ "action": "press"
+ "button": "left"
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+ {
+ "col": 260
+ "row": 50
+ "state": {
+ "action": "release"
+ "button": "left"
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+]
at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:216:32)
at Suite. (out-test/api/MouseTracking.api.js:3094:28)
at step (out-test/api/MouseTracking.api.js:33:23)
at Object.next (out-test/api/MouseTracking.api.js:14:53)
at fulfilled (out-test/api/MouseTracking.api.js:5:58)
7) Mouse Tracking Tests
DECSET 1003 (xterm any event)
default encoding:
AssertionError: expected [] to deeply equal [ Array(3) ]
+ expected - actual
-[]
+[
+ {
+ "col": 95
+ "row": 50
+ "state": {
+ "action": "move"
+ "button": ""
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+ {
+ "col": 95
+ "row": 50
+ "state": {
+ "action": "press"
+ "button": "left"
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+ {
+ "col": 95
+ "row": 50
+ "state": {
+ "action": "release"
+ "button": ""
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+]
at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:216:32)
at Suite. (out-test/api/MouseTracking.api.js:3672:28)
at step (out-test/api/MouseTracking.api.js:33:23)
at Object.next (out-test/api/MouseTracking.api.js:14:53)
at fulfilled (out-test/api/MouseTracking.api.js:5:58)
8) Mouse Tracking Tests
DECSET 1003 (xterm any event)
SGR encoding:
AssertionError: expected [] to deeply equal [ Array(3) ]
+ expected - actual
-[]
+[
+ {
+ "col": 260
+ "row": 50
+ "state": {
+ "action": "move"
+ "button": ""
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+ {
+ "col": 260
+ "row": 50
+ "state": {
+ "action": "press"
+ "button": "left"
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+ {
+ "col": 260
+ "row": 50
+ "state": {
+ "action": "release"
+ "button": "left"
+ "modifier": {
+ "control": false
+ "meta": false
+ "shift": false
+ }
+ }
+ }
+]
at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:216:32)
at Suite. (out-test/api/MouseTracking.api.js:4230:28)
at step (out-test/api/MouseTracking.api.js:33:23)
at Object.next (out-test/api/MouseTracking.api.js:14:53)
at fulfilled (out-test/api/MouseTracking.api.js:5:58)
error Command failed with exit code 8.
Hmm, I wonder why you're seeing failures 🤔
I went the opposite way, since downloading google-chrome-unstable and then discarding it in favor of puppeteer under node_modules is not productive. I have changed the install portion to:
# Install yarn, puppeteer deps
RUN apt-get install -y curl apt-transport-https lsb-release \
&& curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \
&& echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get -y install --no-install-recommends \
yarn fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
# https://github.com/Googlechrome/puppeteer/issues/290#issuecomment-322921352
gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
I am not able to run any tests without --headless, which I guess is understandable, but then mouse related tests breaks. Is it acceptable?
Also --no-sandbox is required, of course.
Running tests only with --headless is fine, but the mouse tests should pass when running locally with --headless. Don't really want to get into the conditionally enabling tests based on where it's running business.
Hey @Tyriar, I am able to fully run the integration suite if I do use a lower cols value to 223, any idea why?
89 passing (5m)
8 pending
There some remarks on the code regarding cols amount:
https://github.com/xtermjs/xterm.js/blob/cbb79a77f9a3120fe9941318caf934eb24a606f6/test/api/MouseTracking.api.ts#L273-L275
And those seems to be most of the ones failing.
@jerch any ideas?
@Tyriar Nope not yet, imho the problematic grid sizes that dont encode in UTF8 are yet to come and still commented out in the tests.
@leomoty Can you point me to the lines in the test file you have changed to get this working?
@jerch sure.
Lower this to 223:
And
To
args: [`--window-size=${width},${height}`, `--no-sandbox`]
Keep in mind you need to rebuild the devcontainer with these changes:
# Install yarn, puppeteer deps
RUN apt-get install -y curl apt-transport-https lsb-release \
&& curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \
&& echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get -y install --no-install-recommends \
yarn fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
# https://github.com/Googlechrome/puppeteer/issues/290#issuecomment-322921352
gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
And then just run:
yarn test-api --headless -f 'Mouse Tracking Tests'
I mean, the cols thingy is how I was able to make the full suite run, that is not needed for the testing.
@leomoty Thx, now looking at the failures above again this looks more like a problem with the screen size in the container - it seems puppeteer does not fire any mouse event if cols or rows is beyond a certain value - I guess 260 is beyond that range. Could you test up to which value this works? A quick fix would be to lower to that last working number (but note that I chose 260 for a good reason, to be >255).
Is there way to tell the container about something like a virtual screen size? Always thought --headless is independent from this, but this seems not to be the case?
@jerch, the virtual screen size is sent on the args:
Will test the cols when I get home. We could also start a remote debugging session to see what is happening with chrome devtools.
@jerch seems like you hit jackpot, I have increased the window size from 1024x768 to 1280x960 and all tests passed:
mocha "**/*.api.js" --headless -f 'Mouse Tracking Tests'
Mouse Tracking Tests
DECSET 9 (X10)
✓ default encoding (18616ms)
- UTF8 encoding
✓ SGR encoding (18547ms)
- URXVT encoding
DECSET 1000 (VT200 mouse)
✓ default encoding (18596ms)
- UTF8 encoding
✓ SGR encoding (18586ms)
- URXVT encoding
DECSET 1002 (xterm with drag)
✓ default encoding (18598ms)
- UTF8 encoding
✓ SGR encoding (18566ms)
- URXVT encoding
DECSET 1003 (xterm any event)
✓ default encoding (15557ms)
- UTF8 encoding
✓ SGR encoding (15546ms)
- URXVT encoding
8 passing (3m)
8 pending
Do you think it is worth investigating smaller cols? Otherwise, is increasing the width and height for this specific file good enough?
Also @Tyriar, do you have any preferences between your image contents or mine? I think yours will end up bigger, because yours get an extra copy of chrome that won't be used. Both should work since the shared libraries will be installed then.
Edit:
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
devcontainer-tyriar latest 2da98e7acc0e 5 minutes ago 1.3GB
devcontainer latest 71b245ae48fa 40 minutes ago 1.08GB
@leomoty Nice, thx for fixing it :heart:. Well I remember a similar problem during creation of the test file, I think I also simply increased the virtual screen size. Imho its fine to make this bigger, puppeteer should correctly translate the new pixel offsets to the right terminal cells.
I'll make a PR then.
@leomoty if the devcontainer changes can run the demo and the tests then that sounds good. Only need 1 version.
I meant that, sorry, I will pick mine since it will be the smallest for the devcontainer user.
Most helpful comment
I'll make a PR then.