diff --git a/examples/sample-angular-app/.eslintrc.js b/examples/sample-angular-app/.eslintrc.js index 28944eec..4185cb4f 100644 --- a/examples/sample-angular-app/.eslintrc.js +++ b/examples/sample-angular-app/.eslintrc.js @@ -1,3 +1,9 @@ const Config = require('@vechain/repo-config'); -module.exports = Config.EslintLibrary; +module.exports = { + ...Config.EslintLibrary, + rules: { + 'no-constant-binary-expression': 'off', + 'eslint-comments/disable-enable-pair': 'off', + }, +}; diff --git a/examples/sample-angular-app/Dockerfile b/examples/sample-angular-app/Dockerfile index 8a1d9dfc..c579f81e 100644 --- a/examples/sample-angular-app/Dockerfile +++ b/examples/sample-angular-app/Dockerfile @@ -8,8 +8,14 @@ RUN apk add git RUN yarn +RUN yarn global add @angular/cli + +RUN yarn global add serve + COPY . . +RUN yarn e2e-build + EXPOSE 5004 -CMD [ "yarn", "dev" ] \ No newline at end of file +CMD [ "serve", "dist/easy-angular", "-p", "5004"] \ No newline at end of file diff --git a/examples/sample-angular-app/angular.json b/examples/sample-angular-app/angular.json index b50b3e75..4820f10a 100644 --- a/examples/sample-angular-app/angular.json +++ b/examples/sample-angular-app/angular.json @@ -26,10 +26,6 @@ "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", "inlineStyleLanguage": "scss", - "assets": [ - "src/assets/img/favicon/favicon.ico", - "src/assets" - ], "styles": [], "scripts": [] }, @@ -92,10 +88,6 @@ "tsConfig": "tsconfig.spec.json", "karmaConfig": "karma.conf.js", "inlineStyleLanguage": "scss", - "assets": [ - "src/assets/img/favicon/favicon.ico", - "src/assets" - ], "styles": [], "scripts": [] } diff --git a/examples/sample-angular-app/package.json b/examples/sample-angular-app/package.json index f74b0069..df2d9702 100644 --- a/examples/sample-angular-app/package.json +++ b/examples/sample-angular-app/package.json @@ -7,6 +7,7 @@ "build": "ng build --configuration development --base-href '/vechain-dapp-kit/angular/'", "clean": "rm -rf dist .turbo .angular", "dev": "ng serve --port 5004", + "e2e-build": "ng build --configuration development", "lint": "eslint src --ext .js,.jsx,.ts,.tsx", "purge": "yarn clean; rm -rf node_modules", "watch": "ng build --watch --configuration development" diff --git a/examples/sample-angular-app/src/app/app.component.ts b/examples/sample-angular-app/src/app/app.component.ts index 4918d532..46a68bb1 100644 --- a/examples/sample-angular-app/src/app/app.component.ts +++ b/examples/sample-angular-app/src/app/app.component.ts @@ -14,8 +14,25 @@ export class AppComponent implements OnInit { // ------------------------------------------------------------------------------- public ngOnInit(): void { - // custom button configuration + const walletConnectOptions = { + projectId: 'a0b855ceaf109dbc8426479a4c3d38d8', + metadata: { + name: 'Sample VeChain dApp', + description: 'A sample VeChain dApp', + url: window.location.origin, + icons: [`${window.location.origin}/images/logo/my-dapp.png`], + }, + }; + + const vechainDAppKitOptions = { + nodeUrl: 'https://testnet.vechain.org/', + genesis: 'test', + walletConnectOptions, + usePersistence: true, + }; + DAppKitUI.configure(vechainDAppKitOptions); + // custom button configuration const customButton = document.getElementById('custom-button'); if (customButton) { const handleConnected = (address: string | null): void => { diff --git a/examples/sample-angular-app/src/index.html b/examples/sample-angular-app/src/index.html index fbd0dd4c..f5a8fb61 100644 --- a/examples/sample-angular-app/src/index.html +++ b/examples/sample-angular-app/src/index.html @@ -6,32 +6,6 @@ - - - - - - - - console.error(err)); - -const walletConnectOptions = { - projectId: 'a0b855ceaf109dbc8426479a4c3d38d8', - metadata: { - name: 'Sample VeChain dApp', - description: 'A sample VeChain dApp', - url: window.location.origin, - icons: [`${window.location.origin}/images/logo/my-dapp.png`], - }, -}; - -const vechainDAppKitOptions = { - nodeUrl: 'https://testnet.vechain.org/', - genesis: 'test', - walletConnectOptions, - usePersistence: true, -}; - -DAppKitUI.configure(vechainDAppKitOptions); diff --git a/examples/sample-angular-app/src/polyfills.ts b/examples/sample-angular-app/src/polyfills.ts index 4852b8d8..3db6b9bd 100644 --- a/examples/sample-angular-app/src/polyfills.ts +++ b/examples/sample-angular-app/src/polyfills.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /** * This file includes polyfills needed by Angular and is loaded before the app. * You can add your own extra polyfills to this file. @@ -52,5 +54,9 @@ import 'zone.js'; // Included with Angular CLI. */ import '@angular/localize/init'; -// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access (window as any).global = window; +global.Buffer = global.Buffer || require('buffer').Buffer; +(window as any).process = { + env: { DEBUG: undefined }, + version: '', // to avoid undefined.slice error +}; diff --git a/tests/e2e/docker-compose.yaml b/tests/e2e/docker-compose.yaml index ca3b0f7b..0a843b58 100644 --- a/tests/e2e/docker-compose.yaml +++ b/tests/e2e/docker-compose.yaml @@ -56,13 +56,13 @@ services: ports: - 5003:5003 - # sample-angular-app: - # container_name: sample-angular-app - # build: - # context: ../../examples/sample-angular-app - # dockerfile: Dockerfile - # ports: - # - 5004:5004 + sample-angular-app: + container_name: sample-angular-app + build: + context: ../../examples/sample-angular-app + dockerfile: Dockerfile + ports: + - 5004:5004 sample-svelte-app: container_name: sample-svelte-app diff --git a/tests/e2e/src/config/hooks/ContainerHooks.ts b/tests/e2e/src/config/hooks/ContainerHooks.ts index 1962c9da..70862e16 100644 --- a/tests/e2e/src/config/hooks/ContainerHooks.ts +++ b/tests/e2e/src/config/hooks/ContainerHooks.ts @@ -42,6 +42,12 @@ BeforeAll(async function () { 'Accepting connections at http://localhost:5003', ), ) + .withWaitStrategy( + 'sample-angular-app', + Wait.forLogMessage( + 'Accepting connections at http://localhost:5004', + ), + ) .withWaitStrategy( 'sample-svelte-app', Wait.forLogMessage('Local: http://localhost:5005'), @@ -50,10 +56,6 @@ BeforeAll(async function () { 'sample-vue-app', Wait.forLogMessage('Local: http://localhost:5006'), ) - // .withWaitStrategy( - // 'sample-angular-app', - // Wait.forLogMessage('Server running at http://localhost:5004'), - // ) .withWaitStrategy('mockserver', Wait.forLogMessage('INFO')) .up(); } catch (e) { diff --git a/tests/e2e/src/features/connect-wallet.feature b/tests/e2e/src/features/connect-wallet.feature index 403d31ce..f1837022 100644 --- a/tests/e2e/src/features/connect-wallet.feature +++ b/tests/e2e/src/features/connect-wallet.feature @@ -8,6 +8,7 @@ Feature: The user can connect to a wallet * The user connect to VeWorld wallet in dapp "" Examples: | dapp | + | angular | | vanilla | | react | | next |