Skip to content

Instantly share code, notes, and snippets.

@denyszet
denyszet / TestRailObservation.swift
Created June 1, 2022 17:18 — forked from billylam/TestRailObservation.swift
Sample for pushing XCTest/XCUITest results to TestRail
//
// TestRailObservation.swift
//
import Foundation
import XCTest
class TestRailObservation: NSObject, XCTestObservation {
// Add a user / pass or key for testrail generation
var testrailUsername: String = ""
@denyszet
denyszet / SampleTest.kt
Last active August 6, 2021 09:19
ViewAssertion sample that checks that all descendant views with provided id have visibility equal to Visibility.INVISIBLE.
@RunWith(AndroidJUnit4::class)
class SampleTest {
@get:Rule
var activityScenarioRule = ActivityScenarioRule(SampleActivity::class.java)
@Test
fun allCheckBoxesShouldNotBeDisplayed() {
onView(withId(R.id.tasksContainer)).check(descendantsWithIdInvisible(R.id.checkbox))
}
@denyszet
denyszet / withTextColor.java
Created March 3, 2015 14:37
Espresso matcher for matching the EditText color.
public static Matcher<View> withTextColor(final int color) {
Checks.checkNotNull(color);
return new BoundedMatcher<View, EditText>(EditText.class) {
@Override
public boolean matchesSafely(EditText warning) {
return color == warning.getCurrentTextColor();
}
@Override
public void describeTo(Description description) {
public class CustomMatchers {
public static Matcher<View> withBackground(final int resourceId) {
return new TypeSafeMatcher<View>() {
@Override
public boolean matchesSafely(View view) {
return sameBitmap(view.getContext(), view.getBackground(), resourceId);
}
@Override