{"id":374181,"date":"2024-05-21T05:54:06","date_gmt":"2024-05-21T05:54:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=374181"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=374181","title":{"rendered":"<span>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 UI \u0432 Compose Multiplatform<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u044f\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c UI-\u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 Compose Multiplatform, \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0430\u0441\u044c \u0441 \u0434\u0435\u0444\u0438\u0446\u0438\u0442\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435. \u0418\u0437 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u0431\u044b\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430 <a href=\"https:\/\/habr.com\/ru\/articles\/674112\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u0435\u0439<\/a> \u0438 \u0432\u044b\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0439 \u043d\u0430 \u043d\u0435\u0434\u0430\u0432\u043d\u0438\u0445 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u044f\u0445, \u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u043a \u0449\u0435\u043b\u0447\u043a\u0443 \u043f\u043e \u043a\u043d\u043e\u043f\u043a\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0447\u0442\u0438 \u043d\u0430\u0443\u0433\u0430\u0434, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f \u043a\u043e\u0434 \u0438 \u0438\u0437\u0443\u0447\u0430\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0425\u0430\u0431\u0440\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u043c\u0438\u0441\u044f \u043d\u0430\u0440\u0430\u0431\u043e\u0442\u043a\u0430\u043c\u0438.<\/p>\n<h3>\u0421\u0442\u0430\u0440\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0438 \u0435\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430<\/h3>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f SourceSet, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0434\u043e\u0445\u043e\u0434\u0447\u0438\u0432\u043e \u043e\u043f\u0438\u0441\u0430\u043d \u0432 <a href=\"https:\/\/www.jetbrains.com\/help\/kotlin-multiplatform-dev\/compose-test.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043d\u0435\u0438\u0437\u0431\u0435\u0436\u043d\u044b\u043c Hello world ?<\/p>\n<pre><code class=\"kotlin\">import androidx.compose.ui.test.assertTextEquals import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithTag import org.junit.Rule import org.junit.Test import androidx.compose.material.Text import androidx.compose.ui.Modifier import androidx.compose.ui.platform.testTag  class HelloWorld {     @get:Rule     val rule = createComposeRule()     val hello = \"Hello, World!\"      @Test     fun myTest() {         rule.setContent {             Text(                 text = hello,                 modifier = Modifier.testTag(\"text\")             )         }         rule.onNodeWithTag(\"text\").assertTextEquals(hello)     } }<\/code><\/pre>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u2013 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u041f\u0440\u0435\u0434\u0432\u0430\u0440\u044f\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <code>@get:Rule<\/code>, \u0433\u0434\u0435 <code>@Rule<\/code> \u2013 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043e\u0442 Java \u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u043a <strong>\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443<\/strong> \u043a\u043b\u0430\u0441\u0441\u0430. \u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, Kotlin \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0443\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a <strong>\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c<\/strong> \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u044f\u0432\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <strong>\u0433\u0435\u0442\u0442\u0435\u0440\u043e\u0432<\/strong>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c <code>get<\/code>, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043e\u0448\u0438\u0431\u0438\u0442\u044c\u0441\u044f \u0430\u0434\u0440\u0435\u0441\u043e\u043c.<\/p>\n<p>\u041d\u0430\u0448\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e <code>rule<\/code> \u2013 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/developer.android.com\/reference\/kotlin\/androidx\/compose\/ui\/test\/junit4\/ComposeContentTestRule\" rel=\"noopener noreferrer nofollow\">ComposeContentTestRule<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A4%D0%B0%D0%B1%D1%80%D0%B8%D1%87%D0%BD%D1%8B%D0%B9_%D0%BC%D0%B5%D1%82%D0%BE%D0%B4_(%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD_%D0%BF%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F)\" rel=\"noopener noreferrer nofollow\">\u0444\u0430\u0431\u0440\u0438\u0447\u043d\u043e\u0433\u043e<\/a> \u043c\u0435\u0442\u043e\u0434\u0430 <code>createComposeRule()<\/code>.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>myTest()<\/code>. \u041f\u0435\u0440\u0435\u0434 \u043d\u0435\u0439 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@Test<\/code>, \u0438 \u0432 IDEA \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0435\u043b\u0435\u043d\u044b\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u0441\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/87e\/8a3\/bca\/87e8a3bca89418127239a2f38c3f66cc.png\" alt=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0435\u0441\u0442\u0430\" title=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0435\u0441\u0442\u0430\" width=\"1291\" height=\"497\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/87e\/8a3\/bca\/87e8a3bca89418127239a2f38c3f66cc.png\"\/><\/p>\n<div><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0435\u0441\u0442\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>setContent()<\/code> \u0437\u0430\u0434\u0430\u0435\u043c composable-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041f\u043e\u043a\u0430 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0434\u043f\u0438\u0441\u044c, \u043d\u043e \u0432\u0441\u043a\u043e\u0440\u0435 \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u044b composable \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 <code>testTag()<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0442\u0435\u0433, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043d\u0430\u0448 \u0442\u0435\u0441\u0442 \u0441\u043c\u043e\u0436\u0435\u0442 \u0435\u0433\u043e \u043d\u0430\u0439\u0442\u0438. \u041a\u0441\u0442\u0430\u0442\u0438, \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0435\u0441\u0442\u044c \u043d\u0435 \u0443 \u0432\u0441\u0435\u0445 composable \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u0430 \u0431\u0435\u0437 \u043d\u0438\u0445 \u0442\u0435\u0433\u0438 \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0439\u0434\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u043e \u043d\u0430\u0448\u0435\u043c\u0443 \u0442\u0435\u0433\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>onNodeWithTag()<\/code> \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0435\u043a\u0441\u0442 \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>hello<\/code>.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/03f\/2f9\/82a\/03f2f982a2b8e50cb19edcbd81ef8afa.png\" alt=\"\u0417\u0435\u043b\u0435\u043d\u044b\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u044b \u0443\u0441\u043f\u0435\u0445\u0430\" title=\"\u0417\u0435\u043b\u0435\u043d\u044b\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u044b \u0443\u0441\u043f\u0435\u0445\u0430\" width=\"947\" height=\"443\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/03f\/2f9\/82a\/03f2f982a2b8e50cb19edcbd81ef8afa.png\"\/><\/p>\n<div><figcaption>\u0417\u0435\u043b\u0435\u043d\u044b\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u044b \u0443\u0441\u043f\u0435\u0445\u0430<\/figcaption><\/div>\n<\/figure>\n<h2>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u043e\u0442\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f<\/h2>\n<p>\u0412 \u043d\u043e\u0432\u043e\u0439, \u043f\u043e\u043a\u0430 \u0435\u0449\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0439, \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u043e. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/developer.android.com\/reference\/kotlin\/androidx\/compose\/ui\/test\/ComposeUiTest\" rel=\"noopener noreferrer nofollow\">\u0444\u0443\u043d\u043a\u0446\u0438\u044e <\/a><code>runComposeUiTest()<\/code><em>. <\/em>\u0422\u043e\u0433\u0434\u0430 \u043d\u0430\u0448 \u0442\u0435\u0441\u0442, \u0443\u043a\u0440\u0430\u0448\u0435\u043d\u043d\u044b\u0439 \u0441\u0440\u0430\u0437\u0443  \u0434\u0432\u0443\u043c\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c\u0438, \u043f\u0440\u0438\u043c\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u0438\u0434:<\/p>\n<pre><code class=\"kotlin\">@OptIn(ExperimentalTestApi::class) @Test fun myTest() = runComposeUiTest{     setContent {         Text(             text = hello,             modifier = Modifier.testTag(\"text\")         )     }     onNodeWithTag(\"text\").assertTextEquals(hello) }<\/code><\/pre>\n<h3>\u0421\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e<\/h3>\n<p>\u0422\u0435\u0433, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e <strong>\u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430<\/strong>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0431\u043e\u0439 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 <strong>\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438<\/strong> (\u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432 Compose \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0430 \u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u2013 \u0440\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f).<\/p>\n<p>\u0422\u0435\u0433\u0438 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041e\u043d\u0438 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0442 <strong>\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u044c<\/strong> (accessibility) \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2013 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u044e.<\/p>\n<p>\u0414\u0435\u0440\u0435\u0432\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u043e\u043e\u0447\u0438\u044e:<\/p>\n<pre><code class=\"kotlin\">onRoot().printToLog(\"text\")<\/code><\/pre>\n<p>\u041f\u0440\u0430\u0432\u0434\u0430, \u043e\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0436\u0438\u0432\u043e\u043f\u0438\u0441\u043d\u043e:<\/p>\n<pre><code>text: printToLog: Printing with useUnmergedTree = 'false' Node #1 at (l=0.0, t=0.0, r=1024.0, b=768.0)px  |-Node #2 at (l=0.0, t=0.0, r=81.0, b=19.0)px, Tag: 'text'    Text = '[Hello, World!]'    Actions = [SetTextSubstitution, ShowTextSubstitution, ClearTextSubstitution, GetTextLayoutResult]<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0432 \u043d\u0430\u0448\u0435\u043c \u0434\u0435\u0440\u0435\u0432\u0435 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u2013 \u043a\u043e\u0440\u0435\u043d\u044c \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u043d\u0430\u0434\u043f\u0438\u0441\u044c.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442:<\/p>\n<pre><code class=\"kotlin\">setContent {     Text(         text = hello,         modifier = Modifier.testTag(\"text\")     )     Button(         onClick = {},         modifier = Modifier.testTag(\"button\")     ) { Text(\"Click me!\") } }<\/code><\/pre>\n<p>\u0418 \u0443\u0432\u0438\u0434\u0438\u043c, \u043a\u0430\u043a \u043f\u043e\u0434\u0440\u043e\u0441\u043b\u043e \u043d\u0430\u0448\u0435 \u0434\u0435\u0440\u0435\u0432\u0446\u0435:<\/p>\n<pre><code>text: printToLog: Printing with useUnmergedTree = 'false' Node #1 at (l=0.0, t=0.0, r=1024.0, b=768.0)px  |-Node #2 at (l=0.0, t=0.0, r=81.0, b=19.0)px, Tag: 'text'  | Text = '[Hello, World!]'  | Actions = [SetTextSubstitution, ShowTextSubstitution, ClearTextSubstitution, GetTextLayoutResult]  |-Node #3 at (l=0.0, t=6.0, r=102.0, b=42.0)px, Tag: 'button'    Focused = 'false'    Role = 'Button'    Text = '[Click me!]'    Actions = [RequestFocus, OnClick, SetTextSubstitution, ShowTextSubstitution, ClearTextSubstitution, GetTextLayoutResult]    MergeDescendants = 'true'<\/code><\/pre>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0437\u0430\u0433\u0430\u0434\u043e\u0447\u043d\u043e\u0435 <code>useUnmergedTree<\/code>. \u042d\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043c\u0435\u0442\u043e\u0434\u0430 <code>onRoot()<\/code>, \u0437\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u0430 \u2013 merged \u0438\u043b\u0438 unmerged. \u0422\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 <strong>merged tree<\/strong>: \u0432 \u043d\u0435\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u0432\u0441\u0435 \u0443\u0437\u043b\u044b, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044d\u0442\u043e \u0446\u0435\u043b\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u0448\u0430 \u043a\u043d\u043e\u043f\u043a\u0430 \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u043d\u0435\u043c \u043a\u0430\u043a \u0435\u0434\u0438\u043d\u043e\u0435 \u0446\u0435\u043b\u043e\u0435 (node #3).<\/p>\n<p>\u0410 \u0432\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 unmerged tree (<code>onRoot(useUnmergedTree = true)<\/code>):<\/p>\n<pre><code>text: printToLog: Printing with useUnmergedTree = 'true' Node #1 at (l=0.0, t=0.0, r=1024.0, b=768.0)px  |-Node #2 at (l=0.0, t=0.0, r=81.0, b=19.0)px, Tag: 'text'  | Text = '[Hello, World!]'  | Actions = [SetTextSubstitution, ShowTextSubstitution, ClearTextSubstitution, GetTextLayoutResult]  |-Node #3 at (l=0.0, t=6.0, r=102.0, b=42.0)px, Tag: 'button'    Focused = 'false'    Role = 'Button'    Actions = [RequestFocus, OnClick]    MergeDescendants = 'true'     |-Node #5 at (l=16.0, t=16.0, r=86.0, b=32.0)px       Text = '[Click me!]'       Actions = [SetTextSubstitution, ShowTextSubstitution, ClearTextSubstitution, GetTextLayoutResult]<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0432 <strong>unmerged<\/strong> \u0434\u0435\u0440\u0435\u0432\u0435 \u043a\u043d\u043e\u043f\u043a\u0430 \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043d\u0435\u0439 \u0442\u0435\u043a\u0441\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 \u0443\u0437\u043b\u044b (node #3 \u0438 node #5 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e). \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 <code>OnClick<\/code> \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043a\u043d\u043e\u043f\u043a\u0438, \u043d\u043e \u043d\u0435 \u0434\u043b\u044f \u0435\u0435 \u0442\u0435\u043a\u0441\u0442\u0430.<\/p>\n<h3>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0435\u0441\u0442\u0430<\/h3>\n<p>\u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438:<\/p>\n<pre><code class=\"kotlin\">onNodeWithTag(\"text\").assertTextEquals(hello)<\/code><\/pre>\n<p>\u041e\u043d\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443:<\/p>\n<p><code>{finder}{.assertion\/action}<\/code><\/p>\n<p><strong>Finder<\/strong> \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0432 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435 \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0437\u043b\u043e\u0432, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044e. \u041f\u0440\u0438\u043c\u0435\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><code>onNodeWithTag()<\/code><\/p>\n<\/li>\n<li>\n<p><code>onNodeWithText()<\/code><\/p>\n<\/li>\n<li>\n<p><code>onAllNodesWithTag()<\/code><\/p>\n<\/li>\n<li>\n<p><code>onAllNodesWithText()<\/code><\/p>\n<\/li>\n<\/ul>\n<p><strong>Assertion <\/strong>\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0442\u0435\u0441\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e:<\/p>\n<ul>\n<li>\n<p><code>assertExists()<\/code><\/p>\n<\/li>\n<li>\n<p><code>assertIsEnabled()<\/code><\/p>\n<\/li>\n<li>\n<p><code>assertTextContains()<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 (<strong>action<\/strong>) \u043d\u0430\u0434 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">onNodeWithTag(\"button\").performClick()<\/code><\/pre>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0438\u0434\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439:<\/p>\n<ul>\n<li>\n<p><code>performClick()<\/code><\/p>\n<\/li>\n<li>\n<p><code>performTextInput()<\/code><\/p>\n<\/li>\n<li>\n<p><code>performKeyPress()<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u0430\u0437\u043d\u043e\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u0433\u0434\u0435 \u043a finder \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442\u0441\u044f <strong>matcher<\/strong>:<\/p>\n<pre><code>{finder({matcher})}{.assertion\/action }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code>onNode(hasTestTag(\"button\")).performClick()<\/code><\/pre>\n<p>Matcher \u0437\u0430\u0434\u0430\u0435\u0442 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u043f\u043e\u0438\u0441\u043a\u0430 \u0434\u043b\u044f finder. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\n<p>hasText()<\/p>\n<\/li>\n<li>\n<p>hasTestTag()<\/p>\n<\/li>\n<li>\n<p>isDialog()<\/p>\n<\/li>\n<li>\n<p>isPopup()<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/developer.android.com\/develop\/ui\/compose\/testing\/testing-cheatsheet\" rel=\"noopener noreferrer nofollow\">\u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0435<\/a>.<\/p>\n<h3>\u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c, \u0447\u0435\u043c \u0449\u0435\u043b\u0447\u043e\u043a \u043f\u043e \u043a\u043d\u043e\u043f\u043a\u0435.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0431\u0435\u0440\u0435\u043c \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>setContent()<\/code> \u043a\u043e\u0434 \u043a\u043d\u043e\u043f\u043e\u043a \u0438 \u043d\u0430\u0434\u043f\u0438\u0441\u0435\u0439. \u041e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043b\u0438\u0448\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u0443 composable \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0433\u0434\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">@OptIn(ExperimentalTestApi::class) class HelloWorld {     val hello = \"Hello, World!\"      private fun ComposeUiTest.launchContent() {         setContent {             MyWindow()         }     }      @Test     fun `Test my window`() = runComposeUiTest {         launchContent()         onNodeWithTag(\"my_tag\").assertExists()     } }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>ComposeUiTest<\/code> \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <code>launchContent()<\/code> \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043b\u0438 \u0432 \u043d\u0435\u0435 \u043a\u043e\u0434 \u0432\u044b\u0437\u043e\u0432\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0430\u0448\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0437\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. <\/p>\n<p>Kotlin \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0432 \u0438\u043c\u0435\u043d\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0435\u0441\u043b\u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0435 \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0438. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0432\u043e\u0434\u043a\u0443 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0447\u0442\u0438 \u043d\u0430 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bea\/e16\/7c7\/beae167c73f50b20b877c5bcb938a404.png\" alt=\"\u0422\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u044b\" title=\"\u0422\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u044b\" width=\"938\" height=\"303\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bea\/e16\/7c7\/beae167c73f50b20b877c5bcb938a404.png\"\/><\/p>\n<div><figcaption>\u0422\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u044b<\/figcaption><\/div>\n<\/figure>\n<h4>\u0422\u0435\u0441\u0442 \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0430<\/h4>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0430\u0439\u0434\u0435\u0440 \u0441 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043e\u0442 1 \u0434\u043e <code>max<\/code> \u0438 \u0448\u0438\u0440\u0438\u043d\u043e\u0439 <code>width<\/code>.<\/p>\n<pre><code class=\"kotlin\">@Composable fun MySlider() {     var x by remember { mutableStateOf(max.toFloat()) }      Slider(         value = x,         valueRange = 1f..max.toFloat(),         onValueChange = { x = it },         steps = max - 2,         modifier = Modifier.width(width)             .testTag(\"my_slider\")     )     Text(\"${x.toInt()}\",         modifier = Modifier.testTag(\"my_text\")) }<\/code><\/pre>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>steps<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u043d\u0430 \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0435. \u041f\u0440\u0438 <code>steps = 0<\/code> \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u0443\u044e \u0448\u043a\u0430\u043b\u0443, \u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0448\u043a\u0430\u043b\u0430 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u0430\u044f. \u0414\u043b\u044f \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 <code>[1..max]<\/code>, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u043e\u0431\u0435 \u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u0441\u043b\u0430\u0439\u0434\u0435\u0440 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0440\u043e\u0432\u043d\u043e <code>max<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0432\u0430 \u2013 \u044d\u0442\u043e \u0441\u0430\u043c\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b 1 \u0438 <code>max<\/code>, \u0430 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 <code>max-2<\/code> \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u0435\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0437\u0443\u043d\u043a\u0430 \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0430 <code>it<\/code> \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 <code>x<\/code>, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>remember()<\/code>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u043d\u0430\u0434\u043f\u0438\u0441\u0438 \u0440\u043e\u0432\u043d\u043e \u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>x<\/code>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043e \u043d\u0430 \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u041e\u0444\u0444\u0442\u043e\u043f<\/summary>\n<div class=\"spoiler__content\">\n<p><a href=\"https:\/\/developer.android.com\/develop\/ui\/compose\/state\" rel=\"noopener noreferrer nofollow\">\u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e<\/a>, \u0434\u0435\u043b\u0435\u0433\u0430\u0442 <code>by<\/code> \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u0432\u0443\u0445 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432 \u2013 <code>getValue()<\/code> \u0438 <code>setValue()<\/code>. \u0412 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 <code>remember<\/code> \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043a\u043e\u0434\u0430 \u043c\u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f:<\/p>\n<blockquote>\n<p><em>Remember, remember the fifth of November,<\/em><\/p>\n<p><em>Gunpowder treason and plot\u2026<\/em><\/p>\n<\/blockquote>\n<\/div>\n<\/details>\n<p>\u041a \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0443 \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u043d\u0430\u0434\u043f\u0438\u0441\u0438 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0442\u0435\u0433\u0438 <code>myslider<\/code> \u0438 <code>mytext<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043d\u0438\u043c \u0438\u0437 \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0443 \u043f\u043e \u0442\u0435\u0433\u0443<\/p>\n<pre><code class=\"kotlin\">onNodeWithTag(\"my_slider\")<\/code><\/pre>\n<p>\u043d\u0430\u0441 \u0436\u0434\u0435\u0442 \u043a\u0443\u043b\u044c\u0442\u0443\u0440\u043d\u044b\u0439 \u0448\u043e\u043a \u043e\u0442 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u044b\u0445 actions. \u041f\u043e \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c \u0438\u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u044c \u043a\u043b\u0430\u0432\u0438\u0448\u0443 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435.<\/p>\n<p>\u041a\u0430\u043a \u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u0442\u0435\u0441\u0442\u0430? \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0430 \u0437\u0430\u0446\u0435\u043f\u0438\u0442\u044c\u0441\u044f \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2013 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b.<\/p>\n<pre><code class=\"kotlin\">onNodeWithTag(\"my_slider\")     .performKeyPress(KeyEvent.VK_PAGE_DOWN)<\/code><\/pre>\n<p>\u0423\u0432\u044b, \u044d\u0442\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. <code>VK_PAGE_DOWN<\/code>\u00a0\u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f <code>Int<\/code>, \u0430 \u043d\u0435 <code>KeyEvent<\/code>.<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043c\u044b\u0448\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u043c\u0443 \u0434\u0435\u043b\u0435\u043d\u0438\u044e \u043d\u0430 \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0435.<\/p>\n<pre><code class=\"kotlin\">@OptIn(ExperimentalTestApi::class) @Test fun `Test my slider`() = runComposeUiTest {     launchContent()     val width = 240     val delta = width \/ max.toFloat()     for (i in 0..&lt; max){           with(onNodeWithTag(\"my_slider\")) {             performMouseInput {                 click(Offset((i * delta + 1).toFloat(), 0f))             }         }         onNodeWithTag(\"my_text\").assertTextEquals((i + 1).toString())     } }<\/code><\/pre>\n<p>\u0417\u043d\u0430\u044f \u0448\u0438\u0440\u0438\u043d\u0443 \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0430 <code>width<\/code> \u0438 \u0435\u0433\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>max<\/code>, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0448\u0438\u0440\u0438\u043d\u0443 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u043c\u0435\u0436\u0434\u0443 \u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438 <code>delta<\/code>. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043b\u044f <code>i<\/code>-\u0433\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043c\u044b\u0448\u0438 \u043d\u0430 <code>i*delta<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u043f\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u044e, \u0438 \u0435\u0449\u0435 \u0447\u0443\u0442\u044c \u0432\u043f\u0440\u0430\u0432\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430. \u041f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438 \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u043e (<code>0f<\/code>). \u041a\u043b\u0438\u043a\u043d\u0443\u0432 \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u043d\u0430\u0434\u043f\u0438\u0441\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u043e\u043c\u0435\u0440\u0443 \u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>click()<\/code> \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u043c\u0443 API, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e<\/p>\n<pre><code class=\"kotlin\">@OptIn(ExperimentalTestApi::class)<\/code><\/pre>\n<p>\u043f\u0435\u0440\u0435\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439.<\/p>\n<h4>\u0422\u0435\u0441\u0442 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u043e\u0432<\/h4>\n<p>UI \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 Compose Multiplatform \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0431\u0435\u0437 assertion. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435<\/p>\n<pre><code class=\"kotlin\">onNodeWithTag(\"my_checkbox\").assertIsOn() <\/code><\/pre>\n<p>\u041d\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u041c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0442\u044c \u0442\u0435\u0441\u0442.<\/p>\n<p>\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0443 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u043e\u0432:<\/p>\n<pre><code class=\"kotlin\">var checkList = mutableMapOf(\"zero\" to true, \"one\" to true, \"two\" to true, \"three\" to true, \"four\" to true, \"five\" to true)  @Composable fun MyCheckboxList() {     Row() {         checkList.forEach { (x, b) ->             Column {                 val isChecked = remember { mutableStateOf(b) }                  Checkbox(                     checked = isChecked.value,                     onCheckedChange = {                         isChecked.value = it                     },                     enabled = true,                     modifier = Modifier.testTag(\"checkbox_${x}\")                 )                 Text(text = x)             }         }     } }<\/code><\/pre>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u0441\u0435 \u0444\u043b\u0430\u0436\u043a\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u2013 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 <code>checkList<\/code> \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0432\u043d\u044b <code>true<\/code>. \u0421\u043d\u0438\u043c\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043a\u043b\u0438\u043a \u043c\u044b\u0448\u043a\u043e\u0439.<\/p>\n<pre><code class=\"kotlin\">@Test fun `Test my checkbox list`() = runComposeUiTest{     launchContent()      \/\/ \u0441\u043d\u0438\u043c\u0435\u043c \u0434\u0432\u0430 \u0444\u043b\u0430\u0436\u043a\u0430     val exclude = listOf(\"one\", \"three\")     exclude.forEach {         checkList[it] = false     }     checkList.filter{(_, b) -> !b }.forEach { (x, _) ->         onNodeWithTag(\"checkbox_$x\").run {             assertExists()             assertIsOn()             performClick()             assertIsOff()         }     }  \u2026 }<\/code><\/pre>\n<p>\u0425\u043e\u0442\u044f \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430\u043c\u0438, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441 \u0431\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0438\u0445 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0441 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u2013 \u0442\u0443\u0442 \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c assertion.<\/p>\n<pre><code class=\"kotlin\">    \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u0444\u043b\u0430\u0436\u043a\u0438 \u0441\u043d\u044f\u0442\u044b     checkList.forEach { (x, b) ->         onNodeWithTag(\"checkbox_$x\").assertExists()          if (b)             onNodeWithTag(\"checkbox_$x\").assertIsOn()         else             onNodeWithTag(\"checkbox_$x\").assertIsOff()     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0442\u0441\u044f \u043d\u0435 \u043f\u0440\u0438 \u043b\u044e\u0431\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430, \u0430 \u043b\u0438\u0448\u044c \u043f\u0440\u0438 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0438 \u043e\u0442 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f.<\/p>\n<h3>\u0412\u044b\u0432\u043e\u0434\u044b<\/h3>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 UI \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 Compose Multiplatform \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u043d\u043e, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043f\u043e\u043a\u0430 \u0435\u0449\u0435 \u0441\u044b\u0440\u0430\u044f \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0433\u0438\u0431\u043a\u0430\u044f. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u0447\u0435\u043c \u0442\u0435\u043a\u0441\u0442 + \u043a\u043d\u043e\u043f\u043a\u0430, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u044b. <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438 \u0432 <a href=\"https:\/\/apptractor.ru\/info\/articles\/prekratite-ispolzovat-testovye-tegi-v-jetpack-compose.html\" rel=\"noopener noreferrer nofollow\">\u043e\u0434\u043d\u043e\u0439 \u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0442\u0435\u0433\u043e\u0432 \u0438 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0438 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u0443. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d\u043e \u00ab\u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d \u043a\u043e\u0434 \u0442\u0435\u0433\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\u00bb.<\/p>\n<h3>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h3>\n<p><a href=\"https:\/\/developer.android.com\/develop\/ui\/compose\/testing\/testing-cheatsheet\" rel=\"noopener noreferrer nofollow\">https:\/\/developer.android.com\/develop\/ui\/compose\/testing\/testing-cheatsheet<\/a> (\u043d\u0430\u0433\u043b\u044f\u0434\u043d\u0430\u044f \u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0430)<\/p>\n<p><a href=\"https:\/\/developer.android.com\/codelabs\/jetpack-compose-testing\" rel=\"noopener noreferrer nofollow\">https:\/\/developer.android.com\/codelabs\/jetpack-compose-testing<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/android\/compose-samples\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/android\/compose-samples<\/a> (\u0441\u043c. \u0442\u0435\u0441\u0442\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432)<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/809127\/\"> https:\/\/habr.com\/ru\/articles\/809127\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u044f\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c UI-\u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 Compose Multiplatform, \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0430\u0441\u044c \u0441 \u0434\u0435\u0444\u0438\u0446\u0438\u0442\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435. \u0418\u0437 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u0431\u044b\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430 <a href=\"https:\/\/habr.com\/ru\/articles\/674112\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u0435\u0439<\/a> \u0438 \u0432\u044b\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0439 \u043d\u0430 \u043d\u0435\u0434\u0430\u0432\u043d\u0438\u0445 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u044f\u0445, \u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u043a \u0449\u0435\u043b\u0447\u043a\u0443 \u043f\u043e \u043a\u043d\u043e\u043f\u043a\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0447\u0442\u0438 \u043d\u0430\u0443\u0433\u0430\u0434, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f \u043a\u043e\u0434 \u0438 \u0438\u0437\u0443\u0447\u0430\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0425\u0430\u0431\u0440\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u043c\u0438\u0441\u044f \u043d\u0430\u0440\u0430\u0431\u043e\u0442\u043a\u0430\u043c\u0438.<\/p>\n<h3>\u0421\u0442\u0430\u0440\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0438 \u0435\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430<\/h3>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f SourceSet, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0434\u043e\u0445\u043e\u0434\u0447\u0438\u0432\u043e \u043e\u043f\u0438\u0441\u0430\u043d \u0432 <a href=\"https:\/\/www.jetbrains.com\/help\/kotlin-multiplatform-dev\/compose-test.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043d\u0435\u0438\u0437\u0431\u0435\u0436\u043d\u044b\u043c Hello world ?<\/p>\n<pre><code class=\"kotlin\">import androidx.compose.ui.test.assertTextEquals import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithTag import org.junit.Rule import org.junit.Test import androidx.compose.material.Text import androidx.compose.ui.Modifier import androidx.compose.ui.platform.testTag  class HelloWorld {     @get:Rule     val rule = createComposeRule()     val hello = \"Hello, World!\"      @Test     fun myTest() {         rule.setContent {             Text(                 text = hello,                 modifier = Modifier.testTag(\"text\")             )         }         rule.onNodeWithTag(\"text\").assertTextEquals(hello)     } }<\/code><\/pre>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u2013 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u041f\u0440\u0435\u0434\u0432\u0430\u0440\u044f\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <code>@get:Rule<\/code>, \u0433\u0434\u0435 <code>@Rule<\/code> \u2013 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043e\u0442 Java \u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u043a <strong>\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443<\/strong> \u043a\u043b\u0430\u0441\u0441\u0430. \u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, Kotlin \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0443\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a <strong>\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c<\/strong> \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u044f\u0432\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <strong>\u0433\u0435\u0442\u0442\u0435\u0440\u043e\u0432<\/strong>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c <code>get<\/code>, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043e\u0448\u0438\u0431\u0438\u0442\u044c\u0441\u044f \u0430\u0434\u0440\u0435\u0441\u043e\u043c.<\/p>\n<p>\u041d\u0430\u0448\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e <code>rule<\/code> \u2013 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/developer.android.com\/reference\/kotlin\/androidx\/compose\/ui\/test\/junit4\/ComposeContentTestRule\" rel=\"noopener noreferrer nofollow\">ComposeContentTestRule<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A4%D0%B0%D0%B1%D1%80%D0%B8%D1%87%D0%BD%D1%8B%D0%B9_%D0%BC%D0%B5%D1%82%D0%BE%D0%B4_(%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD_%D0%BF%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F)\" rel=\"noopener noreferrer nofollow\">\u0444\u0430\u0431\u0440\u0438\u0447\u043d\u043e\u0433\u043e<\/a> \u043c\u0435\u0442\u043e\u0434\u0430 <code>createComposeRule()<\/code>.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>myTest()<\/code>. \u041f\u0435\u0440\u0435\u0434 \u043d\u0435\u0439 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@Test<\/code>, \u0438 \u0432 IDEA \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0435\u043b\u0435\u043d\u044b\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u0441\u0442.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0435\u0441\u0442\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>setContent()<\/code> \u0437\u0430\u0434\u0430\u0435\u043c composable-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041f\u043e\u043a\u0430 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0434\u043f\u0438\u0441\u044c, \u043d\u043e \u0432\u0441\u043a\u043e\u0440\u0435 \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u044b composable \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 <code>testTag()<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0442\u0435\u0433, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043d\u0430\u0448 \u0442\u0435\u0441\u0442 \u0441\u043c\u043e\u0436\u0435\u0442 \u0435\u0433\u043e \u043d\u0430\u0439\u0442\u0438. \u041a\u0441\u0442\u0430\u0442\u0438, \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0435\u0441\u0442\u044c \u043d\u0435 \u0443 \u0432\u0441\u0435\u0445 composable \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u0430 \u0431\u0435\u0437 \u043d\u0438\u0445 \u0442\u0435\u0433\u0438 \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0439\u0434\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u043e \u043d\u0430\u0448\u0435\u043c\u0443 \u0442\u0435\u0433\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>onNodeWithTag()<\/code> \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0435\u043a\u0441\u0442 \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>hello<\/code>.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0417\u0435\u043b\u0435\u043d\u044b\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u044b \u0443\u0441\u043f\u0435\u0445\u0430<\/figcaption><\/div>\n<\/figure>\n<h2>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u043e\u0442\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f<\/h2>\n<p>\u0412 \u043d\u043e\u0432\u043e\u0439, \u043f\u043e\u043a\u0430 \u0435\u0449\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0439, \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u043e. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/developer.android.com\/reference\/kotlin\/androidx\/compose\/ui\/test\/ComposeUiTest\" rel=\"noopener noreferrer nofollow\">\u0444\u0443\u043d\u043a\u0446\u0438\u044e <\/a><code>runComposeUiTest()<\/code><em>. <\/em>\u0422\u043e\u0433\u0434\u0430 \u043d\u0430\u0448 \u0442\u0435\u0441\u0442, \u0443\u043a\u0440\u0430\u0448\u0435\u043d\u043d\u044b\u0439 \u0441\u0440\u0430\u0437\u0443  \u0434\u0432\u0443\u043c\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c\u0438, \u043f\u0440\u0438\u043c\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u0438\u0434:<\/p>\n<pre><code class=\"kotlin\">@OptIn(ExperimentalTestApi::class) @Test fun myTest() = runComposeUiTest{     setContent {         Text(             text = hello,             modifier = Modifier.testTag(\"text\")         )     }     onNodeWithTag(\"text\").assertTextEquals(hello) }<\/code><\/pre>\n<h3>\u0421\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e<\/h3>\n<p>\u0422\u0435\u0433, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e <strong>\u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430<\/strong>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0431\u043e\u0439 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 <strong>\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438<\/strong> (\u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432 Compose \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0430 \u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u2013 \u0440\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f).<\/p>\n<p>\u0422\u0435\u0433\u0438 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041e\u043d\u0438 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0442 <strong>\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u044c<\/strong> (accessibility) \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2013 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u044e.<\/p>\n<p>\u0414\u0435\u0440\u0435\u0432\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u043e\u043e\u0447\u0438\u044e:<\/p>\n<pre><code class=\"kotlin\">onRoot().printToLog(\"text\")<\/code><\/pre>\n<p>\u041f\u0440\u0430\u0432\u0434\u0430, \u043e\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0436\u0438\u0432\u043e\u043f\u0438\u0441\u043d\u043e:<\/p>\n<pre><code>text: printToLog: Printing with useUnmergedTree = 'false' Node #1 at (l=0.0, t=0.0, r=1024.0, b=768.0)px  |-Node #2 at (l=0.0, t=0.0, r=81.0, b=19.0)px, Tag: 'text'    Text = '[Hello, World!]'    Actions = [SetTextSubstitution, ShowTextSubstitution, ClearTextSubstitution, GetTextLayoutResult]<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0432 \u043d\u0430\u0448\u0435\u043c \u0434\u0435\u0440\u0435\u0432\u0435 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u2013 \u043a\u043e\u0440\u0435\u043d\u044c \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u043d\u0430\u0434\u043f\u0438\u0441\u044c.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442:<\/p>\n<pre><code class=\"kotlin\">setContent {     Text(         text = hello,         modifier = Modifier.testTag(\"text\")     )     Button(         onClick = {},         modifier = Modifier.testTag(\"button\")     ) { Text(\"Click me!\") } }<\/code><\/pre>\n<p>\u0418 \u0443\u0432\u0438\u0434\u0438\u043c, \u043a\u0430\u043a \u043f\u043e\u0434\u0440\u043e\u0441\u043b\u043e \u043d\u0430\u0448\u0435 \u0434\u0435\u0440\u0435\u0432\u0446\u0435:<\/p>\n<pre><code>text: printToLog: Printing with useUnmergedTree = 'false' Node #1 at (l=0.0, t=0.0, r=1024.0, b=768.0)px  |-Node #2 at (l=0.0, t=0.0, r=81.0, b=19.0)px, Tag: 'text'  | Text = '[Hello, World!]'  | Actions = [SetTextSubstitution, ShowTextSubstitution, ClearTextSubstitution, GetTextLayoutResult]  |-Node #3 at (l=0.0, t=6.0, r=102.0, b=42.0)px, Tag: 'button'    Focused = 'false'    Role = 'Button'    Text = '[Click me!]'    Actions = [RequestFocus, OnClick, SetTextSubstitution, ShowTextSubstitution, ClearTextSubstitution, GetTextLayoutResult]    MergeDescendants = 'true'<\/code><\/pre>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0437\u0430\u0433\u0430\u0434\u043e\u0447\u043d\u043e\u0435 <code>useUnmergedTree<\/code>. \u042d\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043c\u0435\u0442\u043e\u0434\u0430 <code>onRoot()<\/code>, \u0437\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u0430 \u2013 merged \u0438\u043b\u0438 unmerged. \u0422\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 <strong>merged tree<\/strong>: \u0432 \u043d\u0435\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u0432\u0441\u0435 \u0443\u0437\u043b\u044b, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044d\u0442\u043e \u0446\u0435\u043b\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u0448\u0430 \u043a\u043d\u043e\u043f\u043a\u0430 \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u043d\u0435\u043c \u043a\u0430\u043a \u0435\u0434\u0438\u043d\u043e\u0435 \u0446\u0435\u043b\u043e\u0435 (node #3).<\/p>\n<p>\u0410 \u0432\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 unmerged tree (<code>onRoot(useUnmergedTree = true)<\/code>):<\/p>\n<pre><code>text: printToLog: Printing with useUnmergedTree = 'true' Node #1 at (l=0.0, t=0.0, r=1024.0, b=768.0)px  |-Node #2 at (l=0.0, t=0.0, r=81.0, b=19.0)px, Tag: 'text'  | Text = '[Hello, World!]'  | Actions = [SetTextSubstitution, ShowTextSubstitution, ClearTextSubstitution, GetTextLayoutResult]  |-Node #3 at (l=0.0, t=6.0, r=102.0, b=42.0)px, Tag: 'button'    Focused = 'false'    Role = 'Button'    Actions = [RequestFocus, OnClick]    MergeDescendants = 'true'     |-Node #5 at (l=16.0, t=16.0, r=86.0, b=32.0)px       Text = '[Click me!]'       Actions = [SetTextSubstitution, ShowTextSubstitution, ClearTextSubstitution, GetTextLayoutResult]<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0432 <strong>unmerged<\/strong> \u0434\u0435\u0440\u0435\u0432\u0435 \u043a\u043d\u043e\u043f\u043a\u0430 \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043d\u0435\u0439 \u0442\u0435\u043a\u0441\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 \u0443\u0437\u043b\u044b (node #3 \u0438 node #5 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e). \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 <code>OnClick<\/code> \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043a\u043d\u043e\u043f\u043a\u0438, \u043d\u043e \u043d\u0435 \u0434\u043b\u044f \u0435\u0435 \u0442\u0435\u043a\u0441\u0442\u0430.<\/p>\n<h3>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0435\u0441\u0442\u0430<\/h3>\n<p>\u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438:<\/p>\n<pre><code class=\"kotlin\">onNodeWithTag(\"text\").assertTextEquals(hello)<\/code><\/pre>\n<p>\u041e\u043d\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443:<\/p>\n<p><code>{finder}{.assertion\/action}<\/code><\/p>\n<p><strong>Finder<\/strong> \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0432 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435 \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0437\u043b\u043e\u0432, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044e. \u041f\u0440\u0438\u043c\u0435\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><code>onNodeWithTag()<\/code><\/p>\n<\/li>\n<li>\n<p><code>onNodeWithText()<\/code><\/p>\n<\/li>\n<li>\n<p><code>onAllNodesWithTag()<\/code><\/p>\n<\/li>\n<li>\n<p><code>onAllNodesWithText()<\/code><\/p>\n<\/li>\n<\/ul>\n<p><strong>Assertion <\/strong>\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0442\u0435\u0441\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e:<\/p>\n<ul>\n<li>\n<p><code>assertExists()<\/code><\/p>\n<\/li>\n<li>\n<p><code>assertIsEnabled()<\/code><\/p>\n<\/li>\n<li>\n<p><code>assertTextContains()<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 (<strong>action<\/strong>) \u043d\u0430\u0434 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">onNodeWithTag(\"button\").performClick()<\/code><\/pre>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0438\u0434\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439:<\/p>\n<ul>\n<li>\n<p><code>performClick()<\/code><\/p>\n<\/li>\n<li>\n<p><code>performTextInput()<\/code><\/p>\n<\/li>\n<li>\n<p><code>performKeyPress()<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u0430\u0437\u043d\u043e\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u0433\u0434\u0435 \u043a finder \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442\u0441\u044f <strong>matcher<\/strong>:<\/p>\n<pre><code>{finder({matcher})}{.assertion\/action }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code>onNode(hasTestTag(\"button\")).performClick()<\/code><\/pre>\n<p>Matcher \u0437\u0430\u0434\u0430\u0435\u0442 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u043f\u043e\u0438\u0441\u043a\u0430 \u0434\u043b\u044f finder. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\n<p>hasText()<\/p>\n<\/li>\n<li>\n<p>hasTestTag()<\/p>\n<\/li>\n<li>\n<p>isDialog()<\/p>\n<\/li>\n<li>\n<p>isPopup()<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/developer.android.com\/develop\/ui\/compose\/testing\/testing-cheatsheet\" rel=\"noopener noreferrer nofollow\">\u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0435<\/a>.<\/p>\n<h3>\u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c, \u0447\u0435\u043c \u0449\u0435\u043b\u0447\u043e\u043a \u043f\u043e \u043a\u043d\u043e\u043f\u043a\u0435.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0431\u0435\u0440\u0435\u043c \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>setContent()<\/code> \u043a\u043e\u0434 \u043a\u043d\u043e\u043f\u043e\u043a \u0438 \u043d\u0430\u0434\u043f\u0438\u0441\u0435\u0439. \u041e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043b\u0438\u0448\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u0443 composable \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0433\u0434\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">@OptIn(ExperimentalTestApi::class) class HelloWorld {     val hello = \"Hello, World!\"      private fun ComposeUiTest.launchContent() {         setContent {             MyWindow()         }     }      @Test     fun `Test my window`() = runComposeUiTest {         launchContent()         onNodeWithTag(\"my_tag\").assertExists()     } }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>ComposeUiTest<\/code> \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <code>launchContent()<\/code> \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043b\u0438 \u0432 \u043d\u0435\u0435 \u043a\u043e\u0434 \u0432\u044b\u0437\u043e\u0432\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0430\u0448\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0437\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. <\/p>\n<p>Kotlin \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0432 \u0438\u043c\u0435\u043d\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0435\u0441\u043b\u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0435 \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0438. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0432\u043e\u0434\u043a\u0443 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0447\u0442\u0438 \u043d\u0430 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0422\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u044b<\/figcaption><\/div>\n<\/figure>\n<h4>\u0422\u0435\u0441\u0442 \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0430<\/h4>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0430\u0439\u0434\u0435\u0440 \u0441 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043e\u0442 1 \u0434\u043e <code>max<\/code> \u0438 \u0448\u0438\u0440\u0438\u043d\u043e\u0439 <code>width<\/code>.<\/p>\n<pre><code class=\"kotlin\">@Composable fun MySlider() {     var x by remember { mutableStateOf(max.toFloat()) }      Slider(         value = x,         valueRange = 1f..max.toFloat(),         onValueChange = { x = it },         steps = max - 2,         modifier = Modifier.width(width)             .testTag(\"my_slider\")     )     Text(\"${x.toInt()}\",         modifier = Modifier.testTag(\"my_text\")) }<\/code><\/pre>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>steps<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u043d\u0430 \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0435. \u041f\u0440\u0438 <code>steps = 0<\/code> \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u0443\u044e \u0448\u043a\u0430\u043b\u0443, \u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0448\u043a\u0430\u043b\u0430 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u0430\u044f. \u0414\u043b\u044f \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 <code>[1..max]<\/code>, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u043e\u0431\u0435 \u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u0441\u043b\u0430\u0439\u0434\u0435\u0440 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0440\u043e\u0432\u043d\u043e <code>max<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0432\u0430 \u2013 \u044d\u0442\u043e \u0441\u0430\u043c\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b 1 \u0438 <code>max<\/code>, \u0430 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 <code>max-2<\/code> \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u0435\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0437\u0443\u043d\u043a\u0430 \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0430 <code>it<\/code> \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 <code>x<\/code>, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>remember()<\/code>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u043d\u0430\u0434\u043f\u0438\u0441\u0438 \u0440\u043e\u0432\u043d\u043e \u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>x<\/code>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043e \u043d\u0430 \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u041e\u0444\u0444\u0442\u043e\u043f<\/summary>\n<div class=\"spoiler__content\">\n<p><a href=\"https:\/\/developer.android.com\/develop\/ui\/compose\/state\" rel=\"noopener noreferrer nofollow\">\u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e<\/a>, \u0434\u0435\u043b\u0435\u0433\u0430\u0442 <code>by<\/code> \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u0432\u0443\u0445 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432 \u2013 <code>getValue()<\/code> \u0438 <code>setValue()<\/code>. \u0412 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 <code>remember<\/code> \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043a\u043e\u0434\u0430 \u043c\u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f:<\/p>\n<blockquote>\n<p><em>Remember, remember the fifth of November,<\/em><\/p>\n<p><em>Gunpowder treason and plot\u2026<\/em><\/p>\n<\/blockquote>\n<\/div>\n<\/details>\n<p>\u041a \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0443 \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u043d\u0430\u0434\u043f\u0438\u0441\u0438 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0442\u0435\u0433\u0438 <code>myslider<\/code> \u0438 <code>mytext<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043d\u0438\u043c \u0438\u0437 \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0443 \u043f\u043e \u0442\u0435\u0433\u0443<\/p>\n<pre><code class=\"kotlin\">onNodeWithTag(\"my_slider\")<\/code><\/pre>\n<p>\u043d\u0430\u0441 \u0436\u0434\u0435\u0442 \u043a\u0443\u043b\u044c\u0442\u0443\u0440\u043d\u044b\u0439 \u0448\u043e\u043a \u043e\u0442 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u044b\u0445 actions. \u041f\u043e \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c \u0438\u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u044c \u043a\u043b\u0430\u0432\u0438\u0448\u0443 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435.<\/p>\n<p>\u041a\u0430\u043a \u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u0442\u0435\u0441\u0442\u0430? \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0430 \u0437\u0430\u0446\u0435\u043f\u0438\u0442\u044c\u0441\u044f \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2013 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b.<\/p>\n<pre><code class=\"kotlin\">onNodeWithTag(\"my_slider\")     .performKeyPress(KeyEvent.VK_PAGE_DOWN)<\/code><\/pre>\n<p>\u0423\u0432\u044b, \u044d\u0442\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. <code>VK_PAGE_DOWN<\/code>\u00a0\u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f <code>Int<\/code>, \u0430 \u043d\u0435 <code>KeyEvent<\/code>.<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-374181","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/374181","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=374181"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/374181\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=374181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=374181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=374181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}