Giter Site home page Giter Site logo

michallaskowski / kuiks Goto Github PK

View Code? Open in Web Editor NEW
64.0 10.0 10.0 245 KB

Kotlin Multiplatform based testing framework for Android and iOS

License: Apache License 2.0

Kotlin 59.21% Swift 37.79% Objective-C 3.00%
kotlin-multiplatform kotlin-native espresso xcuitest

kuiks's Introduction

Hello there

kuiks's People

Contributors

michallaskowski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kuiks's Issues

Status of project?

Hi I'm interested in this project. I would like to know if you are using this at your work, or if this is just experimental?
I like the idea of using the same tools to test that we are familiar with, rather than learn a new tool like Appium. Also it seems like it closer to using the native tools and would be easy to customise if we needed particular features of either XCTest or Espresso.
However I'm hesitant to start using it, as I would be asking QA team to help write the tests and they don't have android experience. What would you recommend?

This support Compose ?

Dear Sir

Google next UI is Jetpack Compose

and JB use it do "Compose for Desktop" !!

the project can support compose ?

THX

Help setting up Project

@michallaskowski I really like the idea of using one code base to test iOS and Android, I was wondering is there anything I would need to do to set up this for my own project?

UI Test API proposal

@michallaskowski Here is an API proposal for a standardised UI test framework which is heavily influenced by XCUITest, can I have your thoughts?

package com.laskowski.kuiks

import kotlin.time.Duration
import kotlin.time.ExperimentalTime

typealias TimeInterval = Double

interface UIElement: UIElementInteraction, UIElementWaitForElement {
    /**
     * Check if element exists
     */
    val exists: Boolean

    val isEnabled: Boolean

    /**
     * Check if element is hittable
     */
    val isHittable: Boolean

    val isSelected: Boolean

    val isVisible: Boolean

    /**
     * Print out view hierarchy
     */
    val debugDescription: String

    fun element(): UIElement

    val hasKeyboardFocus: Boolean

    fun isKeyboardKeyAvaliable(key: String): Boolean

    fun dismissKeyboard()

    val label: String

    val identifier: String

    val value: String
}

interface UIElementInteraction {
    fun tap()

    fun forceTap()

    fun doubleTap()

    fun press(forDuration: TimeInterval)

    fun press(forDuration: TimeInterval, thenDragTo: UIElement)

    fun swipeUp()

    fun swipeDown()

    fun swipeLeft()

    fun swipeRight()

    fun pinch(scale: Double, velocity: Double)

    fun rotate(rotation: Double, withVelocity: Double)
    
    /**
     * Scroll to Element
     */
    fun scrollTo(targetElement: UIElement, scrollView: UIElement, direction: ScrollDirection, maximumAttempts: Int, scrollDistance: Double)

    fun typeText(text: String)

    fun adjustSlider(position: Double)
}

interface  UIElementWaitForElement {
    fun waitForElementToExistence(timeout: TimeInterval): Boolean

    fun waitForElementToBecomeHittable(timeout: TimeInterval): Boolean

    fun waitForElementToBecomeSelected(timeout: TimeInterval): Boolean
}

interface UIElementWaitForMultipleElement {
    fun waitForMultipleElementsToBecomeInToExistence(timeout: TimeInterval): Boolean

    fun waitForMultipleElementsToBecomeUnavailable(timeout: TimeInterval): Boolean
}

enum class ScrollDirection {
    down,
    up,
    left,
    right
}

enum class Timeout (val rawValue: Double) {
    ExtraSmall(1.0),
    Small(3.0),
    Medium(5.0),
    Large(10.0),
    ExtraLarge(15.0),
    ExtraExtraLarge(30.0),
    ExtraSuperLarge(45.0),
    Mega(240.0);

    companion object {
        operator fun invoke(rawValue: TimeInterval) = Timeout.values().firstOrNull { it.rawValue == rawValue }
    }
}

Unresolved platform.XCTest.*

Hello, I try to used part of code in this repo to apply our iOS UI test as experiment purpose. But I found below import is unresolved sharedCode/../actual.kt, which I think it is needed to call XCTest framework in KMM project from Xcode.

And now I could open and run the sample-iOS app in Xcode and Android Studio successfully. But I'm unable to run the UI test case defined in this project, the reason could be XCTest is not recognized. Could you give me some clue what step I'm missing?

sharedCode/../actual.kt

import platform.XCTest.*
import platform.Foundation.*

Screen Shot 2022-10-13 at 11 09 52

Screen Shot 2022-10-13 at 11 17 09

xctest_iOSArm64.def

language = Objective-C
package = platform.XCTest
depends = UIKit
modules = XCTest
linkerOpts= -weak_framework XCTest -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/UIKit.framework -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/
compilerOpts= -weak_framework XCTest -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/

And I see in the doc this step, so do I need to create cinterop binding manually for this project?

Create a .def file describing what to include into bindings.

Use the cinterop tool to produce Kotlin bindings.

Run the Kotlin/Native compiler on an application to produce the final executable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.