Skip to content

Commit

Permalink
fix & E2E
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 committed Dec 5, 2023
1 parent 1dbf64f commit 90bc2ac
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 6 deletions.
47 changes: 47 additions & 0 deletions apps/remix-ide-e2e/src/tests/workspace_git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,53 @@ 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/FullRange.sol')
.pause(1000)
.getEditorValue((content) => {
browser.assert.ok(content.indexOf(`contract FullRange is BaseHook`) !== -1,
'Incorrect content')
})
},

'Should run git update submodule #group4': function (browser: NightwatchBrowser) {
browser
.waitForElementVisible('[data-id="updatesubmodules"]')
.click('[data-id="updatesubmodules"]')
.waitForElementPresent('.fa-spinner')
.waitForElementVisible({
selector: '*[data-id="treeViewLitreeViewItem.git"]',
timeout: 60000
})
.waitForElementVisible('[data-id="treeViewDivtreeViewItemcontracts"]')
},

'Should compile a FullRange #group4': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('solidity')
.verifyContracts(['FullRange'])
},

// GIT WORKSPACE E2E ENDS


tearDown: sauce,
}

Expand Down
9 changes: 3 additions & 6 deletions libs/remix-ui/workspace/src/lib/actions/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 90bc2ac

Please sign in to comment.