test script in tests dir

pull/5370/head
aniket-engg 3 years ago committed by Aniket
parent 422bbf8bf0
commit eee30df65e
  1. 4
      apps/remix-ide-e2e/src/tests/plugin_api.ts
  2. 4
      apps/remix-ide-e2e/src/tests/terminal.test.ts
  3. 8
      libs/remix-ui/workspace/src/lib/templates/examples.ts

@ -286,14 +286,14 @@ module.exports = {
// DGIT // DGIT
'Should have changes on new workspace #group3': async function (browser: NightwatchBrowser) { 'Should have changes on new workspace #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel:createWorkspace', null, null, 'dgit') await clickAndCheckLog(browser, 'filePanel:createWorkspace', null, null, 'dgit')
await clickAndCheckLog(browser, 'dGitProvider:status', [['README.txt', 0, 2, 0], ['contracts/1_Storage.sol', 0, 2, 0], ['contracts/2_Owner.sol', 0, 2, 0], ['contracts/3_Ballot.sol', 0, 2, 0], ['scripts/deploy_ethers.js', 0, 2, 0], ['scripts/deploy_web3.js', 0, 2, 0], ['scripts/storage.test.js', 0, 2, 0], ['tests/4_Ballot_test.sol', 0, 2, 0]], null, null) await clickAndCheckLog(browser, 'dGitProvider:status', [['README.txt', 0, 2, 0], ['contracts/1_Storage.sol', 0, 2, 0], ['contracts/2_Owner.sol', 0, 2, 0], ['contracts/3_Ballot.sol', 0, 2, 0], ['scripts/deploy_ethers.js', 0, 2, 0], ['scripts/deploy_web3.js', 0, 2, 0], ['tests/storage.test.js', 0, 2, 0], ['tests/4_Ballot_test.sol', 0, 2, 0]], null, null)
}, },
'Should stage contract #group3': async function (browser: NightwatchBrowser) { 'Should stage contract #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'dGitProvider:add', null, null, { await clickAndCheckLog(browser, 'dGitProvider:add', null, null, {
filepath: 'contracts/1_Storage.sol' filepath: 'contracts/1_Storage.sol'
}) })
await clickAndCheckLog(browser, 'dGitProvider:status', [['README.txt', 0, 2, 0], ['contracts/1_Storage.sol', 0, 2, 2], ['contracts/2_Owner.sol', 0, 2, 0], ['contracts/3_Ballot.sol', 0, 2, 0], ['scripts/deploy_ethers.js', 0, 2, 0], ['scripts/deploy_web3.js', 0, 2, 0], ['scripts/storage.test.js', 0, 2, 0], ['tests/4_Ballot_test.sol', 0, 2, 0]], null, null) await clickAndCheckLog(browser, 'dGitProvider:status', [['README.txt', 0, 2, 0], ['contracts/1_Storage.sol', 0, 2, 2], ['contracts/2_Owner.sol', 0, 2, 0], ['contracts/3_Ballot.sol', 0, 2, 0], ['scripts/deploy_ethers.js', 0, 2, 0], ['scripts/deploy_web3.js', 0, 2, 0], ['tests/storage.test.js', 0, 2, 0], ['tests/4_Ballot_test.sol', 0, 2, 0]], null, null)
}, },
'Should commit changes #group3': async function (browser: NightwatchBrowser) { 'Should commit changes #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'dGitProvider:commit', null, null, { author: { name: 'Remix', email: 'Remix' }, message: 'commit-message' }) await clickAndCheckLog(browser, 'dGitProvider:commit', null, null, { author: { name: 'Remix', email: 'Remix' }, message: 'commit-message' })

@ -121,13 +121,13 @@ module.exports = {
}, },
'Run tests using Mocha script and check result logging in the terminal #group4': function (browser: NightwatchBrowser) { 'Run tests using Mocha script and check result logging in the terminal #group4': function (browser: NightwatchBrowser) {
browser browser
.addFile('scripts/storage2.test.js', { content: storageMochaTests }) .addFile('scripts/storage.test.js', { content: storageMochaTests })
.pause(1000) .pause(1000)
.openFile('contracts/1_Storage.sol') .openFile('contracts/1_Storage.sol')
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.click('*[data-id="compilerContainerCompileBtn"]') .click('*[data-id="compilerContainerCompileBtn"]')
.pause(1000) // compile Storage .pause(1000) // compile Storage
.executeScript('remix.execute(\'scripts/storage2.test.js\')') .executeScript('remix.execute(\'scripts/storage.test.js\')')
.pause(1000) .pause(1000)
.waitForElementContainsText('*[data-id="terminalJournal"]', 'Running tests....') .waitForElementContainsText('*[data-id="terminalJournal"]', 'Running tests....')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'storage contract Address:') .waitForElementContainsText('*[data-id="terminalJournal"]', 'storage contract Address:')

@ -344,15 +344,15 @@ iii. There are no files existing in the File Explorer
This workspace contains 3 directories: This workspace contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name. 1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract & one to unit test a contract. It is explained below. 2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity. 3. 'tests': Contains one Solidity test file for 'Ballot' contract & one JS test file for 'Storage' contract
SCRIPTS SCRIPTS
The 'scripts' folder contains two example async/await scripts for deploying the 'Storage' contract. The 'scripts' folder contains two example async/await scripts for deploying the 'Storage' contract.
For the deployment of any other contract, 'contractName' and 'constructorArgs' should be updated (along with other code if required). For the deployment of any other contract, 'contractName' and 'constructorArgs' should be updated (along with other code if required).
Also, there is a script containing some unit tests for Storage contract. Also, there is a script containing some unit tests for Storage contract inside tests directory.
To run a script, right click on file name in the file explorer and click 'Run'. Remember, Solidity file must already be compiled. To run a script, right click on file name in the file explorer and click 'Run'. Remember, Solidity file must already be compiled.
Output from script will appear in remix terminal. Output from script will appear in remix terminal.
@ -368,7 +368,7 @@ export const examples = {
ballot: { name: 'contracts/3_Ballot.sol', content: ballot }, ballot: { name: 'contracts/3_Ballot.sol', content: ballot },
deployWithWeb3: { name: 'scripts/deploy_web3.js', content: deployWithWeb3 }, deployWithWeb3: { name: 'scripts/deploy_web3.js', content: deployWithWeb3 },
deployWithEthers: { name: 'scripts/deploy_ethers.js', content: deployWithEthers }, deployWithEthers: { name: 'scripts/deploy_ethers.js', content: deployWithEthers },
storageTestJs: { name: 'scripts/storage.test.js', content: storageTestJs }, storageTestJs: { name: 'tests/storage.test.js', content: storageTestJs },
ballot_test: { name: 'tests/4_Ballot_test.sol', content: ballotTest }, ballot_test: { name: 'tests/4_Ballot_test.sol', content: ballotTest },
readme: { name: 'README.txt', content: readme } readme: { name: 'README.txt', content: readme }
} }

Loading…
Cancel
Save