Merge branch 'master' into scriptruntest

pull/2361/head
bunsenstraat 3 years ago committed by GitHub
commit 21349114cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      apps/remix-ide-e2e/src/buildGroupTests.js
  2. 34
      apps/remix-ide-e2e/src/tests/workspace.test.ts
  3. 2
      apps/remix-ide/src/app/files/fileManager.ts
  4. 14
      apps/remix-ide/src/app/panels/tab-proxy.js

@ -47,7 +47,6 @@ function createFlakyTestFiles(file, text) {
lines.forEach((line, index) => { lines.forEach((line, index) => {
// if line contains #flaky // if line contains #flaky
if (line.includes('#flaky')) { if (line.includes('#flaky')) {
console.log(line)
const matches = line.match(/group\d+/g) const matches = line.match(/group\d+/g)
const unique = matches.filter(onlyUnique) const unique = matches.filter(onlyUnique)
createFiles(file, matches, true) createFiles(file, matches, true)

@ -4,6 +4,7 @@ import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
module.exports = { module.exports = {
'@disabled': true,
before: function (browser: NightwatchBrowser, done: VoidFunction) { before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done, 'http://127.0.0.1:8080?activate=solidity,udapp&call=fileManager//open//contracts/3_Ballot.sol&deactivate=home', false) init(browser, done, 'http://127.0.0.1:8080?activate=solidity,udapp&call=fileManager//open//contracts/3_Ballot.sol&deactivate=home', false)
}, },
@ -15,7 +16,7 @@ module.exports = {
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
}, },
'Editor should be focused on the 3_Ballot.sol': function (browser: NightwatchBrowser) { 'Editor should be focused on the 3_Ballot.sol #group1': function (browser: NightwatchBrowser) {
browser browser
.pause(5000) .pause(5000)
.refresh() .refresh()
@ -25,21 +26,22 @@ module.exports = {
}) })
}, },
'Home page should be deactivated': function (browser: NightwatchBrowser) { 'Home page should be deactivated #group1': function (browser: NightwatchBrowser) {
browser browser
.waitForElementNotPresent('[data-id="landingPageHomeContainer"]') .waitForElementNotPresent('[data-id="landingPageHomeContainer"]')
}, },
'Should create two workspace and switch to the first one': function (browser: NightwatchBrowser) { 'Should create two workspace and switch to the first one #group1': function (browser: NightwatchBrowser) {
browser browser
.clickLaunchIcon('filePanel') .clickLaunchIcon('filePanel')
.click('*[data-id="workspaceCreate"]') // create workspace_name .click('*[data-id="workspaceCreate"]') // create workspace_name
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > span') .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > span')
// eslint-disable-next-line dot-notation .click('*[data-id="modalDialogCustomPromptTextCreate"]')
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_name' }) .clearValue('*[data-id="modalDialogCustomPromptTextCreate"]')
.setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_name')
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') .waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() }) .click('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]')
.pause(1000) .pause(1000)
.addFile('test.sol', { content: 'test' }) .addFile('test.sol', { content: 'test' })
@ -47,10 +49,11 @@ module.exports = {
.click('*[data-id="workspaceCreate"]') // create workspace_name_1 .click('*[data-id="workspaceCreate"]') // create workspace_name_1
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > span') .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > span')
// eslint-disable-next-line dot-notation .click('*[data-id="modalDialogCustomPromptTextCreate"]')
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_name_1' }) .clearValue('*[data-id="modalDialogCustomPromptTextCreate"]')
.setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_name_1')
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') .waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() }) .click('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]')
.pause(2000) .pause(2000)
.waitForElementNotPresent('*[data-id="treeViewLitreeViewItemtest.sol"]') .waitForElementNotPresent('*[data-id="treeViewLitreeViewItemtest.sol"]')
@ -59,15 +62,16 @@ module.exports = {
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]')
}, },
'Should rename a workspace': function (browser: NightwatchBrowser) { 'Should rename a workspace #group1': function (browser: NightwatchBrowser) {
browser browser
.click('*[data-id="workspaceRename"]') // rename workspace_name .click('*[data-id="workspaceRename"]') // rename workspace_name
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]')
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextRename"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextRename"]')
// eslint-disable-next-line dot-notation .click('*[data-id="modalDialogCustomPromptTextRename"]')
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextRename"]')['value'] = 'workspace_name_renamed' }) .clearValue('*[data-id="modalDialogCustomPromptTextRename"]')
.setValue('*[data-id="modalDialogCustomPromptTextRename"]', 'workspace_name_renamed')
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') .waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() }) .click('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.waitForElementPresent('*[data-id="workspacesSelect"] option[value="workspace_name_1"]') .waitForElementPresent('*[data-id="workspacesSelect"] option[value="workspace_name_1"]')
.click('*[data-id="workspacesSelect"] option[value="workspace_name_1"]') .click('*[data-id="workspacesSelect"] option[value="workspace_name_1"]')
.pause(2000) .pause(2000)
@ -78,12 +82,12 @@ module.exports = {
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtest.sol"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtest.sol"]')
}, },
'Should delete a workspace': function (browser: NightwatchBrowser) { 'Should delete a workspace #group1': function (browser: NightwatchBrowser) {
browser browser
.click('*[data-id="workspacesSelect"] option[value="workspace_name_1"]') .click('*[data-id="workspacesSelect"] option[value="workspace_name_1"]')
.click('*[data-id="workspaceDelete"]') // delete workspace_name_1 .click('*[data-id="workspaceDelete"]') // delete workspace_name_1
.waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() }) .click('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.waitForElementNotPresent('*[data-id="workspacesSelect"] option[value="workspace_name_1"]') .waitForElementNotPresent('*[data-id="workspacesSelect"] option[value="workspace_name_1"]')
.end() .end()
}, },

