Skip to content

Commit

Permalink
chore: resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
rabi-siddique committed Mar 29, 2024
2 parents fc7fc9d + 5412d82 commit 520b473
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
2 changes: 2 additions & 0 deletions bin/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
echo "Hello, stdout!"
echo "Error occurred" >&2
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agoric/synpress",
"version": "3.8.1-beta.0",
"version": "3.8.1-beta.1",
"description": "Synpress is e2e testing framework based around Cypress.io & playwright with included MetaMask support. Test your dapps with ease.",
"keywords": [
"Synpress",
Expand Down
20 changes: 12 additions & 8 deletions plugins/keplr-plugin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { exec, execSync } = require('child_process');
const helpers = require('../helpers');
const playwright = require('../commands/playwright-keplr');
const keplr = require('../commands/keplr');
Expand Down Expand Up @@ -58,13 +57,18 @@ module.exports = (on, config) => {

async execute(command) {
return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
if (error) {
reject({ error, stdout, stderr });
} else {
resolve({ stdout, stderr });
}
});
const { exec } = require('child_process');
try {
exec(command, (error, stdout, stderr) => {
if (error) {
reject(error);
} else {
resolve({ stdout, stderr });
}
});
} catch (e) {
reject(e);
}
});
},

Expand Down
1 change: 1 addition & 0 deletions synpress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = defineConfig({
fixturesFolder,
screenshotsFolder: 'tests/e2e/screenshots',
videosFolder: 'tests/e2e/videos',
bashScriptsFolder: process.cwd() +'/bin',
chromeWebSecurity: true,
viewportWidth: 1920,
viewportHeight: 1080,
Expand Down
13 changes: 13 additions & 0 deletions tests/e2e/specs/keplr/keplr-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

describe('Keplr', () => {
context('Test commands', () => {
const scriptsFolder = Cypress.config('bashScriptsFolder');
it('Executes a command and verifies stdout and stderr', () => {
const command = 'echo "Hello, stdout!" && echo "Error occurred" >&2';

Expand All @@ -12,6 +13,18 @@ describe('Keplr', () => {
});
});

it('Executes a commands from a file and verifies stdout and stderr', () => {
const fileName = 'script.sh';

cy.execute(`sh ${scriptsFolder}/${fileName}`).then(
({ stdout, stderr, error }) => {
expect(stdout.trim()).to.equal('Hello, stdout!');
expect(stderr.trim()).to.equal('Error occurred');
expect(error).to.be.undefined;
},
);
});

it(`should complete Keplr setup by importing an existing wallet using 24 word phrase`, () => {
cy.setupWallet().then(setupFinished => {
expect(setupFinished).to.be.true;
Expand Down

0 comments on commit 520b473

Please sign in to comment.