Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

Commit

Permalink
Feat: Add test for logs in LogView
Browse files Browse the repository at this point in the history
  • Loading branch information
BastinJafari committed Feb 8, 2021
1 parent 3fcc0c5 commit 7c0492c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
16 changes: 15 additions & 1 deletion cypress/integration/views/logsView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ describe('Logs page', () => {
cy.dataName('logOccurenceDurationSelectedOption').should('contain.text', '15 Minutes')
})
})
})

context('when starting a flow', () => {
it('should display the correct logging', () => {
cy.visit('#/flow')
cy.dataName('playButton').click()
cy.visit('#/logs')
cy.wait(5000)
cy.fixture('sample-output').then((output)=>{
console.log(output.logs[0])
output.logs.forEach((log, index) => {
cy.dataName(`logItem-${index}`).should('contain', log.message)
})
})
})
})
})
})
3 changes: 2 additions & 1 deletion dev-resources/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

module.exports = {
updateStatusInterval: 1000,
jina_version: "0.9.18",
Expand All @@ -19,7 +20,7 @@ module.exports = {
},
messageInterval: 100,
messageLoops:100,
source: "sample-data/sample-output.json"
source: "../cypress/fixtures/sample-output.json"
},
recorder: {
url: "http://localhost:5000",
Expand Down
4 changes: 2 additions & 2 deletions src/components/FlowChart/CommandBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ export default function CommandBar({
<div className="command-bar-container">
<div className="command-bar">
<ButtonGroup>
<PlayButton onClick={startFlow}>
<PlayButton data-name={"playButton"} onClick={startFlow}>
<img alt="Play" src={Play} />
</PlayButton>
<Button onClick={stopFlow}>
<Button data-name={"stopButton"} onClick={stopFlow}>
<img alt="Stop" src={Stop} />
</Button>
<Button onClick={() => exportImage("png")}>
Expand Down
1 change: 1 addition & 0 deletions src/components/LogStream/LogItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const LogItem = memo(
const { firstCol, secondCol, thirdCol } = columns;
return (
<div
data-name={`logItem-${index}`}
className={`log log-${String(
level
).toLowerCase()} px-4 border-bottom py-1`}
Expand Down
1 change: 0 additions & 1 deletion src/redux/logStream/logStream.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export function initLogStream(
}

let logsResult = await jinadClient.getLogs(workspace_id, flow_id);
logsResult = await jinadClient.getLogs(workspace_id, flow_id);

if (logsResult.status === "error") {
if (logsResult.message)
Expand Down

0 comments on commit 7c0492c

Please sign in to comment.