package com.example.tasks.screens

import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.assertIsNotDisplayed
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.example.tasks.navigation.Screen
import com.example.tasks.ui.theme.TasksTheme
import org.junit.Assert.*
import org.junit.Before
import org.junit.Rule
import org.junit.Test

class WorkingStaffTest{
    @get:Rule(order = 0)
    var testRule = createComposeRule()

    @Before
    fun setup() {
        testRule.setContent {
            val navController = rememberNavController()
            TasksTheme {
                NavHost(navController = navController, startDestination = Screen.WorkingStaff.route) {
                    composable(route = Screen.WorkingStaff.route){
                        WorkingStaff(name = "Иван", surname = "Иванов", patronymic = "Иванович", navController = navController)
                    }
                }
            }


        }
    }

    @Test
    fun testWorkingStaff_ChangeStatus() {
        testRule.onNodeWithText("иди работай").assertIsDisplayed()
        testRule.onNodeWithTag("change_status0").performClick()
        testRule.onNodeWithText("иди работай").assertIsNotDisplayed()

    }
}