@ -600,7 +600,7 @@ class FileManager extends Plugin {
// TODO: Only keep `this.emit` (issue#2210) // TODO: Only keep `this.emit` (issue#2210)
this.emit('fileRemoved', path) this.emit('fileRemoved', path)
this.events.emit('fileRemoved', path) this.events.emit('fileRemoved', path)
this.openFile() this.openFile(this._deps.config.get('currentFile'))
} }
async unselectCurrentFile() { async unselectCurrentFile() {

@ -41,7 +41,13 @@ export class TabProxy extends Plugin {
if (this.fileManager.mode === 'browser') { if (this.fileManager.mode === 'browser') {
name = name.startsWith(workspace + '/') ? name : workspace + '/' + name name = name.startsWith(workspace + '/') ? name : workspace + '/' + name
this.removeTab(name) // If deleted file is not current file and not an active tab in editor,
// ensure current file is active in the editor
if (this.fileManager.currentFile() && name !== this.fileManager.currentFile()) {
const currentFile = this.fileManager.currentFile()
const currentFileTabPath = currentFile.startsWith(workspace + '/') ? currentFile : workspace + '/' + currentFile
this.removeTab(name, { name: currentFileTabPath })
} else this.removeTab(name)
} else { } else {
name = name.startsWith(this.fileManager.mode + '/') ? name : this.fileManager.mode + '/' + name name = name.startsWith(this.fileManager.mode + '/') ? name : this.fileManager.mode + '/' + name
this.removeTab(name) this.removeTab(name)
@ -261,11 +267,11 @@ export class TabProxy extends Plugin {
this._handlers[name] = { switchTo, close } this._handlers[name] = { switchTo, close }
} }
removeTab (name) { removeTab (name, currentFileTab) {
delete this._handlers[name] delete this._handlers[name]
let previous = null let previous = currentFileTab
this.loadedTabs = this.loadedTabs.filter((tab, index) => { this.loadedTabs = this.loadedTabs.filter((tab, index) => {
if (tab.name === name) previous = this.loadedTabs[index - 1] if (!previous && tab.name === name) previous = this.loadedTabs[index - 1]
return tab.name !== name return tab.name !== name
}) })
this.renderComponent() this.renderComponent()

Loading…
Cancel
Save