Skip to content

Instantly share code, notes, and snippets.

View mattonem's full-sized avatar
🐧
Just cool

maxmattone mattonem

🐧
Just cool
View GitHub Profile
from selenium import webdriver
from time import sleep
import logging, requests, timeit
desired_cap = {
"browser" : "Chrome",
"browser_version" : "latest",
"browserstack.local" : "false",
"browserstack.selenium_version" : "3.141.59"
}
@mattonem
mattonem / LocalTestingSingleton.java
Last active February 8, 2022 17:05
LocalTesting Singleton
import com.browserstack.local.Local;
import java.util.Random;
import java.nio.charset.Charset;
public class LocalTestingSingleton {
private static Local bsLocal;
public static String localID;
private LocalTestingSingleton(){}
@mattonem
mattonem / custom_steps.js
Last active October 8, 2021 09:57
browserstack/codeceptjs mark test session status
const event = require('codeceptjs').event;
module.exports = function() {
event.dispatcher.on(event.test.passed, function (test) {
const { I } = inject();
I.executeScript(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'setSessionStatus',arguments: {status: 'passed',reason: 'All passed :)'}})}`);
});
event.dispatcher.on(event.test.failed, function (test) {
const { I } = inject();
I.executeScript(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'setSessionStatus',arguments: {status: 'failed',reason: 'failed'}})}`);
@mattonem
mattonem / TestNGBSUpdateStatus.java
Created September 23, 2021 10:01
testNG update browserstack session status accordingly to test result
@AfterMethod
public void afterMethod(ITestResult result) {
if(result.getStatus() == SUCCESS)
{
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("browserstack_executor: {
\"action\": \"setSessionStatus\",
\"arguments\": {\"status\": \"passed\", \"reason\": \""+restult.getName()+" succeeded\"}}");
}
else
@mattonem
mattonem / smalltalkEnv.tex
Last active May 28, 2021 16:24
Smalltalk listing environment
% Just add \input{smalltalkEnv} to your file
% then you can use :
% \begin{lstlisting}[language=Smalltalk]
% false become: true.
% \end{lstlisting}
\usepackage{color}
\usepackage{listings}
\usepackage{etoolbox}
@mattonem
mattonem / .emacs
Created September 5, 2019 12:35
emacs php conf
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(when (>= emacs-major-version 24)
(require 'package)
(add-to-list
'package-archives
Section "InputClass"
Identifier "Saitek Cyborg R.A.T.5 Mouse"
MatchIsPointer "on"
MatchProduct "Saitek Cyborg R.A.T.5 Mouse"
MatchVendor "Saitek|SAITEK"
MatchDevicePath "/dev/input/event*"
Option "Protocol" "auto"
Option "Buttons" "17"
Option "ButtonMapping" "1 2 3 4 5 6 7 8 9 10 11 12 0 0 0 16 17"
Option "ZAxisMapping" "4 5 10 11"
background yes
use_xft yes
xftfont shrapnel:size=9
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager