diff --git a/test/test-project/docker-compose.yml b/test/test-project/docker-compose.yml index c537ae8f0..a73f2e9a6 100644 --- a/test/test-project/docker-compose.yml +++ b/test/test-project/docker-compose.yml @@ -14,6 +14,8 @@ services: test-project: privileged: true image: "node:${NODE_IMAGE_TAG}" + extra_hosts: + - "host.docker.internal:host-gateway" environment: - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true volumes: diff --git a/test/test-project/package.json b/test/test-project/package.json index 8ffae277f..5b1252017 100644 --- a/test/test-project/package.json +++ b/test/test-project/package.json @@ -9,17 +9,12 @@ }, "dependencies": { "@asyncapi/generator": "file:../..", - "@asyncapi/html-template": "0.16.0" - + "@asyncapi/html-template": "^0.16.0" }, "devDependencies": { "fs-extra": "9.1.0", "jest": "25.5.0", - "rimraf": "3.0.2", - "autoprefixer": "^10.2.1", - "postcss-cli": "^8.3.1", - "puppeteer": "^5.3.1", - "tailwindcss": "^2.0.2" + "rimraf": "3.0.2" }, "jest": { "moduleNameMapper": { diff --git a/test/test-project/test-registry.test.js b/test/test-project/test-registry.test.js index 80af37ce9..eb2f8ea5e 100644 --- a/test/test-project/test-registry.test.js +++ b/test/test-project/test-registry.test.js @@ -16,7 +16,7 @@ describe('Integration testing generateFromFile() to make sure the template can b return path.resolve(mainTestResultPath, crypto.randomBytes(4).toString('hex')); }; - jest.setTimeout(600000); + jest.setTimeout(6000000); it('generated using private registory', async () => { const outputDir = generateFolderName(); @@ -29,7 +29,7 @@ describe('Integration testing generateFromFile() to make sure the template can b singleFile: true }, registry: { - url: 'http://127.0.0.1:4873', + url: 'http://host.docker.internal:4873', // Replace the host.docker.internal to localhost for testing without docker auth: 'YWRtaW46bmltZGE=' // base64 encoded username and password represented as admin:nimda } diff --git a/test/test-project/test.sh b/test/test-project/test.sh index 4b8a47d59..bbd289ea6 100644 --- a/test/test-project/test.sh +++ b/test/test-project/test.sh @@ -1,40 +1,17 @@ #!/bin/bash -# Function to install and test a specific project -function test_project { - - npm run test:project - # Installing html template globally before global tests - PUPPETEER_SKIP_DOWNLOAD=true npm install -g @asyncapi/html-template@0.16.0 - # Remove previously installed html template to make sure it is not picked up in the test - rm -rf node_modules/@asyncapi/html-template - rm -rf ../../node_modules/@asyncapi/html-template - npm run test:global -} - -# Function to test the registry -function test_registry { - npm run test:registry -} - -# Required by GitHub Actions +#required by GitHub Actions sudo chown -R 1001:121 "/root/.npm" - -# Always run these steps cd app -PUPPETEER_SKIP_DOWNLOAD=true npm install +npm install cd test/test-project -PUPPETEER_SKIP_DOWNLOAD=true npm install - - -# Run the functions based on the provided arguments -case "$1" in - "test-project") - test_project - test_registry - ;; - *) - echo "Invalid argument. Supported arguments: test-project" - exit 1 - ;; -esac \ No newline at end of file +PUPPETEER_SKIP_DOWNLOAD=true npm install @asyncapi/html-template@0.16.0 +npm install +npm run test:project +#installing html template globally before global tests +PUPPETEER_SKIP_DOWNLOAD=true npm install -g @asyncapi/html-template@0.16.0 +#remove previously installed html template to make sure it is not picked up in the test +rm -rf node_modules/@asyncapi/html-template +rm -rf ../../node_modules/@asyncapi/html-template +npm run test:global +npm run test:registry \ No newline at end of file