@@ -21,7 +21,11 @@ const links = {
2121 video1 :
2222 '/learn/python-for-everybody/python-for-everybody/introduction-why-program' ,
2323 video2 :
24- '/learn/python-for-everybody/python-for-everybody/introduction-hardware-architecture'
24+ '/learn/python-for-everybody/python-for-everybody/introduction-hardware-architecture' ,
25+ multipleChoiceQuestion :
26+ '/learn/a2-english-for-developers/learn-greetings-in-your-first-day-at-the-office/task-7' ,
27+ assignment :
28+ '/learn/full-stack-developer/review-semantic-html/review-semantic-html'
2529} ;
2630
2731const titles = {
@@ -143,3 +147,71 @@ test('User can use shortcuts to navigate between video-based challenges', async
143147 await page . keyboard . press ( 'p' ) ;
144148 await page . waitForURL ( links . video1 ) ;
145149} ) ;
150+
151+ test ( 'User can use Ctrl+Enter to submit their answer in a multiple-choice question challenge' , async ( {
152+ page
153+ } ) => {
154+ await page . goto ( links . multipleChoiceQuestion ) ;
155+
156+ // Wait for page load
157+ await expect ( page . getByRole ( 'heading' , { name : 'Task 7' } ) ) . toBeVisible ( ) ;
158+
159+ await page . keyboard . press ( 'Control+Enter' ) ;
160+
161+ await expect (
162+ page . getByText ( 'You have unanswered questions and/or incorrect answers.' )
163+ ) . toBeVisible ( ) ;
164+ } ) ;
165+
166+ test ( 'User can use Cmd+Enter to submit their answer in a multiple-choice question challenge' , async ( {
167+ page
168+ } ) => {
169+ await page . goto ( links . multipleChoiceQuestion ) ;
170+
171+ // Wait for page load
172+ await expect ( page . getByRole ( 'heading' , { name : 'Task 7' } ) ) . toBeVisible ( ) ;
173+
174+ await page . keyboard . press ( 'Meta+Enter' ) ;
175+
176+ await expect (
177+ page . getByText ( 'You have unanswered questions and/or incorrect answers.' )
178+ ) . toBeVisible ( ) ;
179+ } ) ;
180+
181+ test ( 'User can use Ctrl+Enter to submit their answer in an assignment-type challenge' , async ( {
182+ page
183+ } ) => {
184+ await page . goto ( links . assignment ) ;
185+
186+ // Wait for page load
187+ await expect (
188+ page . getByRole ( 'heading' , { name : 'Semantic HTML Review' } )
189+ ) . toBeVisible ( ) ;
190+
191+ // Check the assignment checkbox
192+ await page . getByRole ( 'checkbox' ) . check ( ) ;
193+
194+ await page . keyboard . press ( 'Control+Enter' ) ;
195+
196+ // Completion modal shows up
197+ await expect ( page . getByRole ( 'dialog' ) ) . toBeVisible ( ) ;
198+ } ) ;
199+
200+ test ( 'User can use Cmd+Enter to submit their answer in an assignment-type challenge' , async ( {
201+ page
202+ } ) => {
203+ await page . goto ( links . assignment ) ;
204+
205+ // Wait for page load
206+ await expect (
207+ page . getByRole ( 'heading' , { name : 'Semantic HTML Review' } )
208+ ) . toBeVisible ( ) ;
209+
210+ // Check the assignment checkbox
211+ await page . getByRole ( 'checkbox' ) . check ( ) ;
212+
213+ await page . keyboard . press ( 'Meta+Enter' ) ;
214+
215+ // Completion modal shows up
216+ await expect ( page . getByRole ( 'dialog' ) ) . toBeVisible ( ) ;
217+ } ) ;
0 commit comments