From 0224b5fa77733e0a7554ec4517a11c41d5a72041 Mon Sep 17 00:00:00 2001 From: lianahus Date: Mon, 3 May 2021 16:11:40 +0200 Subject: [PATCH] added test for switch workspace --- .../src/tests/solidityUnittests.spec.ts | 18 ++++++++++++++++++ apps/remix-ide/src/app/tabs/test-tab.js | 3 +-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts b/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts index 632040aad9..950f722c99 100644 --- a/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts +++ b/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts @@ -144,6 +144,24 @@ module.exports = { .click('*[data-id="testTabGenerateTestFolder"]') }, + 'Changing current path when workspace changed': function (browser: NightwatchBrowser) { + browser + .waitForElementPresent('*[data-id="verticalIconsKindfilePanel"]') + .clickLaunchIcon('solidityUnitTesting') + .clearValue('*[data-id="uiPathInput"]') + .setValue('*[data-id="uiPathInput"]', 'tests1') + .click('*[data-id="testTabGenerateTestFolder"]') + .clickLaunchIcon('filePanel') + .click('*[data-id="workspaceCreate"]') // create workspace_name + .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') + // eslint-disable-next-line dot-notation + .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_new' }) + .click('*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok') + .clickLaunchIcon('solidityUnitTesting') + .assert.containsText('*[data-id="uiPathInput"]', 'tests') + }, + + 'Solidity Unittests': function (browser: NightwatchBrowser) { runTests(browser) } diff --git a/apps/remix-ide/src/app/tabs/test-tab.js b/apps/remix-ide/src/app/tabs/test-tab.js index 1fa24d05a4..7f542b5f3b 100644 --- a/apps/remix-ide/src/app/tabs/test-tab.js +++ b/apps/remix-ide/src/app/tabs/test-tab.js @@ -595,7 +595,6 @@ module.exports = class TestTab extends ViewPlugin { if (testDirInput) { if (testDirInput.endsWith('/')) { - // check if the options list already contains the options if (this.testTabLogic.currentPath === testDirInput.substr(0, testDirInput.length - 1)) { this.createTestFolder.disabled = true this.updateGenerateFileAction().disabled = true @@ -603,7 +602,7 @@ module.exports = class TestTab extends ViewPlugin { this.updateDirList(testDirInput) } else { // If there is no matching folder in the workspace with entered text, enable Create button - if (this.pathAdded(testDirInput)) { + if (this.testTabLogic.pathExists(testDirInput)) { this.createTestFolder.disabled = true this.updateGenerateFileAction().disabled = false } else {