1
0
mirror of synced 2026-01-19 00:05:14 -05:00
Files
airbyte/airbyte-webapp-e2e-tests/cypress/commands/source.ts
Edmundo Ruiz Ghanem 1c02097582 🪟 🧹 Improve and fix linting in webapp-e2e-tests (#20134)
* Apply similar eslint rules to the webapp project and fix outstanding issues

* add paths to e2e tsconfig (for webstorm)
2022-12-07 15:38:57 -05:00

59 lines
1.8 KiB
TypeScript

import { deleteEntity, openSettingForm, submitButtonClick, updateField } from "./common";
import { goToSourcePage, openNewSourceForm } from "pages/sourcePage";
import { fillPostgresForm, fillPokeAPIForm } from "./connector";
export const createPostgresSource = (
name: string,
host = "localhost",
port = "5433",
database = "airbyte_ci_source",
username = "postgres",
password = "secret_password",
schema = ""
) => {
cy.intercept("/api/v1/scheduler/sources/check_connection").as("checkSourceUpdateConnection");
cy.intercept("/api/v1/sources/create").as("createSource");
goToSourcePage();
openNewSourceForm();
fillPostgresForm(name, host, port, database, username, password, schema);
submitButtonClick();
cy.wait("@checkSourceUpdateConnection", { requestTimeout: 10000 });
cy.wait("@createSource");
};
export const createPokeApiSource = (name: string, pokeName: string) => {
cy.intercept("/api/v1/scheduler/sources/check_connection").as("checkSourceUpdateConnection");
cy.intercept("/api/v1/sources/create").as("createSource");
goToSourcePage();
openNewSourceForm();
fillPokeAPIForm(name, pokeName);
submitButtonClick();
cy.wait("@checkSourceUpdateConnection");
cy.wait("@createSource");
};
export const updateSource = (name: string, field: string, value: string) => {
cy.intercept("/api/v1/sources/check_connection_for_update").as("checkSourceConnection");
cy.intercept("/api/v1/sources/update").as("updateSource");
goToSourcePage();
openSettingForm(name);
updateField(field, value);
submitButtonClick();
cy.wait("@checkSourceConnection");
cy.wait("@updateSource");
};
export const deleteSource = (name: string) => {
cy.intercept("/api/v1/sources/delete").as("deleteSource");
goToSourcePage();
openSettingForm(name);
deleteEntity();
cy.wait("@deleteSource");
};