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'
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) => {
addFile(this.api, name, content, () => {
addFile(this.api, name, content, readMeFile, () => {
done()
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
.isVisible({
selector: "//*[@data-id='sidePanelSwapitTitle' and contains(.,'File explorer')]",
@ -25,9 +28,9 @@ function addFile(browser: NightwatchBrowser, name: string, content: NightwatchCo
browser.clickLaunchIcon('filePanel')
}
})
.scrollInto('li[data-id="treeViewLitreeViewItemREADME.txt"]')
.waitForElementVisible('li[data-id="treeViewLitreeViewItemREADME.txt"]')
.click('li[data-id="treeViewLitreeViewItemREADME.txt"]').pause(1000) // focus on root directory
.scrollInto(readmeSelector)
.waitForElementVisible(readmeSelector)
.click(readmeSelector).pause(1000) // focus on root directory
.isVisible({
selector: `//*[@data-id="treeViewLitreeViewItem${name}"]`,
locateStrategy: 'xpath',

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

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

Loading…
Cancel
Save