-
Notifications
You must be signed in to change notification settings - Fork 15
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
ADM-662: [frontend] add version in header #824
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesYou may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation |
Hi @neomgb! 👋 |
description: | | ||
What version of our software are you running? There is two methods to get the current version: | ||
1. you can see the version info at the top of the heartbeat pages | ||
2. Add “api/v1/version”after the host address you visit the heartbeat |
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.
Please use English quotation marks
@@ -15,6 +24,34 @@ describe('Header', () => { | |||
expect(getByText(PROJECT_NAME)).toBeInTheDocument() | |||
}) | |||
|
|||
it('should show version info when request succeed', async () => { | |||
headerClient.getVersion = jest.fn().mockResolvedValueOnce('1.11') | |||
let component: any |
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.
Please fix issues of github actions
|
||
it('should show version info when request failed', async () => { | ||
headerClient.getVersion = jest.fn().mockResolvedValueOnce('') | ||
let component: any |
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.
the same
let component: any | ||
await act(async () => { | ||
component = render( | ||
<BrowserRouter> |
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.
Maybe we can extract a function for those piece of lines
headerClient.getVersion = jest.fn().mockResolvedValueOnce('') | ||
let component: any | ||
await act(async () => { | ||
component = render( |
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.
Maybe we can extract a function for those piece of lines
frontend/cypress/pages/home.ts
Outdated
@@ -11,6 +11,10 @@ class Home { | |||
this.createANewProjectButton().click() | |||
} | |||
|
|||
checkVersion = () => { | |||
cy.get('span[title="Heartbeat"]').parent().next().should('exist') |
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.
Please follow the POM pattern and avoid using assert at the page level
// fontSize: '0.88rem', | ||
fontSize: '14px', | ||
export const StyledTypography = styled('div')({ | ||
width: '10rem', | ||
}) | ||
``` |
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.
Maybe we can add a new one, e2e requires the use of POM's model
}) | ||
|
||
const setup = () => | ||
act(async () => |
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.
Need to put "act" to assert block
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.
PLZ update commit with the comments
suggestion: PLZ refactor code after coding. Ref to red green blue
of the refactor
expect(getByText(PROJECT_NAME)).toBeInTheDocument() | ||
}) | ||
|
||
it('should show version info when request succeed', async () => { | ||
headerClient.getVersion = jest.fn().mockResolvedValueOnce('1.11') |
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.
@neomgb using 1.11
from fixtures.ts
afterAll(() => server.close()) | ||
|
||
it('should get response when get header status 200', async () => { | ||
const excepted = '1.11' |
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.
fixturet.ts
headerClient.getVersion = jest.fn().mockResolvedValueOnce('1.11') | ||
const { getByText } = await act(async () => setup()) | ||
|
||
expect(getByText(/v1.11/)).toBeInTheDocument() |
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.
fixtures.ts
Summary
add version in header
Before
Description
Screenshots
If applicable, add screenshots to help explain behavior of your code.
After
Description
Screenshots
Note
Null