Skip to content

Conversation

@gabe-lyons
Copy link
Contributor

@gabe-lyons gabe-lyons commented Dec 6, 2021

Sets the groundwork for adding more cypress tests in the future. This PR gives an demonstration of how:

  • cypress can be tied into CI to block prs when failing
  • sample data can be loaded into the cypress environment
  • tests that assert against sample data and mutate sample data can both be written
  • examples of how utility methods (e.g. login and deleteUrn) can be written and referenced from tests

I also tested w/ a failing test earlier (before fix dataset name assertion) and verified that cypress outputs a very human-readable response when the test fails.

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable)

@github-actions
Copy link
Contributor

github-actions bot commented Dec 6, 2021

Unit Test Results

     45 files  +  1       45 suites  +1   43m 23s ⏱️ + 17m 9s
   635 tests +19     577 ✔️ +13  58 💤 +6  0 ±0 
1 419 runs  +64  1 345 ✔️ +58  74 💤 +6  0 ±0 

Results for commit a88f62b. ± Comparison against base commit a16c432.

♻️ This comment has been updated with latest results.

@gabe-lyons
Copy link
Contributor Author

its running!

image

@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(do we need it?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an example fixture generated by default by cypress- its just showing someone how they might add another fixture

cy.deleteUrn('urn:li:tag:CypressTestAddTag')
cy.login();
cy.visit('/dataset/urn:li:dataset:(urn:li:dataPlatform:hive,cypress_logging_events,PROD)');
cy.contains('cypress_logging_events');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indent

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or is this indentional?

//
//
// -- This is a parent command --
Cypress.Commands.add('login', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty cool!

]
}
},
"proposedDelta": null
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more snapshots :(((((

proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd="tests/cypress")
stdout = proc.stdout.read()
stderr = proc.stderr.read()
return_code = proc.wait()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fancyyy!

Copy link
Contributor

@shirshanka shirshanka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shirshanka shirshanka merged commit e9c87bc into datahub-project:master Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants