Skip to content

Commit 5b5b14c

Browse files
committed
Topics finished
1 parent 971f78a commit 5b5b14c

File tree

9 files changed

+144
-5
lines changed

9 files changed

+144
-5
lines changed

e2e-playwright/src/features/TopicsCreate.feature renamed to e2e-playwright/src/features/TopicsActions.feature

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,19 @@ Feature: TopicsCreate page
5151
Then TopicCreate TimeToRetainData value is: "604800000"
5252
When TopicCreate 4Weeks button clicked
5353
Then TopicCreate TimeToRetainData value is: "2419200000"
54+
55+
Scenario: Topic Delete
56+
Given Topics is visible
57+
When click on Topics link
58+
Given Topics AddATopic clicked
59+
Given TopicCreate heading visible is: "true"
60+
When TopicCreate Topic name starts with: "NewAutoTopic"
61+
When TopicCreate Number of partitons: 1
62+
When TopicCreate Time to retain data one day
63+
When TopicCreate Create topic clicked
64+
Then Header starts with: "NewAutoTopic"
65+
When click on Topics link
66+
Then Topic name started with: "NewAutoTopic" visible is: "true"
67+
When Topic name started with: "NewAutoTopic" RemoveTopic clicked
68+
Then Topic name started with: "NewAutoTopic" visible is: "false"
69+

e2e-playwright/src/features/TopicsMessages.feature

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ Feature: Produce Messages page
9292
Then TopicName messages count is "2"
9393
When TopicName clear messages clicked
9494
Then TopicName messages count is "0"
95-
9695
Given Produce message clicked
9796
Given ProduceMessage Key input is: "keyFromAutotest3"
9897
Given ProduceMessage Value input is: "ValueFromAutotest3"
@@ -108,7 +107,6 @@ Feature: Produce Messages page
108107
When TopicName menu button clicked
109108
When TopicName menu clear messages clicked
110109
Then TopicName messages count is "0"
111-
112110
Given Produce message clicked
113111
Given ProduceMessage Key input is: "keyFromAutotest5"
114112
Given ProduceMessage Value input is: "ValueFromAutotest5"
@@ -124,10 +122,46 @@ Feature: Produce Messages page
124122
When TopicName menu button clicked
125123
When TopicName menu RecreateTopic clicked
126124
Then TopicName messages count is "0"
127-
128125
Given Produce message clicked
129126
Given ProduceMessage Key input is: "keyFromAutotest7"
130127
Given ProduceMessage Value input is: "ValueFromAutotest7"
131128
Given ProduceMessage Headers input key is: "headerKey7", value is: "headerValue7"
132129
Given ProduceMessage Produce Message button clicked
133-
Then TopicName messages count is "1"
130+
Then TopicName messages count is "1"
131+
132+
133+
Scenario: Topic message filter
134+
Given Topics is visible
135+
When click on Topics link
136+
Given Topics AddATopic clicked
137+
Given TopicCreate heading visible is: "true"
138+
When TopicCreate Topic name starts with: "ANewAutoTopic"
139+
When TopicCreate Number of partitons: 1
140+
When TopicCreate Time to retain data one day
141+
When TopicCreate Create topic clicked
142+
Then Header starts with: "ANewAutoTopic"
143+
Given Produce message clicked
144+
Then ProduceMessage header visible
145+
Given ProduceMessage Key input is: "keyFromAutotest"
146+
Given ProduceMessage Value input template Json
147+
Given ProduceMessage Headers input key is: "headerKey", value is: "headerValue"
148+
Given ProduceMessage Produce Message button clicked
149+
When Topics TopicName Messages clicked
150+
Given Topics TopicName AddFilters button click
151+
Given Topics TopicName AddFilter visible is: "true"
152+
Given Topics TopicName AddFilter filterCode Json value is: "2"
153+
Given Topics TopicName AddFilter display name starts with: "Filter"
154+
When Topics TopicName AddFilter button click
155+
Then Topics TopicName Messages filter name starts with: "Filter" visible is: "true"
156+
Then Topics TopicName Messages exist is: "true"
157+
158+
159+
Given Topics TopicName Messages edit filter button click
160+
Given Topics TopicName AddFilter filterCode change value is: "3"
161+
Then Topics TopicName AddFilter EditFilter button click
162+
163+
Then Topics TopicName Messages filter name starts with: "Filter" visible is: "true"
164+
Then Topics TopicName Messages exist is: "false"
165+
166+
167+

