Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch: Fix ligthouse version to 11.5 #649

Merged
merged 20 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions .github/workflows/docker-apt-get.txt

This file was deleted.

7 changes: 4 additions & 3 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ monotonic
tornado
fonttools
wsaccel
xvfbwrapper
ujson
selenium
future
brotli
xvfbwrapper
google-cloud-storage
google-cloud-pubsub
google-cloud-pubsub
31 changes: 13 additions & 18 deletions .github/workflows/wptagent_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,30 @@ permissions:
jobs:
build:

runs-on: ubuntu-18.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.6.8
uses: actions/setup-python@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.6.8"
python-version: '3.10'
cache: 'pip'

- name: Install dependencies
- name: Install apt dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: pylint apt-transport-https xserver-xorg-video-dummy xvfb gnupg2 python3-ujson imagemagick dbus-x11 traceroute software-properties-common psmisc libnss3-tools iproute2 net-tools openvpn libtiff5-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk python3-dev libavutil-dev libmp3lame-dev libx264-dev yasm autoconf automake build-essential libass-dev libfreetype6-dev libtheora-dev libtool libvorbis-dev pkg-config texi2html libtext-unidecode-perl python3-numpy python3-scipy perl adb ethtool nodejs cmake libsdl2-dev libva-dev libvdpau-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev texinfo wget ttf-mscorefonts-installer fonts-noto fonts-roboto fonts-open-sans
version: 1.0

- name: Install pip dependencies
run: |
python -m pip install --upgrade pip
sudo apt-get install python3-psutil
sudo apt-get install python3-xvfbwrapper
sudo apt-get install python3-dnspython
sudo apt-get install python3-monotonic
sudo apt-get install python3-tornado
sudo apt-get install python3-fonttools
sudo apt-get install python3-wsaccel
sudo apt-get install pylint

- name: Install/Cache pip dependencies
run: pip install -r .github/workflows/requirements.txt
python3 -m pip install --upgrade pip
pip3 install -r .github/workflows/requirements.txt

- name: Analysing the code with pylint
run: |
find -name "*.py" -not -path "./ws4py/*" -exec pylint {} --errors-only \;


- name: Test with pytest
run: |
Expand Down
16 changes: 14 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
### Recommend to install with "docker build <GITHUB-REPO-LINK> -t TAGNAME",
### grabs the latest copy of WPT and build time on average takes 10 minutes.

FROM ubuntu
FROM ubuntu:22.04

### PREVENTs INTERACTIVE PROMPTS WHILE INSTALLING ###
ARG DEBIAN_FRONTEND=noninteractive
Expand All @@ -30,11 +30,23 @@ RUN apt-get update
# RUN apt-get install -y git
# RUN git clone -b dockerfile /~https://github.com/sammeboy635/wptagent.git

RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -

### UPDATE ###
RUN apt-get update

### INSTALL APT-GET LIBS ###
RUN xargs -a /wptagent/.github/workflows/docker-apt-get.txt apt-get install --no-install-recommends --yes; exit 0
RUN apt-get install -y \
python3 python3-pip python3-ujson \
imagemagick dbus-x11 traceroute software-properties-common psmisc libnss3-tools iproute2 net-tools openvpn \
libtiff5-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk \
python3-dev libavutil-dev libmp3lame-dev libx264-dev yasm autoconf automake build-essential libass-dev libfreetype6-dev libtheora-dev \
libtool libvorbis-dev pkg-config texi2html libtext-unidecode-perl python3-numpy python3-scipy perl \
adb ethtool nodejs cmake git-core libsdl2-dev libva-dev libvdpau-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev texinfo wget \
ttf-mscorefonts-installer fonts-noto fonts-roboto fonts-open-sans ffmpeg npm

### Update the font cache
RUN fc-cache -f -v

### UPGRADING PIP AND INSTALLING REQUIRED PACKAGES ###
RUN python3 -m pip install --upgrade --user pip && \
Expand Down
4 changes: 2 additions & 2 deletions internal/devtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,15 +1239,15 @@ def execute_js(self, script, use_execution_context=False):

