Skip to content

Instantly share code, notes, and snippets.

View edwindotcom's full-sized avatar
:octocat:
hubba hubba

Edwin Wong edwindotcom

:octocat:
hubba hubba
  • Alameda, CA
View GitHub Profile
@edwindotcom
edwindotcom / launchUITests.py
Last active December 17, 2015 09:29
quick dirty launch UI tests
from gaiatest import GaiaTestCase
import time
class TestIdentitySmoke(GaiaTestCase):
APP_NAME = 'UI tests'
_bid_tests_locator = ('link text', 'navigator.mozId tests')
_bid_iframe_locator = ('css selector', 'iframe[src*="identity"]')
def setUp(self):
@edwindotcom
edwindotcom / modPref.sh
Last active December 17, 2015 10:39
Pulls and pushes pref.js to your phone.Usage: ./modPref.sh [pull|push]
#!/bin/bash
if [ "$1" == "" ]; then
echo 'Pulls and pushes pref.js to your phone.'
echo 'Usage: ./modPref.sh [pull|push]'
exit
fi
echo "Plug in your device"
adb wait-for-device
echo "Found device"
PROFILE=$(adb shell echo -n "/data/b2g/mozilla/*.default")
@edwindotcom
edwindotcom / launch_browser
Last active December 17, 2015 15:38
simple launch browser
#!/usr/bin/env python
from marionette import Marionette
from gaiatest.apps.browser.app import Browser
# remember to 'adb forward tcp:2828 tcp:2828'
m = Marionette('localhost', 2828)
m.start_session()
browser = Browser(m)
browser.launch()
@edwindotcom
edwindotcom / launch_persona.py
Last active December 17, 2015 16:29
launch persona in browser
from marionette import Marionette
from gaiatest.apps.browser.app import Browser
m = Marionette('localhost', 2828)
m.start_session()
browser = Browser(m)
browser.launch()
browser.go_to_url('http://native.123done.org\n')
browser.switch_to_content()
#wait
btn = m.find_element('css selector', 'img[src*="persona-login"]')
@edwindotcom
edwindotcom / gist:6084476
Created July 25, 2013 22:51
gaiatest json file
{ "acknowledged_risks" : true,
"skip_warning" : true,
"wifi": { "ssid": "Mozilla Guest" }
}
@edwindotcom
edwindotcom / gist:6126978
Created July 31, 2013 22:58
quick and dirty ui test for b2g
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from gaiatest import GaiaTestCase
from gaiatest.apps.browser.app import Browser
from gaiatest.apps.persona.app import Persona
from gaiatest.mocks.persona_test_user import PersonaTestUser
@edwindotcom
edwindotcom / gist:7221127
Created October 29, 2013 19:36
run gaiatest
gaiatest --testvars=/Users/Edwin/home.json --address=localhost:2828 test_persona_cookie.py
@edwindotcom
edwindotcom / genCovCmd.py
Created November 26, 2013 17:43
generate code cover bash script
#! /usr/bin/python
import os
files = os.listdir("test/run")
for file in files:
print "istanbul cover test/run/%s" % file
print "mv coverage coverage_%s" % file
@edwindotcom
edwindotcom / print_iframes
Created December 4, 2013 00:03
way to print iframes on b2g
self.marionette.switch_to_frame()
iframes = self.marionette.find_elements(*self._frame_locator)
for iframe in iframes:
print 'src', iframe.get_attribute("src")
for i in $(eval echo {1..$1})
do
echo $(date +"%T")
curl -v "https://accounts.firefox.com" -o /dev/null
sleep 20
done