From 4fd9c0273155bfc048d7cb2d1c9a5ca68a9a48f8 Mon Sep 17 00:00:00 2001 From: Brad Paugh Date: Mon, 11 Dec 2023 12:24:06 -0800 Subject: [PATCH 1/5] attempt fixing visual tests for vue 2 --- .github/workflows/visual_tests.yml | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/visual_tests.yml b/.github/workflows/visual_tests.yml index bcc61dc27c..5f2f8a6c5a 100644 --- a/.github/workflows/visual_tests.yml +++ b/.github/workflows/visual_tests.yml @@ -13,6 +13,7 @@ jobs: pull-requests: read outputs: dialtone-vue-3: ${{ steps.filter.outputs.dialtone-vue-3 }} + dialtone-vue-2: ${{ steps.filter.outputs.dialtone-vue-2 }} steps: - name: Checkout uses: actions/checkout@v4 @@ -27,10 +28,15 @@ jobs: - 'packages/dialtone-icons/**' - 'packages/dialtone-tokens/**' - 'packages/dialtone-vue3/**' + dialtone-vue-2: + - 'packages/dialtone/**' + - 'packages/dialtone-icons/**' + - 'packages/dialtone-tokens/**' + - 'packages/dialtone-vue2/**' prompt_for_label: needs: filter-actions - if: (needs.filter-actions.outputs.dialtone-vue-3 == 'true' && (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'no-visual-test') && !contains(github.event.pull_request.labels.*.name, 'visual-test-ready'))) + if: ((needs.filter-actions.outputs.dialtone-vue-3 == 'true' || needs.filter-actions.outputs.dialtone-vue-2 == 'true') && (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'no-visual-test') && !contains(github.event.pull_request.labels.*.name, 'visual-test-ready'))) runs-on: ubuntu-latest steps: - uses: actions/github-script@v6 @@ -40,7 +46,7 @@ jobs: test: needs: filter-actions - if: (needs.filter-actions.outputs.dialtone-vue-3 == 'true' && (contains(github.event.pull_request.labels.*.name, 'visual-test-ready') || github.event_name == 'push')) + if: ((needs.filter-actions.outputs.dialtone-vue-3 == 'true' || needs.filter-actions.outputs.dialtone-vue-2 == 'true') && (contains(github.event.pull_request.labels.*.name, 'visual-test-ready') || github.event_name == 'push')) concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -78,11 +84,24 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Build Dialtone library and documentation site + - name: Build Dialtone library and documentation site (Vue 3) + if: needs.filter-actions.outputs.dialtone-vue-3 == 'true' run: pnpm nx run --verbose dialtone-vue3-documentation:build - - name: Run Visual Tests + - name: Run Visual Tests (Vue 3) + if: needs.filter-actions.outputs.dialtone-vue-3 == 'true' env: PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} PERCY_TARGET_BRANCH: ${{ github.base_ref }} run: pnpm nx run --verbose dialtone-vue3-documentation:test:visual + + - name: Build Dialtone library and documentation site (Vue 2) + if: needs.filter-actions.outputs.dialtone-vue-2 == 'true' + run: pnpm nx run --verbose dialtone-vue2-documentation:build + + - name: Run Visual Tests (Vue 2) + if: needs.filter-actions.outputs.dialtone-vue-2 == 'true' + env: + PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} + PERCY_TARGET_BRANCH: ${{ github.base_ref }} + run: pnpm nx run --verbose dialtone-vue2-documentation:test:visual From f8ffadceb2aac0ab01b51e34d44ffde98ff02ced Mon Sep 17 00:00:00 2001 From: Brad Paugh Date: Mon, 11 Dec 2023 12:26:41 -0800 Subject: [PATCH 2/5] test vue 2 change --- packages/dialtone-vue2/components/button/button.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dialtone-vue2/components/button/button.vue b/packages/dialtone-vue2/components/button/button.vue index bfaf9c02e7..8921badaa4 100644 --- a/packages/dialtone-vue2/components/button/button.vue +++ b/packages/dialtone-vue2/components/button/button.vue @@ -9,7 +9,7 @@ :disabled="disabled" :style="{ width: width }" :aria-live="computedAriaLive" - :aria-label="loading ? 'loading' : $attrs['aria-label']" + :aria-label="loading ? 'loading1111' : $attrs['aria-label']" v-on="buttonListeners" > From 2cd4b0897852414dc196b59435607163de38c6dc Mon Sep 17 00:00:00 2001 From: Brad Paugh Date: Mon, 11 Dec 2023 12:32:58 -0800 Subject: [PATCH 3/5] correct commands --- .github/workflows/visual_tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/visual_tests.yml b/.github/workflows/visual_tests.yml index 5f2f8a6c5a..95c8874b0f 100644 --- a/.github/workflows/visual_tests.yml +++ b/.github/workflows/visual_tests.yml @@ -86,22 +86,22 @@ jobs: - name: Build Dialtone library and documentation site (Vue 3) if: needs.filter-actions.outputs.dialtone-vue-3 == 'true' - run: pnpm nx run --verbose dialtone-vue3-documentation:build + run: pnpm nx run --verbose dialtone-vue3:build:documentation - name: Run Visual Tests (Vue 3) if: needs.filter-actions.outputs.dialtone-vue-3 == 'true' env: PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} PERCY_TARGET_BRANCH: ${{ github.base_ref }} - run: pnpm nx run --verbose dialtone-vue3-documentation:test:visual + run: pnpm nx run --verbose dialtone-vue3:test:visual - name: Build Dialtone library and documentation site (Vue 2) if: needs.filter-actions.outputs.dialtone-vue-2 == 'true' - run: pnpm nx run --verbose dialtone-vue2-documentation:build + run: pnpm nx run --verbose dialtone-vue2:build:documentation - name: Run Visual Tests (Vue 2) if: needs.filter-actions.outputs.dialtone-vue-2 == 'true' env: PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} PERCY_TARGET_BRANCH: ${{ github.base_ref }} - run: pnpm nx run --verbose dialtone-vue2-documentation:test:visual + run: pnpm nx run --verbose dialtone-vue2:test:visual From 63ff8d870b4267362282eb0fc853a3c7494452d1 Mon Sep 17 00:00:00 2001 From: Brad Paugh Date: Mon, 11 Dec 2023 12:57:49 -0800 Subject: [PATCH 4/5] create dir if doesn't exist in doc script --- packages/dialtone-vue2/scripts/build-docs.js | 6 +++++- packages/dialtone-vue3/scripts/build-docs.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/dialtone-vue2/scripts/build-docs.js b/packages/dialtone-vue2/scripts/build-docs.js index 952de8c880..8756984087 100644 --- a/packages/dialtone-vue2/scripts/build-docs.js +++ b/packages/dialtone-vue2/scripts/build-docs.js @@ -1,7 +1,7 @@ import { parse } from 'vue-docgen-api'; import path, { join } from 'path'; import { fileURLToPath } from 'url'; -import { readdirSync, writeFile } from 'fs'; +import { readdirSync, writeFile, existsSync, mkdirSync } from 'fs'; import componentsList from '../common/components_list.cjs'; @@ -32,6 +32,10 @@ const getFileList = (folder) => { const writeDocumentationFile = (data) => { const jsonData = JSON.stringify(data); + const dist = path.resolve(join(__dirname, '../dist')); + if (!existsSync(dist)) { + mkdirSync(dist); + } writeFile(outputPath, jsonData, 'utf8', (err) => { if (err) return console.error('An error occurred while writing JSON Object to File.', err); diff --git a/packages/dialtone-vue3/scripts/build-docs.js b/packages/dialtone-vue3/scripts/build-docs.js index 952de8c880..8756984087 100644 --- a/packages/dialtone-vue3/scripts/build-docs.js +++ b/packages/dialtone-vue3/scripts/build-docs.js @@ -1,7 +1,7 @@ import { parse } from 'vue-docgen-api'; import path, { join } from 'path'; import { fileURLToPath } from 'url'; -import { readdirSync, writeFile } from 'fs'; +import { readdirSync, writeFile, existsSync, mkdirSync } from 'fs'; import componentsList from '../common/components_list.cjs'; @@ -32,6 +32,10 @@ const getFileList = (folder) => { const writeDocumentationFile = (data) => { const jsonData = JSON.stringify(data); + const dist = path.resolve(join(__dirname, '../dist')); + if (!existsSync(dist)) { + mkdirSync(dist); + } writeFile(outputPath, jsonData, 'utf8', (err) => { if (err) return console.error('An error occurred while writing JSON Object to File.', err); From 84b7f80d2368b87143bbf7b0f363311775b0944a Mon Sep 17 00:00:00 2001 From: Brad Paugh Date: Mon, 11 Dec 2023 13:03:21 -0800 Subject: [PATCH 5/5] use storybook:build --- .github/workflows/visual_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/visual_tests.yml b/.github/workflows/visual_tests.yml index 95c8874b0f..4099e90059 100644 --- a/.github/workflows/visual_tests.yml +++ b/.github/workflows/visual_tests.yml @@ -86,7 +86,7 @@ jobs: - name: Build Dialtone library and documentation site (Vue 3) if: needs.filter-actions.outputs.dialtone-vue-3 == 'true' - run: pnpm nx run --verbose dialtone-vue3:build:documentation + run: pnpm nx run --verbose dialtone-vue3:storybook:build - name: Run Visual Tests (Vue 3) if: needs.filter-actions.outputs.dialtone-vue-3 == 'true' @@ -97,7 +97,7 @@ jobs: - name: Build Dialtone library and documentation site (Vue 2) if: needs.filter-actions.outputs.dialtone-vue-2 == 'true' - run: pnpm nx run --verbose dialtone-vue2:build:documentation + run: pnpm nx run --verbose dialtone-vue2:storybook:build - name: Run Visual Tests (Vue 2) if: needs.filter-actions.outputs.dialtone-vue-2 == 'true'