From 694f88fa7ab55cd242fc7680cf8f1ab670df2be2 Mon Sep 17 00:00:00 2001 From: datguychen Date: Sun, 15 Oct 2023 09:21:31 +0200 Subject: [PATCH] vercel push added --- .github/workflows/CronWorkflow.yml | 6 +-- .github/workflows/PushWorkflow.yml | 18 +++++-- package-lock.json | 81 +++++++++++++++++++----------- package.json | 3 +- tests/1_Sidebar.spec.ts | 10 ++-- tests/2_Home.spec.ts | 2 +- tests/4_Resume.spec.ts | 2 +- tests/5_Projects.spec.ts | 2 +- tests/6_Contact.spec.ts | 4 +- tests/example.spec.ts | 18 ------- 10 files changed, 79 insertions(+), 67 deletions(-) delete mode 100644 tests/example.spec.ts diff --git a/.github/workflows/CronWorkflow.yml b/.github/workflows/CronWorkflow.yml index eca1d82..3886bd4 100644 --- a/.github/workflows/CronWorkflow.yml +++ b/.github/workflows/CronWorkflow.yml @@ -20,12 +20,10 @@ jobs: - name: Install dependencies run: npm ci - - name: Install Testmo CLI - run: npm install --no-save @testmo/testmo-cli - name: Install Playwright run: npx playwright install --with-deps chromium - - name: Run Playwright - All tests - run: npx playwright test + - name: Run core tests + run: npx playwright test --grep "@core" --project="Chrome" - name: Upload test results if: always() uses: actions/upload-artifact@v3 diff --git a/.github/workflows/PushWorkflow.yml b/.github/workflows/PushWorkflow.yml index 6c41b3e..9d5bda8 100644 --- a/.github/workflows/PushWorkflow.yml +++ b/.github/workflows/PushWorkflow.yml @@ -18,16 +18,24 @@ jobs: - name: Install dependencies run: npm ci - - name: Install Testmo CLI - run: npm install --no-save @testmo/testmo-cli - name: Install Playwright run: npx playwright install --with-deps chromium - - name: Run Playwright - All tests - run: npx playwright test + - name: Install Vercel CLI + run: pnpm i -g vercel + - name: Run vercel tests + run: npx playwright test --grep "@vercel" --project="Chrome" - name: Upload test results if: always() uses: actions/upload-artifact@v3 with: name: playwright-report path: playwright-report - retention-days: 5 \ No newline at end of file + retention-days: 5 + - name: Build and Deploy to Vercel + if: success() + run: | + npm run build + npx vercel --prod + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} # Add your Vercel token as a secret in your repository + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 0be29e8..b916213 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,8 @@ "web-vitals": "^2.1.4" }, "devDependencies": { - "@playwright/test": "^1.37.1", + "@playwright/test": "^1.39.0", + "@types/node": "^20.8.6", "tailwindcss": "^3.3.2" } }, @@ -3743,36 +3744,18 @@ } }, "node_modules/@playwright/test": { - "version": "1.37.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.37.1.tgz", - "integrity": "sha512-bq9zTli3vWJo8S3LwB91U0qDNQDpEXnw7knhxLM0nwDvexQAwx9tO8iKDZSqqneVq+URd/WIoz+BALMqUTgdSg==", + "version": "1.39.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.39.0.tgz", + "integrity": "sha512-3u1iFqgzl7zr004bGPYiN/5EZpRUSFddQBra8Rqll5N0/vfpqlP9I9EXqAoGacuAbX6c9Ulg/Cjqglp5VkK6UQ==", "dev": true, "dependencies": { - "@types/node": "*", - "playwright-core": "1.37.1" + "playwright": "1.39.0" }, "bin": { "playwright": "cli.js" }, "engines": { "node": ">=16" - }, - "optionalDependencies": { - "fsevents": "2.3.2" - } - }, - "node_modules/@playwright/test/node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, "node_modules/@pmmmwh/react-refresh-webpack-plugin": { @@ -4551,9 +4534,12 @@ "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==" }, "node_modules/@types/node": { - "version": "20.5.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.6.tgz", - "integrity": "sha512-Gi5wRGPbbyOTX+4Y2iULQ27oUPrefaB0PxGQJnfyWN3kvEDGM3mIB5M/gQLmitZf7A9FmLeaqxD3L1CXpm3VKQ==" + "version": "20.8.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.6.tgz", + "integrity": "sha512-eWO4K2Ji70QzKUqRy6oyJWUeB7+g2cRagT3T/nxYibYcT4y2BDL8lqolRXjTHmkZCdJfIPaY73KbJAZmcryxTQ==", + "dependencies": { + "undici-types": "~5.25.1" + } }, "node_modules/@types/pako": { "version": "1.0.4", @@ -13471,10 +13457,28 @@ "node": ">=4" } }, + "node_modules/playwright": { + "version": "1.39.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.39.0.tgz", + "integrity": "sha512-naE5QT11uC/Oiq0BwZ50gDmy8c8WLPRTEWuSSFVG2egBka/1qMoSqYQcROMT9zLwJ86oPofcTH2jBY/5wWOgIw==", + "dev": true, + "dependencies": { + "playwright-core": "1.39.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, "node_modules/playwright-core": { - "version": "1.37.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.37.1.tgz", - "integrity": "sha512-17EuQxlSIYCmEMwzMqusJ2ztDgJePjrbttaefgdsiqeLWidjYz9BxXaTaZWxH1J95SHGk6tjE+dwgWILJoUZfA==", + "version": "1.39.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.39.0.tgz", + "integrity": "sha512-+k4pdZgs1qiM+OUkSjx96YiKsXsmb59evFoqv8SKO067qBA+Z2s/dCzJij/ZhdQcs2zlTAgRKfeiiLm8PQ2qvw==", "dev": true, "bin": { "playwright-core": "cli.js" @@ -13483,6 +13487,20 @@ "node": ">=16" } }, + "node_modules/playwright/node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/postcss": { "version": "8.4.28", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.28.tgz", @@ -17160,6 +17178,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/undici-types": { + "version": "5.25.3", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz", + "integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==" + }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", diff --git a/package.json b/package.json index a93ea93..ca3b630 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,8 @@ ] }, "devDependencies": { - "@playwright/test": "^1.37.1", + "@playwright/test": "^1.39.0", + "@types/node": "^20.8.6", "tailwindcss": "^3.3.2" } } diff --git a/tests/1_Sidebar.spec.ts b/tests/1_Sidebar.spec.ts index fcad5bd..5c9f6f3 100644 --- a/tests/1_Sidebar.spec.ts +++ b/tests/1_Sidebar.spec.ts @@ -8,7 +8,7 @@ function delay(time: number) { }); } -test('Sidebar_ProfilePicture @core', async ({browser})=> +test('Sidebar_ProfilePicture @core @vercel', async ({browser})=> { test.info().annotations.push({type: "severity", description: "Critical"}); @@ -37,7 +37,7 @@ test('Sidebar_ProfilePicture @core', async ({browser})=> await page.close(); }); -test('Sidebar_FullName @core', async ({browser})=> +test('Sidebar_FullName @core @vercel', async ({browser})=> { test.info().annotations.push({type: "severity", description: "Critical"}); @@ -66,7 +66,7 @@ test('Sidebar_FullName @core', async ({browser})=> await page.close(); }); -test('Sidebar_Tabs_HoverStates @core', async ({browser})=> +test('Sidebar_Tabs_HoverStates @core @vercel', async ({browser})=> { test.info().annotations.push({type: "severity", description: "Critical"}); @@ -120,7 +120,7 @@ test('Sidebar_Tabs_HoverStates @core', async ({browser})=> await page.close(); }); -test('Sidebar_Tabs_Click_Check @core', async ({browser})=> +test('Sidebar_Tabs_Click_Check @core @vercel', async ({browser})=> { test.info().annotations.push({type: "severity", description: "Critical"}); @@ -168,7 +168,7 @@ test('Sidebar_Tabs_Click_Check @core', async ({browser})=> await page.close(); }); -test('Sidebar_Github_LinkedIn_Buttons @core', async ({browser})=> +test('Sidebar_Github_LinkedIn_Buttons @core @vercel', async ({browser})=> { test.info().annotations.push({type: "severity", description: "Critical"}); diff --git a/tests/2_Home.spec.ts b/tests/2_Home.spec.ts index b8d33f8..03d42ef 100644 --- a/tests/2_Home.spec.ts +++ b/tests/2_Home.spec.ts @@ -8,7 +8,7 @@ function delay(time: number) { }); } -test('Home_Text_Visibility @core', async ({browser})=> +test('Home_Text_Visibility @core @vercel', async ({browser})=> { test.info().annotations.push({type: "severity", description: "Critical"}); diff --git a/tests/4_Resume.spec.ts b/tests/4_Resume.spec.ts index f6e68d5..f9b4bf3 100644 --- a/tests/4_Resume.spec.ts +++ b/tests/4_Resume.spec.ts @@ -8,7 +8,7 @@ function delay(time: number) { }); } -test('Resume_General_Sections_Visibility @core', async ({browser})=> +test('Resume_General_Sections_Visibility @core @vercel', async ({browser})=> { test.info().annotations.push({type: "severity", description: "Critical"}); diff --git a/tests/5_Projects.spec.ts b/tests/5_Projects.spec.ts index 14941ba..a8936d1 100644 --- a/tests/5_Projects.spec.ts +++ b/tests/5_Projects.spec.ts @@ -8,7 +8,7 @@ function delay(time: number) { }); } -test('Projects_General_Sections_Visibility @core', async ({browser})=> +test('Projects_General_Sections_Visibility @core @vercel', async ({browser})=> { test.info().annotations.push({type: "severity", description: "Critical"}); diff --git a/tests/6_Contact.spec.ts b/tests/6_Contact.spec.ts index 4d1f5d3..bfb5d7d 100644 --- a/tests/6_Contact.spec.ts +++ b/tests/6_Contact.spec.ts @@ -8,7 +8,7 @@ function delay(time: number) { }); } -test('Contact_General_Sections_Visibility @core', async ({browser})=> +test('Contact_General_Sections_Visibility @core @vercel', async ({browser})=> { test.info().annotations.push({type: "severity", description: "Critical"}); @@ -39,7 +39,7 @@ test('Contact_General_Sections_Visibility @core', async ({browser})=> await page.close(); }); -test('Contact_GitHub_LinkedIn @core', async ({browser})=> +test('Contact_GitHub_LinkedIn @core @vercel', async ({browser})=> { test.info().annotations.push({type: "severity", description: "Critical"}); diff --git a/tests/example.spec.ts b/tests/example.spec.ts deleted file mode 100644 index 54a906a..0000000 --- a/tests/example.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('has title', async ({ page }) => { - await page.goto('https://playwright.dev/'); - - // Expect a title "to contain" a substring. - await expect(page).toHaveTitle(/Playwright/); -}); - -test('get started link', async ({ page }) => { - await page.goto('https://playwright.dev/'); - - // Click the get started link. - await page.getByRole('link', { name: 'Get started' }).click(); - - // Expects page to have a heading with the name of Installation. - await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible(); -});