|
1 | 1 | package com.github.streamshub.systemtests.messages; |
2 | 2 |
|
| 3 | +import java.time.Instant; |
| 4 | +import java.time.OffsetDateTime; |
| 5 | +import java.time.ZoneId; |
| 6 | +import java.time.ZoneOffset; |
| 7 | +import java.time.format.DateTimeFormatter; |
| 8 | +import java.util.Map; |
| 9 | +import java.util.stream.Stream; |
| 10 | + |
| 11 | +import org.apache.kafka.common.security.auth.SecurityProtocol; |
| 12 | +import org.apache.logging.log4j.Logger; |
| 13 | +import org.junit.jupiter.api.AfterAll; |
| 14 | +import org.junit.jupiter.api.BeforeAll; |
| 15 | +import org.junit.jupiter.api.Tag; |
| 16 | +import org.junit.jupiter.api.Test; |
| 17 | +import org.junit.jupiter.params.ParameterizedTest; |
| 18 | +import org.junit.jupiter.params.provider.Arguments; |
| 19 | +import org.junit.jupiter.params.provider.MethodSource; |
| 20 | + |
3 | 21 | import com.github.streamshub.systemtests.AbstractST; |
4 | 22 | import com.github.streamshub.systemtests.MessageStore; |
5 | 23 | import com.github.streamshub.systemtests.TestCaseConfig; |
|
24 | 42 | import com.github.streamshub.systemtests.utils.resourceutils.kafka.KafkaTopicUtils; |
25 | 43 | import com.github.streamshub.systemtests.utils.resourceutils.kafka.KafkaUtils; |
26 | 44 | import com.github.streamshub.systemtests.utils.testchecks.MessagesChecks; |
27 | | -import io.skodjob.kubetest4j.resources.KubeResourceManager; |
28 | | -import org.apache.kafka.common.security.auth.SecurityProtocol; |
29 | | -import org.apache.logging.log4j.Logger; |
30 | | -import org.junit.jupiter.api.AfterAll; |
31 | | -import org.junit.jupiter.api.BeforeAll; |
32 | | -import org.junit.jupiter.api.Tag; |
33 | | -import org.junit.jupiter.api.Test; |
34 | | -import org.junit.jupiter.params.ParameterizedTest; |
35 | | -import org.junit.jupiter.params.provider.Arguments; |
36 | | -import org.junit.jupiter.params.provider.MethodSource; |
| 45 | +import com.microsoft.playwright.Page.GetByRoleOptions; |
| 46 | +import com.microsoft.playwright.assertions.LocatorAssertions.ContainsTextOptions; |
| 47 | +import com.microsoft.playwright.assertions.PlaywrightAssertions; |
| 48 | +import com.microsoft.playwright.options.AriaRole; |
37 | 49 |
|
38 | | -import java.time.Instant; |
39 | | -import java.time.OffsetDateTime; |
40 | | -import java.time.ZoneId; |
41 | | -import java.time.ZoneOffset; |
42 | | -import java.time.format.DateTimeFormatter; |
43 | | -import java.util.Map; |
44 | | -import java.util.stream.Stream; |
| 50 | +import io.skodjob.kubetest4j.resources.KubeResourceManager; |
45 | 51 |
|
46 | 52 | import static com.github.streamshub.systemtests.utils.Utils.getTestCaseConfig; |
47 | 53 | import static org.junit.jupiter.api.Assertions.assertTrue; |
@@ -319,8 +325,12 @@ void testFilterMessagesUsingUIForm() { |
319 | 325 | PwUtils.navigate(tcc, PwPageUrls.getMessagesPage(tcc, tcc.kafkaName(), topicId)); |
320 | 326 |
|
321 | 327 | LOGGER.info("Wait for page toolbar to be fully loaded before filtering"); |
322 | | - PwUtils.waitForContainsText(tcc, CssSelectors.PAGES_CONTENT_HEADER_TITLE_CONTENT, kafkaTopicName, true); |
323 | | - PwUtils.waitForLocatorVisible(tcc, MessagesPageSelectors.MPS_SEARCH_TOOLBAR_QUERY_INPUT); |
| 328 | + PlaywrightAssertions.assertThat(tcc.page().getByRole(AriaRole.HEADING, new GetByRoleOptions().setLevel(1))) |
| 329 | + .containsText(kafkaTopicName, new ContainsTextOptions().setTimeout(20000)); |
| 330 | + PlaywrightAssertions.assertThat(tcc.page().getByPlaceholder("Search")).isVisible(); |
| 331 | + |
| 332 | + //PwUtils.waitForContainsText(tcc, CssSelectors.PAGES_CONTENT_HEADER_TITLE_CONTENT, kafkaTopicName, true); |
| 333 | + //PwUtils.waitForLocatorVisible(tcc, MessagesPageSelectors.MPS_SEARCH_TOOLBAR_QUERY_INPUT); |
324 | 334 |
|
325 | 335 | LOGGER.info("Verify default state of displayed messages"); |
326 | 336 | PwUtils.waitForLocatorCount(tcc, 50, MessagesPageSelectors.MPS_SEARCH_RESULTS_TABLE_ITEMS, true); |
@@ -445,37 +455,51 @@ public void prepareVariousMessageTypes() { |
445 | 455 |
|
446 | 456 | // Setup UI form filtering |
447 | 457 | // First set clients to send messages with KEY |
448 | | - KafkaClients clients = new KafkaClientsBuilder() |
| 458 | + KafkaClients clients1 = new KafkaClientsBuilder() |
449 | 459 | .withNamespaceName(tcc.namespace()) |
450 | 460 | .withTopicName(kafkaTopicName) |
451 | 461 | .withMessageCount(MESSAGE_COUNT) |
452 | 462 | .withDelayMs(0) |
453 | | - .withProducerName(KafkaNamingUtils.producerName(kafkaTopicName)) |
454 | | - .withConsumerName(KafkaNamingUtils.consumerName(kafkaTopicName)) |
455 | | - .withConsumerGroup(KafkaNamingUtils.consumerGroupName(kafkaTopicName)) |
| 463 | + .withProducerName(KafkaNamingUtils.producerName(kafkaTopicName) + "-1") |
| 464 | + .withConsumerName(KafkaNamingUtils.consumerName(kafkaTopicName) + "-1") |
| 465 | + .withConsumerGroup(KafkaNamingUtils.consumerGroupName(kafkaTopicName) + "-1") |
456 | 466 | .withBootstrapAddress(KafkaUtils.getPlainScramShaBootstrapAddress(tcc.kafkaName())) |
457 | 467 | .withUsername(tcc.kafkaUserName()) |
458 | 468 | .withMessage(KEY_FILTER_MESSAGE) |
459 | 469 | .withMessageKey(KEY_FILTER) |
460 | 470 | .withAdditionalConfig(KafkaClientsUtils.getScramShaConfig(tcc.namespace(), tcc.kafkaUserName(), SecurityProtocol.SASL_PLAINTEXT)) |
461 | 471 | .build(); |
462 | 472 |
|
463 | | - KubeResourceManager.get().createResourceWithWait(clients.producer(), clients.consumer()); |
464 | | - WaitUtils.waitForClientsSuccess(clients); |
465 | | - |
466 | 473 | // create second set of messages with different HEADER and MESSAGE |
467 | | - clients.setMessageKey("NoDataInKey-True"); |
468 | | - clients.setHeaders(HEADER_FILTER); |
469 | | - clients.setMessage(HEADER_FILTER_MESSAGE); |
| 474 | + KafkaClients clients2 = new KafkaClientsBuilder(clients1) |
| 475 | + .withProducerName(KafkaNamingUtils.producerName(kafkaTopicName) + "-2") |
| 476 | + .withConsumerName(KafkaNamingUtils.consumerName(kafkaTopicName) + "-2") |
| 477 | + .withConsumerGroup(KafkaNamingUtils.consumerGroupName(kafkaTopicName) + "-2") |
| 478 | + .withMessageKey("NoDataInKey-True") |
| 479 | + .withHeaders(HEADER_FILTER) |
| 480 | + .withMessage(HEADER_FILTER_MESSAGE) |
| 481 | + .build(); |
470 | 482 |
|
471 | | - KubeResourceManager.get().createResourceWithWait(clients.producer(), clients.consumer()); |
472 | | - WaitUtils.waitForClientsSuccess(clients); |
473 | 483 | // create third set of messages with different MESSAGE |
474 | | - clients.setHeaders("NoDataInHeader=true"); |
475 | | - clients.setMessage(VALUE_FILTER); |
476 | | - |
477 | | - KubeResourceManager.get().createResourceWithWait(clients.producer(), clients.consumer()); |
478 | | - WaitUtils.waitForClientsSuccess(clients); |
| 484 | + KafkaClients clients3 = new KafkaClientsBuilder(clients2) |
| 485 | + .withProducerName(KafkaNamingUtils.producerName(kafkaTopicName) + "-3") |
| 486 | + .withConsumerName(KafkaNamingUtils.consumerName(kafkaTopicName) + "-3") |
| 487 | + .withConsumerGroup(KafkaNamingUtils.consumerGroupName(kafkaTopicName) + "-3") |
| 488 | + .withHeaders("NoDataInHeader=true") |
| 489 | + .withMessage(VALUE_FILTER) |
| 490 | + .build(); |
| 491 | + |
| 492 | + KubeResourceManager.get().createOrUpdateResourceAsyncWait( |
| 493 | + clients1.producer(), |
| 494 | + clients1.consumer(), |
| 495 | + clients2.producer(), |
| 496 | + clients2.consumer(), |
| 497 | + clients3.producer(), |
| 498 | + clients3.consumer() |
| 499 | + ); |
| 500 | + WaitUtils.waitForClientsSuccess(clients1); |
| 501 | + WaitUtils.waitForClientsSuccess(clients2); |
| 502 | + WaitUtils.waitForClientsSuccess(clients3); |
479 | 503 | LOGGER.info("Filtering scenario prepared"); |
480 | 504 | } |
481 | 505 |
|
|
0 commit comments