def set_execution_context(self, target):
""" Set the js execution context by matching id, origin or name """
if len(target):
if target is not None and len(target):
parts = target.split('=', 1)
if len(parts) == 2:
key = parts[0].strip()
value = parts[1].strip()
if key in ['id', 'name', 'origin'] and len(value):
for id in self.execution_contexts:
context = self.execution_contexts[id]
if key in context and context[key] == value:
if key in context and str(context[key]) == str(value):
self.execution_context = id
break
else:
Expand Down
1 change: 1 addition & 0 deletions internal/os_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def flush_dns():
subprocess.call(['sudo', 'service', 'dnsmasq', 'restart'])
subprocess.call(['sudo', 'rndc', 'restart'])
subprocess.call(['sudo', 'systemd-resolve', '--flush-caches'])
subprocess.call(['sudo', 'resolvectl', 'flush-caches'])

# pylint: disable=E0611,E0401
def run_elevated(command, args, wait=True):
Expand Down
88 changes: 88 additions & 0 deletions internal/support/trace_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6006,6 +6006,77 @@ def main():
"4525": "WindowOpenFullscreenRequested",
"4526": "FullscreenAllowedByWindowOpen",
"4527": "AttributeValueContainsLtOrGt",
"4528": "V8ImportAssertionDeprecatedSyntax",
"4529": "ImageCaptureBackgroundBlur",
"4530": "PrivateNetworkAccessPreflightError",
"4531": "PrivateNetworkAccessPreflightSuccess",
"4532": "PrivateNetworkAccessPreflightWarning",
"4533": "CSSGetComputedAnimationDurationZero",
"4534": "CSSGetComputedWebkitFontSmoothingAnimationDurationZero",
"4535": "DocumentOpenAliasedOriginDocumentDomain",
"4536": "GamepadTouchEvents",
"4537": "GamepadTouchTouchId",
"4538": "GamepadTouchSurfaceId",
"4539": "GamepadTouchPosition",
"4540": "GamepadTouchSurfaceDimension",
"4541": "SandboxViaFencedFrame",
"4542": "VisibilityStateObserver",
"4543": "V8CompileHintsMagicAll",
"4544": "TextWrapBalance",
"4545": "TextWrapBalanceFail",
"4546": "AttributionReportingCrossAppWeb",
"4547": "SecurePaymentConfirmationActivationlessShow",
"4548": "ServiceWorkerBypassFetchHandlerForAllWithRaceNetworkRequest",
"4549": "FlexIntrinsicSizesCacheMiss",
"4550": "CSSStyleContainerQuery",
"4551": "CSSValueAppearanceMediaSlider",
"4552": "CSSValueAppearanceMediaSliderthumb",
"4553": "CSSValueAppearanceMediaVolumeSlider",
"4554": "CSSValueAppearanceMediaVolumeSliderthumb",
"4555": "CSSValueAppearanceSliderHorizontal",
"4556": "CSSValueAppearanceSliderVertical",
"4557": "CSSValueAppearanceSliderthumbHorizontal",
"4558": "CSSValueAppearanceSliderthumbVertical",
"4559": "ServiceWorkerBypassFetchHandlerForAllWithRaceNetworkRequestByOriginTrial",
"4560": "EventTimingPaintedPresentationPromiseResolvedWithEarlierPromiseUnresolved",
"4561": "LinkRelPreloadAsFont",
"4562": "CrossWindowAccessToBrowserGeneratedDocument",
"4563": "SpeculationRulesNoVarySearchHint",
"4564": "FileSystemAccessMoveRename",
"4565": "FileSystemAccessMoveReparent",
"4566": "FileSystemAccessMoveReparentAndRename",
"4567": "V8FileSystemDirectoryHandle_RemoveEntry_Method",
"4568": "V8FileSystemFileHandle_CreateWritable_Method",
"4569": "V8FileSystemFileHandle_GetFile_Method",
"4570": "V8FileSystemHandle_GetUniqueId_Method",
"4571": "V8FileSystemHandle_Remove_Method",
"4572": "PerformanceNavigateSystemEntropy",
"4573": "V8InvalidatedNumberStringNotRegexpLikeProtector",
"4574": "CriticalCHRestartNavigationTiming",
"4575": "TopLevelDocumentWithEmbeddedCredentials",
"4576": "V8Navigator_GetInterestGroupAdAuctionData_Method",
"4577": "LongAnimationFrameObserver",
"4578": "LongAnimationFrameRequested",
"4579": "FedCmLoginHint",
"4580": "FedCmRpContext",
"4581": "EventTimingArtificialPointerupOrClick",
"4582": "AbortSignalAny",
"4583": "FedCmIdpSigninStatusApi",
"4584": "FedCmIdpSigninStatusJsApi",
"4585": "ExecCommand",
"4586": "WebGPUQueueSubmit",
"4587": "WebGPUCanvasContextGetCurrentTexture",
"4588": "EditContext",
"4589": "ServiceWorkerStaticRouter_RegisterRouter",
"4590": "ServiceWorkerStaticRouter_Evaluate",
"4591": "ClientHintsUAFormFactor",
"4592": "URLSearchParamsHasFnBehaviourDiverged",
"4593": "URLSearchParamsDeleteFnBehaviourDiverged",
"4594": "TextWrapPretty",
"4595": "TextWrapPrettyFail",
"4596": "ContainerQueryEvalUnknown",
"4597": "EventTimingPresentationPromiseResolvedAfterReport",
"4598": "GetCoalescedEventsInInsecureContext",
}

