From 5521fd300d1e2a261fc743de9a56cd0e883cdd83 Mon Sep 17 00:00:00 2001 From: Sven Kroell Date: Tue, 2 Oct 2018 13:27:38 +0200 Subject: [PATCH 01/10] add model and simple repository --- .../novoda/androidstoreexample/data/models/Article.kt | 3 +++ .../data/repositories/ArticleRepository.kt | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt create mode 100644 AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt new file mode 100644 index 00000000..a350ee81 --- /dev/null +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt @@ -0,0 +1,3 @@ +package com.novoda.androidstoreexample.data.models + +data class Article(val title: String, val category: String) \ No newline at end of file diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt new file mode 100644 index 00000000..9d10a3db --- /dev/null +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt @@ -0,0 +1,9 @@ +package com.novoda.androidstoreexample.data.repositories + +import com.novoda.androidstoreexample.data.models.Article + +class ArticleRepository { + val standardArticle = Article(title = "Hat white", category = "HATS") + + +} \ No newline at end of file From 4de460c37134dafb8af812bd22bf78ccfcbb8510 Mon Sep 17 00:00:00 2001 From: Sven Kroell Date: Thu, 4 Oct 2018 17:21:52 +0200 Subject: [PATCH 02/10] add repositories --- AndroidTestAutomationStarter/app/build.gradle | 2 + .../data/dto/ArticleDTO.kt | 20 +++++++ .../data/dto/CategoryDTO.kt | 20 +++++++ .../data/models/Article.kt | 8 ++- .../data/models/Categories.kt | 3 + .../androidstoreexample/data/models/Item.kt | 3 + .../data/repositories/ArticleRepository.kt | 28 +++++++++- .../EspressoTestExampleWithRepositories.kt | 56 +++++++++++++++++++ 8 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt create mode 100644 AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt create mode 100644 AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Categories.kt create mode 100644 AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Item.kt create mode 100644 AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/tests/EspressoTestExampleWithRepositories.kt diff --git a/AndroidTestAutomationStarter/app/build.gradle b/AndroidTestAutomationStarter/app/build.gradle index b7becb3d..298e58f6 100644 --- a/AndroidTestAutomationStarter/app/build.gradle +++ b/AndroidTestAutomationStarter/app/build.gradle @@ -46,7 +46,9 @@ dependencies { testImplementation 'io.rest-assured:json-schema-validator:3.0.6' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' + androidTestImplementation 'com.google.code.gson:gson:2.8.5' androidTestImplementation 'com.squareup.okhttp:mockwebserver:1.3.0' + androidTestImplementation 'khttp:khttp:0.1.0' androidTestImplementation 'org.mockito:mockito-core:2.8.9' androidTestImplementation('com.android.support.test.espresso:espresso-contrib:3.0.1') { exclude module: 'support-annotations' diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt new file mode 100644 index 00000000..770fe7b1 --- /dev/null +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt @@ -0,0 +1,20 @@ +package com.novoda.androidstoreexample.data.dto + +import com.google.gson.Gson +import com.novoda.androidstoreexample.data.models.Article +import com.novoda.testautomationstarter.test.BuildConfig +import khttp.get + +class ArticleDTO { + private val gson = Gson() + + fun getArticlesForCategory(id: Int): ArrayList
{ + val articles = arrayListOf
() + val articleResponse = get("${BuildConfig.API_URL}/category/$id/items") + .jsonObject.getJSONArray("products") + for (i in 0 until articleResponse.length()) { + articles.add(gson.fromJson(articleResponse.getString(i), Article::class.java)) + } + return articles + } +} \ No newline at end of file diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt new file mode 100644 index 00000000..a1c4bb02 --- /dev/null +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt @@ -0,0 +1,20 @@ +package com.novoda.androidstoreexample.data.dto + +import com.google.gson.Gson +import com.novoda.androidstoreexample.BuildConfig +import com.novoda.androidstoreexample.data.models.Categories +import khttp.get + +class CategoryDTO { + + private val gson = Gson() + + fun getAllCategories(): ArrayList { + val categories = arrayListOf() + val categoryResponse = get("${BuildConfig.API_URL}/categories").jsonObject.getJSONArray("categories") + for (i in 0 until categoryResponse.length()) { + categories.add(gson.fromJson(categoryResponse.getString(i), Categories::class.java)) + } + return categories + } +} \ No newline at end of file diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt index a350ee81..600c53f7 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt @@ -1,3 +1,9 @@ package com.novoda.androidstoreexample.data.models -data class Article(val title: String, val category: String) \ No newline at end of file +import com.google.gson.annotations.SerializedName + +data class Article(val id: Int, + val title: String, + val price: String, + val image: String, + @SerializedName("product_description")val productDescription: String) \ No newline at end of file diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Categories.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Categories.kt new file mode 100644 index 00000000..3bd1a834 --- /dev/null +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Categories.kt @@ -0,0 +1,3 @@ +package com.novoda.androidstoreexample.data.models + +data class Categories(val id: Int, val title: String, val image: String) \ No newline at end of file diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Item.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Item.kt new file mode 100644 index 00000000..c28d08a9 --- /dev/null +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Item.kt @@ -0,0 +1,3 @@ +package com.novoda.androidstoreexample.data.models + +data class Item(val title: String, val category: String, val description: String = "", val price: String = "") \ No newline at end of file diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt index 9d10a3db..253ca58d 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt @@ -1,9 +1,35 @@ package com.novoda.androidstoreexample.data.repositories +import com.novoda.androidstoreexample.data.dto.ArticleDTO +import com.novoda.androidstoreexample.data.dto.CategoryDTO import com.novoda.androidstoreexample.data.models.Article +import com.novoda.androidstoreexample.data.models.Item class ArticleRepository { - val standardArticle = Article(title = "Hat white", category = "HATS") + private val categories = CategoryDTO().getAllCategories() + private val articleDto = ArticleDTO() + private val hatsCategoryName = "HATS" + val standardArticle = Item(title = "Hat white", category = "HATS") + fun getHat(id: Int = 0): Item { + val categoryId = getCategoryIdForCategory(hatsCategoryName) + val product = articleDto.getArticlesForCategory(categoryId)[id] + return buildItem(product, hatsCategoryName) + } + + fun getRandomHat(): Item { + val categoryId = getCategoryIdForCategory(hatsCategoryName) + val articles = articleDto.getArticlesForCategory(categoryId) + val product = articles.shuffled().take(articles.size)[0] + return buildItem(product, hatsCategoryName) + } + + private fun buildItem(article: Article, categoryName: String): Item { + return Item(title = article.title, price = article.price, category = categoryName, description = article.productDescription) + } + + private fun getCategoryIdForCategory(categoryName: String): Int { + return categories.filter { it.title == categoryName }[0].id + } } \ No newline at end of file diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/tests/EspressoTestExampleWithRepositories.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/tests/EspressoTestExampleWithRepositories.kt new file mode 100644 index 00000000..47820a6d --- /dev/null +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/tests/EspressoTestExampleWithRepositories.kt @@ -0,0 +1,56 @@ +package com.novoda.androidstoreexample.tests + +import android.support.test.rule.ActivityTestRule +import com.novoda.androidstoreexample.activities.MainActivity +import com.novoda.androidstoreexample.data.repositories.ArticleRepository +import com.novoda.androidstoreexample.userflows.productUserFlow +import org.junit.Before +import org.junit.Rule +import org.junit.Test + +class EspressoTestExampleWithRepositories { + + private val activityTestRule = ActivityTestRule(MainActivity::class.java) + lateinit var articleRepository: ArticleRepository + + @get:Rule + var activityRule: ActivityTestRule = activityTestRule + + @Before + fun setUp() { + articleRepository = ArticleRepository() + } + + @Test + fun testNavigationWithFirstItemFromRepository() { + val hat = articleRepository.getHat() + + productUserFlow { + navigateToCategory(hat.category) + openItemFromProductlist(hat.title) + checkThatCorrectProductIsDisplayed() + } + } + + @Test + fun testNavigationWithRandomItemFromRepository() { + val hat = articleRepository.getRandomHat() + + productUserFlow { + navigateToCategory(hat.category) + openItemFromProductlist(hat.title) + checkThatCorrectProductIsDisplayed() + } + } + + @Test + fun testNavigationWithItemFromFixture() { + val hat = articleRepository.standardArticle + + productUserFlow { + navigateToCategory(hat.category) + openItemFromProductlist(hat.title) + checkThatCorrectProductIsDisplayed() + } + } +} \ No newline at end of file From 8ee9e5de42c28704ba8c9cc5b3c86b30ed587f88 Mon Sep 17 00:00:00 2001 From: Sven Kroell Date: Fri, 5 Oct 2018 09:20:10 +0200 Subject: [PATCH 03/10] split dtos into smaller methods --- .../androidstoreexample/data/dto/ArticleDTO.kt | 17 ++++++++++++++--- .../androidstoreexample/data/dto/CategoryDTO.kt | 15 ++++++++++++--- .../androidstoreexample/data/models/Article.kt | 2 +- .../data/models/Categories.kt | 2 +- .../androidstoreexample/data/models/Item.kt | 2 +- .../data/repositories/ArticleRepository.kt | 2 +- 6 files changed, 30 insertions(+), 10 deletions(-) diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt index 770fe7b1..27440b43 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt @@ -4,17 +4,28 @@ import com.google.gson.Gson import com.novoda.androidstoreexample.data.models.Article import com.novoda.testautomationstarter.test.BuildConfig import khttp.get +import org.json.JSONArray class ArticleDTO { private val gson = Gson() + private val productsIdentifier = "products" fun getArticlesForCategory(id: Int): ArrayList
{ + val articleJson = requestProdutJson(id) + return mapJsonOnModel(articleJson) + } + + private fun requestProdutJson(id: Int): JSONArray { + val articleUrl = "${BuildConfig.API_URL}/category/$id/items" + return get(articleUrl) + .jsonObject.getJSONArray(productsIdentifier) + } + + private fun mapJsonOnModel(articleResponse: JSONArray): ArrayList
{ val articles = arrayListOf
() - val articleResponse = get("${BuildConfig.API_URL}/category/$id/items") - .jsonObject.getJSONArray("products") for (i in 0 until articleResponse.length()) { articles.add(gson.fromJson(articleResponse.getString(i), Article::class.java)) } return articles } -} \ No newline at end of file +} diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt index a1c4bb02..ca302d7a 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt @@ -4,17 +4,26 @@ import com.google.gson.Gson import com.novoda.androidstoreexample.BuildConfig import com.novoda.androidstoreexample.data.models.Categories import khttp.get +import org.json.JSONArray class CategoryDTO { - + private val categoryIdentifier = "categories" + private val categoriesUrl = "${BuildConfig.API_URL}/categories" private val gson = Gson() fun getAllCategories(): ArrayList { + val categoryResponse = requestCategories() + return mapJsonOnModel(categoryResponse) + } + + private fun mapJsonOnModel(categoryResponse: JSONArray): ArrayList { val categories = arrayListOf() - val categoryResponse = get("${BuildConfig.API_URL}/categories").jsonObject.getJSONArray("categories") for (i in 0 until categoryResponse.length()) { categories.add(gson.fromJson(categoryResponse.getString(i), Categories::class.java)) } return categories } -} \ No newline at end of file + + private fun requestCategories() = + get(categoriesUrl).jsonObject.getJSONArray(categoryIdentifier) +} diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt index 600c53f7..da7c2c36 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt @@ -6,4 +6,4 @@ data class Article(val id: Int, val title: String, val price: String, val image: String, - @SerializedName("product_description")val productDescription: String) \ No newline at end of file + @SerializedName("product_description")val productDescription: String) diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Categories.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Categories.kt index 3bd1a834..0c189d30 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Categories.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Categories.kt @@ -1,3 +1,3 @@ package com.novoda.androidstoreexample.data.models -data class Categories(val id: Int, val title: String, val image: String) \ No newline at end of file +data class Categories(val id: Int, val title: String, val image: String) diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Item.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Item.kt index c28d08a9..88318958 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Item.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Item.kt @@ -1,3 +1,3 @@ package com.novoda.androidstoreexample.data.models -data class Item(val title: String, val category: String, val description: String = "", val price: String = "") \ No newline at end of file +data class Item(val title: String, val category: String, val description: String = "", val price: String = "") diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt index 253ca58d..483f9c12 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt @@ -32,4 +32,4 @@ class ArticleRepository { private fun getCategoryIdForCategory(categoryName: String): Int { return categories.filter { it.title == categoryName }[0].id } -} \ No newline at end of file +} From 4e41040171e82627bbce9abee3bb2c8544d42a6e Mon Sep 17 00:00:00 2001 From: Sven Kroell Date: Fri, 5 Oct 2018 09:20:26 +0200 Subject: [PATCH 04/10] fix typo --- .../com/novoda/androidstoreexample/data/dto/ArticleDTO.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt index 27440b43..ed443a40 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt @@ -11,11 +11,11 @@ class ArticleDTO { private val productsIdentifier = "products" fun getArticlesForCategory(id: Int): ArrayList
{ - val articleJson = requestProdutJson(id) + val articleJson = requestProductJson(id) return mapJsonOnModel(articleJson) } - private fun requestProdutJson(id: Int): JSONArray { + private fun requestProductJson(id: Int): JSONArray { val articleUrl = "${BuildConfig.API_URL}/category/$id/items" return get(articleUrl) .jsonObject.getJSONArray(productsIdentifier) From 203ddbaa94bf90070205c09f5764c8099e6835e1 Mon Sep 17 00:00:00 2001 From: Sven Kroell Date: Fri, 5 Oct 2018 09:59:17 +0200 Subject: [PATCH 05/10] rename models --- .../androidstoreexample/data/dto/CategoryDTO.kt | 10 +++++----- .../data/dto/{ArticleDTO.kt => ProductDTO.kt} | 12 ++++++------ .../androidstoreexample/data/models/Article.kt | 8 +------- .../data/models/Categories.kt | 3 --- .../androidstoreexample/data/models/Category.kt | 3 +++ .../androidstoreexample/data/models/Item.kt | 3 --- .../androidstoreexample/data/models/Product.kt | 9 +++++++++ .../data/repositories/ArticleRepository.kt | 16 ++++++++-------- 8 files changed, 32 insertions(+), 32 deletions(-) rename AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/{ArticleDTO.kt => ProductDTO.kt} (77%) delete mode 100644 AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Categories.kt create mode 100644 AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Category.kt delete mode 100644 AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Item.kt create mode 100644 AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Product.kt diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt index ca302d7a..a5da164f 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt @@ -2,7 +2,7 @@ package com.novoda.androidstoreexample.data.dto import com.google.gson.Gson import com.novoda.androidstoreexample.BuildConfig -import com.novoda.androidstoreexample.data.models.Categories +import com.novoda.androidstoreexample.data.models.Category import khttp.get import org.json.JSONArray @@ -11,15 +11,15 @@ class CategoryDTO { private val categoriesUrl = "${BuildConfig.API_URL}/categories" private val gson = Gson() - fun getAllCategories(): ArrayList { + fun getAllCategories(): ArrayList { val categoryResponse = requestCategories() return mapJsonOnModel(categoryResponse) } - private fun mapJsonOnModel(categoryResponse: JSONArray): ArrayList { - val categories = arrayListOf() + private fun mapJsonOnModel(categoryResponse: JSONArray): ArrayList { + val categories = arrayListOf() for (i in 0 until categoryResponse.length()) { - categories.add(gson.fromJson(categoryResponse.getString(i), Categories::class.java)) + categories.add(gson.fromJson(categoryResponse.getString(i), Category::class.java)) } return categories } diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ProductDTO.kt similarity index 77% rename from AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt rename to AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ProductDTO.kt index ed443a40..48706140 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ArticleDTO.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ProductDTO.kt @@ -1,16 +1,16 @@ package com.novoda.androidstoreexample.data.dto import com.google.gson.Gson -import com.novoda.androidstoreexample.data.models.Article +import com.novoda.androidstoreexample.data.models.Product import com.novoda.testautomationstarter.test.BuildConfig import khttp.get import org.json.JSONArray -class ArticleDTO { +class ProductDTO { private val gson = Gson() private val productsIdentifier = "products" - fun getArticlesForCategory(id: Int): ArrayList
{ + fun getArticlesForCategory(id: Int): ArrayList { val articleJson = requestProductJson(id) return mapJsonOnModel(articleJson) } @@ -21,10 +21,10 @@ class ArticleDTO { .jsonObject.getJSONArray(productsIdentifier) } - private fun mapJsonOnModel(articleResponse: JSONArray): ArrayList
{ - val articles = arrayListOf
() + private fun mapJsonOnModel(articleResponse: JSONArray): ArrayList { + val articles = arrayListOf() for (i in 0 until articleResponse.length()) { - articles.add(gson.fromJson(articleResponse.getString(i), Article::class.java)) + articles.add(gson.fromJson(articleResponse.getString(i), Product::class.java)) } return articles } diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt index da7c2c36..04fe20d2 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Article.kt @@ -1,9 +1,3 @@ package com.novoda.androidstoreexample.data.models -import com.google.gson.annotations.SerializedName - -data class Article(val id: Int, - val title: String, - val price: String, - val image: String, - @SerializedName("product_description")val productDescription: String) +data class Article(val title: String, val category: String, val description: String = "", val price: String = "") diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Categories.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Categories.kt deleted file mode 100644 index 0c189d30..00000000 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Categories.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.novoda.androidstoreexample.data.models - -data class Categories(val id: Int, val title: String, val image: String) diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Category.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Category.kt new file mode 100644 index 00000000..4f82937e --- /dev/null +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Category.kt @@ -0,0 +1,3 @@ +package com.novoda.androidstoreexample.data.models + +data class Category(val id: Int, val title: String, val image: String) diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Item.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Item.kt deleted file mode 100644 index 88318958..00000000 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Item.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.novoda.androidstoreexample.data.models - -data class Item(val title: String, val category: String, val description: String = "", val price: String = "") diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Product.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Product.kt new file mode 100644 index 00000000..17dbb41b --- /dev/null +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Product.kt @@ -0,0 +1,9 @@ +package com.novoda.androidstoreexample.data.models + +import com.google.gson.annotations.SerializedName + +data class Product(val id: Int, + val title: String, + val price: String, + val image: String, + @SerializedName("product_description")val productDescription: String) diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt index 483f9c12..d92162ba 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt @@ -1,32 +1,32 @@ package com.novoda.androidstoreexample.data.repositories -import com.novoda.androidstoreexample.data.dto.ArticleDTO +import com.novoda.androidstoreexample.data.dto.ProductDTO import com.novoda.androidstoreexample.data.dto.CategoryDTO +import com.novoda.androidstoreexample.data.models.Product import com.novoda.androidstoreexample.data.models.Article -import com.novoda.androidstoreexample.data.models.Item class ArticleRepository { private val categories = CategoryDTO().getAllCategories() - private val articleDto = ArticleDTO() + private val articleDto = ProductDTO() private val hatsCategoryName = "HATS" - val standardArticle = Item(title = "Hat white", category = "HATS") + val standardArticle = Article(title = "Hat white", category = "HATS") - fun getHat(id: Int = 0): Item { + fun getHat(id: Int = 0): Article { val categoryId = getCategoryIdForCategory(hatsCategoryName) val product = articleDto.getArticlesForCategory(categoryId)[id] return buildItem(product, hatsCategoryName) } - fun getRandomHat(): Item { + fun getRandomHat(): Article { val categoryId = getCategoryIdForCategory(hatsCategoryName) val articles = articleDto.getArticlesForCategory(categoryId) val product = articles.shuffled().take(articles.size)[0] return buildItem(product, hatsCategoryName) } - private fun buildItem(article: Article, categoryName: String): Item { - return Item(title = article.title, price = article.price, category = categoryName, description = article.productDescription) + private fun buildItem(article: Product, categoryName: String): Article { + return Article(title = article.title, price = article.price, category = categoryName, description = article.productDescription) } private fun getCategoryIdForCategory(categoryName: String): Int { From 581030a761012c6688694554530768ca70df8317 Mon Sep 17 00:00:00 2001 From: Sven Kroell Date: Tue, 9 Oct 2018 11:45:02 +0200 Subject: [PATCH 06/10] use moshi instead of gson --- AndroidTestAutomationStarter/app/build.gradle | 2 +- .../novoda/androidstoreexample/data/dto/CategoryDTO.kt | 9 +++++---- .../novoda/androidstoreexample/data/dto/ProductDTO.kt | 9 +++++---- .../novoda/androidstoreexample/data/models/Category.kt | 3 --- .../novoda/androidstoreexample/data/models/Product.kt | 9 --------- .../data/repositories/ArticleRepository.kt | 4 ++-- 6 files changed, 13 insertions(+), 23 deletions(-) delete mode 100644 AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Category.kt delete mode 100644 AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Product.kt diff --git a/AndroidTestAutomationStarter/app/build.gradle b/AndroidTestAutomationStarter/app/build.gradle index 298e58f6..2e351a0a 100644 --- a/AndroidTestAutomationStarter/app/build.gradle +++ b/AndroidTestAutomationStarter/app/build.gradle @@ -46,7 +46,7 @@ dependencies { testImplementation 'io.rest-assured:json-schema-validator:3.0.6' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' - androidTestImplementation 'com.google.code.gson:gson:2.8.5' + androidTestImplementation 'com.squareup.moshi:moshi:1.4.0' androidTestImplementation 'com.squareup.okhttp:mockwebserver:1.3.0' androidTestImplementation 'khttp:khttp:0.1.0' androidTestImplementation 'org.mockito:mockito-core:2.8.9' diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt index a5da164f..d1ba9387 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt @@ -1,15 +1,16 @@ package com.novoda.androidstoreexample.data.dto -import com.google.gson.Gson import com.novoda.androidstoreexample.BuildConfig -import com.novoda.androidstoreexample.data.models.Category +import com.novoda.androidstoreexample.models.Category +import com.squareup.moshi.Moshi import khttp.get import org.json.JSONArray class CategoryDTO { private val categoryIdentifier = "categories" private val categoriesUrl = "${BuildConfig.API_URL}/categories" - private val gson = Gson() + private val moshi = Moshi.Builder().build() + private val jsonAdapter = moshi.adapter(Category::class.java) fun getAllCategories(): ArrayList { val categoryResponse = requestCategories() @@ -19,7 +20,7 @@ class CategoryDTO { private fun mapJsonOnModel(categoryResponse: JSONArray): ArrayList { val categories = arrayListOf() for (i in 0 until categoryResponse.length()) { - categories.add(gson.fromJson(categoryResponse.getString(i), Category::class.java)) + categories.add(jsonAdapter.fromJson(categoryResponse.getString(i))) } return categories } diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ProductDTO.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ProductDTO.kt index 48706140..3b5b6b11 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ProductDTO.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ProductDTO.kt @@ -1,14 +1,15 @@ package com.novoda.androidstoreexample.data.dto -import com.google.gson.Gson -import com.novoda.androidstoreexample.data.models.Product +import com.novoda.androidstoreexample.models.Product import com.novoda.testautomationstarter.test.BuildConfig +import com.squareup.moshi.Moshi import khttp.get import org.json.JSONArray class ProductDTO { - private val gson = Gson() private val productsIdentifier = "products" + private val moshi = Moshi.Builder().build() + private val jsonAdapter = moshi.adapter(Product::class.java) fun getArticlesForCategory(id: Int): ArrayList { val articleJson = requestProductJson(id) @@ -24,7 +25,7 @@ class ProductDTO { private fun mapJsonOnModel(articleResponse: JSONArray): ArrayList { val articles = arrayListOf() for (i in 0 until articleResponse.length()) { - articles.add(gson.fromJson(articleResponse.getString(i), Product::class.java)) + articles.add(jsonAdapter.fromJson(articleResponse.getString(i))) } return articles } diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Category.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Category.kt deleted file mode 100644 index 4f82937e..00000000 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Category.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.novoda.androidstoreexample.data.models - -data class Category(val id: Int, val title: String, val image: String) diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Product.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Product.kt deleted file mode 100644 index 17dbb41b..00000000 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/models/Product.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.novoda.androidstoreexample.data.models - -import com.google.gson.annotations.SerializedName - -data class Product(val id: Int, - val title: String, - val price: String, - val image: String, - @SerializedName("product_description")val productDescription: String) diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt index d92162ba..c99a289d 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/repositories/ArticleRepository.kt @@ -1,9 +1,9 @@ package com.novoda.androidstoreexample.data.repositories -import com.novoda.androidstoreexample.data.dto.ProductDTO import com.novoda.androidstoreexample.data.dto.CategoryDTO -import com.novoda.androidstoreexample.data.models.Product +import com.novoda.androidstoreexample.data.dto.ProductDTO import com.novoda.androidstoreexample.data.models.Article +import com.novoda.androidstoreexample.models.Product class ArticleRepository { private val categories = CategoryDTO().getAllCategories() From a5dec5c1ac3d2b0f726c9d9908391544344bfc52 Mon Sep 17 00:00:00 2001 From: Sven Kroell Date: Tue, 9 Oct 2018 12:28:36 +0200 Subject: [PATCH 07/10] use before class --- .../tests/EspressoTestExampleWithRepositories.kt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/tests/EspressoTestExampleWithRepositories.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/tests/EspressoTestExampleWithRepositories.kt index 47820a6d..ace72d97 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/tests/EspressoTestExampleWithRepositories.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/tests/EspressoTestExampleWithRepositories.kt @@ -4,23 +4,29 @@ import android.support.test.rule.ActivityTestRule import com.novoda.androidstoreexample.activities.MainActivity import com.novoda.androidstoreexample.data.repositories.ArticleRepository import com.novoda.androidstoreexample.userflows.productUserFlow -import org.junit.Before +import org.junit.BeforeClass import org.junit.Rule import org.junit.Test class EspressoTestExampleWithRepositories { private val activityTestRule = ActivityTestRule(MainActivity::class.java) - lateinit var articleRepository: ArticleRepository + @get:Rule var activityRule: ActivityTestRule = activityTestRule - @Before - fun setUp() { - articleRepository = ArticleRepository() + companion object { + lateinit var articleRepository: ArticleRepository + + @JvmStatic + @BeforeClass + fun setUp() { + articleRepository = ArticleRepository() + } } + @Test fun testNavigationWithFirstItemFromRepository() { val hat = articleRepository.getHat() From c42a8172d7e8908e273300d0fcb6b01fe661719a Mon Sep 17 00:00:00 2001 From: Sven Kroell Date: Wed, 10 Oct 2018 09:34:00 +0200 Subject: [PATCH 08/10] add constants for fetching from repository --- .../androidstoreexample/data/dto/CategoryDTO.kt | 5 +---- .../androidstoreexample/data/dto/Constants.kt | 13 +++++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/Constants.kt diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt index d1ba9387..32f5260b 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt @@ -1,14 +1,11 @@ package com.novoda.androidstoreexample.data.dto -import com.novoda.androidstoreexample.BuildConfig import com.novoda.androidstoreexample.models.Category import com.squareup.moshi.Moshi import khttp.get import org.json.JSONArray class CategoryDTO { - private val categoryIdentifier = "categories" - private val categoriesUrl = "${BuildConfig.API_URL}/categories" private val moshi = Moshi.Builder().build() private val jsonAdapter = moshi.adapter(Category::class.java) @@ -26,5 +23,5 @@ class CategoryDTO { } private fun requestCategories() = - get(categoriesUrl).jsonObject.getJSONArray(categoryIdentifier) + get(Constants.Urls.category).jsonObject.getJSONArray(Constants.identifier.category) } diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/Constants.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/Constants.kt new file mode 100644 index 00000000..72ff8005 --- /dev/null +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/Constants.kt @@ -0,0 +1,13 @@ +package com.novoda.androidstoreexample.data.dto + +import com.novoda.androidstoreexample.BuildConfig + +object Constants { + object Urls { + const val category = "${BuildConfig.API_URL}/categories" + } + + object identifier { + const val category = "categories" + } +} \ No newline at end of file From d280dead46d0a3096821c7fe6c0741ad5320d0f8 Mon Sep 17 00:00:00 2001 From: Sven Kroell Date: Wed, 10 Oct 2018 10:36:22 +0200 Subject: [PATCH 09/10] extract articles to constants --- .../com/novoda/androidstoreexample/data/dto/CategoryDTO.kt | 2 +- .../com/novoda/androidstoreexample/data/dto/Constants.kt | 5 ++++- .../com/novoda/androidstoreexample/data/dto/ProductDTO.kt | 6 ++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt index 32f5260b..1109a9c4 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/CategoryDTO.kt @@ -23,5 +23,5 @@ class CategoryDTO { } private fun requestCategories() = - get(Constants.Urls.category).jsonObject.getJSONArray(Constants.identifier.category) + get(Constants.Urls.category).jsonObject.getJSONArray(Constants.Identifier.category) } diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/Constants.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/Constants.kt index 72ff8005..b64a86cb 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/Constants.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/Constants.kt @@ -5,9 +5,12 @@ import com.novoda.androidstoreexample.BuildConfig object Constants { object Urls { const val category = "${BuildConfig.API_URL}/categories" + const val itemsPrefix = "${BuildConfig.API_URL}/category/" + const val itemsSuffix = "items" } - object identifier { + object Identifier { const val category = "categories" + const val product = "products" } } \ No newline at end of file diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ProductDTO.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ProductDTO.kt index 3b5b6b11..4260b3b9 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ProductDTO.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/ProductDTO.kt @@ -1,13 +1,11 @@ package com.novoda.androidstoreexample.data.dto import com.novoda.androidstoreexample.models.Product -import com.novoda.testautomationstarter.test.BuildConfig import com.squareup.moshi.Moshi import khttp.get import org.json.JSONArray class ProductDTO { - private val productsIdentifier = "products" private val moshi = Moshi.Builder().build() private val jsonAdapter = moshi.adapter(Product::class.java) @@ -17,9 +15,9 @@ class ProductDTO { } private fun requestProductJson(id: Int): JSONArray { - val articleUrl = "${BuildConfig.API_URL}/category/$id/items" + val articleUrl = "${Constants.Urls.itemsPrefix}$id/${Constants.Urls.itemsSuffix}" return get(articleUrl) - .jsonObject.getJSONArray(productsIdentifier) + .jsonObject.getJSONArray(Constants.Identifier.product) } private fun mapJsonOnModel(articleResponse: JSONArray): ArrayList { From 597b0e9f403c27f57144524a251a3eb91670c1de Mon Sep 17 00:00:00 2001 From: Sven Kroell Date: Wed, 10 Oct 2018 11:06:19 +0200 Subject: [PATCH 10/10] add new lines --- .../java/com/novoda/androidstoreexample/data/dto/Constants.kt | 2 +- .../tests/EspressoTestExampleWithRepositories.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/Constants.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/Constants.kt index b64a86cb..78a9adef 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/Constants.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/data/dto/Constants.kt @@ -13,4 +13,4 @@ object Constants { const val category = "categories" const val product = "products" } -} \ No newline at end of file +} diff --git a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/tests/EspressoTestExampleWithRepositories.kt b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/tests/EspressoTestExampleWithRepositories.kt index ace72d97..bf37d8ff 100644 --- a/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/tests/EspressoTestExampleWithRepositories.kt +++ b/AndroidTestAutomationStarter/app/src/androidTest/java/com/novoda/androidstoreexample/tests/EspressoTestExampleWithRepositories.kt @@ -59,4 +59,4 @@ class EspressoTestExampleWithRepositories { checkThatCorrectProductIsDisplayed() } } -} \ No newline at end of file +}