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

refactor: yarn, e2e and eslint #311

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
const Config = require('@vechain/repo-config');

module.exports = Config.EslintLibrary;
module.exports = {
...Config.EslintLibrary,
rules: {
...Config.EslintLibrary.rules,
'import/no-extraneous-dependencies': 'error',
},
};
4 changes: 3 additions & 1 deletion .github/workflows/lint-build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ jobs:
cache: 'yarn'

- name: Install
run: yarn install:all
run: |
yarn
yarn install:all

- name: Lint
run: yarn run lint
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ jobs:
cache: 'yarn'

- name: Install
run: yarn install:all
run: |
yarn
yarn install:all

- name: Run E2E Tests
run: yarn test:e2e:ci
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

Binary file added .yarn/install-state.gz
Binary file not shown.
934 changes: 934 additions & 0 deletions .yarn/releases/yarn-4.5.1.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.5.1.cjs
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"stop-preview": "kill -2 $(ps aux | grep '[t]urbo run preview' | awk '{print $2}')",
"test": "turbo run test --filter='@vechain/*'",
"test:e2e": "turbo run preview > /dev/null 2>&1 & turbo run test:e2e; yarn stop-preview",
"test:e2e:ci": "turbo run preview & turbo run test:e2e:headless",
"test:e2e:ci": "turbo run preview & turbo run test:e2e:headless; yarn stop-preview",
"test:e2e:headless": "turbo run preview > /dev/null 2>&1 & turbo run test:e2e:headless; yarn stop-preview"
},
"husky": {
Expand Down Expand Up @@ -55,8 +55,9 @@
"lint-staged": "^15.0.2",
"prettier": "^2.5.1",
"punycode": "^1.4.1",
"ts-node": "^10.9.2",
"turbo": "latest",
"typescript": "5.3.3"
},
"packageManager": "yarn@1.22.19"
"packageManager": "yarn@4.5.1"
}
4 changes: 4 additions & 0 deletions packages/dapp-kit-react/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ module.exports = {
'*.test.ts',
'test/**',
],
rules: {
...Config.EslintReact.rules,
'import/no-extraneous-dependencies': 'error',
},
};
5 changes: 2 additions & 3 deletions packages/dapp-kit-react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@vechain/dapp-kit-react",
"version": "1.0.11",
"private": false,
"homepage": "https://github.com/vechain/vechain-dapp-kit",
"repository": "github:vechain/vechain-dapp-kit",
"license": "MIT",
Expand Down Expand Up @@ -29,6 +28,7 @@
"@vechain/dapp-kit-ui": "*",
"@vechain/sdk-core": "1.0.0-rc.1",
"@vechain/sdk-network": "1.0.0-rc.1",
"react": "^18.2.0",
"valtio": "1.11.2"
},
"devDependencies": {
Expand All @@ -37,10 +37,9 @@
"@types/react-dom": "^18.2.13",
"@vechain/repo-config": "https://github.com/vechain/repo-config#v0.0.1",
"eslint": "^8.15.0",
"react": "^18.2.0",
"tsup": "*",
"typescript": "*",
"vite": "^4.5.2",
"vite": "^4.5.5",
"vitest": "^0.34.6"
}
}
8 changes: 7 additions & 1 deletion packages/dapp-kit-ui/.eslintrc.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
const Config = require('@vechain/repo-config');

module.exports = Config.EslintLibrary;
module.exports = {
...Config.EslintReact,
rules: {
...Config.EslintReact.rules,
'import/no-extraneous-dependencies': 'error',
},
};
3 changes: 1 addition & 2 deletions packages/dapp-kit-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@vechain/dapp-kit-ui",
"version": "1.0.11",
"private": false,
"description": "Vanilla JS DAppKit",
"keywords": [
"web-components",
Expand Down Expand Up @@ -59,7 +58,7 @@
"tsup": "^7.2.0",
"typechain": "^8.3.2",
"typescript": "~5.2.0",
"vite": "^4.5.2",
"vite": "^4.5.5",
"vitest": "^0.34.6"
}
}
8 changes: 7 additions & 1 deletion packages/dapp-kit/.eslintrc.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
const Config = require('@vechain/repo-config');

