From d6df59d8d5ba9134056584d8502920ac0a94d468 Mon Sep 17 00:00:00 2001 From: Andrea Vinci Date: Sun, 15 Nov 2020 09:52:39 +0000 Subject: [PATCH] Add refresh button (#138) * Cache list topic in cluster scope * Add refresh button * Add test refresh button in topic list * Add test for refresh schema registry list * Fix PR lint * Add unit test for register schema * Remove code duplication * Rename buttons * Fix text in button alignment Co-authored-by: Auto Lint --- .../integrationtest/RefreshButtonTests.kt | 64 +++++++++++++++++++ .../helpers/IntegrationTestFixture.kt | 35 ++++++++-- .../kotlin/insulator/ui/component/AppBar.kt | 28 ++++++-- .../kotlin/insulator/ui/style/AppBarStyle.kt | 6 +- .../main/topic/ListTopicViewModel.kt | 2 + .../kotlin/insulator/views/main/MainView.kt | 7 +- .../main/schemaregistry/ListSchemaView.kt | 23 ++++--- .../views/main/schemaregistry/SchemaView.kt | 9 +-- .../views/main/topic/ListTopicView.kt | 23 +++++-- .../views/main/topic/ProducerView.kt | 3 +- .../insulator/views/main/topic/TopicView.kt | 12 ++-- .../kotlin/insulator/kafka/SchemaRegistry.kt | 5 ++ .../insulator/kafka/SchemaRegistryTest.kt | 28 ++++++++ 13 files changed, 198 insertions(+), 47 deletions(-) create mode 100644 app/src/integrationTest/kotlin/insulator/integrationtest/RefreshButtonTests.kt diff --git a/app/src/integrationTest/kotlin/insulator/integrationtest/RefreshButtonTests.kt b/app/src/integrationTest/kotlin/insulator/integrationtest/RefreshButtonTests.kt new file mode 100644 index 00000000..4ed3b6fe --- /dev/null +++ b/app/src/integrationTest/kotlin/insulator/integrationtest/RefreshButtonTests.kt @@ -0,0 +1,64 @@ +package insulator.integrationtest + +import insulator.integrationtest.helpers.IntegrationTestFixture +import insulator.integrationtest.helpers.click +import insulator.integrationtest.helpers.lookupFirst +import insulator.integrationtest.helpers.screenShoot +import insulator.integrationtest.helpers.selectCluster +import insulator.integrationtest.helpers.waitWindowWithTitle +import io.kotest.core.spec.style.FreeSpec +import io.kotest.matchers.shouldBe +import javafx.scene.Node +import javafx.scene.control.Button +import javafx.scene.control.Label +import javafx.scene.control.ListView +import kotlinx.coroutines.delay +import tornadofx.CssRule +import tornadofx.Stylesheet.Companion.listView +import kotlin.time.ExperimentalTime + +@ExperimentalTime +class RefreshButtonTests : FreeSpec({ + + "Test refresh topic button" - { + IntegrationTestFixture().use { fixture -> + fixture.startAppWithKafkaCuster("Test cluster") + selectCluster(fixture.currentKafkaCluster) + + val mainView = waitWindowWithTitle("Insulator") + suspend fun getListViewItems() = mainView.lookupFirst>(listView).items + + "Refresh topic list" { + val topicName = "test-new-topic" + // create topic + fixture.createTopic(topicName) + delay(1_000) + // the topic shouldn't be visible + getListViewItems().count { it == topicName } shouldBe 0 + // click the refresh button wil load the new topic + mainView.lookupFirst