Skip to content

Instantly share code, notes, and snippets.

View rafalf's full-sized avatar

Rafal Fusik rafalf

  • freelancer
  • Dublin
View GitHub Profile
@rafalf
rafalf / html_screenshots.py
Created November 25, 2018 12:07
html webdriver python report screenshots
@pytest.mark.hookwrapper
def pytest_runtest_makereport(item, call):
"""
Extends the PyTest Plugin to take and embed screenshots in html report, whenever test fails.
:param item:
"""
pytest_html = item.config.pluginmanager.getplugin('html')
outcome = yield
report = outcome.get_result()
extra = getattr(report, 'extra', [])
@rafalf
rafalf / gist:970ac1731b922b5f00aeb8e405d8ee36
Created January 21, 2018 12:14 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@rafalf
rafalf / test_sample.py
Last active November 3, 2017 10:06
pytest test example for show&tell
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from pages.imports import *
from config import BASE_URL, SIGNUP_RETAILER_URL
EAT = "[email protected]"
INVITE_EMAILS = [
'[email protected]',
@rafalf
rafalf / conftest.py
Created November 3, 2017 10:03
pytest conftest for show&tell
import pytest
from selenium import webdriver
import os
from sys import platform
from config import *
import logging
import logging.config
def pytest_addoption(parser):
@rafalf
rafalf / logger_config.py
Created October 6, 2017 07:19
Python - Rollover logging with logging config - console & file
import logging
from logging import config
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
LOGGING_CONFIG = {
'formatters': {
'brief': {
'format': '[%(asctime)s][%(levelname)s] %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S'
var bottlejs = require('bottlejs').pop('test');
bottlejs.factory('PageObject', function () {
return {
getTemplatePage: function () {
var templatePage = require('./template.po.js');
return new templatePage();
},
getSearchPage: function () {
var searchPage = require('./search.po.js');
var pageObject = require('../../po/pages').container.PageObject;
var templatePage = pageObject.getTemplatePage();
var searchPage = pageObject.getSearchPage();
var slidersPage = pageObject.getSlidersPage();
var detailsPage = pageObject.getDetailsPage();
var loginPage = pageObject.getLoginPage();
var usersData = require('../../data/users/data');
var commonHelper = require('../../helpers/common.helper.js');
describe('Company whitelists', function () {
# http://gspread.readthedocs.io/en/latest/oauth2.html#
# http://alexsavio.github.io/gspread_oauth2client_intro.html
# SHARE with the json email - http://stackoverflow.com/questions/37602460/gspread-exceptions-spreadsheetnotfound
# https://github.com/burnash/gspread
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import time
import requests
from bs4 import BeautifulSoup
--------- beginning of main
D/Remote Repository( 3140): Get request : Request{method=GET, url=http://demoapp3v2-env-live.ap-southeast-1.elasticbeanstalk.com/v2/GetUpdatedTableNames?timestamp=1478246849639, tag=null}
D/Remote Repository( 3140): Get response : Response{protocol=http/1.1, code=200, message=OK, url=http://demoapp3v2-env-live.ap-southeast-1.elasticbeanstalk.com/v2/GetUpdatedTableNames?timestamp=1478246849639}
D/Remote Repository( 3140): Get response : com.squareup.okhttp.internal.http.RealResponseBody@2bb133a5
E/PushPull Helper( 3140): Response received, parsing.. {"success":true,"ErrorCode":100,"message":"completed sucessfully","items":[],"ServerCurrentTime":1478246923362,"recordCount":0}
@rafalf
rafalf / gist:23c02967b1e3dafcc428f27d0375d63d
Created November 4, 2016 07:55
appium-1.6-log-failure-logcat
--------- beginning of main
I/CoreCoach( 2707): Synch completed
I/CoreCoach( 2707): Synch is in progress....
I/CoreCoach( 2707): Last Synch time .. 1478245821615
W/PushPull Helper( 2707): get updated tables : 1478245821615