test script in tests dir

pull/2226/head
aniket-engg 3 years ago committed by Aniket
parent 8118885827
commit f050075526
  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
'Should have changes on new workspace #group3': async function (browser: NightwatchBrowser) {
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) {
await clickAndCheckLog(browser, 'dGitProvider:add', null, null, {
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) {
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) {
browser
.addFile('scripts/storage2.test.js', { content: storageMochaTests })
.addFile('scripts/storage.test.js', { content: storageMochaTests })
.pause(1000)
.openFile('contracts/1_Storage.sol')
.clickLaunchIcon('solidity')
.click('*[data-id="compilerContainerCompileBtn"]')
.pause(1000) // compile Storage
.executeScript('remix.execute(\'scripts/storage2.test.js\')')
.executeScript('remix.execute(\'scripts/storage.test.js\')')
.pause(1000)
.waitForElementContainsText('*[data-id="terminalJournal"]', 'Running tests....')
.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:
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.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one Solidity test file for 'Ballot' contract & one JS test file for 'Storage' contract
SCRIPTS
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).
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.
Output from script will appear in remix terminal.
@ -368,7 +368,7 @@ export const examples = {
ballot: { name: 'contracts/3_Ballot.sol', content: ballot },
deployWithWeb3: { name: 'scripts/deploy_web3.js', content: deployWithWeb3 },
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 },
readme: { name: 'README.txt', content: readme }
}

Loading…
Cancel
Save