Skip to content

Commit c0100cd

Browse files
committed
add more cypress tests
1 parent 4f12eb2 commit c0100cd

File tree

4 files changed

+178
-2
lines changed

4 files changed

+178
-2
lines changed

metadata-ingestion/tests/integration/mlflow/mlflow_mcps_golden.json

+27
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,33 @@
428428
"lastRunId": "no-run-id-provided"
429429
}
430430
},
431+
{
432+
"entityType": "mlModel",
433+
"entityUrn": "urn:li:mlModel:(urn:li:dataPlatform:mlflow,test-model_1,PROD)",
434+
"changeType": "UPSERT",
435+
"aspectName": "versionProperties",
436+
"aspect": {
437+
"json": {
438+
"versionSet": "urn:li:versionSet:(test-model,mlModel)",
439+
"version": {
440+
"versionTag": "1",
441+
"metadataAttribution": {
442+
"time": 1615443388097,
443+
"actor": "urn:li:corpuser:datahub",
444+
"sourceDetail": {}
445+
}
446+
},
447+
"aliases": [],
448+
"sortId": "",
449+
"versioningScheme": "LEXICOGRAPHIC_STRING"
450+
}
451+
},
452+
"systemMetadata": {
453+
"lastObserved": 1615443388097,
454+
"runId": "mlflow-source-test",
455+
"lastRunId": "no-run-id-provided"
456+
}
457+
},
431458
{
432459
"entityType": "mlModel",
433460
"entityUrn": "urn:li:mlModel:(urn:li:dataPlatform:mlflow,test-model_1,PROD)",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
describe("models", () => {
2+
// Add global error handling
3+
beforeEach(() => {
4+
// This prevents test failures due to unhandled exceptions in the application
5+
Cypress.on("uncaught:exception", (err, runnable) => {
6+
console.error("Uncaught exception:", err);
7+
return false; // Prevents Cypress from failing the test
8+
});
9+
});
10+
11+
it("can visit mlflow model groups", () => {
12+
// Monitor GraphQL requests to debug API issues
13+
cy.intercept("POST", "/api/v2/graphql*").as("graphqlRequest");
14+
15+
// Visit with improved waiting for page load
16+
cy.visitWithLogin(
17+
"/mlModelGroup/urn:li:mlModelGroup:(urn:li:dataPlatform:mlflow,sample_ml_model_group,PROD)",
18+
);
19+
20+
// Wait for initial GraphQL request to complete
21+
cy.wait("@graphqlRequest");
22+
23+
// Ensure page has loaded by checking for specific content
24+
cy.contains("2025-03-03").should("be.visible");
25+
cy.contains("2025-03-04").should("be.visible");
26+
cy.contains("urn:li:corpuser:datahub").should("be.visible");
27+
28+
// Navigate to Properties tab with verification
29+
cy.url().should("include", "mlModelGroup");
30+
cy.get('[data-node-key="Properties"]').should("be.visible").first().click();
31+
32+
// Wait for content to load after tab change
33+
cy.contains("data_science").should("be.visible");
34+
35+
// Navigate to Models tab with verification
36+
cy.get('[data-node-key="Models"]').should("be.visible").click();
37+
38+
// Wait for models to load
39+
cy.contains("SAMPLE ML MODEL").should("be.visible");
40+
cy.contains("A sample ML model").should("be.visible");
41+
42+
// Click model with verification
43+
cy.contains("SAMPLE ML MODEL").click();
44+
45+
// Verify model details page loaded
46+
cy.contains("A sample ML model").should("be.visible");
47+
});
48+
49+
it("can visit mlflow model", () => {
50+
// Monitor GraphQL requests
51+
cy.intercept("POST", "/api/v2/graphql*").as("graphqlRequest");
52+
53+
cy.visitWithLogin(
54+
"/mlModels/urn:li:mlModel:(urn:li:dataPlatform:mlflow,sample_ml_model,PROD)",
55+
);
56+
57+
// Wait for initial data load
58+
cy.wait("@graphqlRequest");
59+
60+
// Verify model metadata
61+
cy.contains("Simple Training Run").should("be.visible");
62+
cy.contains("A sample ML model").should("be.visible");
63+
cy.contains("val_loss").should("be.visible");
64+
cy.contains("max_depth").should("be.visible");
65+
66+
// Navigate to Properties tab with verification
67+
cy.contains("Properties").should("be.visible").click();
68+
69+
// Wait for properties to load
70+
cy.contains("data_science").should("be.visible");
71+
72+
// Navigate to Group tab with verification
73+
cy.contains("Group").should("be.visible").click();
74+
75+
// Wait for group data to load
76+
cy.contains("SAMPLE ML MODEL GROUP").should("be.visible");
77+
cy.contains("A sample ML model group").should("be.visible");
78+
79+
// Click model group with verification
80+
cy.contains("SAMPLE ML MODEL GROUP").click();
81+
82+
// Verify group details page loaded
83+
cy.contains("A sample ML model group").should("be.visible");
84+
});
85+
});

smoke-test/tests/cypress/cypress/e2e/ml/model.js smoke-test/tests/cypress/cypress/e2e/ml/model_sagemaker.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
describe("models", () => {
2-
it("can visit models and groups", () => {
2+
it("can visit sagemaker models and groups", () => {
33
cy.visitWithLogin(
44
"/mlModels/urn:li:mlModel:(urn:li:dataPlatform:sagemaker,cypress-model,PROD)/Summary?is_lineage_mode=false",
55
);
@@ -21,7 +21,7 @@ describe("models", () => {
2121
cy.contains("cypress-model-package-group");
2222
});
2323

24-
it("can visit models and groups", () => {
24+
it("can visit sagemaker models and groups", () => {
2525
cy.visitWithLogin(
2626
"/mlModelGroup/urn:li:mlModelGroup:(urn:li:dataPlatform:sagemaker,cypress-model-package-group,PROD)",
2727
);

smoke-test/tests/cypress/data.json

+64
Original file line numberDiff line numberDiff line change
@@ -2680,5 +2680,69 @@
26802680
"container": "urn:li:container:airline_forecast_experiment"
26812681
}
26822682
}
2683+
},
2684+
{
2685+
"entityType": "mlModelGroup",
2686+
"entityUrn": "urn:li:mlModelGroup:(urn:li:dataPlatform:mlflow,sample_ml_model_group,PROD)",
2687+
"changeType": "UPSERT",
2688+
"aspectName": "mlModelGroupProperties",
2689+
"aspect": {
2690+
"json": {
2691+
"customProperties": {
2692+
"team": "data_science"
2693+
},
2694+
"trainingJobs": ["urn:li:dataProcessInstance:simple_training_run"],
2695+
"name": "SAMPLE ML MODEL GROUP",
2696+
"description": "A sample ML model group",
2697+
"created": {
2698+
"time": 1741096069000,
2699+
"actor": "urn:li:corpuser:datahub"
2700+
},
2701+
"lastModified": {
2702+
"time": 1741000000000,
2703+
"actor": "urn:li:corpuser:datahub"
2704+
}
2705+
}
2706+
}
2707+
},
2708+
{
2709+
"entityType": "mlModel",
2710+
"entityUrn": "urn:li:mlModel:(urn:li:dataPlatform:mlflow,sample_ml_model,PROD)",
2711+
"changeType": "UPSERT",
2712+
"aspectName": "mlModelProperties",
2713+
"aspect": {
2714+
"json": {
2715+
"customProperties": {
2716+
"team": "data_science"
2717+
},
2718+
"trainingJobs": ["urn:li:dataProcessInstance:simple_training_run"],
2719+
"name": "SAMPLE ML MODEL",
2720+
"description": "A sample ML model",
2721+
"created": {
2722+
"time": 1741096069000,
2723+
"actor": "urn:li:corpuser:datahub"
2724+
},
2725+
"lastModified": {
2726+
"time": 1741000000000,
2727+
"actor": "urn:li:corpuser:datahub"
2728+
},
2729+
"hyperParams": [
2730+
{
2731+
"name": "max_depth",
2732+
"value": "3"
2733+
}
2734+
],
2735+
"trainingMetrics": [
2736+
{
2737+
"name": "val_loss",
2738+
"value": "0.1"
2739+
}
2740+
],
2741+
"tags": [],
2742+
"groups": [
2743+
"urn:li:mlModelGroup:(urn:li:dataPlatform:mlflow,sample_ml_model_group,PROD)"
2744+
]
2745+
}
2746+
}
26832747
}
26842748
]

0 commit comments

Comments
 (0)