mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-24 17:51:14 +02:00
This PR revamps e2e tests, while adding a new one for the interactive demo guide: - Bumps Cypress from `9.7.0` to `12.11.0`; - Bumps Cypress GH action from `v2` to `v5`; - Makes any adjustments needed; - Fixes a lot of issues identified with existing tests; - Adds new `demo.spec.ts` e2e test that covers the entire demo guide flow; **Note:** Currently does not include `demo.spec.ts` in the GH action, as it [fails](https://github.com/Unleash/unleash/actions/runs/4896839575/jobs/8744137231?pr=3656) on step 2.13 (last step of "user-specific" topic). It runs perfectly fine locally, though. Might be placebo, but in general tests seem less flaky now and they may even be faster (especially when not adding the `demo` one, which would always take a long time).
68 lines
2.0 KiB
TypeScript
68 lines
2.0 KiB
TypeScript
import { Button, Typography, styled } from '@mui/material';
|
|
import { DemoDialog } from '../DemoDialog';
|
|
import Confetti from 'react-confetti';
|
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
|
|
|
const StyledActions = styled('div')(({ theme }) => ({
|
|
display: 'grid',
|
|
gridTemplateColumns: '1fr 1fr',
|
|
gap: theme.spacing(3),
|
|
marginTop: theme.spacing(7.5),
|
|
}));
|
|
|
|
const StyledButton = styled(Button)(({ theme }) => ({
|
|
height: theme.spacing(7),
|
|
}));
|
|
|
|
interface IDemoDialogFinishProps {
|
|
open: boolean;
|
|
onClose: () => void;
|
|
onRestart: () => void;
|
|
}
|
|
|
|
export const DemoDialogFinish = ({
|
|
open,
|
|
onClose,
|
|
onRestart,
|
|
}: IDemoDialogFinishProps) => (
|
|
<>
|
|
<ConditionallyRender
|
|
condition={open}
|
|
show={
|
|
<Confetti
|
|
recycle={false}
|
|
numberOfPieces={1000}
|
|
initialVelocityY={50}
|
|
gravity={0.3}
|
|
style={{ zIndex: 3000 }}
|
|
/>
|
|
}
|
|
/>
|
|
<DemoDialog open={open} onClose={onClose}>
|
|
<DemoDialog.Header>You finished the demo</DemoDialog.Header>
|
|
<Typography color="textSecondary" sx={{ mt: 4 }}>
|
|
Great job! Keep exploring Unleash, as this was just a small
|
|
example of its full potential. You can do the demo again at any
|
|
moment.
|
|
</Typography>
|
|
<StyledActions>
|
|
<StyledButton
|
|
variant="outlined"
|
|
color="primary"
|
|
onClick={onRestart}
|
|
>
|
|
Restart demo
|
|
</StyledButton>
|
|
<StyledButton
|
|
variant="contained"
|
|
color="primary"
|
|
onClick={onClose}
|
|
data-testid="DEMO_FINISH_BUTTON"
|
|
>
|
|
Continue
|
|
</StyledButton>
|
|
</StyledActions>
|
|
</DemoDialog>
|
|
</>
|
|
);
|