From 6748281240de45c2ce5a4cac3b4a94b8c74c65cb Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 20 Feb 2024 12:23:05 +0100 Subject: [PATCH] fix test --- apps/remix-ide-e2e/src/tests/gist.test.ts | 13 +++++++------ apps/remix-ide-e2e/src/tests/plugin_api.ts | 7 ++++--- .../remix-ui/workspace/src/lib/actions/workspace.ts | 3 +-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/gist.test.ts b/apps/remix-ide-e2e/src/tests/gist.test.ts index 38ef449fd4..e0a2e15996 100644 --- a/apps/remix-ide-e2e/src/tests/gist.test.ts +++ b/apps/remix-ide-e2e/src/tests/gist.test.ts @@ -110,8 +110,8 @@ module.exports = { .waitForElementVisible('[data-id="settingsTabRemoveGistToken"]') .click('[data-id="settingsTabRemoveGistToken"]') .clickLaunchIcon('filePanel') - .waitForElementVisible('*[data-id="fileExplorerNewFilepublishToGist"]') - .click('*[data-id="fileExplorerNewFilepublishToGist"]') + .click('*[data-id="workspacesMenuDropdown"]') + .click('*[data-id="workspacepublishToGist"]') .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') .execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() }) .pause(10000) @@ -153,12 +153,13 @@ module.exports = { .url('http://127.0.0.1:8080/#gist=' + gistId) // loading the gist .refreshPage() .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 15000) - .waitForElementVisible(`#fileExplorerView li[data-path='README.txt']`, 30000) - .openFile(`scripts/deploy_with_ethers.ts`) + .waitForElementVisible(`#fileExplorerView li[data-path='contracts']`, 30000) + .openFile(`contracts/2_Owner.sol`) .getEditorValue((content) => { - browser.assert.ok(content !== '') + browser.assert.ok(content.indexOf('contract Owner {') !== -1) }) - .click('*[data-id="fileExplorerNewFileupdateGist"]') + .click('*[data-id="workspacesMenuDropdown"]') + .click('*[data-id="workspacepublishToGist"]') .modalFooterOKClick('fileSystem') .waitForElementVisible('*[data-shared="tooltipPopup"]', 5000) .assert.containsText('*[data-shared="tooltipPopup"]', 'Saving gist (' + gistId + ') ...') diff --git a/apps/remix-ide-e2e/src/tests/plugin_api.ts b/apps/remix-ide-e2e/src/tests/plugin_api.ts index 91a1df9ad4..69bbc140ca 100644 --- a/apps/remix-ide-e2e/src/tests/plugin_api.ts +++ b/apps/remix-ide-e2e/src/tests/plugin_api.ts @@ -128,6 +128,7 @@ const checkForAcceptAndRemember = async function (browser: NightwatchBrowser) { */ const clickAndCheckLog = async (browser: NightwatchBrowser, buttonText: string, methodResult: any, eventResult: any, payload: any, waitResult: boolean = true) => { // eslint-disable-line + console.log('clickAndCheckLog', buttonText, methodResult, eventResult, payload, waitResult) if (payload) { await setPayload(browser, payload) } else { @@ -295,7 +296,7 @@ module.exports = { }, null, '/') }, 'Should get all workspaces #group2': async function (browser: NightwatchBrowser) { - await clickAndCheckLog(browser, 'filePanel:getWorkspaces', [{name:"default_workspace",isGitRepo:false,hasGitSubmodules:false}, {name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false}, {name:"testspace",isGitRepo:false,hasGitSubmodules:false}], null, null) + await clickAndCheckLog(browser, 'filePanel:getWorkspaces', [{name:"default_workspace",isGitRepo:false,hasGitSubmodules:false,isGist:null}, {name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false,isGist:null}, {name:"testspace",isGitRepo:false,hasGitSubmodules:false,isGist:null}], null, null) }, 'Should have set workspace event #group2': async function (browser: NightwatchBrowser) { await clickAndCheckLog(browser, 'filePanel:createWorkspace', null, { event: 'setWorkspace', args: [{ name: 'newspace', isLocalhost: false }] }, 'newspace') @@ -309,11 +310,11 @@ module.exports = { 'Should rename workspace #group2': async function (browser: NightwatchBrowser) { await clickAndCheckLog(browser, 'filePanel:renameWorkspace', null, null, ['default_workspace', 'renamed']) - await clickAndCheckLog(browser, 'filePanel:getWorkspaces', [{name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false},{name:"testspace",isGitRepo:false,hasGitSubmodules:false},{name:"newspace",isGitRepo:false,hasGitSubmodules:false},{name:"renamed",isGitRepo:false,hasGitSubmodules:false}], null, null) + await clickAndCheckLog(browser, 'filePanel:getWorkspaces', [{name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false,isGist:null},{name:"testspace",isGitRepo:false,hasGitSubmodules:false,isGist:null},{name:"newspace",isGitRepo:false,hasGitSubmodules:false,isGist:null},{name:"renamed",isGitRepo:false,hasGitSubmodules:false,isGist:null}], null, null) }, 'Should delete workspace #group2': async function (browser: NightwatchBrowser) { await clickAndCheckLog(browser, 'filePanel:deleteWorkspace', null, null, ['testspace']) - await clickAndCheckLog(browser, 'filePanel:getWorkspaces', [{name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false},{name:"newspace",isGitRepo:false,hasGitSubmodules:false},{name:"renamed",isGitRepo:false,hasGitSubmodules:false}], null, null) + await clickAndCheckLog(browser, 'filePanel:getWorkspaces', [{name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false,isGist:null},{name:"newspace",isGitRepo:false,hasGitSubmodules:false,isGist:null},{name:"renamed",isGitRepo:false,hasGitSubmodules:false,isGist:null}], null, null) }, // DGIT 'Should have changes on new workspace #group3': async function (browser: NightwatchBrowser) { diff --git a/libs/remix-ui/workspace/src/lib/actions/workspace.ts b/libs/remix-ui/workspace/src/lib/actions/workspace.ts index ec3557e54d..be45f3f4d7 100644 --- a/libs/remix-ui/workspace/src/lib/actions/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/actions/workspace.ts @@ -627,12 +627,11 @@ export const getWorkspaces = async (): Promise<{ name: string; isGitRepo: boolea isGist: null } } else { - const gistId = await plugin.call('filePanel', 'isGist', name) return { name, isGitRepo, hasGitSubmodules, - isGist: gistId + isGist: plugin.isGist(name) // plugin is filePanel } } })