pull/5370/head
filip mertens 3 years ago
parent 1a16e7e62c
commit e0cfff6389
  1. 29
      apps/remix-ide-e2e/src/tests/migrateFileSystem.test.ts
  2. 7
      apps/remix-ide/src/app/components/preload.tsx
  3. 1
      apps/remix-ide/src/app/files/filesystems/fileSystemUtility.ts

@ -14,7 +14,17 @@ module.exports = {
.waitForElementVisible('[id="remixTourSkipbtn"]')
.click('[id="remixTourSkipbtn"]')
},
'should have indexedDB storage in terminal #group1': function (browser: NightwatchBrowser) {
'Should load the testmigration url and refresh and still have test data #group7': function (browser: NightwatchBrowser) {
browser.url('http://127.0.0.1:8080?e2e_testmigration=true')
.pause(6000)
.switchBrowserTab(0)
.maximizeWindow()
.waitForElementVisible('*[data-id="skipbackup-btn"]', 5000)
.click('*[data-id="skipbackup-btn"]')
.waitForElementVisible('[id="remixTourSkipbtn"]')
.click('[id="remixTourSkipbtn"]').refresh()
},
'should have indexedDB storage in terminal #group1 #group7': function (browser: NightwatchBrowser) {
browser.assert.containsText('*[data-id="terminalJournal"]', 'indexedDB')
},
'Should fallback to localstorage with default data #group2': function (browser: NightwatchBrowser) {
@ -69,12 +79,12 @@ module.exports = {
})
},
// these are test data entries
'Should have a workspace_test #group1 #group3 #group5': function (browser: NightwatchBrowser) {
'Should have a workspace_test #group1 #group3 #group5 #group7': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 5000)
.click('*[data-id="workspacesSelect"] option[value="workspace_test"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtest_contracts"]')
},
'Should have a sol file with test data #group1 #group3 #group5': function (browser: NightwatchBrowser) {
'Should have a sol file with test data #group1 #group3 #group5 #group7': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 5000)
.click('*[data-id="treeViewLitreeViewItemtest_contracts"]')
.openFile('test_contracts/1_Storage.sol')
@ -82,7 +92,7 @@ module.exports = {
browser.assert.equal(content, 'testing')
})
},
'Should have a artifacts file with JSON test data #group1 #group3 #group5': function (browser: NightwatchBrowser) {
'Should have a artifacts file with JSON test data #group1 #group3 #group5 #group7': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 5000)
.click('*[data-id="treeViewLitreeViewItemtest_contracts/artifacts"]')
.openFile('test_contracts/artifacts/Storage_metadata.json')
@ -91,7 +101,7 @@ module.exports = {
browser.assert.equal(metadata.test, 'data')
})
},
'Should have a empty workspace #group1 #group3 #group5': function (browser: NightwatchBrowser) {
'Should have a empty workspace #group1 #group3 #group5 #group7': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 5000)
.click('*[data-id="workspacesSelect"] option[value="emptyspace"]')
},
@ -103,5 +113,14 @@ module.exports = {
.maximizeWindow()
.assert.containsText('.alert-warning', 'Your browser does not support')
},
'Should with errors #group6': function (browser: NightwatchBrowser) {
browser.url('http://127.0.0.1:8080?e2e_testmigration=true')
.pause(6000)
.switchBrowserTab(0)
.maximizeWindow().execute('delete window.localStorage')
.waitForElementVisible('*[data-id="skipbackup-btn"]', 5000)
.click('*[data-id="skipbackup-btn"]')
.assert.containsText('.alert-danger', 'An unknown error')
},
}

@ -16,6 +16,7 @@ export const Preload = () => {
const remixFileSystems = useRef<fileSystems>(new fileSystems())
const remixIndexedDB = useRef<fileSystem>(new indexedDBFileSystem())
const localStorageFileSystem = useRef<fileSystem>(new localStorageFS())
// url parameters to e2e test the fallbacks and error warnings
const testmigrationFallback = useRef<boolean>(window.location.hash.includes('e2e_testmigration_fallback=true') && window.location.host === '127.0.0.1:8080' && window.location.protocol === 'http:')
const testmigrationResult = useRef<boolean>(window.location.hash.includes('e2e_testmigration=true') && window.location.host === '127.0.0.1:8080' && window.location.protocol === 'http:')
const testBlockStorage = useRef<boolean>(window.location.hash.includes('e2e_testblock_storage=true') && window.location.host === '127.0.0.1:8080' && window.location.protocol === 'http:')
@ -52,8 +53,6 @@ export const Preload = () => {
}
const setFileSystems = async() => {
// url parameters to e2e test the fallbacks and error warnings
const fsLoaded = await remixFileSystems.current.setFileSystem([(testmigrationFallback.current || testBlockStorage.current)? null: remixIndexedDB.current, testBlockStorage.current? null:localStorageFileSystem.current])
if (fsLoaded) {
console.log(fsLoaded.name + ' activated')
@ -63,9 +62,7 @@ export const Preload = () => {
}
}
const testmigration = async() => {
// load dummy data for e2e test
const testmigration = async() => {
const fsUtility = new fileSystemUtility()
if (testmigrationResult.current) {
fsUtility.populateWorkspace(migrationTestData, remixFileSystems.current.fileSystems['localstorage'].fs)

@ -19,7 +19,6 @@ export class fileSystemUtility {
}
const fromFiles = await this.copyFolderToJson('/', null, null, fsFrom.fs)
console.log(fsFrom.name, hashMessage(JSON.stringify(fromFiles)), fromFiles)
await this.populateWorkspace(fromFiles, fsTo.fs)
const toFiles = await this.copyFolderToJson('/', null, null, fsTo.fs)

Loading…
Cancel
Save