Merge branch 'apply-refactored-tooltips' of github.com:ethereum/remix-project into apply-refactored-tooltips
commit
09284d1c2f
@ -0,0 +1,241 @@ |
||||
'use strict' |
||||
import { NightwatchBrowser } from "nightwatch" |
||||
import init from "../helpers/init" |
||||
import sauce from "./sauce" |
||||
|
||||
module.exports = { |
||||
'@disabled': true, |
||||
before: function (browser: NightwatchBrowser, done: VoidFunction) { |
||||
init(browser, done) |
||||
}, |
||||
|
||||
'Should create and initialize a GIT repository #group1': function (browser: NightwatchBrowser) { |
||||
browser |
||||
.clickLaunchIcon('filePanel') |
||||
.waitForElementNotVisible('[data-id="workspaceGitPanel"]') |
||||
.click('*[data-id="workspaceCreate"]') |
||||
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') |
||||
.waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > button') |
||||
// eslint-disable-next-line dot-notation
|
||||
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_blank' }) |
||||
.click('select[id="wstemplate"]') |
||||
.click('select[id="wstemplate"] option[value=blank]') |
||||
.click('[data-id="initGitRepositoryLabel"]') |
||||
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') |
||||
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() }) |
||||
.pause(100) |
||||
.waitForElementVisible('[data-id="workspaceGitPanel"]') |
||||
.waitForElementContainsText('[data-id="workspaceGitBranchesDropdown"]', 'main') |
||||
}, |
||||
|
||||
// CLONE REPOSITORY E2E START
|
||||
|
||||
'Should clone a repository #group2': function (browser: NightwatchBrowser) { |
||||
browser |
||||
.clickLaunchIcon('filePanel') |
||||
.useXpath() |
||||
.click('//*[@id="workspacesMenuDropdown"]/span/i') |
||||
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') |
||||
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') |
||||
.useCss() |
||||
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') |
||||
.click('[data-id="fileSystemModalDialogModalBody-react"]') |
||||
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') |
||||
.setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') |
||||
.click('[data-id="fileSystem-modal-footer-ok-react"]') |
||||
.waitForElementPresent('.fa-spinner') |
||||
.pause(5000) |
||||
.waitForElementNotPresent('.fa-spinner') |
||||
.waitForElementVisible('*[data-id="treeViewLitreeViewItem.git"]') |
||||
.waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix') |
||||
}, |
||||
|
||||
'Should display dgit icon for cloned workspace #group2': function (browser: NightwatchBrowser) { |
||||
browser |
||||
.switchWorkspace('default_workspace') |
||||
.waitForElementNotVisible('[data-id="workspacesSelect"] .fa-code-branch') |
||||
.switchWorkspace('awesome-remix') |
||||
.waitForElementVisible('[data-id="workspacesSelect"] .fa-code-branch') |
||||
}, |
||||
|
||||
'Should display non-clashing names for duplicate clone #group2': '' + function (browser: NightwatchBrowser) { |
||||
browser |
||||
.useXpath() |
||||
.click('//*[@id="workspacesMenuDropdown"]/span/i') |
||||
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') |
||||
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') |
||||
.useCss() |
||||
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') |
||||
.click('[data-id="fileSystemModalDialogModalBody-react"]') |
||||
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') |
||||
.setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') |
||||
.click('[data-id="fileSystem-modal-footer-ok-react"]') |
||||
.pause(5000) |
||||
.waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix1') |
||||
.useXpath() |
||||
.click('//*[@id="workspacesMenuDropdown"]/span/i') |
||||
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') |
||||
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') |
||||
.useCss() |
||||
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') |
||||
.click('[data-id="fileSystemModalDialogModalBody-react"]') |
||||
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') |
||||
.setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') |
||||
.click('[data-id="fileSystem-modal-footer-ok-react"]') |
||||
.pause(5000) |
||||
.waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix2') |
||||
.useXpath() |
||||
.click('//*[@id="workspacesMenuDropdown"]/span/i') |
||||
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') |
||||
.useCss() |
||||
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') |
||||
.click('[data-id="fileSystemModalDialogModalBody-react"]') |
||||
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') |
||||
.setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') |
||||
.click('[data-id="fileSystem-modal-footer-ok-react"]') |
||||
.pause(5000) |
||||
.waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix3') |
||||
.switchWorkspace('awesome-remix') |
||||
.switchWorkspace('awesome-remix1') |
||||
.switchWorkspace('awesome-remix2') |
||||
.switchWorkspace('awesome-remix3') |
||||
}, |
||||
|
||||
'Should display error message in modal for failed clone #group2': function (browser: NightwatchBrowser) { |
||||
browser |
||||
.useXpath() |
||||
.waitForElementPresent({ |
||||
selector: '//i[@data-icon="workspaceDropdownMenuIcon"]', |
||||
locateStrategy: 'xpath', |
||||
}) |
||||
.click('//*[@id="workspacesMenuDropdown"]/span/i') |
||||
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') |
||||
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') |
||||
.useCss() |
||||
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') |
||||
.click('[data-id="fileSystemModalDialogModalBody-react"]') |
||||
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') |
||||
.setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/non-existent-repo') |
||||
.click('[data-id="fileSystem-modal-footer-ok-react"]') |
||||
.pause(5000) |
||||
.waitForElementVisible('[data-id="cloneGitRepositoryModalDialogModalBody-react"]') |
||||
.waitForElementContainsText('[data-id="cloneGitRepositoryModalDialogModalBody-react"]', 'An error occurred: Please check that you have the correct URL for the repo. If the repo is private, you need to add your github credentials (with the valid token permissions) in Settings plugin') |
||||
.click('[data-id="cloneGitRepository-modal-footer-ok-react"]') |
||||
}, |
||||
|
||||
// CLONE REPOSITORY E2E END
|
||||
|
||||
// GIT BRANCHES E2E START
|
||||
'Should show all cloned repo branches #group3': function (browser: NightwatchBrowser) { |
||||
browser |
||||
.clickLaunchIcon('filePanel') |
||||
.waitForElementNotVisible('[data-id="workspaceGitPanel"]') |
||||
.useXpath() |
||||
.click('//*[@id="workspacesMenuDropdown"]/span/i') |
||||
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') |
||||
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') |
||||
.useCss() |
||||
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') |
||||
.click('[data-id="fileSystemModalDialogModalBody-react"]') |
||||
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') |
||||
.setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ioedeveloper/test-branch-change') |
||||
.click('[data-id="fileSystem-modal-footer-ok-react"]') |
||||
.waitForElementPresent('.fa-spinner') |
||||
.pause(5000) |
||||
.waitForElementNotPresent('.fa-spinner') |
||||
.waitForElementContainsText('[data-id="workspacesSelect"]', 'test-branch-change') |
||||
.waitForElementVisible('[data-id="workspaceGitPanel"]') |
||||
.click('[data-id="workspaceGitBranchesDropdown"]') |
||||
.waitForElementVisible('[data-id="custom-dropdown-menu"]') |
||||
.waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/dev') |
||||
.waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/production') |
||||
.waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/setup') |
||||
.expect.element('[data-id="workspaceGit-main"]').text.to.contain('✓ ') |
||||
}, |
||||
|
||||
'Should a checkout to a remote branch #group3': function (browser: NightwatchBrowser) { |
||||
browser |
||||
.waitForElementVisible('[data-id="custom-dropdown-menu"]') |
||||
.waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/dev') |
||||
.waitForElementPresent('[data-id="workspaceGit-origin/dev"]') |
||||
.click('[data-id="workspaceGit-origin/dev"]') |
||||
.pause(5000) |
||||
.waitForElementPresent('[data-id="treeViewDivtreeViewItemdev.ts"]') |
||||
.click('[data-id="workspaceGitBranchesDropdown"]') |
||||
.expect.element('[data-id="workspaceGit-dev"]').text.to.contain('✓ ') |
||||
}, |
||||
|
||||
'Should search for a branch (local and remote) #group3': function (browser: NightwatchBrowser) { |
||||
browser |
||||
.waitForElementVisible('[data-id="custom-dropdown-menu"]') |
||||
.waitForElementPresent('[data-id="workspaceGitInput"]') |
||||
.sendKeys('[data-id="workspaceGitInput"]', 'setup') |
||||
.waitForElementNotPresent('[data-id="workspaceGit-origin/dev"]') |
||||
.waitForElementNotPresent('[data-id="workspaceGit-origin/production"]') |
||||
.waitForElementNotPresent('[data-id="workspaceGit-dev"]') |
||||
.waitForElementNotPresent('[data-id="workspaceGit-main"]') |
||||
.waitForElementPresent('[data-id="workspaceGit-origin/setup"]') |
||||
}, |
||||
|
||||
'Should checkout to a new local branch #group3': function (browser: NightwatchBrowser) { |
||||
browser |
||||
.waitForElementVisible('[data-id="custom-dropdown-menu"]') |
||||
.waitForElementPresent('[data-id="workspaceGitInput"]') |
||||
.clearValue('[data-id="workspaceGitInput"]') |
||||
.sendKeys('[data-id="workspaceGitInput"]', 'newLocalBranch') |
||||
.waitForElementContainsText('[data-id="workspaceGitCreateNewBranch"]', `Create branch: newLocalBranch from 'dev'`) |
||||
.click('[data-id="workspaceGitCreateNewBranch"]') |
||||
.pause(2000) |
||||
.click('[data-id="workspaceGitBranchesDropdown"]') |
||||
.waitForElementVisible('[data-id="custom-dropdown-menu"]') |
||||
.expect.element('[data-id="workspaceGit-newLocalBranch"]').text.to.contain('✓ ') |
||||
}, |
||||
|
||||
'Should checkout to an exisiting local branch #group3': function (browser: NightwatchBrowser) { |
||||
browser |
||||
.waitForElementVisible('[data-id="custom-dropdown-menu"]') |
||||
.waitForElementPresent('[data-id="workspaceGitInput"]') |
||||
.clearValue('[data-id="workspaceGitInput"]') |
||||
.sendKeys('[data-id="workspaceGitInput"]', [browser.Keys.SPACE, browser.Keys.BACK_SPACE]) |
||||
.waitForElementPresent('[data-id="workspaceGit-main"]') |
||||
.click('[data-id="workspaceGit-main"]') |
||||
.pause(2000) |
||||
.waitForElementNotPresent('[data-id="treeViewDivtreeViewItemdev.ts"]') |
||||
.waitForElementPresent('[data-id="treeViewDivtreeViewItemmain.ts"]') |
||||
.click('[data-id="workspaceGitBranchesDropdown"]') |
||||
.expect.element('[data-id="workspaceGit-main"]').text.to.contain('✓ ') |
||||
}, |
||||
|
||||
'Should prevent checkout to a branch if local changes exists #group3': function (browser: NightwatchBrowser) { |
||||
browser |
||||
.renamePath('README.md', 'README.txt', 'README.txt') |
||||
.waitForElementVisible('[data-id="workspaceGitBranchesDropdown"]') |
||||
.click('[data-id="workspaceGitBranchesDropdown"]') |
||||
.waitForElementVisible('[data-id="workspaceGit-dev"]') |
||||
.click('[data-id="workspaceGit-dev"]') |
||||
.waitForElementVisible('[data-id="switchBranchModalDialogContainer-react"]') |
||||
.waitForElementContainsText('[data-id="switchBranchModalDialogModalBody-react"]', 'Your local changes to the following files would be overwritten by checkout.') |
||||
.click('[data-id="switchBranchModalDialogModalFooter-react"]') |
||||
.click('[data-id="switchBranch-modal-footer-cancel-react"]') |
||||
.pause(2000) |
||||
.click('[data-id="workspaceGitBranchesDropdown"]') |
||||
.expect.element('[data-id="workspaceGit-main"]').text.to.contain('✓ ') |
||||
}, |
||||
|
||||
'Should force checkout to a branch with exisiting local changes #group3': function (browser: NightwatchBrowser) { |
||||
browser |
||||
.waitForElementVisible('[data-id="workspaceGit-dev"]') |
||||
.click('[data-id="workspaceGit-dev"]') |
||||
.waitForElementVisible('[data-id="switchBranchModalDialogContainer-react"]') |
||||
.waitForElementContainsText('[data-id="switchBranchModalDialogModalBody-react"]', 'Your local changes to the following files would be overwritten by checkout.') |
||||
.click('[data-id="switchBranchModalDialogModalFooter-react"]') |
||||
.click('[data-id="switchBranch-modal-footer-ok-react"]') |
||||
.pause(2000) |
||||
.click('[data-id="workspaceGitBranchesDropdown"]') |
||||
.expect.element('[data-id="workspaceGit-dev"]').text.to.contain('✓ ') |
||||
}, |
||||
|
||||
// GIT BRANCHES E2E END
|
||||
|
||||
tearDown: sauce |
||||
} |
@ -0,0 +1,264 @@ |
||||
/* eslint-disable no-useless-escape */ |
||||
export const moveLanguageConfig = { |
||||
comments: { |
||||
lineComment: "//", |
||||
blockComment: ["/*", "*/"], |
||||
}, |
||||
brackets: [ |
||||
["{", "}"], |
||||
["[", "]"], |
||||
["(", ")"], |
||||
], |
||||
autoClosingPairs: [ |
||||
{ open: "[", close: "]" }, |
||||
{ open: "{", close: "}" }, |
||||
{ open: "(", close: ")" }, |
||||
{ open: '"', close: '"', notIn: ["string"] }, |
||||
], |
||||
surroundingPairs: [ |
||||
{ open: "{", close: "}" }, |
||||
{ open: "[", close: "]" }, |
||||
{ open: "(", close: ")" }, |
||||
{ open: '"', close: '"' }, |
||||
{ open: "'", close: "'" }, |
||||
], |
||||
folding: { |
||||
markers: { |
||||
start: new RegExp("^\\s*#pragma\\s+region\\b"), |
||||
end: new RegExp("^\\s*#pragma\\s+endregion\\b"), |
||||
}, |
||||
}, |
||||
}; |
||||
export const moveTokenProvider = { |
||||
// Set defaultToken to invalid to see what you do not tokenize yet
|
||||
// defaultToken: 'invalid',
|
||||
keywords: [ |
||||
"as", |
||||
"break", |
||||
"const", |
||||
"crate", |
||||
"enum", |
||||
"extern", |
||||
"false", |
||||
"fun", |
||||
"script", |
||||
"in", |
||||
"let", |
||||
"module", |
||||
"move", |
||||
"mut", |
||||
"pub", |
||||
"ref", |
||||
"return", |
||||
"self", |
||||
"Self", |
||||
"static", |
||||
"struct", |
||||
"super", |
||||
"trait", |
||||
"true", |
||||
"type", |
||||
"unsafe", |
||||
"use", |
||||
"where", |
||||
"use", |
||||
"macro_rules", |
||||
], |
||||
|
||||
controlFlowKeywords: [ |
||||
"continue", |
||||
"else", |
||||
"for", |
||||
"if", |
||||
"while", |
||||
"loop", |
||||
"match", |
||||
], |
||||
|
||||
typeKeywords: [ |
||||
"Self", |
||||
"m32", |
||||
"m64", |
||||
"m128", |
||||
"f80", |
||||
"f16", |
||||
"f128", |
||||
"int", |
||||
"uint", |
||||
"float", |
||||
"char", |
||||
"bool", |
||||
"u8", |
||||
"u16", |
||||
"u32", |
||||
"u64", |
||||
"f32", |
||||
"f64", |
||||
"i8", |
||||
"i16", |
||||
"i32", |
||||
"i64", |
||||
"str", |
||||
"Option", |
||||
"Either", |
||||
"c_float", |
||||
"c_double", |
||||
"c_void", |
||||
"FILE", |
||||
"fpos_t", |
||||
"DIR", |
||||
"dirent", |
||||
"c_char", |
||||
"c_schar", |
||||
"c_uchar", |
||||
"c_short", |
||||
"c_ushort", |
||||
"c_int", |
||||
"c_uint", |
||||
"c_long", |
||||
"c_ulong", |
||||
"size_t", |
||||
"ptrdiff_t", |
||||
"clock_t", |
||||
"time_t", |
||||
"c_longlong", |
||||
"c_ulonglong", |
||||
"intptr_t", |
||||
"uintptr_t", |
||||
"off_t", |
||||
"dev_t", |
||||
"ino_t", |
||||
"pid_t", |
||||
"mode_t", |
||||
"ssize_t", |
||||
], |
||||
|
||||
operators: [ |
||||
"=", |
||||
">", |
||||
"<", |
||||
"!", |
||||
"~", |
||||
"?", |
||||
":", |
||||
"==", |
||||
"<=", |
||||
">=", |
||||
"!=", |
||||
"&&", |
||||
"||", |
||||
"++", |
||||
"--", |
||||
"+", |
||||
"-", |
||||
"*", |
||||
"/", |
||||
"&", |
||||
"|", |
||||
"^", |
||||
"%", |
||||
"<<", |
||||
">>", |
||||
">>>", |
||||
"+=", |
||||
"-=", |
||||
"*=", |
||||
"/=", |
||||
"&=", |
||||
"|=", |
||||
"^=", |
||||
"%=", |
||||
"<<=", |
||||
">>=", |
||||
">>>=", |
||||
], |
||||
|
||||
// we include these common regular expressions
|
||||
symbols: /[=><!~?:&|+\-*\/\^%]+/, |
||||
|
||||
// C# style strings
|
||||
escapes: |
||||
/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/, |
||||
|
||||
// The main tokenizer for languages
|
||||
tokenizer: { |
||||
root: [ |
||||
// identifiers and keywords
|
||||
[ |
||||
/[a-z_$][\w$]*/, |
||||
{ |
||||
cases: { |
||||
"@typeKeywords": "type.identifier", |
||||
"@keywords": { |
||||
cases: { |
||||
fun: { token: "keyword", next: "@func_decl" }, |
||||
let: { token: "keyword", next: "@func_decl" }, |
||||
if: { token: "keyword", next: "@func_decl" }, |
||||
use: { token: "keyword", next: "@func_decl" }, |
||||
"@default": "keyword", |
||||
}, |
||||
}, |
||||
"@controlFlowKeywords": "keyword.control", |
||||
"@default": "variable", |
||||
}, |
||||
}, |
||||
], |
||||
[/[A-Z][\w\$]*/, "type.identifier"], // to show class names nicely
|
||||
|
||||
// whitespace
|
||||
{ include: "@whitespace" }, |
||||
|
||||
// delimiters and operators
|
||||
[/[{}()\[\]]/, "@brackets"], |
||||
[/[<>](?!@symbols)/, "@brackets"], |
||||
[/@symbols/, { cases: { "@operators": "operator", "@default": "" } }], |
||||
|
||||
// @ annotations.
|
||||
// As an example, we emit a debugging log message on these tokens.
|
||||
// Note: message are supressed during the first load -- change some lines to see them.
|
||||
[ |
||||
/@\s*[a-zA-Z_\$][\w\$]*/, |
||||
{ token: "annotation", log: "annotation token: $0" }, |
||||
], |
||||
|
||||
// numbers
|
||||
[/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"], |
||||
[/0[xX][0-9a-fA-F]+/, "number.hex"], |
||||
[/\d+/, "number"], |
||||
|
||||
// delimiter: after number because of .\d floats
|
||||
[/[;,.]/, "delimiter"], |
||||
|
||||
// strings
|
||||
[/"([^"\\]|\\.)*$/, "string.invalid"], // non-teminated string
|
||||
[/"/, { token: "string.quote", bracket: "@open", next: "@string" }], |
||||
|
||||
// characters
|
||||
[/'[^\\']'/, "string"], |
||||
[/(')(@escapes)(')/, ["string", "string.escape", "string"]], |
||||
[/'/, "string.invalid"], |
||||
], |
||||
|
||||
comment: [ |
||||
[/[^\/*]+/, "comment"], |
||||
[/\/\*/, "comment", "@push"], // nested comment
|
||||
["\\*/", "comment", "@pop"], |
||||
[/[\/*]/, "comment"], |
||||
], |
||||
|
||||
string: [ |
||||
[/[^\\"]+/, "string"], |
||||
[/@escapes/, "string.escape"], |
||||
[/\\./, "string.escape.invalid"], |
||||
[/"/, { token: "string.quote", bracket: "@close", next: "@pop" }], |
||||
], |
||||
|
||||
whitespace: [ |
||||
[/[ \t\r\n]+/, "white"], |
||||
[/\/\*/, "comment", "@comment"], |
||||
[/\/\/.*$/, "comment"], |
||||
], |
||||
|
||||
func_decl: [[/[a-z_$][\w$]*/, "support.function", "@pop"]], |
||||
}, |
||||
}; |
Loading…
Reference in new issue