Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download Lineage Results Cypress Test #9017

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export default function DownloadAsCsvModal({
Close
</Button>
<Button
data-testid="csv-modal-download-button"
onClick={() => {
setShowDownloadAsCsvModal(false);
triggerCsvDownload(saveAsTitle);
Expand All @@ -142,6 +143,7 @@ export default function DownloadAsCsvModal({
}
>
<Input
data-testid="download-as-csv-input"
placeholder="datahub.csv"
value={saveAsTitle}
onChange={(e) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function SearchExtendedMenu({

const menu = (
<Menu>
<MenuItem key="0">
<MenuItem key="0" data-testid="download-as-csv-menu-item">
<DownloadAsCsvButton
isDownloadingCsv={isDownloadingCsv}
setShowDownloadAsCsvModal={setShowDownloadAsCsvModal}
Expand Down Expand Up @@ -75,7 +75,7 @@ export default function SearchExtendedMenu({
totalResults={totalResults}
/>
<Dropdown overlay={menu} trigger={['click']}>
<MenuIcon />
<MenuIcon data-testid="tree-dot-menu" />
kkorchak marked this conversation as resolved.
Show resolved Hide resolved
</Dropdown>
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
const test_dataset = "urn:li:dataset:(urn:li:dataPlatform:kafka,SampleCypressKafkaDataset,PROD)";
const first_degree = [
"urn:li:chart:(looker,cypress_baz1)",
"urn:li:dataset:(urn:li:dataPlatform:hdfs,SampleCypressHdfsDataset,PROD)",
"urn:li:mlFeature:(cypress-test-2,some-cypress-feature-1)"
];
const second_degree = [
"urn:li:chart:(looker,cypress_baz2)",
"urn:li:dashboard:(looker,cypress_baz)",
"urn:li:dataset:(urn:li:dataPlatform:hive,SampleCypressHiveDataset,PROD)",
"urn:li:mlPrimaryKey:(cypress-test-2,some-cypress-feature-2)"
];
const third_degree_plus = [
"urn:li:dataJob:(urn:li:dataFlow:(airflow,cypress_dag_abc,PROD),cypress_task_123)",
"urn:li:dataJob:(urn:li:dataFlow:(airflow,cypress_dag_abc,PROD),cypress_task_456)",
"urn:li:dataset:(urn:li:dataPlatform:hive,cypress_logging_events,PROD)",
"urn:li:dataset:(urn:li:dataPlatform:hive,fct_cypress_users_created,PROD)",
"urn:li:dataset:(urn:li:dataPlatform:hive,fct_cypress_users_created_no_tag,PROD)",
"urn:li:dataset:(urn:li:dataPlatform:hive,fct_cypress_users_deleted,PROD)"
];
const downloadCsvFile = (filename) => {
cy.get('[data-testid="tree-dot-menu"]').click();
cy.get('[data-testid="download-as-csv-menu-item"]').click();
cy.get('[data-testid="download-as-csv-input"]').clear().type(filename);
cy.get('[data-testid="csv-modal-download-button"]').click().wait(5000);
cy.ensureTextNotPresent("Creating CSV to download");
};

describe("download lineage results to .csv file", () => {

it("download and verify lineage results for 1st, 2nd and 3+ degree of dependencies", () => {
cy.loginWithCredentials();
cy.goToDataset(test_dataset,"SampleCypressKafkaDataset");
cy.openEntityTab("Lineage");

// Verify 1st degree of dependencies
cy.contains(/1 - 3 of 3/);
downloadCsvFile("first_degree_results.csv");
let first_degree_csv = cy.readFile('cypress/downloads/first_degree_results.csv');
first_degree.forEach(function (urn) {
first_degree_csv.should('contain', urn)
});
second_degree.forEach(function (urn) {
first_degree_csv.should('not.contain', urn)
});
third_degree_plus.forEach(function (urn) {
first_degree_csv.should('not.contain', urn);
});

// Verify 1st and 2nd degree of dependencies
cy.get('[data-testid="facet-degree-2"]').click().wait(5000);
cy.contains(/1 - 7 of 7/);
downloadCsvFile("second_degree_results.csv");
let second_degree_csv = cy.readFile('cypress/downloads/second_degree_results.csv');
first_degree.forEach(function (urn) {
second_degree_csv.should('contain', urn)
});
second_degree.forEach(function (urn) {
second_degree_csv.should('contain', urn)
});
third_degree_plus.forEach(function (urn) {
second_degree_csv.should('not.contain', urn);
});

// Verify 1st 2nd and 3+ degree of dependencies(Verify multi page download)
cy.get('[data-testid="facet-degree-3+"]').click().wait(5000);
cy.contains(/1 - 10 of 13/);
downloadCsvFile("third_plus_degree_results.csv");
let third_degree_csv = cy.readFile('cypress/downloads/third_plus_degree_results.csv');
first_degree.forEach(function (urn) {
third_degree_csv.should('contain', urn)
});
second_degree.forEach(function (urn) {
third_degree_csv.should('contain', urn)
});
third_degree_plus.forEach(function (urn) {
third_degree_csv.should('contain', urn);
});
});
});
Loading