Skip to content

Commit

Permalink
feat(ci): add cypress test ui based ingestion (datahub-project#6769)
Browse files Browse the repository at this point in the history
  • Loading branch information
anshbansal authored and cccs-Dustin committed Feb 1, 2023
1 parent 45b4d71 commit 1e36ef1
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export function ActionsColumn({
DETAILS
</Button>
)}
<Button onClick={() => onDelete(record.urn)} type="text" shape="circle" danger>
<Button data-testid="delete-button" onClick={() => onDelete(record.urn)} type="text" shape="circle" danger>
<DeleteOutlined />
</Button>
</ActionButtonContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export const NameSourceStep = ({ state, updateState, prev, submit }: StepProps)
>
<Typography.Paragraph>Give this ingestion source a name.</Typography.Paragraph>
<Input
data-testid="source-name-input"
className="source-name-input"
placeholder="My Redshift Source #2"
value={state.name}
onChange={(event) => setName(event.target.value)}
Expand All @@ -98,6 +100,8 @@ export const NameSourceStep = ({ state, updateState, prev, submit }: StepProps)
Advanced: Provide a custom CLI version to use for ingestion.
</Typography.Paragraph>
<Input
data-testid="cli-version-input"
className="cli-version-input"
placeholder="(e.g. 0.9.3)"
value={state.config?.version || ''}
onChange={(event) => setVersion(event.target.value)}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
function readyToTypeEditor() {
return cy.get('.monaco-editor textarea:first')
.click().focused();
}

describe("run managed ingestion", () => {
it("create run managed ingestion source", () => {
let number = Math.floor(Math.random() * 100000);
let testName = `cypress test source ${number}`
let cli_version = "0.9.3.3rc5";
cy.login();
cy.goToIngestionPage();
cy.clickOptionWithText("Create new source");
cy.clickOptionWithText("Other");

cy.waitTextVisible("source-type");
readyToTypeEditor().type('{ctrl}a').clear()
readyToTypeEditor().type("source:");
readyToTypeEditor().type("{enter}");
readyToTypeEditor().type(" type: demo-data");
readyToTypeEditor().type("{enter}");
// no space because the editor starts new line at same indentation
readyToTypeEditor().type("config: {}");
cy.clickOptionWithText("Next")

cy.clickOptionWithText("Skip")

cy.enterTextInTestId('source-name-input', testName)
cy.clickOptionWithText("Advanced")
cy.enterTextInTestId('cli-version-input', cli_version)
cy.clickOptionWithText("Save & Run")
cy.waitTextVisible(testName)

cy.contains(testName).parent().within(() => {
cy.contains("Succeeded", {timeout: 30000})
cy.clickOptionWithTestId("delete-button");
})
cy.clickOptionWithText("Yes")
cy.ensureTextNotPresent(testName)
})
});
5 changes: 5 additions & 0 deletions smoke-test/tests/cypress/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ Cypress.Commands.add("goToViewsSettings", () => {
cy.waitTextVisible("Manage Views");
});

Cypress.Commands.add("goToIngestionPage", () => {
cy.visit("/ingestion");
cy.waitTextVisible("Manage Ingestion");
});

Cypress.Commands.add("goToDataset", (urn, dataset_name) => {
cy.visit(
"/dataset/" + urn
Expand Down

0 comments on commit 1e36ef1

Please sign in to comment.