Merge pull request #4492 from ethereum/fix_saving_gist

fix saving the gist
pull/5370/head
yann300 10 months ago committed by GitHub
commit e70633dedb
  1. 7
      apps/remix-ide-e2e/src/tests/gist.test.ts
  2. 5
      libs/remix-ui/workspace/src/lib/actions/index.ts

@ -150,7 +150,7 @@ module.exports = {
'Load Gist from URL and verify truncated files are loaded #group3': function (browser: NightwatchBrowser) { 'Load Gist from URL and verify truncated files are loaded #group3': function (browser: NightwatchBrowser) {
const gistId = '1b179bf1b92c8b0664b4cbe61774e15d' const gistId = '1b179bf1b92c8b0664b4cbe61774e15d'
browser browser
.url('http://127.0.0.1:8080/#gist=' + gistId) .url('http://127.0.0.1:8080/#gist=' + gistId) // loading the gist
.refreshPage() .refreshPage()
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 15000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 15000)
.waitForElementVisible(`#fileExplorerView li[data-path='gist-${gistId}/README.txt']`, 30000) .waitForElementVisible(`#fileExplorerView li[data-path='gist-${gistId}/README.txt']`, 30000)
@ -158,5 +158,10 @@ module.exports = {
.getEditorValue((content) => { .getEditorValue((content) => {
browser.assert.ok(content !== '') browser.assert.ok(content !== '')
}) })
.rightClickCustom(`li[data-path='gist-${gistId}'] div`) // saving the gist
.click('[data-id="contextMenuItempublishFolderToGist"]')
.modalFooterOKClick('fileSystem')
.waitForElementVisible('*[data-shared="tooltipPopup"]', 5000)
.assert.containsText('*[data-shared="tooltipPopup"]', 'Saving gist (' + gistId + ') ...')
} }
} }

@ -226,8 +226,11 @@ export type SolidityConfiguration = {
export const publishToGist = async (path?: string, type?: string) => { export const publishToGist = async (path?: string, type?: string) => {
// If 'id' is not defined, it is not a gist update but a creation so we have to take the files from the browser explorer. // If 'id' is not defined, it is not a gist update but a creation so we have to take the files from the browser explorer.
const folder = path || '/' const folder = path || '/'
const id = type === 'gist' ? extractNameFromKey(path).split('-')[1] : null
try { try {
const name = extractNameFromKey(path)
const id = name && name.startsWith('gist-') ? name.split('-')[1] : null
const packaged = await packageGistFiles(folder) const packaged = await packageGistFiles(folder)
// check for token // check for token
const config = plugin.registry.get('config').api const config = plugin.registry.get('config').api

Loading…
Cancel
Save