-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): improve cypress trigger and automate tabs (#3442)
- Loading branch information
Showing
12 changed files
with
143 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 2 additions & 10 deletions
12
web/src/components/RunDetailAutomateMethods/methods/CLICommand/CliCommand.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
web/src/components/RunDetailAutomateMethods/methods/Cypress/Cypress.styled.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {Typography} from 'antd'; | ||
import styled from 'styled-components'; | ||
|
||
export const Title = styled(Typography.Title).attrs({ | ||
level: 3, | ||
})` | ||
&& { | ||
font-size: ${({theme}) => theme.size.md}; | ||
font-weight: 600; | ||
margin-bottom: 16px; | ||
} | ||
`; | ||
|
||
export const TitleContainer = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
`; | ||
|
||
export const Container = styled.div` | ||
margin: 16px 0; | ||
`; |
22 changes: 22 additions & 0 deletions
22
web/src/components/RunDetailAutomateMethods/methods/Cypress/Cypress.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {Typography} from 'antd'; | ||
import {FramedCodeBlock} from 'components/CodeBlock'; | ||
import {CypressCodeSnippet} from 'constants/Automate.constants'; | ||
import Test from 'models/Test.model'; | ||
import * as S from './Cypress.styled'; | ||
import {IMethodChildrenProps} from '../../RunDetailAutomateMethods'; | ||
|
||
interface IProps extends IMethodChildrenProps { | ||
test: Test; | ||
} | ||
|
||
const Cypress = ({test}: IProps) => ( | ||
<S.Container> | ||
<S.TitleContainer> | ||
<S.Title>Cypress Integration</S.Title> | ||
</S.TitleContainer> | ||
<Typography.Paragraph>The code snippet below enables you to run this test via a cypress run.</Typography.Paragraph> | ||
<FramedCodeBlock title="Cypress code snippet:" language="javascript" value={CypressCodeSnippet(test.name)} /> | ||
</S.Container> | ||
); | ||
|
||
export default Cypress; |
2 changes: 2 additions & 0 deletions
2
web/src/components/RunDetailAutomateMethods/methods/Cypress/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// eslint-disable-next-line no-restricted-exports | ||
export {default} from './Cypress'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export function CypressCodeSnippet(testName: string) { | ||
return `import Tracetest from '@tracetest/cypress'; | ||
const TRACETEST_API_TOKEN = Cypress.env('TRACETEST_API_TOKEN') || ''; | ||
const tracetest = Tracetest(); | ||
describe('Cypress Test', () => { | ||
before(done => { | ||
tracetest.configure(TRACETEST_API_TOKEN).then(() => done()); | ||
}); | ||
beforeEach(() => { | ||
cy.visit('/', { | ||
onBeforeLoad: win => tracetest.capture(win.document), | ||
}); | ||
}); | ||
afterEach(done => { | ||
tracetest.runTest('').then(() => done()); | ||
}); | ||
it('${testName}', () => { | ||
// ...cy commands | ||
}); | ||
});`; | ||
} |