Skip to content
This repository has been archived by the owner on May 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #158 from Unlimity/release/2.1.0
Browse files Browse the repository at this point in the history
Prepare 2.1.0 release
  • Loading branch information
Unlimity authored Jul 10, 2019
2 parents bf40f77 + 278235b commit da26bde
Show file tree
Hide file tree
Showing 252 changed files with 2,624 additions and 297 deletions.
96 changes: 78 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Kakao
[![Github tag version](https://img.shields.io/github/tag/agoda-com/kakao.svg?label=version)](https://bintray.com/agoda/maven/kakao)
[![CircleCI](https://circleci.com/gh/agoda-com/Kakao/tree/master.svg?style=shield&circle-token=0d0ed659625be4efe54fe706c16894cd54213690)](https://circleci.com/gh/agoda-com/Kakao/tree/master)
[![Kotlin version badge](https://img.shields.io/badge/kotlin-1.3.21-blue.svg)](http://kotlinlang.org/)
[![Kotlin version badge](https://img.shields.io/badge/kotlin-1.3.41-blue.svg)](http://kotlinlang.org/)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Kakao-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/6314)

Nice and simple DSL for Espresso in Kotlin
Expand Down Expand Up @@ -117,13 +117,11 @@ Inside your `Screen` create the KView matching with your view:

For `KListView`:
```Kotlin
val list = KListView ({
builder = { withId(R.id.list) } })
val list = KListView { builder = { withId(R.id.list) } }
```
For `KRecyclerView`:
```Kotlin
val myList = KRecyclerView ({
builder = { withId(R.id.recycler_view) } })
val recycler = KRecyclerView { builder = { withId(R.id.recycler_view) } }
```

You can combine different matchers to retrieve your view.
Expand Down Expand Up @@ -180,8 +178,8 @@ Kakao provides different accessors in the adapter:
* lastChild
* childWith


##### Custom KViews

If you have custom Views in your tests and you want to create your own `KView`, we have KBaseView. Just extend
this class and implement as much additional Action/Assertion interfaces as you want.
You also need to override constructors that you need.
Expand All @@ -193,14 +191,78 @@ class KMyView : KBaseView<KView>, MyActions, MyAssertions {
constructor(parent: DataInteraction, function: ViewBuilder.() -> Unit) : super(parent, function)
}
```


##### Intercepting

If you need to add custom logic during the `Kakao -> Espresso` call chain (for example, logging) or
if you need to completely change the `ViewAssertion` or `ViewAction` that are being sent to Espresso
during runtime in some cases, you can use the intercepting mechanism.

Interceptors are lambdas that you pass to a configuration DSL that will be invoked before `ViewInteraction`,
`DataInteraction` or `Web.WebInteraction` classes' `perform` and `check` calls happening from inside Kakao.

You have the ability to provide interceptors at 3 different levels: Kakao runtime, your 'Screen' classes
and any individual `KView` instance.

On each invocation of Espresso function that can be intercepted, Kakao will aggregate all available interceptors
for this particular call and invoke them in descending order: `KView interceptor -> Active Screens interceptors ->
Kakao interceptor`.

Each of the interceptors in the chain can break the chain call by setting `isOverride` to true during configuration.
In that case Kakao will not only stop invoking remaining interceptors in the chain, **but will not perform the Espresso
call**. It means that in such case, the responsibility to actually invoke Espresso lies on the shoulders
of the developer.

Here's the examples of intercepting configurations:
```Kotlin
class SomeTest {
@Before
fun setup() {
Kakao { // Kakao runtime
intercept {
onViewInteraction { // Intercepting calls on ViewInteraction classes across whole runtime
onPerform { interaction, action -> // Intercept perform() call
Log.d("KAKAO", "$interaction is performing $action")
}
}
}
}
}

@Test
fun test() {
onScreen<MyScreen> {
intercept {
onViewInteraction { // Intercepting calls on ViewInteraction classes while in the context of MyScreen
onCheck { interaction, assertion -> // Intercept check() call
Log.d("KAKAO", "$interaction is checking $assertion")
}
}
}

myView {
intercept { // Intercepting ViewInteraction calls on this individual view
onPerform(true) { interaction, action -> // Intercept perform() call and overriding the chain
// When performing actions on this view, Kakao level interceptor will not be called
// and we have to manually call Espresso now.
Log.d("KAKAO_VIEW", "$interaction is performing $action")
interaction.perform(action)
}
}
}
}
}
}
```
For more detailed info please refer to the documentation.

### Setup
Maven
```xml
<dependency>
<groupId>com.agoda.kakao</groupId>
<artifactId>kakao</artifactId>
<version>2.0.0</version>
<version>2.1.0</version>
<type>pom</type>
</dependency>
```
Expand All @@ -209,24 +271,22 @@ or Gradle:
repositories {
jcenter()
}
dependencies {
// For Gradle Version below 3.0.0
androidTestCompile 'com.agoda.kakao:kakao:2.0.0'
// For Gradle Version 3.0.0 or above
androidTestImplementation 'com.agoda.kakao:kakao:2.0.0'
dependencies {
androidTestImplementation 'com.agoda.kakao:kakao:2.1.0'
}
```

### AndroidX
Default artifact starting from `2.0.0` includes AndroidX libraries to build upon. If you're still using
old support libraries, please use `2.0.0-support` artifact.
old support libraries, please use `2.X.X-support` artifact.
```
dependencies {
androidTestImplementation 'com.agoda.kakao:kakao:2.0.0-support'
androidTestImplementation 'com.agoda.kakao:kakao:2.1.0-support'
}
```
We will move to AndroidX dependencies in the major release as soon as Google will publish stable release.
**IMPORTANT:** We stop the development for the `-support` artifact and version `2.1.0-support` is the
latest version available with usage of support libraries. Please consider migrating to AndroidX.

### Contribution Policy

Expand All @@ -245,8 +305,8 @@ Kakao is open source and available under the [Apache License, Version 2.0](https
### Thanks to

* [Unlimity](https://github.com/Unlimity) - **Ilya Lim**
* [VerachadW](https://github.com/VerachadW) - **Verachad Wongsawangtham**
* [Сdsap](https://github.com/cdsap) - **Inaki Villar**
* [Vacxe](https://github.com/Vacxe) - **Konstantin Aksenov**
* [Сdsap](https://github.com/cdsap) - **Inaki Villar**
* [VerachadW](https://github.com/VerachadW) - **Verachad Wongsawangtham**
* [JuDrummer](https://github.com/judrummer) - **Tipatai Puthanukunkit**

10 changes: 5 additions & 5 deletions buildsystem/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext.versions = [
kotlin : '1.3.21',
dokka : '0.9.17',
android_gradle : '3.3.1',
kotlin : '1.3.41',
dokka : '0.9.18',
android_gradle : '3.4.2',
bintray : '1.7.3',
maven : '1.5',
oss : '4.5.4',
Expand Down Expand Up @@ -47,8 +47,8 @@ ext.kakao = [
artifact : 'kakao',
name : 'kakao',
description : 'Kotlin based DSL for fluent AT with Espresso',
version : "2.0.0$alias",
version_desc : "Kakao 2.0.0$alias",
version : "2.1.0$alias",
version_desc : "Kakao 2.1.0$alias",
site : 'https://github.com/agoda-com/Kakao',
github : 'https://github.com/agoda-com/Kakao.git'
]
1 change: 1 addition & 0 deletions buildsystem/dokka.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ apply plugin: 'org.jetbrains.dokka-android'
dokka {
moduleName = 'kakao'
outputFormat = 'gfm'
jdkVersion = 6
outputDirectory = "$rootDir/docs/"
}
Loading

0 comments on commit da26bde

Please sign in to comment.