module.exports = Config.EslintLibrary;
module.exports = {
...Config.EslintLibrary,
rules: {
...Config.EslintLibrary.rules,
'import/no-extraneous-dependencies': 'error',
},
};
5 changes: 1 addition & 4 deletions packages/dapp-kit/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@vechain/dapp-kit",
"version": "1.0.11",
"private": false,
"homepage": "https://github.com/vechain/vechain-dapp-kit",
"repository": "github:vechain/vechain-dapp-kit",
"license": "MIT",
Expand Down Expand Up @@ -33,8 +32,6 @@
"valtio": "1.11.2"
},
"devDependencies": {
"@types/react": "^18.2.28",
"@types/react-dom": "^18.2.13",
"@vechain/repo-config": "https://github.com/vechain/repo-config#v0.0.1",
"@vitest/coverage-v8": "^0.34.6",
"@walletconnect/types": "2.10.2",
Expand All @@ -43,7 +40,7 @@
"lokijs": "^1.5.12",
"tsup": "*",
"typescript": "*",
"vite": "^4.5.2",
"vite": "^4.5.5",
"vitest": "^0.34.6"
}
}
2 changes: 1 addition & 1 deletion packages/dapp-kit/src/classes/vechain-signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class VeChainSignerDAppKit extends VeChainAbstractSigner {
this.walletManager = walletManager;
}

get address() {
get address(): string | null {
return this.walletManager.state.address;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/dapp-kit/test/helpers/mocked-sign-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
import { DefaultMethods } from '../../src';
import { wcSessionStruct } from './wc-fixtures';
import { address, mockedConnexSigner } from './mocked-signer';
import { randomUUID } from 'node:crypto';
import { Blake2b256 } from '@vechain/sdk-core';

const requestHandler: IEngine['request'] = vi.fn();
const connectHandler: IEngine['connect'] = vi.fn();
Expand Down Expand Up @@ -55,7 +55,7 @@ const mockedSignClient = {
keys: [],
get: vi.fn(),
},
name: randomUUID(),
name: Blake2b256.random(12).toString(),
} as unknown as ResolvedSignClient;

vi.mocked(mockedSignClient.request).mockImplementation(
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
"test:e2e:headless": "SELENIUM_HEADLESS=true cucumber-js"
},
"devDependencies": {
"@cucumber/cucumber": "^10.3.1",
"@cucumber/cucumber": "^11.0.1",
"@serenity-js/console-reporter": "^3.4.1",
"@serenity-js/cucumber": "^3.4.1",
"@serenity-js/serenity-bdd": "^3.4.1",
"@types/chrome": "^0.0.262",
"@types/chromedriver": "^81.0.1",
"@types/cucumber": "^7.0.0",
"@types/jest": "^29.5.12",
"@types/node": "^16.11.11",
"@types/selenium-webdriver": "^4.1.13",
"@vechain/repo-config": "https://github.com/vechain/repo-config",
"async-mutex": "^0.2.6",
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/src/config/hooks/ExtensionHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ BeforeAll(async function () {
'..',
'veworld-dist.zip',
);
await asyncExec(`unzip ${zipPath} -d ${distPath}`);
await asyncExec(`unzip -o ${zipPath}`);
});
2 changes: 1 addition & 1 deletion tests/e2e/src/extension/flows/ApproveFlows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const approveAndSign = async (password?: string) => {
const sign = async (password?: string) => {
const pw = password || TestDefaults.PASSWORD;
//Click the "Sign Cert" button
await extension.driver.waitAndClick(Locators.byId('signCertificateButton'));
await extension.driver.waitAndClick(Locators.byId('signApproveButton'));
await PasswordFlows.submitPassword(pw);
};

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/src/extension/flows/DashboardFlows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Locators from '../selenium/Locators';
import NavigationUtils from '../utils/NavigationUtils';

const isActive = async () => {
const locator = Locators.byId('yourBalanceTitle');
const locator = Locators.byDataTestId('accountFiatBalance');
return ScreenUtils.isActive([locator], ROUTES.DASHBOARD);
};

Expand Down Expand Up @@ -78,7 +78,7 @@ const checkTokenBalance = async (token: string) => {

const countTransactionsByToken = async (token: string) => {
await extension.driver.sleep(1000);
await extension.driver.waitAndClick(Locators.byId('token-' + token));
await extension.driver.waitAndClick(Locators.byId(`token-${token}`));
await extension.driver.sleep(2000);
const transactionsCount = await extension.driver.findElements(
Locators.byDataTestId('ft-activity'),
Expand Down
Binary file modified tests/e2e/veworld-dist.zip
Binary file not shown.
Loading
Loading