add file test

pull/4791/head
Your Name 5 months ago
parent 97802c9a63
commit 33e90077d3
  1. 15
      apps/remix-ide-e2e/src/commands/addFile.ts
  2. 5
      apps/remix-ide-e2e/src/githttpbackend/setup.sh
  3. 5
      apps/remix-ide-e2e/src/tests/dgit_local.test.ts

@ -2,9 +2,11 @@ import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch'
import EventEmitter from 'events' import EventEmitter from 'events'
class AddFile extends EventEmitter { class AddFile extends EventEmitter {
command(this: NightwatchBrowser, name: string, content: NightwatchContractContent): NightwatchBrowser { command(this: NightwatchBrowser, name: string, content: NightwatchContractContent, readMeFile?:string): NightwatchBrowser {
if(!readMeFile)
readMeFile = 'README.txt'
this.api.perform((done) => { this.api.perform((done) => {
addFile(this.api, name, content, () => { addFile(this.api, name, content, readMeFile, () => {
done() done()
this.emit('complete') this.emit('complete')
}) })
@ -13,7 +15,8 @@ class AddFile extends EventEmitter {
} }
} }
function addFile(browser: NightwatchBrowser, name: string, content: NightwatchContractContent, done: VoidFunction) { function addFile(browser: NightwatchBrowser, name: string, content: NightwatchContractContent, readMeFile:string, done: VoidFunction) {
const readmeSelector = `li[data-id="treeViewLitreeViewItem${readMeFile}"]`
browser browser
.isVisible({ .isVisible({
selector: "//*[@data-id='sidePanelSwapitTitle' and contains(.,'File explorer')]", selector: "//*[@data-id='sidePanelSwapitTitle' and contains(.,'File explorer')]",
@ -25,9 +28,9 @@ function addFile(browser: NightwatchBrowser, name: string, content: NightwatchCo
browser.clickLaunchIcon('filePanel') browser.clickLaunchIcon('filePanel')
} }
}) })
.scrollInto('li[data-id="treeViewLitreeViewItemREADME.txt"]') .scrollInto(readmeSelector)
.waitForElementVisible('li[data-id="treeViewLitreeViewItemREADME.txt"]') .waitForElementVisible(readmeSelector)
.click('li[data-id="treeViewLitreeViewItemREADME.txt"]').pause(1000) // focus on root directory .click(readmeSelector).pause(1000) // focus on root directory
.isVisible({ .isVisible({
selector: `//*[@data-id="treeViewLitreeViewItem${name}"]`, selector: `//*[@data-id="treeViewLitreeViewItem${name}"]`,
locateStrategy: 'xpath', locateStrategy: 'xpath',

@ -4,7 +4,4 @@ rm -rf git/bare.git
rm -rf git rm -rf git
mkdir -p git mkdir -p git
cd git cd git
mkdir bare.git git clone --bare https://github.com/ethereum/awesome-remix bare.git
cd bare.git
git init --bare
cd /tmp/

@ -2,6 +2,7 @@ import { ChildProcess, spawn } from "child_process"
import kill from 'tree-kill' import kill from 'tree-kill'
import init from "../helpers/init" import init from "../helpers/init"
let gitserver: ChildProcess let gitserver: ChildProcess
// if needed kill the server: kill -9 $(sudo lsof -t -i:6868)
module.exports = { module.exports = {
'@disabled': true, '@disabled': true,
before: function (browser, done) { before: function (browser, done) {
@ -42,8 +43,8 @@ module.exports = {
.waitForElementVisible('*[data-id="clone-btn"]') .waitForElementVisible('*[data-id="clone-btn"]')
.click('*[data-id="clone-btn"]') .click('*[data-id="clone-btn"]')
.clickLaunchIcon('filePanel') .clickLaunchIcon('filePanel')
.waitForElementVisible('*[data-id="treeViewDivtreeViewItem.git"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemREADME.md"]')
.addFile('test.txt') .addFile('testFile.text', { content: 'hello world' }, 'README.md')
.pause(10000) .pause(10000)
} }
} }

Loading…
Cancel
Save