##########################################################################
Expand Down Expand Up @@ -6711,6 +6782,23 @@ def main():
"746": "CSSPropertyTextWrap",
"747": "CSSPropertyTextBoxTrim",
"748": "CSSPropertyOverlay",
"749": "CSSPropertyWhiteSpaceCollapse",
"750": "CSSPropertyScrollTimelineAttachment",
"751": "CSSPropertyViewTimelineAttachment",
"752": "CSSPropertyScrollStartBlock",
"753": "CSSPropertyScrollStartInline",
"754": "CSSPropertyScrollStartX",
"755": "CSSPropertyScrollStartY",
"756": "CSSPropertyScrollStart",
"757": "CSSPropertyScrollStartTargetBlock",
"758": "CSSPropertyScrollStartTargetInline",
"759": "CSSPropertyScrollStartTargetX",
"760": "CSSPropertyScrollStartTargetY",
"761": "CSSPropertyScrollStartTarget",
"762": "CSSPropertyTimelineScope",
"763": "CSSPropertyScrollbarColor",
"764": "CSSPropertyWordBoundaryDetection",
"765": "CSSPropertyPositionFallbackBounds",
}

if '__main__' == __name__:
Expand Down
2 changes: 1 addition & 1 deletion internal/webpagetest.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def __init__(self, options, workdir):
pass
# If we are running in a git clone, grab the date of the last
# commit as the version
self.version = '21.07'
self.version = '23.07'
try:
directory = os.path.abspath(os.path.dirname(__file__))
if (sys.version_info >= (3, 0)):
Expand Down
18 changes: 18 additions & 0 deletions wptagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,10 @@ def startup(self, detected_browsers):
if self.get_node_version() < 16.0:
logging.warning("Node.js 16 or newer is required for Lighthouse testing")

# Force lighthouse 11.5.0
if self.get_lighthouse_version() != '11.5.0':
subprocess.call(['sudo', 'npm', 'i', '-g', 'lighthouse@11.5.0'])

# Check the iOS install
if self.ios is not None:
ret = self.requires('usbmuxwrapper') and ret
Expand Down Expand Up @@ -623,6 +627,20 @@ def get_node_version(self):
pass
return version

def get_lighthouse_version(self):
"""Get the installed version of lighthouse"""
version = None
try:
if sys.version_info >= (3, 0):
stdout = subprocess.check_output(['lighthouse', '--version'], encoding='UTF-8')
else:
stdout = subprocess.check_output(['lighthouse', '--version'])
version = stdout.strip()
except Exception:
pass

return version

def update_windows_certificates(self):
""" Update the root Windows certificates"""
try:
Expand Down