pull/4243/head
yann300 1 year ago
parent f70f9ec0f4
commit 71f5d48e16
  1. 30
      apps/remix-ide-e2e/src/tests/workspace_git.test.ts
  2. 9
      libs/remix-ui/workspace/src/lib/actions/workspace.ts

@ -339,6 +339,36 @@ module.exports = {
.waitForElementVisible('[data-id="treeViewDivtreeViewItemrecursive/plugins/build"]')
},
// GIT SUBMODULES E2E ENDS
// GIT WORKSPACE E2E STARTS
'Should create a git workspace (uniswapV4Periphery) #group4': function (browser: NightwatchBrowser) {
browser
.click('*[data-id="workspacesMenuDropdown"]')
.click('*[data-id="workspacecreate"]')
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > button')
.click('select[id="wstemplate"]')
.click('select[id="wstemplate"] option[value=uniswapV4Periphery]')
.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="treeViewLitreeViewItemcontracts"]')
.openFile('contracts')
.openFile('contracts/hooks')
.openFile('contracts/hooks/examples')
.openFile('contracts/hooks/examples/FullRange.sol')
.pause(1000)
.getEditorValue((content) => {
browser.assert.ok(content.indexOf(`contract FullRange is BaseHook`) !== -1,
'Incorrect content')
})
},
// GIT WORKSPACE E2E ENDS
tearDown: sauce,
}

@ -39,7 +39,6 @@ import { IndexedDBStorage } from '../../../../../../apps/remix-ide/src/app/files
import { getUncommittedFiles } from '../utils/gitStatusFilter'
import { AppModal, ModalTypes } from '@remix-ui/app'
import { contractDeployerScripts, etherscanScripts } from '@remix-project/remix-ws-templates'
import { template } from 'lodash'
declare global {
interface Window {
@ -193,14 +192,12 @@ export const createWorkspace = async (
export const createWorkspaceTemplate = async (workspaceName: string, template: WorkspaceTemplate = 'remixDefault') => {
const metadata = TEMPLATE_METADATA[template]
if (metadata) {
await plugin.call('dGitProvider', 'clone', {url: metadata.url, branch: metadata.branch}, TEMPLATE_NAMES[template])
return
}
if (!workspaceName) throw new Error('workspace name cannot be empty')
if (checkSpecialChars(workspaceName) || checkSlash(workspaceName)) throw new Error('special characters are not allowed')
if ((await workspaceExists(workspaceName)) && template === 'remixDefault') throw new Error('workspace already exists')
else {
else if (metadata) {
await plugin.call('dGitProvider', 'clone', {url: metadata.url, branch: metadata.branch}, workspaceName)
} else {
const workspaceProvider = plugin.fileProviders.workspace
await workspaceProvider.createWorkspace(workspaceName)
}

Loading…
Cancel
Save