Closed reiinoldo closed 4 years ago
Running locally means:
npm install
npm run e2e
OS: Microsoft Windows version 1803
Could you set the DEBUG=pw:browser* environment variable and see what it complaints about?
Thank you I've set up and this was the output:
2020-04-27T15:59:43.936Z pw:browser <launching> /automation/node_modules/playwright/.local-browsers/chromium/chrome-linux/chrome --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --user-data-dir=/tmp/playwright_dev_profile-FOsd6U --remote-debugging-pipe --headless --hide-scrollbars --mute-audio --no-startup-window
2020-04-27T15:59:43.944Z pw:browser <launched> pid=31
2020-04-27T15:59:44.129Z pw:browser:err [0427/155944.127852:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
2020-04-27T15:59:44.155Z pw:browser <process did exit 1, null>
FAIL specs/index.js
If you trust the content you open in the browser (you open your own pages) or if this runs in a container that has no access to sensitive data, you can pass --no-sandbox
argument whem you launch the browser.
Search for no-sandbox
in the [Troubleshooting] (https://github.com/microsoft/playwright/blob/master/docs/troubleshooting.md) for details and other options.
Indeed, I've added these arguments but still getting issues:
Configuration:
import { chromium } from "playwright";
module.exports = {
browserType: chromium,
launchConfig: {
headless: true,
args: ["--no-sandbox", "--disable-setuid-sandbox"],
},
};
Log:
2020-04-27T16:14:20.991Z pw:browser <launching> /automation/node_modules/playwright/.local-browsers/chromium/chrome-linux/chrome --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --user-data-dir=/tmp/playwright_dev_profile-K4SNU1 --remote-debugging-pipe --headless --hide-scrollbars --mute-audio --no-sandbox --disable-setuid-sandbox --no-startup-window
2020-04-27T16:14:20.997Z pw:browser <launched> pid=31
2020-04-27T16:14:21.446Z pw:browser:err [0427/161421.446040:WARNING:ipc_message_attachment_set.cc(49)] MessageAttachmentSet destroyed with unconsumed attachments: 0/1
2020-04-27T16:14:21.447Z pw:browser:err [0427/161421.446096:ERROR:command_buffer_proxy_impl.cc(122)] ContextResult::kTransientFailure: Failed to send GpuChannelMsg_CreateCommandBuffer.
2020-04-27T16:14:21.465Z pw:browser <gracefully close start>
2020-04-27T16:14:21.482Z pw:browser <process did exit 0, null>
2020-04-27T16:14:21.490Z pw:browser <gracefully close end>
FAIL specs/index.js
So I've had to downgrade the Playwright version to 0.9.24, this is due to the function that I use to get the page title I think that was changed the way to get this info on 0.15.0 version. But that is ok for now. I just wanted to ensure that was working in a host machine and inside Docker.
After I've added to the Docker file these libraries the test worked.
RUN apt-get install -y libatk-bridge2.0-0 \
wget \
libgbm1
So where is the final version from Docker file:
################################################
# Compile with:
# sudo docker build -t microsoft/playwright:bionic -f Dockerfile.bionic .
#
# Run with:
# sudo docker run -d -p --rm --name playwright microsoft/playwright:bionic
#
#################################################
FROM ubuntu:bionic
# 1. Install node12
RUN apt-get update && apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
apt-get install -y nodejs
# 2. Install WebKit dependencies
RUN apt-get install -y libwoff1 \
libopus0 \
libwebp6 \
libwebpdemux2 \
libenchant1c2a \
libgudev-1.0-0 \
libsecret-1-0 \
libhyphen0 \
libgdk-pixbuf2.0-0 \
libegl1 \
libnotify4 \
libxslt1.1 \
libevent-2.1-6 \
libgles2 \
libvpx5
# 3. Install Chromium dependencies
RUN apt-get install -y libnss3 \
libxss1 \
libasound2
# 4. Install Firefox dependencies
RUN apt-get install -y libdbus-glib-1-2 \
xvfb \
gconf-service \
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
# 5. Add user so we don't need --no-sandbox in Chromium
RUN groupadd -r pwuser && useradd -r -g pwuser -G audio,video pwuser \
&& mkdir -p /home/pwuser/Downloads \
&& chown -R pwuser:pwuser /home/pwuser
RUN apt-get install -y libatk-bridge2.0-0 \
wget \
libgbm1
# 6. (Optional) Install XVFB if there's a need to run browsers in headful mode
RUN apt-get install -y xvfb
# Run everything after as non-privileged user.
# USER pwuser
# ENV DEBUG=pw:browser*
WORKDIR /automation
COPY package.json ./
RUN npm install
COPY . ./
RUN npm run e2e
Consequently, the problem was solved, but wouldn't it be nice to add these libraries in the Running Playwright in Docker documentation?
I tried to reproduce this locally on my linux machine, I see that the libraries you mentioned are already in previous build steps:
Step 3/12 : RUN apt-get install -y libwoff1 libopus0 libwebp6 libwebpdemux2 libenchant1c2a libgudev-1.0-0 libsecret-1-0 libhyphen0 libgdk-pixbuf2.0-0 libegl1 libnotify4 libxslt1.1 libevent-2.1-6 libgles2 libvpx5
---> Running in 6b133384c9cb
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
adwaita-icon-theme aspell aspell-en at-spi2-core dbus
dconf-gsettings-backend dconf-service dictionaries-common emacsen-common
enchant fontconfig fontconfig-config fonts-dejavu-core glib-networking
glib-networking-common glib-networking-services gsettings-desktop-schemas
gtk-update-icon-cache hicolor-icon-theme humanity-icon-theme hunspell-en-us
libapparmor1 libaspell15 > libatk-bridge2.0-0 < libatk1.0-0 libatk1.0-data
libatspi2.0-0 libavahi-client3 libavahi-common-data libavahi-common3
libbrotli1 libbsd0 libcairo-gobject2 libcairo2 libcolord2 libcroco3 libcups2
libdatrie1 libdbus-1-3 libdconf1 libdrm-common libdrm2 libegl-mesa0
libepoxy0 libfontconfig1 libfreetype6 > libgbm1 < libgdk-pixbuf2.0-bin
...
The following NEW packages will be installed:
adwaita-icon-theme aspell aspell-en at-spi2-core dbus
dconf-gsettings-backend dconf-service dictionaries-common emacsen-common
enchant fontconfig fontconfig-config fonts-dejavu-core glib-networking
glib-networking-common glib-networking-services gsettings-desktop-schemas
gtk-update-icon-cache hicolor-icon-theme humanity-icon-theme hunspell-en-us
libapparmor1 libaspell15 > libatk-bridge2.0-0 < libatk1.0-0 libatk1.0-data
libatspi2.0-0 libavahi-client3 libavahi-common-data libavahi-common3
libbrotli1 libbsd0 libcairo-gobject2 libcairo2 libcolord2 libcroco3 libcups2
libdatrie1 libdbus-1-3 libdconf1 libdrm-common libdrm2 libegl-mesa0 libegl1
libenchant1c2a libepoxy0 libevent-2.1-6 libfontconfig1 libfreetype6 > libgbm1 <
libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common
...
0 upgraded, 135 newly installed, 0 to remove and 24 not upgraded.
@reiinoldo I wonder why it's not happening in your setup. Can you you run the following command and share your log?
docker-compose build --no-cache
That's true, I didn't realize that these libraries were implicitly included.
I've reduced to this and still working
################################################
# Compile with:
# sudo docker build -t microsoft/playwright:bionic -f Dockerfile.bionic .
#
# Run with:
# sudo docker run -d -p --rm --name playwright microsoft/playwright:bionic
#
#################################################
FROM ubuntu:bionic
# 1. Install node12
RUN apt-get update && apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
apt-get install -y nodejs
# 2. Install WebKit dependencies
RUN apt-get install -y libwoff1 \
libopus0 \
libwebp6 \
libwebpdemux2 \
libenchant1c2a \
libgudev-1.0-0 \
libsecret-1-0 \
libhyphen0 \
libgdk-pixbuf2.0-0 \
libegl1 \
libnotify4 \
libxslt1.1 \
libevent-2.1-6 \
libgles2 \
libvpx5
# 3. Install Chromium dependencies
RUN apt-get install -y libnss3 \
libxss1 \
libasound2 \
wget \
gconf-service \
libgcc1 \
libgconf-2-4 \
libstdc++6 \
fonts-liberation \
libappindicator1 \
xdg-utils
# 4. Install Firefox dependencies
RUN apt-get install -y libdbus-glib-1-2
# 5. Add user so we don't need --no-sandbox in Chromium
RUN groupadd -r pwuser && useradd -r -g pwuser -G audio,video pwuser \
&& mkdir -p /home/pwuser/Downloads \
&& chown -R pwuser:pwuser /home/pwuser
# 6. (Optional) Install XVFB if there's a need to run browsers in headful mode
RUN apt-get install -y xvfb
# Run everything after as non-privileged user.
# USER pwuser
# ENV DEBUG=pw:browser*
WORKDIR /automation
COPY package.json ./
RUN npm install
COPY . ./
RUN npm run e2e
Note that libgcc1 and libstdc++6 are already installed, xdg-utils is only used for opening external apps, libappindicator1 and fonts are unlikely to cause any startup issues. The fact that this is not reproducible for me locally suggests that there maybe something with your setup which may make it break.
Can you apply attached patch (which switches to Playwright 0.15 and reset deps to the docker file from our docs), run
docker-compose build --no-cache 2>&1 | tee log.txt
and share log.txt with us?
I have the same error message, not sure if related though:
# in package.json:
# "test:playwright": "jest --runInBand",
# "ctest": "BROWSER=chromium npm run test:playwright",
$ DEBUG=pw:browser* npm run ctest -- routes
pw:browser <launching> /Users/aes/playwright-browsers/chromium-763809/chrome-mac/Chromium.app/Contents/MacOS/Chromium --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --user-data-dir=/var/folders/v2/l_d6kjbs0rb03pkwv3g1tmth0000gp/T/playwright_dev_profile-Whkf1X --remote-debugging-pipe --headless --hide-scrollbars --mute-audio --no-startup-window +0ms
pw:browser <launched> pid=39206 +10ms
pw:browser <process did exit null, SIGABRT> +44ms
FAIL test/e2e/routes.spec.js
● Test suite failed to run
Protocol error (Target.setAutoAttach): Target closed.
at node_modules/playwright-core/lib/chromium/crConnection.js:130:63
at CRSession.send (node_modules/playwright-core/lib/chromium/crConnection.js:129:16)
at CRSession.<anonymous> (node_modules/playwright-core/lib/helper.js:64:31)
at Function.connect (node_modules/playwright-core/lib/chromium/crBrowser.js:63:27)
at Chromium.launch (node_modules/playwright-core/lib/server/chromium.js:41:53)
at getBrowserPerProcess (node_modules/jest-playwright-preset/lib/PlaywrightEnvironment.js:58:33)
at PlaywrightEnvironment.setup (node_modules/jest-playwright-preset/lib/PlaywrightEnvironment.js:109:31)
I migrated from 0.13.0 -> 0.16.0. I'll try lower versions and see what happens.
EDIT: Works fine on 0.14.0 and 0.15.0
EDIT2: Well this is weird, I did rm -rf chromium-763809/ firefox-1088/ webkit-1213/
and reinstalled 0.16.0. It works fine now.
EDIT3: Not the full story though, I installed node@14 via nvm and forgot to nvm use
before installing playwright. I had node 13
for my nvmrc. I suppose it had something to do with the error as well.
Closing as there hasn't been any activity for a month. If the problem still persists please follow the steps from https://github.com/microsoft/playwright/issues/1991#issuecomment-622000299 to collect some logs and reopen this issue.
solved my issue on how to mute. thanks
Context:
Code Snippet
The Docker image file follows the Running Playwright in Docker documentation, this is the chromium configuration.
This is the docker file:
Describe the bug
I'm getting this error when trying to run inside a docker container with Chromium browser, running locally it works fine and running with Firefox browser it also works inside docker.
To run the firefox tests I also had to add more Linux libraries then the found on the Dockerfile.bionic pre-built image from Playwright documentation.