Skip to content

Commit 3fac03d

Browse files
committed
Schema registry start
1 parent f47a6b9 commit 3fac03d

File tree

6 files changed

+143
-0
lines changed

6 files changed

+143
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Feature: Schema page
2+
3+
Scenario: SchemaRegistry and SchemaRegistryCreate visibility
4+
Given Schema Registry is visible
5+
When click on Schema Registry link
6+
Then Schema Registry heading visible
7+
Given SchemaRegistry CheateSchema clicked
8+
9+
Given SchemaRegistryCreate is visible
10+
Given SchemaRegistryCreate Subject visible is: "true"
11+
Given SchemaRegistryCreate Schema visible is: "true"
12+
Given SchemaRegistryCreate SchemaType visible is: "true"
13+
When SchemaRegistryCreate Subject input starts with: "SchemaSubject"
14+
When SchemaRegistryCreate Schema input from avro
15+
When SchemaRegistryCreate Submit clicked
16+
Then SchemaRegistrySchemaName starts with: "SchemaSubject", visible is: "true"

e2e-playwright/src/pages/Locators.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import DashboardLocators from "./Dashboard/DashboardLocators";
1111
import TopicsTopickNameLocators from "./Topics/TopicsTopickNameLocators"
1212
import ProduceMessageLocators from "./Topics/ProduceMessageLocators"
1313
import BrokerDetailsLocators from "./Brokers/BrokerDetailsLocators"
14+
import SchemaRegistrySchemaNameLocators from "./SchemaRegistry/SchemaRegistrySchemaNameLocators"
1415

