-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
Feat: add integration test for the stakeholder #1774
base: v2
Are you sure you want to change the base?
Changes from 1 commit
bacd4e7
2ee8dda
94011f1
81753ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import stakeholder from '../../../../doc/examples/organizations/1.json'; | ||
import { prepareNocks, clearNocks } from '../nockRoutes'; | ||
|
||
beforeEach(() => { | ||
clearNocks(); | ||
}); | ||
|
||
describe('Organizations', () => { | ||
const imageFixturePath = `images/organization.png`; | ||
return it(`organization test`, () => { | ||
const path = `/stakeholder/${stakeholder.id}`; | ||
cy.fixture(imageFixturePath).then((image) => { | ||
const blob = Cypress.Blob.base64StringToBlob(image, 'images/png'); | ||
const photo_url = Cypress.Blob.createObjectURL(blob); | ||
prepareNocks({ stakeholder: { ...stakeholder, photo_url } }); | ||
}); | ||
|
||
cy.task('nockIntercept', { | ||
hostname: 'https://dev-k8s.treetracker.org', | ||
method: 'get', | ||
path: '/query/v2/stakeholder/1', | ||
statusCode: 200, | ||
body: stakeholder, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The organization mock json is deprecated, please create a new fixture (under fixture folder) json file for stakeholder , the spec of stakeholder is defined in our query api doc here: |
||
}); | ||
|
||
cy.visit(path, { | ||
failOnStatusCode: false, | ||
}); | ||
|
||
cy.url().should('include', '/stakeholder'); | ||
cy.contains(stakeholder.name); | ||
cy.screenshot(); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I would use
instead of
to populate the stakeholder id in path dynamically. And this should apply to all other paths in this test file if you are modifying any of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @yunchipang , thanks for your suggestion! I've just changed it. I agree it will make my code look cleaner.