Skip to content

Instantly share code, notes, and snippets.

@jineshqa
jineshqa / disable-swipe-tutorial.sh
Created September 12, 2024 05:30 — forked from kinwahlai/disable-swipe-tutorial.sh
Disable swipe tutorial for simulator (ios13 above)
#!/bin/bash
# This script archive 2 things here
# 1. boot the fresh simulator once, so we can reduce the boot time in UI test
# 2. Simulator shows swipe tutorial on first use of keyboard (iOS13 above), this script will set simulator preferences so it wont show the tutorial
function get_simulator_udid() {
echo '' | xcrun simctl list devices | grep "iPhone" | grep -v "unavailable" | awk -F "[()]" '{ for (i=2; i<NF; i+=2) print $i }' | grep '^[-A-Z0-9]*$'
}
@jineshqa
jineshqa / test.log
Created March 3, 2020 23:56
appium error
2020-03-03 15:49:44.579009-0800 WebDriverAgentRunner-Runner[13001:2373474] The following attributes were requested to be included into the XML: {(
FBEnabledAttribute,
FBVisibleAttribute,
FBXAttribute,
FBYAttribute,
FBWidthAttribute,
FBHeightAttribute,
FBTypeAttribute,
FBValueAttribute,
FBNameAttribute,
# Redirect console output to a file and display on console at the same time.
bundle exec fastlane <your_lane_here> --verbose 2>&1 | tee /path/to/logfile.txt
@jineshqa
jineshqa / reset_simulators.sh
Created October 22, 2019 17:35
No simulators visible in Xcode
# Install snapshot gem
gem install snapshot
# Reset all the simulators
fastlane snapshot reset_simulators
@jineshqa
jineshqa / screen_commands.sh
Created March 5, 2019 00:39
Screen command usages
# to list the sessions and their status
screen -ls
# to start a session with a given name. The name should be unique
screen -S session_name
# to start a session without going into it
screen -dmS session_name /path/to/script/file.sh
@jineshqa
jineshqa / Makefile
Created January 11, 2019 18:21 — forked from pietbrauer/Makefile
Shutdown and reset all iOS Simulators
erase_sim:
./reset_sim.sh 2>/dev/null; true
@jineshqa
jineshqa / scroll.swift
Last active April 6, 2019 22:40
code to scroll to an element
// Copied from https://stackoverflow.com/a/49944637
import XCTest
enum TestSwipeDirections {
case up
case down
case left
case right
}
@jineshqa
jineshqa / XCUIApplication+Scrolling.swift
Created November 14, 2018 19:33 — forked from ryanmeisters/XCUIApplication+Scrolling.swift
Scrolling helpers automated ui tests using XCUIApplication
extension XCUIApplication {
private struct Constants {
// Half way accross the screen and 10% from top
static let topOffset = CGVector(dx: 0.5, dy: 0.1)
// Half way accross the screen and 90% from top
static let bottomOffset = CGVector(dx: 0.5, dy: 0.9)
}
var screenTopCoordinate: XCUICoordinate {
@jineshqa
jineshqa / udid.md
Last active March 7, 2019 01:59
How to get udid for a particular device from shell using jq

With JQ installed - output of this command is string with quotes

xcrun simctl list --json | jq '.devices["iOS 12.0"] [] | select(.name=="iPhone X") | .udid'

With JQ if you don't want quotes

@jineshqa
jineshqa / grep.md
Last active November 17, 2017 23:53
grep command
$ cat a.txt

hello

This line starts with T and finishes with e

foo