|
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 | | - |
21 | 3 | import com.github.streamshub.systemtests.AbstractST; |
22 | 4 | import com.github.streamshub.systemtests.MessageStore; |
23 | 5 | import com.github.streamshub.systemtests.TestCaseConfig; |
|
42 | 24 | import com.github.streamshub.systemtests.utils.resourceutils.kafka.KafkaTopicUtils; |
43 | 25 | import com.github.streamshub.systemtests.utils.resourceutils.kafka.KafkaUtils; |
44 | 26 | import com.github.streamshub.systemtests.utils.testchecks.MessagesChecks; |
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; |
49 | | - |
50 | 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; |
| 37 | + |
| 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; |
51 | 45 |
|
52 | 46 | import static com.github.streamshub.systemtests.utils.Utils.getTestCaseConfig; |
53 | 47 | import static org.junit.jupiter.api.Assertions.assertTrue; |
@@ -325,12 +319,8 @@ void testFilterMessagesUsingUIForm() { |
325 | 319 | PwUtils.navigate(tcc, PwPageUrls.getMessagesPage(tcc, tcc.kafkaName(), topicId)); |
326 | 320 |
|
327 | 321 | LOGGER.info("Wait for page toolbar to be fully loaded before filtering"); |
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); |
| 322 | + PwUtils.waitForContainsText(tcc, CssSelectors.PAGES_CONTENT_HEADER_TITLE_CONTENT, kafkaTopicName, true); |
| 323 | + PwUtils.waitForLocatorVisible(tcc, MessagesPageSelectors.MPS_SEARCH_TOOLBAR_QUERY_INPUT); |
334 | 324 |
|
335 | 325 | LOGGER.info("Verify default state of displayed messages"); |
336 | 326 | PwUtils.waitForLocatorCount(tcc, 50, MessagesPageSelectors.MPS_SEARCH_RESULTS_TABLE_ITEMS, true); |
@@ -455,51 +445,37 @@ public void prepareVariousMessageTypes() { |
455 | 445 |
|
456 | 446 | // Setup UI form filtering |
457 | 447 | // First set clients to send messages with KEY |
458 | | - KafkaClients clients1 = new KafkaClientsBuilder() |
| 448 | + KafkaClients clients = new KafkaClientsBuilder() |
459 | 449 | .withNamespaceName(tcc.namespace()) |
460 | 450 | .withTopicName(kafkaTopicName) |
461 | 451 | .withMessageCount(MESSAGE_COUNT) |
462 | 452 | .withDelayMs(0) |
463 | | - .withProducerName(KafkaNamingUtils.producerName(kafkaTopicName) + "-1") |
464 | | - .withConsumerName(KafkaNamingUtils.consumerName(kafkaTopicName) + "-1") |
465 | | - .withConsumerGroup(KafkaNamingUtils.consumerGroupName(kafkaTopicName) + "-1") |
| 453 | + .withProducerName(KafkaNamingUtils.producerName(kafkaTopicName)) |
| 454 | + .withConsumerName(KafkaNamingUtils.consumerName(kafkaTopicName)) |
| 455 | + .withConsumerGroup(KafkaNamingUtils.consumerGroupName(kafkaTopicName)) |
466 | 456 | .withBootstrapAddress(KafkaUtils.getPlainScramShaBootstrapAddress(tcc.kafkaName())) |
467 | 457 | .withUsername(tcc.kafkaUserName()) |
468 | 458 | .withMessage(KEY_FILTER_MESSAGE) |
469 | 459 | .withMessageKey(KEY_FILTER) |
470 | 460 | .withAdditionalConfig(KafkaClientsUtils.getScramShaConfig(tcc.namespace(), tcc.kafkaUserName(), SecurityProtocol.SASL_PLAINTEXT)) |
471 | 461 | .build(); |
472 | 462 |
|
| 463 | + KubeResourceManager.get().createResourceWithWait(clients.producer(), clients.consumer()); |
| 464 | + WaitUtils.waitForClientsSuccess(clients); |
| 465 | + |
473 | 466 | // create second set of messages with different HEADER and 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(); |
| 467 | + clients.setMessageKey("NoDataInKey-True"); |
| 468 | + clients.setHeaders(HEADER_FILTER); |
| 469 | + clients.setMessage(HEADER_FILTER_MESSAGE); |
482 | 470 |
|
| 471 | + KubeResourceManager.get().createResourceWithWait(clients.producer(), clients.consumer()); |
| 472 | + WaitUtils.waitForClientsSuccess(clients); |
483 | 473 | // create third set of messages with different MESSAGE |
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); |
| 474 | + clients.setHeaders("NoDataInHeader=true"); |
| 475 | + clients.setMessage(VALUE_FILTER); |
| 476 | + |
| 477 | + KubeResourceManager.get().createResourceWithWait(clients.producer(), clients.consumer()); |
| 478 | + WaitUtils.waitForClientsSuccess(clients); |
503 | 479 | LOGGER.info("Filtering scenario prepared"); |
504 | 480 | } |
505 | 481 |
|
|
0 commit comments