Skip to content

Commit 03d4b9e

Browse files
committed
e2e test modal prompt
1 parent 5c70fda commit 03d4b9e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

apps/remix-ide-e2e/src/tests/plugin_api.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,9 @@ module.exports = {
403403
.waitForElementVisible('*[data-id="test_id_2_ModalDialogModalBody-react"]')
404404
.assert.containsText('*[data-id="test_id_2_ModalDialogModalBody-react"]', 'message 2')
405405
.modalFooterOKClick('test_id_2_')
406+
.waitForElementVisible('*[data-id="test_id_3_ModalDialogModalBody-react"]')
407+
.modalFooterOKClick('test_id_3_')
408+
.journalLastChildIncludes('default value... ') // check the return value of the prompt
406409
// check the toasters
407410
.waitForElementVisible('*[data-shared="tooltipPopup"]')
408411
.waitForElementContainsText('*[data-shared="tooltipPopup"]', 'message toast from local plugin')
@@ -415,12 +418,24 @@ const testModalToasterApi = `
415418
// Right click on the script name and hit "Run" to execute
416419
(async () => {
417420
try {
418-
setTimeout(() => {
421+
setTimeout(async () => {
419422
console.log('test .. ')
420423
remix.call('notification', 'alert', { message: 'message 1', id: 'test_id_1_' })
421424
remix.call('notification', 'toast', 'I am a toast')
422425
remix.call('notification', 'toast', 'I am a re-toast')
423426
remix.call('notification', 'alert', { message: 'message 2', id: 'test_id_2_' })
427+
428+
const modalContent = {
429+
id: 'test_id_3_'
430+
title: 'test with input title',
431+
message: 'test with input content',
432+
modalType: 'prompt',
433+
okLabel: 'OK',
434+
cancelLabel: 'Cancel',
435+
defaultValue: 'default value... '
436+
}
437+
const result = await remix.call('notification', 'modal', modalContent)
438+
console.log(result)
424439
}, 500)
425440
} catch (e) {
426441
console.log(e.message)

0 commit comments

Comments
 (0)