1
1
package io .kafbat .ui .screens .topics ;
2
2
3
+ import static com .codeborne .selenide .Condition .enabled ;
3
4
import static com .codeborne .selenide .Selenide .$ ;
4
5
import static com .codeborne .selenide .Selenide .$$ ;
5
6
import static com .codeborne .selenide .Selenide .$x ;
17
18
import io .kafbat .ui .screens .topics .enums .TimeToRetain ;
18
19
import io .kafbat .ui .utilities .WebUtil ;
19
20
import io .qameta .allure .Step ;
21
+ import org .openqa .selenium .Keys ;
20
22
21
23
public class TopicCreateEditForm extends BasePage {
22
24
@@ -32,7 +34,7 @@ public class TopicCreateEditForm extends BasePage {
32
34
protected SelenideElement customParameterDdl = $x ("//input[contains(@name, 'customParams')][@role='listitem']" );
33
35
protected SelenideElement deleteCustomParameterBtn = $x ("//span[contains(@title, 'Delete customParam')]" );
34
36
protected SelenideElement addCustomParameterTypeBtn = $x ("//button[contains(text(), 'Add Custom Parameter')]" );
35
- protected SelenideElement customParameterValueField = $x ("//input[@placeholder ='Value'] " );
37
+ protected SelenideElement customParameterValueField = $x ("//label[text() ='Value *']/..//input " );
36
38
protected SelenideElement validationCustomParameterValueMsg = $x ("//p[contains(text(), 'Value is required')]" );
37
39
protected String ddlElementLocator = "//li[@value='%s']" ;
38
40
protected String btnTimeToRetainLocator = "//button[@class][text()='%s']" ;
@@ -116,20 +118,27 @@ public TopicCreateEditForm setCustomParameterType(CustomParameterType customPara
116
118
117
119
@ Step
118
120
public TopicCreateEditForm clearCustomParameterValue () {
119
- WebUtil .clearByKeyboard (customParameterValueField );
121
+ customParameterValueField .shouldBe (enabled ).sendKeys (Keys .END );
122
+ String value = customParameterValueField .getValue ();
123
+ int valueLength = value != null
124
+ ? value .length ()
125
+ : 0 ;
126
+ for (int i = 0 ; i < valueLength ; i ++) {
127
+ customParameterValueField .sendKeys (Keys .BACK_SPACE );
128
+ }
120
129
return this ;
121
130
}
122
131
123
132
@ Step
124
133
public TopicCreateEditForm setNumberOfPartitions (int partitions ) {
125
- partitionsField .shouldBe (Condition . enabled ).clear ();
134
+ partitionsField .shouldBe (enabled ).clear ();
126
135
partitionsField .sendKeys (String .valueOf (partitions ));
127
136
return this ;
128
137
}
129
138
130
139
@ Step
131
140
public TopicCreateEditForm setTimeToRetainDataByButtons (TimeToRetain timeToRetain ) {
132
- $x (String .format (btnTimeToRetainLocator , timeToRetain .getButton ())).shouldBe (Condition . enabled ).click ();
141
+ $x (String .format (btnTimeToRetainLocator , timeToRetain .getButton ())).shouldBe (enabled ).click ();
133
142
return this ;
134
143
}
135
144
0 commit comments