Skip to content

Commit

Permalink
fix cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaElastic committed Dec 4, 2023
1 parent d21aa8d commit 9e90865
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ describe('Outputs', () => {
it('saves the output', () => {
selectKafkaOutput();

fillInKafkaOutputForm();
fillInKafkaOutputForm(true);

cy.intercept('POST', '**/api/fleet/outputs').as('saveOutput');

Expand Down
7 changes: 5 additions & 2 deletions x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,13 @@ export const resetKafkaOutputForm = () => {
cy.getBySel(SETTINGS_OUTPUTS_KAFKA.COMPRESSION_SWITCH).click();
};

export const fillInKafkaOutputForm = () => {
export const fillInKafkaOutputForm = (create?: boolean) => {
cy.getBySel(kafkaOutputFormValues.name.selector).type(kafkaOutputFormValues.name.value);
cy.get('[placeholder="Specify host"').clear().type('localhost:5000');
cy.getBySel(kafkaOutputFormValues.username.selector).type(kafkaOutputFormValues.username.value);
if (create) {
cy.getBySel(kafkaOutputFormValues.password.selector).type(kafkaOutputFormValues.password.value);
}
cy.getBySel(kafkaOutputFormValues.verificationMode.selector).select(
kafkaOutputFormValues.verificationMode.value
);
Expand Down Expand Up @@ -290,7 +293,7 @@ export const validateOutputTypeChangeToKafka = (outputId: string) => {
cy.getBySel(SETTINGS_OUTPUTS.TYPE_INPUT).select('kafka');
cy.getBySel(SETTINGS_OUTPUTS_KAFKA.AUTHENTICATION_USERNAME_PASSWORD_OPTION).click();

fillInKafkaOutputForm();
fillInKafkaOutputForm(true);
cy.intercept('PUT', '**/api/fleet/outputs/**').as('saveOutput');

cy.getBySel(SETTINGS_SAVE_BTN).click();
Expand Down

0 comments on commit 9e90865

Please sign in to comment.