Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accounts - 4.x System E2E Tests #5285

Merged
merged 90 commits into from
Aug 31, 2022
Merged

Conversation

avkos
Copy link
Contributor

@avkos avkos commented Jul 27, 2022

Description

#5038

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run dtslint with success and extended the tests and types if necessary.
  • I ran npm run test:cov and my test cases cover all the lines and branches of the added code.
  • I ran npm run build with success.
  • I have tested the built dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.

@avkos avkos marked this pull request as ready for review July 27, 2022 11:13
Copy link
Contributor

@jdevcs jdevcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crypto.subtle is available in firefox 34 , there is error in tests because : "This feature is available only in secure contexts (HTTPS)" and CI logs shows tests are running without SSL

web3-eth-accounts:      TypeError: crypto_1.crypto.web.subtle is undefined
350
web3-eth-accounts:   getBrowserKey@http://localhost:43915/__cypress/tests?p=test/integration/account.test.ts:54252:18

@render
Copy link

render bot commented Aug 1, 2022

@jdevcs jdevcs added the 4.x 4.0 related label Aug 1, 2022
@avkos avkos requested review from nazarhussain and jdevcs August 2, 2022 12:49
@avkos avkos requested a review from luu-alex August 2, 2022 15:18
@luu-alex luu-alex self-requested a review August 30, 2022 04:51
@avkos avkos requested a review from spacesailor24 August 30, 2022 13:53
Copy link
Contributor

@jdevcs jdevcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Good work. Just need some minor changes.

@@ -27,6 +27,7 @@ module.exports = (on, config) => {
config.env.WEB3_SYSTEM_TEST_MNEMONIC = process.env.WEB3_SYSTEM_TEST_MNEMONIC;
config.env.WEB3_SYSTEM_TEST_PORT = process.env.WEB3_SYSTEM_TEST_PORT;
config.env.WEB3_SYSTEM_TEST_PROVIDER = process.env.WEB3_SYSTEM_TEST_PROVIDER;
config.env.WEB3_SYSTEM_TEST_CLIENT = process.env.WEB3_SYSTEM_TEST_CLIENT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should refer client for eth node, in our repo.

packages/web3-eth-accounts/src/wallet.ts Show resolved Hide resolved
@avkos avkos requested a review from jdevcs August 31, 2022 13:03
Copy link
Contributor

@Muhammad-Altabba Muhammad-Altabba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!
However, there are some minor points. Which I hope you modify them in this MR or create follow-up tasks for them.

beforeAll(async () => {
contract = await contract.deploy(deployOptions).send(sendOptions);
let contractDeployed: Contract<typeof ERC20TokenAbi>;
beforeEach(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, do we really need here to have those repeated before each?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

let web3: Web3;

beforeAll(async () => {
beforeEach(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do all the lines need to be executed beforeEach? I mean, It seems the following needed to be executed only once:

 		clientUrl = getSystemTestProvider();
		web3 = new Web3(clientUrl);
		await waitForOpenConnection(web3);

Right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +14 to +32
// if (process.env.WEB3_SYSTEM_TEST_ENGINE === 'firefox') {
// const port = parseInt(String(Math.random() * 10000 + 10000));
// config.clientCertificates = [
// {
// url: 'https://web3.js',
// certs: [
// {
// cert: './cypress/.cert/cert.pem',
// key: './cypress/.cert/key.pem',
// },
// ],
// },
// ];
// config.e2e.port = port;
// config.e2e.hosts = {
// 'web3.js': '127.0.0.1',
// };
// config.e2e.baseUrl = `https://web3.js:${port}`;
// }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a comment that possibly refers to an issue that describes why this code is commented. And when this code is supposed to be uncommented.
Thanks,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

expect.objectContaining({ from: accounts[0] }),
);
});
itIf(!isIpc)(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, why this test should not apply to IPC? And why it was working when it was applied to all including IPC?

And if there a good reason for that, could we please, have a small comment hereon why this test should not apply to IPC?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@avkos avkos merged commit 37219fc into 4.x Aug 31, 2022
@avkos avkos deleted the ok/5038-Accounts-4.x-System-E2E-Tests branch August 31, 2022 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants