Skip to content

Instantly share code, notes, and snippets.

View stephendonner's full-sized avatar

Stephen Donner stephendonner

View GitHub Profile
@davehunt
davehunt / build.log
Created November 17, 2011 14:12
Logs from Selenium session issue in 2.12.0
Started by timer
Building on master
Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/mdn.staging/workspace - hudson.remoting.LocalChannel@5ea47962
Using strategy: Default
Last Built Revision: Revision 14384a8d45f03d4f76934cec602b3514cfcd9502 (origin/HEAD, origin/master)
Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/mdn.staging/workspace - hudson.remoting.LocalChannel@5ea47962
Wiping out workspace first.
Cloning the remote Git repository
Cloning repository origin
Fetching upstream changes from git://github.com/mozilla/mdn-tests.git
@dhylands
dhylands / remove-app.py
Created September 25, 2013 17:16
Removes an app from a directory tree, and also updates webapps.json to remove the app from there as well. Usage: remove-app.py <webapps-directory> webapp ... For example: remove-app.py gaia/profile/webapps uitest.gaiamobile.org cubevid.gaiamobile.org
#!/usr/bin/python
import json
import sys, string, os
import shutil
webapps_dir = sys.argv[1]
webapps_filename = os.path.join(webapps_dir, "webapps.json")
webapps = json.load(open(webapps_filename))
@stephendonner
stephendonner / new-flash.sh
Created December 6, 2013 17:26
1) grab an engineering mozilla-central build from pvtbuilds, for Hamachi 2) rename it to be "hamachi.zip" 3) put it in the same folder as this flash script 4) chmod +x new-flash.sh (or whatever you want to call the file) 5) ./new-flash.sh
#!/bin/bash -xe
wait_for_device() {
SERIAL=MSM7627A
DEVICE=05c6
# to break out if failed after so many tries.
# RETRYTIME*MAXWAITTIME is how long the max wait time will be
RETRYTIME=1
MAXWAITTIME=60
@jrbenny35
jrbenny35 / gist:3380b3d70e751c015fda4bf4946ed9b8
Created January 9, 2018 23:45
Selenium firefox nightly dockerfile
FROM selenium/standalone-firefox
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y install mysql-server
RUN apt-get install -y libmysqlclient-dev
RUN apt-get install -y git
RUN apt-get install -y nodejs
#!/usr/bin/env groovy
pipeline {
agent none
stages {
stage('clone') {
agent any
steps {
checkout([
$class: 'GitSCM',
driver = webdriver.Firefox()
driver.get('https://pypi.org')
with driver.context('chrome'):
driver.find_element_by_css_selector('image#pageActionButton').click()
driver.find_element_by_css_selector('#pageAction-panel-screenshots').click()
with driver.context(driver.CONTEXT_CONTENT):
sleep(2)
onboarding = driver.find_element_by_id('firefox-screenshots-onboarding-iframe')
driver.switch_to.frame(onboarding)
driver.find_element_by_id('skip').click()

WebPageTest

Custom Metrics tab:

[timeToDOMContentFlushed]
return window.performance.timing.timeToDOMContentFlushed;

Script tab:

@davehunt
davehunt / wpt_user_agent.py
Created November 8, 2018 09:48
Show location and user agents from WebPageTest results
import json
with open("/Users/dhunt/Desktop/wpt.json") as f:
data = json.load(f)
for test in data:
location = test["data"]["location"]
request_headers = test["data"]["runs"]["1"]["firstView"]["requests"][0]["headers"]["request"]
user_agent = next(filter(lambda x: x.startswith("User-Agent:"), request_headers))
print(f"location: {location}")
print(f"- user-agent: {user_agent}")
Timing Specs Used (incl. which Level)
* Navigation Timing API
* Performance Navigation Timing API
** https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming
Metrics
* Using:
** fetchStart:
*** https://developer.mozilla.org/en-US/docs/Web/API/PerformanceTiming/fetchStart
from dataclasses import asdict, dataclass
import json
import os
import sys
from jsonschema import validate
# import requests
@dataclass