1516
export class Locators {
1617
private readonly page: Page;
@@ -24,6 +25,7 @@ export class Locators {
2425
private _produceMessage?: ProduceMessageLocators;
2526
private _consumers?: ConsumersLocators;
2627
private _schemaRegistry?: SchemaRegistryLocators;
28+
private _schemaName?: SchemaRegistrySchemaNameLocators;
2729
private _connectors?: ConnectorsLocators;
2830
private _ksqlDb?: ksqlDbLocators;
2931
private _dashboard?: DashboardLocators;
@@ -68,6 +70,10 @@ export class Locators {
6870
return (this._schemaRegistry ??= new SchemaRegistryLocators(this.page));
6971
}
7072

73+
get schemaName() {
74+
return (this._schemaName ??= new SchemaRegistrySchemaNameLocators(this.page));
75+
}
76+
7177
get connectors() {
7278
return (this._connectors ??= new ConnectorsLocators(this.page));
7379
}

e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,12 @@ export default class SchemaRegistryLocators {
1010
get heading(): Locator { return this.page.getByRole('heading', { name: 'Schema Registry' })};
1111
get searchBox(): Locator { return this.page.getByRole('textbox', { name: 'Search by Schema Name' })};
1212
get createSchemaButton(): Locator { return this.page.getByRole('button', { name: 'Create Schema' })};
13+
14+
get createHeading(): Locator { return this.page.getByText('Schema RegistryCreate')};
15+
get subjectTextBox(): Locator { return this.page.getByRole('textbox', { name: 'Schema Name' })};
16+
get schemaTextBox(): Locator { return this.page.locator('textarea[name="schema"]')};
17+
get schemaTypeDropDown(): Locator { return this.page.locator('form path')};
18+
get submit(): Locator { return this.page.getByRole('button', { name: 'Submit' })};
19+
20+
schemaTypeDropDownElement(value:string): Locator { return this.page.getByRole('option', { name: value })};
1321
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Page, Locator } from "@playwright/test";
2+
3+
export default class SchemaRegistrySchemaNameLocators {
4+
private readonly page: Page;
5+
6+
constructor(page: Page) {
7+
this.page = page;
8+
}
9+
10+
heading(value: string): Locator { return this.page.getByText(`Schema Registry${value}`)};
11+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
export function getAvroSchema(): string {
2+
return JSON.stringify({
3+
type: 'record',
4+
name: 'Student',
5+
namespace: 'DataFlair',
6+
fields: [
7+
{ name: 'Name', type: 'string' },
8+
{ name: 'Age', type: 'int' }
9+
]
10+
}, null, 2);
11+
}
12+
13+
export function getAvroUpdatedSchema(): string {
14+
return JSON.stringify({
15+
type: "record",
16+
name: "Message",
17+
namespace: "io.kafbat.ui",
18+
fields: [
19+
{
20+
name: "text",
21+
type: "string",
22+
default: null
23+
},
24+
{
25+
name: "value",
26+
type: "string",
27+
default: null
28+
}
29+
]
30+
}, null, 2);
31+
}
32+
33+
export function getJsonSchema(): string {
34+
return JSON.stringify({
35+
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
36+
"connection.url": "jdbc:postgresql://postgres-db:5432/test",
37+
"connection.user": "dev_user",
38+
"connection.password": "12345",
39+
"topics": "topic_for_connector"
40+
}, null, 2);
41+
}
42+
43+
export function getProtobufSchema(): string {
44+
return `
45+
enum SchemaType {
46+
AVRO = 0;
47+
JSON = 1;
48+
PROTOBUF = 2;
49+
}
50+
`.trim();
51+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/* eslint-disable no-unused-vars */
2+
import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber";
3+
import { PlaywrightWorld } from "../support/PlaywrightWorld";
4+
import { expectVisibility } from "../services/uiHelper";
5+
import { generateName } from "../services/commonFunctions";
6+
import { getAvroSchema } from "../services/schemas"
7+
8+
setDefaultTimeout(60 * 1000 * 2);
9+
10+
Given('SchemaRegistry CheateSchema clicked', async function(this: PlaywrightWorld) {
11+
await this.locators.schemaRegistry.createSchemaButton.click();
12+
});
13+
14+
Given('SchemaRegistryCreate is visible', async function(this: PlaywrightWorld) {
15+
await expectVisibility(this.locators.schemaRegistry.createHeading, "true");
16+
});
17+
18+
Given('SchemaRegistryCreate Subject visible is: {string}', async function(this: PlaywrightWorld, visible: string) {
19+
await expectVisibility(this.locators.schemaRegistry.subjectTextBox, visible);
20+
});
21+
22+
Given('SchemaRegistryCreate Schema visible is: {string}', async function(this: PlaywrightWorld, visible: string) {
23+
await expectVisibility(this.locators.schemaRegistry.schemaTextBox, visible);
24+
});
25+
26+
Given('SchemaRegistryCreate SchemaType visible is: {string}', async function(this: PlaywrightWorld, visible: string) {
27+
await expectVisibility(this.locators.schemaRegistry.schemaTypeDropDown, visible);
28+
});
29+
30+
When('SchemaRegistryCreate Subject input starts with: {string}', async function(this: PlaywrightWorld, prefix: string) {
31+
const subjectName = generateName(prefix);
32+
await this.locators.schemaRegistry.subjectTextBox.fill(subjectName);
33+
this.setValue(`subjectName-${prefix}`, subjectName);
34+
});
35+
36+
When('SchemaRegistryCreate Schema input from avro', async function(this: PlaywrightWorld) {
37+
const schema = getAvroSchema();
38+
await this.locators.schemaRegistry.schemaTextBox.fill(schema);
39+
});
40+
41+
When('SchemaRegistryCreate Submit clicked', async function(this: PlaywrightWorld) {
42+
await this.locators.schemaRegistry.submit.click();
43+
});
44+
45+
Then('SchemaRegistrySchemaName starts with: {string}, visible is: {string}',
46+
async function(this: PlaywrightWorld, prefix: string, visible: string) {
47+
const streamName = this.getValue<string>(`subjectName-${prefix}`);
48+
const locator = this.locators.schemaName.heading(streamName);
49+
await expectVisibility(locator, visible);
50+
}
51+
);

0 commit comments

Comments
 (0)