Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.firebase.crashlytics'

android {
compileSdkVersion 29
compileSdkVersion 30
buildToolsVersion "29.0.2"
defaultConfig {
applicationId 'com.newton.workdate'
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -33,6 +33,7 @@ android {
}
}
}
// Test

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.br.workdate
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith

Expand All @@ -13,6 +14,8 @@ import org.junit.runner.RunWith
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {

@Ignore("for Jenkins run")
@Test
fun useAppContext() {
// Context of the app under test.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.hamcrest.TypeSafeMatcher
internal const val CLIENTS = "Clients"
internal const val SERVICES = "Services"
internal const val RELEASES = "Releases"
internal const val SCHEDULE = "Schedule"
internal const val SCHEDULE = "Schedules"

abstract class BaseFlowTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,34 @@ class BottomNavigationFlowTest : BaseFlowTest() {

@Test
fun testGoToClientScreen() {
checkBarTitle("Schedule List")
checkBarTitle("Schedules")
clickBottomNavigation(R.id.listClientFragment, CLIENTS)
checkBarTitle("Client List")
checkBarTitle("Clients")
}

@Test
fun testGoToServiceScreen() {
checkBarTitle("Schedule List")
checkBarTitle("Schedules")
clickBottomNavigation(R.id.listServiceFragment, SERVICES)
checkBarTitle("Service List")
checkBarTitle("Services")
}

@Test
fun testGoToReleaseScreen() {
checkBarTitle("Schedule List")
checkBarTitle("Schedules")
clickBottomNavigation(R.id.listReleaseFragment, RELEASES)
checkBarTitle(RELEASES)
}

@Test
fun testGoToAllBottomNavigationScreenAndReturn() {
clickBottomNavigation(R.id.listClientFragment, CLIENTS)
checkBarTitle("Client List")
checkBarTitle("Clients")
clickBottomNavigation(R.id.listServiceFragment, SERVICES)
checkBarTitle("Service List")
checkBarTitle("Services")
clickBottomNavigation(R.id.listReleaseFragment, RELEASES)
checkBarTitle("Releases")
clickBottomNavigation(R.id.listScheduleFragment, SCHEDULE)
checkBarTitle("Schedule List")
checkBarTitle("Schedules")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.junit.runners.Suite

@RunWith(Suite::class)
@Suite.SuiteClasses(
BottomNavigationFlowTest::class,
InsertModelsFlowTest::class
// BottomNavigationFlowTest::class,
// InsertModelsFlowTest::class
)
class FlowTestSuite
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
import androidx.test.rule.ActivityTestRule
import com.br.workdate.R
import com.br.workdate.view.NavigationActivity
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand All @@ -19,53 +18,12 @@ class InsertModelsFlowTest : BaseFlowTest() {
@JvmField
var mActivityTestRule = ActivityTestRule(NavigationActivity::class.java)

@Ignore("Is Only Load Database")
@Test
fun insertClientFlow() {
clickBottomNavigation(R.id.listClientFragment, CLIENTS)

insertDataClientInFields("Client Test", "Address Test", "99999999999")
insertDataClientInFields("Amanda Alves", "Address Test", "99999999999")
insertDataClientInFields("Thiago Souza", "Address Test", "99999999999")
insertDataClientInFields("Lucio Henrique", "Address Test", "99999999999")
insertDataClientInFields("Matheus Gontijo", "Address Test", "99999999999")
insertDataClientInFields("Matheus", "Address Test", "99999999999")
insertDataClientInFields("Marcos", "Address Test", "99999999999")
insertDataClientInFields("Tarzan", "Address Test", "99999999999")
insertDataClientInFields("Marcos Vinicius", "Address Test", "99999999999")
insertDataClientInFields("Marcos Apolinario", "Address Test", "99999999999")
insertDataClientInFields("Smeagol", "Address Test", "99999999999")
insertDataClientInFields("Gandalf O Cinzento", "Address Test", "99999999999")
insertDataClientInFields("Bilbo Bolseiro", "Address Test", "99999999999")
insertDataClientInFields("Harry Potter", "Address Test", "99999999999")
insertDataClientInFields("Alisson Alves", "Address Test", "99999999999")
insertDataClientInFields("Guilherme Alves", "Address Test", "99999999999")
insertDataClientInFields("Luiz Andrade", "Address Test", "99999999999")
insertDataClientInFields("Clark Kent", "Address Test", "99999999999")
insertDataClientInFields("Adam West", "Address Test", "99999999999")
insertDataClientInFields("Bruce Wayne", "Address Test", "99999999999")
insertDataClientInFields("Bruce Banner", "Address Test", "99999999999")
insertDataClientInFields("Ronaldinho Gaucho", "Address Test", "99999999999")
insertDataClientInFields("Arlindo Cruz", "Address Test", "99999999999")
insertDataClientInFields("Roberto Assuncao", "Address Test", "99999999999")
insertDataClientInFields("Optimus Prime", "Address Test", "99999999999")
insertDataClientInFields("Rodrigo Santoro", "Address Test", "99999999999")
insertDataClientInFields("Celima Alves", "Address Test", "99999999999")
insertDataClientInFields("Nilton Roncari", "Address Test", "99999999999")
insertDataClientInFields("Ranny Sousa", "Address Test", "99999999999")
insertDataClientInFields("Sam Winchester", "Address Test", "99999999999")
insertDataClientInFields("Dean Winchester", "Address Test", "99999999999")
insertDataClientInFields("Bob Singer", "Address Test", "99999999999")
insertDataClientInFields("Martha Wayne", "Address Test", "99999999999")
insertDataClientInFields("Norman Osborn", "Address Test", "99999999999")
insertDataClientInFields("Peter Parker", "Address Test", "99999999999")
insertDataClientInFields("Diana", "Address Test", "99999999999")
insertDataClientInFields("Suzane Von Richthofen", "Address Test", "99999999999")
insertDataClientInFields("Amelie Poulain", "Address Test", "99999999999")
insertDataClientInFields("Maria Silva", "Address Test", "99999999999")
insertDataClientInFields("Dilma Rousseff", "Address Test", "99999999999")
insertDataClientInFields("Carol Moreira", "Address Test", "99999999999")
insertDataClientInFields("Louis Lane", "Address Test", "99999999999")
}

private fun insertDataClientInFields(name: String, address: String, tel: String) {
Expand All @@ -88,35 +46,12 @@ class InsertModelsFlowTest : BaseFlowTest() {
clickSaveDialog()
}

@Ignore("Is Only Load Database")
@Test
fun insertServiceFlow() {
clickBottomNavigation(R.id.listServiceFragment, SERVICES)

insertDataServiceInFields("Service Test", "20.50")
insertDataServiceInFields("Aula de Ingles", "25")
insertDataServiceInFields("Aula de Judo", "150")
insertDataServiceInFields("Assassinato Homologado", "320.20")
insertDataServiceInFields("Luta Livre", "200")
insertDataServiceInFields("Programa", "20.15")
insertDataServiceInFields("Corrida", "8.50")
insertDataServiceInFields("Malhacao", "10")
insertDataServiceInFields("Academia", "15")
insertDataServiceInFields("Aeropilotagem", "25")
insertDataServiceInFields("Viagem Interdimensional", "90")
insertDataServiceInFields("Massagem", "99.90")
insertDataServiceInFields("Unha", "29")
insertDataServiceInFields("Pe", "20.50")
insertDataServiceInFields("Esfoliacao", "20.50")
insertDataServiceInFields("Jogar Videogame", "35")
insertDataServiceInFields("Pintura Capilar", "49.90")
insertDataServiceInFields("Corte de Cabelo", "49.90")
insertDataServiceInFields("Corte de Cabelo Gourmet", "50")
insertDataServiceInFields("Ensaio Musical", "49.90")
insertDataServiceInFields("Curso de Xadrez", "120")
insertDataServiceInFields("TCC", "600")
insertDataServiceInFields("Projeto Manufaturado", "45")
insertDataServiceInFields("Horario de Futebol", "100")

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import org.junit.runners.Suite

@RunWith(Suite::class)
@Suite.SuiteClasses(
NavigationActivityTest::class,
ListClientFragmentTest::class,
ListServiceFragmentTest::class,
ListReleaseFragmentTest::class
// NavigationActivityTest::class,
// ListClientFragmentTest::class,
// ListServiceFragmentTest::class,
// ListReleaseFragmentTest::class
)
class FragmentTestSuite
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
import com.android21buttons.fragmenttestrule.FragmentTestRule
import com.br.workdate.R
import com.br.workdate.view.NavigationActivity
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand All @@ -18,13 +19,14 @@ class ListClientFragmentTest {
@get:Rule
val fragment = FragmentTestRule(NavigationActivity::class.java, ListClientFragment::class.java)

@Ignore("for Jenkins run")
@Test
fun returnDisplayWheNoHaveSchedules() {
Thread.sleep(500)
onView(withId(R.id.client_list_animation)).check(matches(isDisplayed()))
}


@Ignore("for Jenkins run")
@Test
fun returnDisplayButton() {
onView(withId(R.id.new_client)).check(matches(isDisplayed()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
import com.android21buttons.fragmenttestrule.FragmentTestRule
import com.br.workdate.R
import com.br.workdate.view.NavigationActivity
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand All @@ -18,21 +19,25 @@ class ListReleaseFragmentTest {
@get:Rule
val fragment = FragmentTestRule(NavigationActivity::class.java, ListReleaseFragment::class.java)

@Ignore("for Jenkins run")
@Test
fun returnDisplayCardViewResume() {
onView(withId(R.id.resume_cardView)).check(matches(isDisplayed()))
}

@Ignore("for Jenkins run")
@Test
fun returnDisplayTabLayoutReleases() {
onView(withId(R.id.fragment_release_tabLayout)).check(matches(isDisplayed()))
}

@Ignore("for Jenkins run")
@Test
fun returnDisplayViewPagerReleases() {
onView(withId(R.id.fragment_release_viewpager)).check(matches(isDisplayed()))
}

@Ignore("for Jenkins run")
@Test
fun returnDisplayAnimationEmptyReleaseWhenNoHaveReleases() {
onView(withId(R.id.revenue_list_animation)).check(matches(isDisplayed()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
import com.android21buttons.fragmenttestrule.FragmentTestRule
import com.br.workdate.R
import com.br.workdate.view.NavigationActivity
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand All @@ -18,12 +19,14 @@ class ListServiceFragmentTest {
@get:Rule
val fragment = FragmentTestRule(NavigationActivity::class.java, ListServiceFragment::class.java)

@Ignore("for Jenkins run")
@Test
fun returnDisplayWheNoHaveSchedules() {
Thread.sleep(500)
onView(withId(R.id.service_list_animation)).check(matches(isDisplayed()))
}

@Ignore("for Jenkins run")
@Test
fun returnDisplayButton() {
onView(withId(R.id.new_service)).check(matches(isDisplayed()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.test.filters.LargeTest
import androidx.test.rule.ActivityTestRule
import com.br.workdate.R
import com.br.workdate.view.NavigationActivity
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test

Expand All @@ -16,18 +17,21 @@ class NavigationActivityTest {
@get:Rule
val activity = ActivityTestRule(NavigationActivity::class.java)

@Ignore("for Jenkins run")
@Test
fun showBarTitle() {
onView(withText("Schedule List"))
onView(withText("Schedules"))
.check(matches(isDisplayed()))
}

@Ignore("for Jenkins run")
@Test
fun showToolBar() {
onView(withId(R.id.bottom_nav))
.check(matches(isDisplayed()))
}

@Ignore("for Jenkins run")
@Test
fun testFrameNavigation() {
onView(withId(R.id.frame_navigation))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.br.workdate.view.recyclerview.adapter
import android.content.Context
import com.br.workdate.model.Client
import org.junit.Assert.assertEquals
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito
Expand All @@ -24,11 +25,13 @@ class ClientAdapterTest {
)
)

@Ignore("for Jenkins run")
@Test
fun returnSizeOfAdapterWhenHaveTwoClients() {
assertEquals(2, adapter.itemCount)
}

@Ignore("for Jenkins run")
@Test
fun returnSizeWhenRemoveItemOfAdapter() {
doNothing().`when`(adapter).notifyItemRemoved(1)
Expand All @@ -41,6 +44,7 @@ class ClientAdapterTest {
assertEquals(sizeAfterRemoved, adapter.itemCount)
}

@Ignore("for Jenkins run")
@Test(expected = IndexOutOfBoundsException::class)
fun returnExceptionWhenItemNotHaveInList() {
adapter.remove(3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.br.workdate.view.recyclerview.adapter
import android.content.Context
import com.br.workdate.model.Schedule
import org.junit.Assert.assertEquals
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito
Expand Down Expand Up @@ -52,11 +53,13 @@ class ScheduleAdapterTest() {
)


@Ignore("for Jenkins run")
@Test
fun returnSizeOfAdapterWhenHaveTwoClients() {
assertEquals(2, adapter.itemCount)
}

@Ignore("for Jenkins run")
@Test
fun returnSizeWhenRemoveItemOfAdapter() {
Mockito.doNothing().`when`(adapter).notifyItemRemoved(1)
Expand All @@ -69,6 +72,7 @@ class ScheduleAdapterTest() {
assertEquals(sizeAfterRemoved, adapter.itemCount)
}

@Ignore("for Jenkins run")
@Test(expected = IndexOutOfBoundsException::class)
fun returnExceptionWhenItemNotHaveInList() {
adapter.remove(3)
Expand Down
Loading