From 3404d2318fa765cbe3ce31fb6365c0462305779e Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 1 May 2024 11:28:32 +0200 Subject: [PATCH] fix E2E setting input value --- apps/remix-ide-e2e/src/tests/ballot.test.ts | 4 +-- apps/remix-ide-e2e/src/tests/erc721.test.ts | 4 +-- .../remix-ide-e2e/src/tests/workspace.test.ts | 31 ++++++++++--------- .../src/tests/workspace_git.test.ts | 7 +++-- .../src/app/plugins/templates-selection.tsx | 3 +- 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/ballot.test.ts b/apps/remix-ide-e2e/src/tests/ballot.test.ts index 8c537c5235..c9fb7c27bc 100644 --- a/apps/remix-ide-e2e/src/tests/ballot.test.ts +++ b/apps/remix-ide-e2e/src/tests/ballot.test.ts @@ -100,8 +100,8 @@ module.exports = { .waitForElementPresent('*[data-id="create-remixDefault"]') .scrollAndClick('*[data-id="create-remixDefault"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - // eslint-disable-next-line dot-notation - .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_remix_default' }) + .scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]') + .setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_remix_default') .modalFooterOKClick('TemplatesSelection') .pause(1000) .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]') diff --git a/apps/remix-ide-e2e/src/tests/erc721.test.ts b/apps/remix-ide-e2e/src/tests/erc721.test.ts index 5c56e205e3..890a5e7fc3 100644 --- a/apps/remix-ide-e2e/src/tests/erc721.test.ts +++ b/apps/remix-ide-e2e/src/tests/erc721.test.ts @@ -20,8 +20,8 @@ module.exports = { .waitForElementPresent('*[data-id="create-hashchecker"]') .scrollAndClick('*[data-id="create-ozerc721"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - // eslint-disable-next-line dot-notation - .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_erc721' }) + .scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]') + .setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_erc721') .modalFooterOKClick('TemplatesSelection') .pause(100) .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]') diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts index a1f43608dd..094b35a080 100644 --- a/apps/remix-ide-e2e/src/tests/workspace.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts @@ -41,8 +41,8 @@ module.exports = { .waitForElementPresent('*[data-id="create-remixDefault"]') .scrollAndClick('*[data-id="create-remixDefault"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - // eslint-disable-next-line dot-notation - .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_remix_default' }) + .scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]') + .setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_remix_default') .modalFooterOKClick('TemplatesSelection') .pause(1000) .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]') @@ -113,8 +113,8 @@ module.exports = { .waitForElementPresent('*[data-id="create-blank"]') .scrollAndClick('*[data-id="create-blank"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - // eslint-disable-next-line dot-notation - .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_blank' }) + .scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]') + .setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_blank') .modalFooterOKClick('TemplatesSelection') .pause(100) .waitForElementPresent('*[data-id="treeViewUltreeViewMenu"]') @@ -134,8 +134,8 @@ module.exports = { .waitForElementPresent('*[data-id="create-ozerc20"]') .scrollAndClick('*[data-id="create-ozerc20"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - // eslint-disable-next-line dot-notation - .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_erc20' }) + .scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]') + .setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_erc20') .modalFooterOKClick('TemplatesSelection') .pause(100) .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]') @@ -193,8 +193,8 @@ module.exports = { .waitForElementPresent('*[data-id="create-ozerc721"]') .scrollAndClick('*[data-id="create-ozerc721"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - // eslint-disable-next-line dot-notation - .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_erc721' }) + .scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]') + .setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_erc721') .modalFooterOKClick('TemplatesSelection') .pause(100) .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]') @@ -252,8 +252,8 @@ module.exports = { .waitForElementPresent('*[data-id="create-ozerc1155"]') .scrollAndClick('*[data-id="create-ozerc1155"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - // eslint-disable-next-line dot-notation - .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_erc1155' }) + .scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]') + .setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_erc1155') .modalFooterOKClick('TemplatesSelection') .pause(100) .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]') @@ -482,7 +482,8 @@ module.exports = { .waitForElementPresent('*[data-id="create-ozerc1155"]') .scrollAndClick('*[data-id="create-ozerc1155"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'sometestworkspace' }) + .scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]') + .setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'sometestworkspace') .modalFooterOKClick('TemplatesSelection') .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts/MyToken.sol"]') @@ -507,8 +508,8 @@ module.exports = { .waitForElementPresent('*[data-id="create-ozerc1155"]') .scrollAndClick('*[data-id="create-ozerc1155"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - // eslint-disable-next-line dot-notation - .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_db_test' }) + .scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]') + .setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_db_test') .modalFooterOKClick('TemplatesSelection') .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts/MyToken.sol"]') @@ -535,8 +536,8 @@ module.exports = { .waitForElementPresent('*[data-id="create-uniswapV4HookBookMultiSigSwapHook"]') .scrollAndClick('*[data-id="create-uniswapV4HookBookMultiSigSwapHook"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - // eslint-disable-next-line dot-notation - .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'multisig cookbook' }) + .scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]') + .setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'multisig cookbook') .modalFooterOKClick('TemplatesSelection') .waitForElementVisible('[data-id="PermissionHandler-modal-footer-ok-react"]', 300000) .click('[data-id="PermissionHandler-modal-footer-ok-react"]') diff --git a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts index b0b99608e8..7d8cca606a 100644 --- a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts @@ -24,7 +24,8 @@ module.exports = { selector: '//*[@data-id="initGitRepository"][@disabled]', locateStrategy: 'xpath' }) - .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_blank' }) + .scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]') + .setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_blank') .click('[data-id="initGitRepositoryLabel"]') .modalFooterOKClick('TemplatesSelection') .pause(100) @@ -50,8 +51,8 @@ module.exports = { .waitForElementPresent('*[data-id="create-blank"]') .scrollAndClick('*[data-id="create-blank"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - // eslint-disable-next-line dot-notation - .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_blank' }) + .scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]') + .setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_blank') .click('[data-id="initGitRepositoryLabel"]') .modalFooterOKClick('TemplatesSelection') .pause(100) diff --git a/apps/remix-ide/src/app/plugins/templates-selection.tsx b/apps/remix-ide/src/app/plugins/templates-selection.tsx index a68b47fb75..4d3df29a33 100644 --- a/apps/remix-ide/src/app/plugins/templates-selection.tsx +++ b/apps/remix-ide/src/app/plugins/templates-selection.tsx @@ -420,7 +420,6 @@ export class TemplatesSelection extends ViewPlugin { ) } - } const createModalMessage = async ( @@ -440,6 +439,7 @@ const createModalMessage = async ( defaultValue={defaultName} className="form-control" onChange={(e) => onChangeTemplateName(e.target.value)} + onInput={(e) => onChangeTemplateName((e.target as any).value)} />
onChangeInitGit(e.target.value)} + onInput={(e) => onChangeInitGit((e.target as any).value)} />