e2e-playwright/src/pages/Topics/TopicsLocators.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export default class TopicsLocators {
1717
get copySelectedTopicButton(): Locator { return this.page.getByRole('button', { name: 'Copy selected topic' }); }
1818
get purgeMessagesOfSelectedTopicsButton(): Locator { return this.page.getByRole('button', { name: 'Purge messages of selected' }); }
1919
get selectAllCheckBox(): Locator { return this.page.getByRole('row', { name: 'Topic Name Partitions Out of' }).getByRole('checkbox'); }
20+
get topicMenuItemRemove(): Locator { return this.page.getByRole('menuitem', { name: 'Remove Topic' }).locator('div'); }
21+
get topicApproveWindowConfirm(): Locator { return this.page.getByRole('button', { name: 'Confirm' }); }
22+
2023
rowCheckBox(message: string): Locator { return this.page.getByRole('row', { name: message }).getByRole('checkbox'); }
2124
nameLink(value: string): Locator { return this.page.getByRole('link', { name: value }); }
25+
topicMenu(value: string): Locator { return this.page.getByRole('row', { name: `${value} 1 0 1 0 0 Bytes` }).getByLabel('Dropdown Toggle'); }
2226
}

e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ export default class TopicsTopickNameLocators {
2929
get clearMessages():Locator { return this.page.getByText('Clear Messages', { exact: true }) }
3030
get deleteSuccess():Locator { return this.page.getByRole('heading', { name: 'Success' }) }
3131

32+
get addFilters():Locator { return this.page.getByRole('button', { name: 'Add Filters' }) }
33+
get addFilterHead():Locator { return this.page.getByText('Add Filter').nth(1) }
34+
get addFilterFilterCode():Locator { return this.page.locator('.ace_content').first() }
35+
get addFilterFilterCodeInput():Locator { return this.page.getByRole('form', { name: 'Filters submit Form' }).locator('textarea') }
36+
get addFilterDisplayName():Locator { return this.page.getByRole('textbox', { name: 'Enter Name' }) }
37+
get addFilterButton():Locator { return this.page.getByRole('button', { name: 'Add Filter', exact: true }) }
38+
get cellExists():Locator { return this.page.getByRole('cell', { name: '0', exact: true }).first() }
39+
get editFilter():Locator { return this.page.getByTestId('activeSmartFilter').getByRole('button', { name: 'Edit' }) }
40+
get editFilterButton():Locator { return this.page.getByRole('button', { name: 'Edit Filter' }) }
41+
3242
heading(topicName: string): Locator { return this.page.getByText(`Topics${topicName}`); }
3343
partitions(value: string):Locator { return this.page.getByRole('group').getByText(value).first(); }
3444
messageKey(value: string):Locator { return this.page.getByText(value, { exact: true }); }
@@ -39,6 +49,6 @@ export default class TopicsTopickNameLocators {
3949
messageHeadersTextbox(value: string):Locator { return this.page.locator('div').filter({ hasText: value }).nth(1); }
4050

4151
cleanupPolicyDropdownItem(value: string):Locator { return this.page.getByRole('option', { name: value, exact: true }); }
42-
4352
messagesCount(value: string):Locator { return this.page.getByText(`Message Count ${value}`); }
53+
filterName(value: string):Locator { return this.page.getByTestId('activeSmartFilter').getByText(value); }
4454
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const jsonFilter = (value : string):string => {
2+
return `record.value.value.internalValue == ${value}`;
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const getBlankJson = '{"name":"Name","value":{"internalValue":2}}';

e2e-playwright/src/steps/ProduceMessages.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber";
33
import { expect } from "@playwright/test";
44
import { expectVisibility, expectVisuallyActive, refreshPageAfterDelay } from "../services/uiHelper";
55
import { PlaywrightWorld } from "../support/PlaywrightWorld";
6+
import { getBlankJson } from "../services/templateJsons"
7+
import { jsonFilter } from "../services/filters"
68

79
setDefaultTimeout(60 * 1000 * 4);
810

@@ -54,6 +56,15 @@ Given('ProduceMessage Value input is: {string}', async function(this: Playwright
5456
expect(actualValue).toContain(value);
5557
});
5658

59+
Given('ProduceMessage Value input template Json', async function(this: PlaywrightWorld) {
60+
const value = getBlankJson
61+
const textbox = this.locators.produceMessage.valueTextbox;
62+
await textbox.fill(value);
63+
64+
const actualValue = await textbox.inputValue();
65+
expect(actualValue).toContain(value);
66+
});
67+
5768
Given('ProduceMessage Headers input key is: {string}, value is: {string}', async function(this: PlaywrightWorld, key: string, value: string) {
5869
const header = `{"${key}":"${value}"}`;
5970
const textbox = this.locators.produceMessage.headersTextbox;
@@ -133,4 +144,49 @@ When('TopicName menu clear messages clicked', async function(this: PlaywrightWor
133144
When('TopicName menu RecreateTopic clicked', async function(this: PlaywrightWorld) {
134145
await this.locators.topicTopicName.menuItemRecreateTopic.click();
135146
await this.locators.topicTopicName.confirm.click();
147+
});
148+
149+
Given('Topics TopicName AddFilters button click', async function(this: PlaywrightWorld) {
150+
await this.locators.topicTopicName.addFilters.click();
151+
});
152+
153+
Given('Topics TopicName AddFilter visible is: {string}', async function(this: PlaywrightWorld, visible: string) {
154+
await expectVisibility(this.locators.topicTopicName.addFilterHead, "true");
155+
});
156+
157+
Given('Topics TopicName AddFilter filterCode Json value is: {string}', async function(this: PlaywrightWorld, value: string) {
158+
const filter = jsonFilter(value);
159+
await this.locators.topicTopicName.addFilterFilterCode.click();
160+
const input = this.locators.topicTopicName.addFilterFilterCodeInput;
161+
await input.fill(filter);
162+
});
163+
164+
Given('Topics TopicName AddFilter filterCode change value is: {string}', async function(this: PlaywrightWorld, newValue: string) {
165+
await this.locators.topicTopicName.addFilterFilterCode.click();
166+
await this.locators.topicTopicName.addFilterFilterCodeInput.press('Backspace');
167+
await this.locators.topicTopicName.addFilterFilterCodeInput.type(newValue);
168+
});
169+
170+
Given('Topics TopicName AddFilter display name starts with: {string}', async function(this: PlaywrightWorld, namePrefix: string) {
171+
await this.locators.topicTopicName.addFilterDisplayName.fill(namePrefix);
172+
});
173+
174+
When('Topics TopicName AddFilter button click', async function(this: PlaywrightWorld) {
175+
await this.locators.topicTopicName.addFilterButton.click();
176+
});
177+
178+
Then('Topics TopicName Messages filter name starts with: {string} visible is: {string}', async function(this: PlaywrightWorld, namePrefix: string, visible: string) {
179+
await expectVisibility( this.locators.topicTopicName.filterName(namePrefix), visible);
180+
});
181+
182+
Then('Topics TopicName Messages exist is: {string}', async function(this: PlaywrightWorld, expected: string) {
183+
await expectVisibility( this.locators.topicTopicName.cellExists, expected);
184+
});
185+
186+
Given('Topics TopicName Messages edit filter button click', async function(this: PlaywrightWorld) {
187+
await this.locators.topicTopicName.editFilter.click();
188+
});
189+
190+
Then('Topics TopicName AddFilter EditFilter button click', async function(this: PlaywrightWorld) {
191+
await this.locators.topicTopicName.editFilterButton.click();
136192
});

e2e-playwright/src/steps/TopicsCreate.steps.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,10 @@ When('TopicCreate 7Day button clicked', async function() {
135135
When('TopicCreate 4Weeks button clicked', async function() {
136136
await this.locators.topicsCreate.button4Weeks.click();
137137
});
138+
139+
When('Topic name started with: {string} RemoveTopic clicked', async function(this: PlaywrightWorld, prefix: string) {
140+
const topicName = this.getValue<string>(`topicName-${prefix}`);
141+
await this.locators.topics.topicMenu(topicName).click();
142+
await this.locators.topics.topicMenuItemRemove.click();
143+
await this.locators.topics.topicApproveWindowConfirm.click();
144+
});

e2e-tests/src/main/java/io/kafbat/ui/screens/topics/TopicDetails.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ public class TopicDetails extends BasePage {
4141
protected SelenideElement addFiltersBtn = $x("//button[text()='Add Filters']");
4242
protected SelenideElement savedFiltersLink = $x("//div[text()='Saved Filters']");
4343
protected SelenideElement addFilterCodeModalTitle = $x("//label[text()='Filter code']");
44+
4445
protected SelenideElement addFilterCodeEditor = $x("//div[@id='ace-editor']");
4546
protected SelenideElement addFilterCodeTextarea = $x("//div[@id='ace-editor']//textarea");
47+
48+
4649
protected SelenideElement saveThisFilterCheckBoxAddFilterMdl = $x("//input[@name='saveFilter']");
50+
4751
protected SelenideElement displayNameInputAddFilterMdl = $x("//input[@placeholder='Enter Name']");
4852
protected SelenideElement cancelBtnAddFilterMdl = $x("//button[text()='Cancel']");
4953
protected SelenideElement addFilterBtnAddFilterMdl = $x("//button[text()='Add Filter']");
@@ -227,6 +231,8 @@ public TopicDetails setFilterCodeFldAddFilterMdl(String filterCode) {
227231
return this;
228232
}
229233

234+
235+
230236
@Step
231237
public String getFilterCodeValue() {
232238
addFilterCodeEditor.shouldBe(enabled).click();
@@ -238,6 +244,8 @@ public String getFilterCodeValue() {
238244
}
239245
}
240246

247+
248+
241249
@Step
242250
public String getFilterNameValue() {
243251
return displayNameInputAddFilterMdl.shouldBe(enabled).getValue();

0 commit comments

Comments
 (0)