Merge branch 'master' into ISSUE-3427_frontend
This commit is contained in:
commit
95580bb346
8 changed files with 42 additions and 86 deletions
|
@ -12,7 +12,7 @@
|
|||
<artifactId>kafka-ui-api</artifactId>
|
||||
|
||||
<properties>
|
||||
<jacoco.version>0.8.8</jacoco.version>
|
||||
<jacoco.version>0.8.10</jacoco.version>
|
||||
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
|
||||
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
|
||||
<sonar.jacoco.reportPath>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPath>
|
||||
|
|
|
@ -17,11 +17,12 @@ import java.util.List;
|
|||
public class KsqlQueryForm extends BasePage {
|
||||
protected SelenideElement clearBtn = $x("//div/button[text()='Clear']");
|
||||
protected SelenideElement executeBtn = $x("//div/button[text()='Execute']");
|
||||
protected SelenideElement stopQueryBtn = $x("//div/button[text()='Stop query']");
|
||||
protected SelenideElement clearResultsBtn = $x("//div/button[text()='Clear results']");
|
||||
protected SelenideElement addStreamPropertyBtn = $x("//button[text()='Add Stream Property']");
|
||||
protected SelenideElement queryAreaValue = $x("//div[@class='ace_content']");
|
||||
protected SelenideElement queryArea = $x("//div[@id='ksql']/textarea[@class='ace_text-input']");
|
||||
protected SelenideElement abortButton = $x("//div[@role='status']/div[text()='Abort']");
|
||||
protected SelenideElement cancelledAlert = $x("//div[@role='status'][text()='Cancelled']");
|
||||
protected ElementsCollection ksqlGridItems = $$x("//tbody//tr");
|
||||
protected ElementsCollection keyField = $$x("//input[@aria-label='key']");
|
||||
protected ElementsCollection valueField = $$x("//input[@aria-label='value']");
|
||||
|
@ -48,7 +49,7 @@ public class KsqlQueryForm extends BasePage {
|
|||
public KsqlQueryForm clickExecuteBtn(String query) {
|
||||
clickByActions(executeBtn);
|
||||
if (query.contains("EMIT CHANGES")) {
|
||||
loadingSpinner.shouldBe(Condition.visible);
|
||||
abortButton.shouldBe(Condition.visible);
|
||||
} else {
|
||||
waitUntilSpinnerDisappear();
|
||||
}
|
||||
|
@ -56,12 +57,21 @@ public class KsqlQueryForm extends BasePage {
|
|||
}
|
||||
|
||||
@Step
|
||||
public KsqlQueryForm clickStopQueryBtn() {
|
||||
clickByActions(stopQueryBtn);
|
||||
waitUntilSpinnerDisappear();
|
||||
public boolean isAbortBtnVisible() {
|
||||
return isVisible(abortButton);
|
||||
}
|
||||
|
||||
@Step
|
||||
public KsqlQueryForm clickAbortBtn() {
|
||||
clickByActions(abortButton);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Step
|
||||
public boolean isCancelledAlertVisible() {
|
||||
return isVisible(cancelledAlert);
|
||||
}
|
||||
|
||||
@Step
|
||||
public KsqlQueryForm clickClearResultsBtn() {
|
||||
clickByActions(clearResultsBtn);
|
||||
|
|
|
@ -22,72 +22,65 @@ public class SmokeBacklog extends BaseManualTest {
|
|||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = KSQL_DB_SUITE_ID)
|
||||
@QaseId(277)
|
||||
@Suite(id = BROKERS_SUITE_ID)
|
||||
@QaseId(331)
|
||||
@Test
|
||||
public void testCaseB() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = BROKERS_SUITE_ID)
|
||||
@QaseId(331)
|
||||
@Test
|
||||
public void testCaseC() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = BROKERS_SUITE_ID)
|
||||
@QaseId(332)
|
||||
@Test
|
||||
public void testCaseD() {
|
||||
public void testCaseC() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = TOPICS_PROFILE_SUITE_ID)
|
||||
@QaseId(335)
|
||||
@Test
|
||||
public void testCaseE() {
|
||||
public void testCaseD() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = TOPICS_PROFILE_SUITE_ID)
|
||||
@QaseId(336)
|
||||
@Test
|
||||
public void testCaseF() {
|
||||
public void testCaseE() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = TOPICS_PROFILE_SUITE_ID)
|
||||
@QaseId(343)
|
||||
@Test
|
||||
public void testCaseG() {
|
||||
public void testCaseF() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = KSQL_DB_SUITE_ID)
|
||||
@QaseId(344)
|
||||
@Test
|
||||
public void testCaseH() {
|
||||
public void testCaseG() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = SCHEMAS_SUITE_ID)
|
||||
@QaseId(345)
|
||||
@Test
|
||||
public void testCaseI() {
|
||||
public void testCaseH() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = SCHEMAS_SUITE_ID)
|
||||
@QaseId(346)
|
||||
@Test
|
||||
public void testCaseJ() {
|
||||
public void testCaseI() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = TOPICS_PROFILE_SUITE_ID)
|
||||
@QaseId(347)
|
||||
@Test
|
||||
public void testCaseK() {
|
||||
public void testCaseJ() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.provectus.kafka.ui.smokesuite.ksqldb;
|
||||
|
||||
import static com.provectus.kafka.ui.pages.ksqldb.enums.KsqlMenuTabs.STREAMS;
|
||||
import static com.provectus.kafka.ui.pages.ksqldb.enums.KsqlQueryConfig.SELECT_ALL_FROM;
|
||||
import static com.provectus.kafka.ui.pages.ksqldb.enums.KsqlQueryConfig.SHOW_STREAMS;
|
||||
import static com.provectus.kafka.ui.pages.ksqldb.enums.KsqlQueryConfig.SHOW_TABLES;
|
||||
import static com.provectus.kafka.ui.pages.panels.enums.MenuItem.KSQL_DB;
|
||||
|
@ -87,7 +88,8 @@ public class KsqlDbTest extends BaseTest {
|
|||
navigateToKsqlDbAndExecuteRequest(SHOW_STREAMS.getQuery());
|
||||
SoftAssert softly = new SoftAssert();
|
||||
softly.assertTrue(ksqlQueryForm.areResultsVisible(), "areResultsVisible()");
|
||||
softly.assertTrue(ksqlQueryForm.getItemByName(DEFAULT_STREAM.getName()).isVisible(), "getItemByName()");
|
||||
softly.assertTrue(ksqlQueryForm.getItemByName(DEFAULT_STREAM.getName()).isVisible(),
|
||||
String.format("getItemByName(%s)", FIRST_TABLE.getName()));
|
||||
softly.assertAll();
|
||||
}
|
||||
|
||||
|
@ -104,6 +106,16 @@ public class KsqlDbTest extends BaseTest {
|
|||
softly.assertAll();
|
||||
}
|
||||
|
||||
@QaseId(277)
|
||||
@Test(priority = 6)
|
||||
public void stopQueryFunctionalCheck() {
|
||||
navigateToKsqlDbAndExecuteRequest(String.format(SELECT_ALL_FROM.getQuery(), FIRST_TABLE.getName()));
|
||||
Assert.assertTrue(ksqlQueryForm.isAbortBtnVisible(), "isAbortBtnVisible()");
|
||||
ksqlQueryForm
|
||||
.clickAbortBtn();
|
||||
Assert.assertTrue(ksqlQueryForm.isCancelledAlertVisible(), "isCancelledAlertVisible()");
|
||||
}
|
||||
|
||||
@AfterClass(alwaysRun = true)
|
||||
public void afterClass() {
|
||||
TOPIC_NAMES_LIST.forEach(topicName -> apiService.deleteTopic(topicName));
|
||||
|
|
|
@ -37,7 +37,7 @@ const Config: React.FC = () => {
|
|||
formState: { isDirty, isSubmitting, isValid, errors },
|
||||
setValue,
|
||||
} = useForm<FormValues>({
|
||||
mode: 'onTouched',
|
||||
mode: 'onChange',
|
||||
resolver: yupResolver(validationSchema),
|
||||
defaultValues: {
|
||||
config: JSON.stringify(config, null, '\t'),
|
||||
|
|
|
@ -55,7 +55,7 @@ const Form: React.FC = () => {
|
|||
yup.object().shape({
|
||||
newSchema:
|
||||
schema?.schemaType === SchemaType.PROTOBUF
|
||||
? yup.string().required().isEnum('Schema syntax is not valid')
|
||||
? yup.string().required()
|
||||
: yup.string().required().isJsonObject('Schema syntax is not valid'),
|
||||
});
|
||||
const methods = useForm<NewSchemaSubjectRaw>({
|
||||
|
|
|
@ -1,19 +1,5 @@
|
|||
import { isValidEnum, isValidJsonObject } from 'lib/yupExtended';
|
||||
import { isValidJsonObject } from 'lib/yupExtended';
|
||||
|
||||
const invalidEnum = `
|
||||
ennum SchemType {
|
||||
AVRO = 0;
|
||||
JSON = 1;
|
||||
PROTOBUF = 3;
|
||||
}
|
||||
`;
|
||||
const validEnum = `
|
||||
enum SchemType {
|
||||
AVRO = 0;
|
||||
JSON = 1;
|
||||
PROTOBUF = 3;
|
||||
}
|
||||
`;
|
||||
describe('yup extended', () => {
|
||||
describe('isValidJsonObject', () => {
|
||||
it('returns false for no value', () => {
|
||||
|
@ -35,21 +21,4 @@ describe('yup extended', () => {
|
|||
expect(isValidJsonObject('{ "foo": "bar" }')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('isValidEnum', () => {
|
||||
it('returns false for invalid enum', () => {
|
||||
expect(isValidEnum(invalidEnum)).toBeFalsy();
|
||||
});
|
||||
it('returns false for no value', () => {
|
||||
expect(isValidEnum()).toBeFalsy();
|
||||
});
|
||||
it('returns true should trim value', () => {
|
||||
expect(
|
||||
isValidEnum(` enum SchemType {AVRO = 0; PROTOBUF = 3;} `)
|
||||
).toBeTruthy();
|
||||
});
|
||||
it('returns true for valid enum', () => {
|
||||
expect(isValidEnum(validEnum)).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,7 +10,6 @@ declare module 'yup' {
|
|||
TFlags extends yup.Flags = ''
|
||||
> extends yup.Schema<TType, TContext, TDefault, TFlags> {
|
||||
isJsonObject(message?: string): StringSchema<TType, TContext>;
|
||||
isEnum(message?: string): StringSchema<TType, TContext>;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,32 +39,6 @@ const isJsonObject = (message?: string) => {
|
|||
isValidJsonObject
|
||||
);
|
||||
};
|
||||
|
||||
export const isValidEnum = (value?: string) => {
|
||||
try {
|
||||
if (!value) return false;
|
||||
const trimmedValue = value.trim();
|
||||
if (
|
||||
trimmedValue.indexOf('enum') === 0 &&
|
||||
trimmedValue.lastIndexOf('}') === trimmedValue.length - 1
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
} catch {
|
||||
// do nothing
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const isEnum = (message?: string) => {
|
||||
return yup.string().test(
|
||||
'isEnum',
|
||||
// eslint-disable-next-line no-template-curly-in-string
|
||||
message || '${path} is not Enum object',
|
||||
isValidEnum
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* due to yup rerunning all the object validiation during any render,
|
||||
* it makes sense to cache the async results
|
||||
|
@ -88,7 +61,6 @@ export function cacheTest(
|
|||
}
|
||||
|
||||
yup.addMethod(yup.StringSchema, 'isJsonObject', isJsonObject);
|
||||
yup.addMethod(yup.StringSchema, 'isEnum', isEnum);
|
||||
|
||||
export const topicFormValidationSchema = yup.object().shape({
|
||||
name: yup
|
||||
|
|
Loading…
Add table
Reference in a new issue