-
Notifications
You must be signed in to change notification settings - Fork 125
Add E2E Test Playground with SCW Release Test Suite #217
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
Open
spencerstock
wants to merge
21
commits into
master
Choose a base branch
from
spencer/e2e-playground
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
0ea3619
initial playground
spencerstock d3223d2
fully featured for local use
spencerstock 729f1bf
use npm latest import
spencerstock 77b79f0
better abstractions
spencerstock 76d4817
refactor(e2e-test): remove redundant logging and unused connection he…
spencerstock e7c3bf7
skipmodal
spencerstock 161eb2b
clean up feedback abstraction
spencerstock 877cd20
Add SCW release test suite with wallet URL configuration
spencerstock dda5648
Fix lint errors
spencerstock 292fa96
Revert changes outside examples directory
spencerstock 1c55055
remove useless docs
spencerstock f9e8c77
fix ci
spencerstock 8bf7d1c
clean up
spencerstock 099b558
fix ci
spencerstock 6449a7f
Revert formatting changes (import reordering) unrelated to e2e test s…
spencerstock 00e9233
Remove backup file from e2e test suite
spencerstock 2cb5cbb
file wide any exemption
spencerstock 1839916
fix CI
spencerstock c8982ab
remove unnecessary configs
spencerstock 1b9aa67
udpate example
spencerstock 348e24b
fix ci
spencerstock File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
102 changes: 102 additions & 0 deletions
102
examples/testapp/src/components/UserInteractionModal.tsx
This file contains hidden or 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,102 @@ | ||
| import { | ||
| Box, | ||
| Button, | ||
| Modal, | ||
| ModalBody, | ||
| ModalContent, | ||
| ModalFooter, | ||
| ModalHeader, | ||
| ModalOverlay, | ||
| Text, | ||
| VStack, | ||
| } from '@chakra-ui/react'; | ||
| import { useEffect, useRef } from 'react'; | ||
|
|
||
| interface UserInteractionModalProps { | ||
| isOpen: boolean; | ||
| testName: string; | ||
| onContinue: () => void; | ||
| onCancel: () => void; | ||
| } | ||
|
|
||
| export function UserInteractionModal({ | ||
| isOpen, | ||
| testName, | ||
| onContinue, | ||
| onCancel, | ||
| }: UserInteractionModalProps) { | ||
| const continueButtonRef = useRef<HTMLButtonElement>(null); | ||
|
|
||
| // Focus the continue button when modal opens | ||
| useEffect(() => { | ||
| if (isOpen) { | ||
| setTimeout(() => { | ||
| continueButtonRef.current?.focus(); | ||
| }, 100); | ||
| } | ||
| }, [isOpen]); | ||
|
|
||
| // Handle Enter key to continue | ||
| useEffect(() => { | ||
| if (!isOpen) return; | ||
|
|
||
| const handleKeyDown = (e: KeyboardEvent) => { | ||
| if (e.key === 'Enter') { | ||
| e.preventDefault(); | ||
| onContinue(); | ||
| } else if (e.key === 'Escape') { | ||
| e.preventDefault(); | ||
| onCancel(); | ||
| } | ||
| }; | ||
|
|
||
| window.addEventListener('keydown', handleKeyDown); | ||
| return () => window.removeEventListener('keydown', handleKeyDown); | ||
| }, [isOpen, onContinue, onCancel]); | ||
|
|
||
| return ( | ||
| <Modal | ||
| isOpen={isOpen} | ||
| onClose={onCancel} | ||
| isCentered | ||
| closeOnOverlayClick={false} | ||
| closeOnEsc={true} | ||
| > | ||
| <ModalOverlay bg="blackAlpha.700" backdropFilter="blur(10px)" /> | ||
| <ModalContent> | ||
| <ModalHeader>User Interaction Required</ModalHeader> | ||
| <ModalBody> | ||
| <VStack spacing={4} align="stretch"> | ||
| <Text>The next test requires user interaction to prevent popup blockers:</Text> | ||
| <Text fontWeight="bold" fontSize="lg" color="purple.500"> | ||
| {testName} | ||
| </Text> | ||
| <Box | ||
| bg="purple.50" | ||
| borderWidth="2px" | ||
| borderColor="purple.400" | ||
| borderRadius="md" | ||
| p={4} | ||
| textAlign="center" | ||
| > | ||
| <Text fontWeight="bold" fontSize="xl" color="purple.600"> | ||
| [Press Enter to Continue] | ||
| </Text> | ||
| </Box> | ||
| <Text fontSize="sm" color="gray.600"> | ||
| Or click "Continue Test" to proceed, or "Cancel Test" to stop the test suite. | ||
| </Text> | ||
| </VStack> | ||
| </ModalBody> | ||
| <ModalFooter gap={3}> | ||
| <Button variant="ghost" onClick={onCancel}> | ||
| Cancel Test | ||
| </Button> | ||
| <Button ref={continueButtonRef} colorScheme="purple" onClick={onContinue}> | ||
| Continue Test | ||
| </Button> | ||
| </ModalFooter> | ||
| </ModalContent> | ||
| </Modal> | ||
| ); | ||
| } |
This file contains hidden or 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,51 @@ | ||
| import { useState } from 'react'; | ||
|
|
||
| interface UseUserInteractionReturn { | ||
| isModalOpen: boolean; | ||
| currentTestName: string; | ||
| requestUserInteraction: (testName: string, skipModal?: boolean) => Promise<void>; | ||
| handleContinue: () => void; | ||
| handleCancel: () => void; | ||
| } | ||
|
|
||
| export function useUserInteraction(): UseUserInteractionReturn { | ||
| const [isModalOpen, setIsModalOpen] = useState(false); | ||
| const [currentTestName, setCurrentTestName] = useState(''); | ||
| const [resolver, setResolver] = useState<{ | ||
| resolve: () => void; | ||
| reject: (error: Error) => void; | ||
| } | null>(null); | ||
|
|
||
| const requestUserInteraction = (testName: string, skipModal = false): Promise<void> => { | ||
| // If skipModal is true, immediately resolve without showing the modal | ||
| if (skipModal) { | ||
| return Promise.resolve(); | ||
| } | ||
|
|
||
| return new Promise((resolve, reject) => { | ||
| setCurrentTestName(testName); | ||
| setIsModalOpen(true); | ||
| setResolver({ resolve, reject }); | ||
| }); | ||
| }; | ||
|
|
||
| const handleContinue = () => { | ||
| setIsModalOpen(false); | ||
| resolver?.resolve(); | ||
| setResolver(null); | ||
| }; | ||
|
|
||
| const handleCancel = () => { | ||
| setIsModalOpen(false); | ||
| resolver?.reject(new Error('Test cancelled by user')); | ||
| setResolver(null); | ||
| }; | ||
|
|
||
| return { | ||
| isModalOpen, | ||
| currentTestName, | ||
| requestUserInteraction, | ||
| handleContinue, | ||
| handleCancel, | ||
| }; | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
removing this since it currently does nothing