From a2660c4a8872488e737447784b25d04be1a46e8a Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Fri, 19 Apr 2024 12:00:31 +0100 Subject: [PATCH] format tests. update test to use snekmate --- apps/remix-ide-e2e/src/commands/openFile.ts | 16 ++++++------- .../remix-ide-e2e/src/tests/vyper_api.test.ts | 24 +++++++++++-------- apps/vyper/src/app/utils/remix-client.tsx | 8 +++---- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/openFile.ts b/apps/remix-ide-e2e/src/commands/openFile.ts index f214100eee..a049b125e9 100644 --- a/apps/remix-ide-e2e/src/commands/openFile.ts +++ b/apps/remix-ide-e2e/src/commands/openFile.ts @@ -31,15 +31,15 @@ function openFile (browser: NightwatchBrowser, name: string, done: VoidFunction) done() }) } - - }) - }) - .waitForElementVisible('li[data-id="treeViewLitreeViewItem' + name + '"', 60000) - .click('li[data-id="treeViewLitreeViewItem' + name + '"') - .pause(2000) - .perform(() => { - done() + + }) }) + .waitForElementVisible('li[data-id="treeViewLitreeViewItem' + name + '"', 60000) + .click('li[data-id="treeViewLitreeViewItem' + name + '"') + .pause(2000) + .perform(() => { + done() + }) } module.exports = OpenFile diff --git a/apps/remix-ide-e2e/src/tests/vyper_api.test.ts b/apps/remix-ide-e2e/src/tests/vyper_api.test.ts index 3ef6892284..683a31b017 100644 --- a/apps/remix-ide-e2e/src/tests/vyper_api.test.ts +++ b/apps/remix-ide-e2e/src/tests/vyper_api.test.ts @@ -27,28 +27,29 @@ module.exports = { .frameParent() .clickLaunchIcon('filePanel') .waitForElementVisible({ - selector: "//*[@data-id='workspacesSelect' and contains(.,'vyper-lang')]", + selector: "//*[@data-id='workspacesSelect' and contains(.,'snekmate')]", locateStrategy: 'xpath', timeout: 60000 }) - .currentWorkspaceIs('vyper-lang') + .currentWorkspaceIs('snekmate') .waitForElementVisible({ selector: "//*[@data-id='treeViewLitreeViewItemexamples' and contains(.,'examples')]", locateStrategy: 'xpath', timeout: 60000 }) - .openFile('examples') - .openFile('examples/auctions') - .openFile('examples/auctions/blind_auction.vy') + .openFile('src') + .openFile('src/tokens') + .openFile('src/tokens/ERC721.vy') }, // 'Add vyper file to run tests #group1': function (browser: NightwatchBrowser) { // browser.addFile('TestBallot.sol', sources[0]['TestBallot.sol']) // }, - + '@sources': () => sources, 'Context menu click to compile blind_auction should succeed #group1': function (browser: NightwatchBrowser) { browser - .click('*[data-id="treeViewLitreeViewItemexamples/auctions/blind_auction.vy"]') - .rightClick('*[data-id="treeViewLitreeViewItemexamples/auctions/blind_auction.vy"]') + .addFile('blind_auction.vy', sources[0]['blindAuction']) + .click('*[data-id="treeViewLitreeViewItemblind_auction.vy"]') + .rightClick('*[data-id="treeViewLitreeViewItemblind_auction.vy"]') .waitForElementPresent('[data-id="contextMenuItemvyper"]') .click('[data-id="contextMenuItemvyper"]') .clickLaunchIcon('vyper') @@ -180,8 +181,9 @@ def _createPokemon(_name: String[32], _dna: uint256, _HP: uint256): wins: 0 }) self.totalPokemonCount += 1` +const sources = [{ -const blindAuction = ` + 'blindAuction' : { content: ` # Blind Auction. Adapted to Vyper from [Solidity by Example](https://github.com/ethereum/solidity/blob/develop/docs/solidity-by-example.rst#blind-auction-1) #pragma version ^0.3.10 @@ -358,4 +360,6 @@ def auctionEnd(): # Transfer funds to beneficiary send(self.beneficiary, self.highestBid) -` +`} +} +] diff --git a/apps/vyper/src/app/utils/remix-client.tsx b/apps/vyper/src/app/utils/remix-client.tsx index 94d149167b..088aa6c36d 100644 --- a/apps/vyper/src/app/utils/remix-client.tsx +++ b/apps/vyper/src/app/utils/remix-client.tsx @@ -80,20 +80,20 @@ export class RemixClient extends PluginClient { async cloneVyperRepo() { try { // @ts-ignore - this.call('notification', 'toast', 'cloning Vyper repository...') + this.call('notification', 'toast', 'cloning Snekmate Vyper repository...') await this.call('manager', 'activatePlugin', 'dGitProvider') await this.call( 'dGitProvider', 'clone', - {url: 'https://github.com/vyperlang/vyper', token: null, branch: 'v0.3.10'}, + {url: 'https://github.com/pcaversaccio/snekmate', token: null, branch: 'v0.0.5'}, // @ts-ignore - 'vyper-lang' + 'snekmate' ) this.call( // @ts-ignore 'notification', 'toast', - 'Vyper repository cloned, the workspace Vyper has been created.' + 'Snekmate Vyper repository cloned, the workspace snekmate has been created.' ) } catch (e) { // @ts-ignore