From dcb5722464214f56fe1bf1ebb95a3f0089220932 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 15:38:53 +0200 Subject: [PATCH 01/19] add import for @umbraco-ui/uui and router-slot to test runner config to correctly register implicit uui components --- src/Umbraco.Web.UI.Client/web-test-runner.config.mjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/web-test-runner.config.mjs b/src/Umbraco.Web.UI.Client/web-test-runner.config.mjs index 40121901ae..7e846d09ed 100644 --- a/src/Umbraco.Web.UI.Client/web-test-runner.config.mjs +++ b/src/Umbraco.Web.UI.Client/web-test-runner.config.mjs @@ -14,8 +14,10 @@ export default { ` - `, From 23d82837431778ce82b58f6703a159bbd8b894b8 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 15:39:07 +0200 Subject: [PATCH 02/19] import from '.' --- .../core/services/notification/notification-handler.test.ts | 4 +++- .../core/services/notification/notifications.service.test.ts | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/core/services/notification/notification-handler.test.ts b/src/Umbraco.Web.UI.Client/src/core/services/notification/notification-handler.test.ts index 7684463c85..734397e934 100644 --- a/src/Umbraco.Web.UI.Client/src/core/services/notification/notification-handler.test.ts +++ b/src/Umbraco.Web.UI.Client/src/core/services/notification/notification-handler.test.ts @@ -1,8 +1,10 @@ import { assert, expect } from '@open-wc/testing'; import { validate as uuidValidate } from 'uuid'; + import { UmbNotificationHandler } from './notification-handler'; + import type { UmbNotificationDefaultData } from './layouts/default'; -import type { UmbNotificationOptions } from './'; +import type { UmbNotificationOptions } from '.'; describe('UCPNotificationHandler', () => { let notificationHandler: UmbNotificationHandler; diff --git a/src/Umbraco.Web.UI.Client/src/core/services/notification/notifications.service.test.ts b/src/Umbraco.Web.UI.Client/src/core/services/notification/notifications.service.test.ts index b828d053aa..8a9f5877a8 100644 --- a/src/Umbraco.Web.UI.Client/src/core/services/notification/notifications.service.test.ts +++ b/src/Umbraco.Web.UI.Client/src/core/services/notification/notifications.service.test.ts @@ -1,5 +1,6 @@ import { expect } from '@open-wc/testing'; -import { UmbNotificationService, UmbNotificationHandler } from './'; + +import { UmbNotificationHandler, UmbNotificationService } from '.'; describe('UCPNotificationService', () => { let notificationService: UmbNotificationService; From 1b953c44307c6b38fffc5f7756d1519cea2fc5aa Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 15:42:05 +0200 Subject: [PATCH 03/19] add correct await usage for chai accessible() --- .../src/installer/installer.test.ts | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/installer/installer.test.ts b/src/Umbraco.Web.UI.Client/src/installer/installer.test.ts index 56b019d8b6..a93083013c 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/installer.test.ts +++ b/src/Umbraco.Web.UI.Client/src/installer/installer.test.ts @@ -1,4 +1,7 @@ -import { html, fixture, expect } from '@open-wc/testing'; +import '.'; + +import { expect, fixture, html } from '@open-wc/testing'; + import { UmbInstallerConsent } from './installer-consent.element'; import { UmbInstallerDatabase } from './installer-database.element'; import { UmbInstallerInstalling } from './installer-installing.element'; @@ -13,12 +16,12 @@ describe('UmbInstaller', () => { element = await fixture(html``); }); - it('is defined with its own instance', async () => { + it('is defined with its own instance', () => { expect(element).to.be.instanceOf(UmbInstaller); }); it('passes the a11y audit', async () => { - expect(element).shadowDom.to.be.accessible(); + await expect(element).shadowDom.to.be.accessible(); }); }); @@ -29,12 +32,12 @@ describe('UmbInstallerLayout', () => { element = await fixture(html``); }); - it('is defined with its own instance', async () => { + it('is defined with its own instance', () => { expect(element).to.be.instanceOf(UmbInstallerLayout); }); it('passes the a11y audit', async () => { - expect(element).shadowDom.to.be.accessible(); + await expect(element).shadowDom.to.be.accessible(); }); }); @@ -45,12 +48,12 @@ describe('UmbInstallerUser', () => { element = await fixture(html``); }); - it('is defined with its own instance', async () => { + it('is defined with its own instance', () => { expect(element).to.be.instanceOf(UmbInstallerUser); }); it('passes the a11y audit', async () => { - expect(element).shadowDom.to.be.accessible(); + await expect(element).to.be.accessible(); }); }); @@ -61,12 +64,12 @@ describe('UmbInstallerConsent', () => { element = await fixture(html``); }); - it('is defined with its own instance', async () => { + it('is defined with its own instance', () => { expect(element).to.be.instanceOf(UmbInstallerConsent); }); it('passes the a11y audit', async () => { - expect(element).shadowDom.to.be.accessible(); + await expect(element).shadowDom.to.be.accessible(); }); }); @@ -77,12 +80,12 @@ describe('UmbInstallerDatabase', () => { element = await fixture(html``); }); - it('is defined with its own instance', async () => { + it('is defined with its own instance', () => { expect(element).to.be.instanceOf(UmbInstallerDatabase); }); it('passes the a11y audit', async () => { - expect(element).shadowDom.to.be.accessible(); + await expect(element).shadowDom.to.be.accessible(); }); }); @@ -93,11 +96,11 @@ describe('UmbInstallerInstalling', () => { element = await fixture(html``); }); - it('is defined with its own instance', async () => { + it('is defined with its own instance', () => { expect(element).to.be.instanceOf(UmbInstallerInstalling); }); it('passes the a11y audit', async () => { - expect(element).shadowDom.to.be.accessible(); + await expect(element).shadowDom.to.be.accessible(); }); }); From 0a16d9921e0cc797fe33fbec96f7d1d219900bf5 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 15:47:05 +0200 Subject: [PATCH 04/19] add test for upgrader-view --- .../src/upgrader/upgrader-view.test.ts | 19 +++++++++++++++++++ .../src/upgrader/upgrader.test.ts | 4 ---- 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts diff --git a/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts b/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts new file mode 100644 index 0000000000..74bc26db1d --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts @@ -0,0 +1,19 @@ +import { expect, fixture, html } from '@open-wc/testing'; + +import { UmbUpgraderView } from './upgrader-view.element'; + +describe('UmbUpgrader', () => { + let element: UmbUpgraderView; + + beforeEach(async () => { + element = await fixture(html``); + }); + + it('is defined with its own instance', () => { + expect(element).to.be.instanceOf(UmbUpgraderView); + }); + + it('passes the a11y audit', async () => { + await expect(element).shadowDom.to.be.accessible(); + }); +}); diff --git a/src/Umbraco.Web.UI.Client/src/upgrader/upgrader.test.ts b/src/Umbraco.Web.UI.Client/src/upgrader/upgrader.test.ts index cd6871b717..152dacda45 100644 --- a/src/Umbraco.Web.UI.Client/src/upgrader/upgrader.test.ts +++ b/src/Umbraco.Web.UI.Client/src/upgrader/upgrader.test.ts @@ -12,8 +12,4 @@ describe('UmbUpgrader', () => { it('is defined with its own instance', () => { expect(element).to.be.instanceOf(UmbUpgrader); }); - - it('passes the a11y audit', () => { - expect(element).shadowDom.to.be.accessible(); - }); }); From 91e3a76afba4dcc60a97415daf33262597934a4c Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 15:57:36 +0200 Subject: [PATCH 05/19] define correct name of upgraderview test --- src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts b/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts index 74bc26db1d..86cfd581ca 100644 --- a/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts +++ b/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts @@ -2,7 +2,7 @@ import { expect, fixture, html } from '@open-wc/testing'; import { UmbUpgraderView } from './upgrader-view.element'; -describe('UmbUpgrader', () => { +describe('UmbUpgraderView', () => { let element: UmbUpgraderView; beforeEach(async () => { From fc7f539db542ad705755e5fe2b74496f4ebe1c95 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 15:57:44 +0200 Subject: [PATCH 06/19] add test for umb-context-provider --- .../context/context-provider.element.test.ts | 40 +++++++++++++++++++ .../core/context/context-provider.element.ts | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/Umbraco.Web.UI.Client/src/core/context/context-provider.element.test.ts diff --git a/src/Umbraco.Web.UI.Client/src/core/context/context-provider.element.test.ts b/src/Umbraco.Web.UI.Client/src/core/context/context-provider.element.test.ts new file mode 100644 index 0000000000..e8676ab1eb --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/context/context-provider.element.test.ts @@ -0,0 +1,40 @@ +import { expect, fixture, html } from '@open-wc/testing'; +import { LitElement } from 'lit'; +import { customElement } from 'lit/decorators.js'; + +import { UmbContextConsumerMixin } from './context-consumer.mixin'; +import { UmbContextProviderElement } from './context-provider.element'; + +@customElement('umb-context-test') +export class ContextTestElement extends UmbContextConsumerMixin(LitElement) { + public value: string | null = null; + constructor() { + super(); + this.consumeContext('test-context', (value) => { + this.value = value; + }); + } +} + +describe('UmbContextProvider', () => { + let element: UmbContextProviderElement; + let consumer: ContextTestElement; + const contextValue = 'test-value'; + + beforeEach(async () => { + element = await fixture( + html` + + ` + ); + consumer = element.getElementsByTagName('umb-context-test')[0] as ContextTestElement; + }); + + it('is defined with its own instance', () => { + expect(element).to.be.instanceOf(UmbContextProviderElement); + }); + + it('provides the context', () => { + expect(consumer.value).to.equal(contextValue); + }); +}); diff --git a/src/Umbraco.Web.UI.Client/src/core/context/context-provider.element.ts b/src/Umbraco.Web.UI.Client/src/core/context/context-provider.element.ts index 172c8aa476..575e81f818 100644 --- a/src/Umbraco.Web.UI.Client/src/core/context/context-provider.element.ts +++ b/src/Umbraco.Web.UI.Client/src/core/context/context-provider.element.ts @@ -10,7 +10,7 @@ export class UmbContextProviderElement extends UmbContextProviderMixin(LitElemen * @required */ @property({ type: Object }) - value!: unknown; + value: unknown; /** * The key to provide to the context. From c8831b599a641ce8bf1b616a14a44aed1f3da0be Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 16:18:40 +0200 Subject: [PATCH 07/19] add tests for login element --- .../src/auth/login/login.element.ts | 4 ++-- .../src/auth/login/login.test.ts | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/auth/login/login.test.ts diff --git a/src/Umbraco.Web.UI.Client/src/auth/login/login.element.ts b/src/Umbraco.Web.UI.Client/src/auth/login/login.element.ts index 216fb81965..9fe0e552f7 100644 --- a/src/Umbraco.Web.UI.Client/src/auth/login/login.element.ts +++ b/src/Umbraco.Web.UI.Client/src/auth/login/login.element.ts @@ -79,7 +79,7 @@ export default class UmbLogin extends LitElement {
- Email + Email - Password + Password { + let element: UmbLogin; + + beforeEach(async () => { + element = await fixture(html``); + }); + + it('is defined with its own instance', () => { + expect(element).to.be.instanceOf(UmbLogin); + }); + + it('passes the a11y audit', async () => { + await expect(element).to.be.accessible({ + ignoredRules: ['color-contrast'], + }); + }); +}); From ae91e12d78ef60a371bebba720031ac4fa421654 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 16:18:53 +0200 Subject: [PATCH 08/19] add specific ids for labels --- .../src/installer/installer-user.element.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/installer/installer-user.element.ts b/src/Umbraco.Web.UI.Client/src/installer/installer-user.element.ts index 734b559ae6..20c5dcdf68 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/installer-user.element.ts +++ b/src/Umbraco.Web.UI.Client/src/installer/installer-user.element.ts @@ -1,6 +1,7 @@ import { css, CSSResultGroup, html, LitElement } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { Subscription } from 'rxjs'; + import { UmbContextConsumerMixin } from '../core/context'; import { UmbInstallerContext } from './installer-context'; @@ -111,7 +112,7 @@ export class UmbInstallerUser extends UmbContextConsumerMixin(LitElement) { - Name + Name - Email + Email - Password + Password Date: Tue, 9 Aug 2022 16:19:05 +0200 Subject: [PATCH 09/19] ignore the 'color-contrast' rule for now --- src/Umbraco.Web.UI.Client/src/installer/installer.test.ts | 8 ++++++-- .../src/upgrader/upgrader-view.test.ts | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/installer/installer.test.ts b/src/Umbraco.Web.UI.Client/src/installer/installer.test.ts index a93083013c..1313c89842 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/installer.test.ts +++ b/src/Umbraco.Web.UI.Client/src/installer/installer.test.ts @@ -53,7 +53,9 @@ describe('UmbInstallerUser', () => { }); it('passes the a11y audit', async () => { - await expect(element).to.be.accessible(); + await expect(element).to.be.accessible({ + ignoredRules: ['color-contrast'], + }); }); }); @@ -85,7 +87,9 @@ describe('UmbInstallerDatabase', () => { }); it('passes the a11y audit', async () => { - await expect(element).shadowDom.to.be.accessible(); + await expect(element).to.be.accessible({ + ignoredRules: ['color-contrast'], + }); }); }); diff --git a/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts b/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts index 86cfd581ca..99b53c12f2 100644 --- a/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts +++ b/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts @@ -14,6 +14,8 @@ describe('UmbUpgraderView', () => { }); it('passes the a11y audit', async () => { - await expect(element).shadowDom.to.be.accessible(); + await expect(element).to.be.accessible({ + ignoredRules: ['color-contrast'], + }); }); }); From 1562aefabc1773dd83d11bde56f3d40d2b184053 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 16:24:22 +0200 Subject: [PATCH 10/19] add helper const for chai a11y rules --- .../src/auth/login/login.test.ts | 5 ++--- .../src/core/helpers/chai.ts | 3 +++ .../src/installer/installer.test.ts | 17 +++++++---------- .../src/upgrader/upgrader-view.test.ts | 5 ++--- 4 files changed, 14 insertions(+), 16 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/core/helpers/chai.ts diff --git a/src/Umbraco.Web.UI.Client/src/auth/login/login.test.ts b/src/Umbraco.Web.UI.Client/src/auth/login/login.test.ts index 72bd452fb9..4e0e92841a 100644 --- a/src/Umbraco.Web.UI.Client/src/auth/login/login.test.ts +++ b/src/Umbraco.Web.UI.Client/src/auth/login/login.test.ts @@ -1,5 +1,6 @@ import { expect, fixture, html } from '@open-wc/testing'; +import { defaultA11yConfig } from '../../core/helpers/chai'; import UmbLogin from './login.element'; describe('UmbLogin', () => { @@ -14,8 +15,6 @@ describe('UmbLogin', () => { }); it('passes the a11y audit', async () => { - await expect(element).to.be.accessible({ - ignoredRules: ['color-contrast'], - }); + await expect(element).to.be.accessible(defaultA11yConfig); }); }); diff --git a/src/Umbraco.Web.UI.Client/src/core/helpers/chai.ts b/src/Umbraco.Web.UI.Client/src/core/helpers/chai.ts new file mode 100644 index 0000000000..a738f42671 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/helpers/chai.ts @@ -0,0 +1,3 @@ +export const defaultA11yConfig = { + ignoredRules: ['color-contrast'], +}; diff --git a/src/Umbraco.Web.UI.Client/src/installer/installer.test.ts b/src/Umbraco.Web.UI.Client/src/installer/installer.test.ts index 1313c89842..331b27aee0 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/installer.test.ts +++ b/src/Umbraco.Web.UI.Client/src/installer/installer.test.ts @@ -2,6 +2,7 @@ import '.'; import { expect, fixture, html } from '@open-wc/testing'; +import { defaultA11yConfig } from '../core/helpers/chai'; import { UmbInstallerConsent } from './installer-consent.element'; import { UmbInstallerDatabase } from './installer-database.element'; import { UmbInstallerInstalling } from './installer-installing.element'; @@ -21,7 +22,7 @@ describe('UmbInstaller', () => { }); it('passes the a11y audit', async () => { - await expect(element).shadowDom.to.be.accessible(); + await expect(element).to.be.accessible(defaultA11yConfig); }); }); @@ -37,7 +38,7 @@ describe('UmbInstallerLayout', () => { }); it('passes the a11y audit', async () => { - await expect(element).shadowDom.to.be.accessible(); + await expect(element).to.be.accessible(defaultA11yConfig); }); }); @@ -53,9 +54,7 @@ describe('UmbInstallerUser', () => { }); it('passes the a11y audit', async () => { - await expect(element).to.be.accessible({ - ignoredRules: ['color-contrast'], - }); + await expect(element).to.be.accessible(defaultA11yConfig); }); }); @@ -71,7 +70,7 @@ describe('UmbInstallerConsent', () => { }); it('passes the a11y audit', async () => { - await expect(element).shadowDom.to.be.accessible(); + await expect(element).to.be.accessible(defaultA11yConfig); }); }); @@ -87,9 +86,7 @@ describe('UmbInstallerDatabase', () => { }); it('passes the a11y audit', async () => { - await expect(element).to.be.accessible({ - ignoredRules: ['color-contrast'], - }); + await expect(element).to.be.accessible(defaultA11yConfig); }); }); @@ -105,6 +102,6 @@ describe('UmbInstallerInstalling', () => { }); it('passes the a11y audit', async () => { - await expect(element).shadowDom.to.be.accessible(); + await expect(element).to.be.accessible(defaultA11yConfig); }); }); diff --git a/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts b/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts index 99b53c12f2..6a4794bf2f 100644 --- a/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts +++ b/src/Umbraco.Web.UI.Client/src/upgrader/upgrader-view.test.ts @@ -1,5 +1,6 @@ import { expect, fixture, html } from '@open-wc/testing'; +import { defaultA11yConfig } from '../core/helpers/chai'; import { UmbUpgraderView } from './upgrader-view.element'; describe('UmbUpgraderView', () => { @@ -14,8 +15,6 @@ describe('UmbUpgraderView', () => { }); it('passes the a11y audit', async () => { - await expect(element).to.be.accessible({ - ignoredRules: ['color-contrast'], - }); + await expect(element).to.be.accessible(defaultA11yConfig); }); }); From 84493beee348d2b98bccabd74d59d3caca718de2 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 16:53:05 +0200 Subject: [PATCH 11/19] add lcov and text-summary as coverage reporters --- src/Umbraco.Web.UI.Client/web-test-runner.config.mjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/web-test-runner.config.mjs b/src/Umbraco.Web.UI.Client/web-test-runner.config.mjs index 7e846d09ed..0550ab6e94 100644 --- a/src/Umbraco.Web.UI.Client/web-test-runner.config.mjs +++ b/src/Umbraco.Web.UI.Client/web-test-runner.config.mjs @@ -10,6 +10,9 @@ export default { playwrightLauncher({ product: 'firefox' }), playwrightLauncher({ product: 'webkit' }), ], + coverageConfig: { + reporters: ['lcov', 'text-summary'], + }, testRunnerHtml: (testFramework) => ` From 2c74227d11ad891c5307d2e66dcc2848553a5e0f Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 16:53:13 +0200 Subject: [PATCH 12/19] add coverage report upload to github --- .../.github/workflows/build_test.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml b/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml index 23e2c23745..a68bf75be5 100644 --- a/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml +++ b/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml @@ -33,3 +33,17 @@ jobs: - run: npm run build - run: sudo npx playwright install-deps - run: npm test + - name: Report code coverage + uses: zgosalvez/github-actions-report-lcov@v1 + with: + coverage-files: coverage/lcov.*.info + minimum-coverage: 90 + artifact-name: code-coverage-report + github-token: ${{ secrets.GITHUB_TOKEN }} + working-directory: apps/my-first-app + - uses: actions/upload-artifact@v2 + if: always() + with: + name: coverage-report + path: coverage/lcov-report/ + retention-days: 30 From 16532754e62704a2976c7229e3ad6b29d3814058 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 17:06:29 +0200 Subject: [PATCH 13/19] remove working-directory --- src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml b/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml index a68bf75be5..6b6f59e820 100644 --- a/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml +++ b/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml @@ -40,7 +40,6 @@ jobs: minimum-coverage: 90 artifact-name: code-coverage-report github-token: ${{ secrets.GITHUB_TOKEN }} - working-directory: apps/my-first-app - uses: actions/upload-artifact@v2 if: always() with: From ed001d9685ebd633e951f0740d0a6d68a49b09c9 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 17:14:44 +0200 Subject: [PATCH 14/19] update action with working dir --- src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml b/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml index 6b6f59e820..43d3ac1427 100644 --- a/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml +++ b/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml @@ -36,13 +36,14 @@ jobs: - name: Report code coverage uses: zgosalvez/github-actions-report-lcov@v1 with: - coverage-files: coverage/lcov.*.info + coverage-files: coverage/lcov.info minimum-coverage: 90 artifact-name: code-coverage-report github-token: ${{ secrets.GITHUB_TOKEN }} + working-directory: ./src - uses: actions/upload-artifact@v2 if: always() with: - name: coverage-report + name: coverage-report-html path: coverage/lcov-report/ retention-days: 30 From 0455a8f4573c1a7e8324d467586c56a8976f5bd6 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 17:15:10 +0200 Subject: [PATCH 15/19] set working dir to root --- src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml b/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml index 43d3ac1427..8912390c8c 100644 --- a/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml +++ b/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml @@ -40,7 +40,7 @@ jobs: minimum-coverage: 90 artifact-name: code-coverage-report github-token: ${{ secrets.GITHUB_TOKEN }} - working-directory: ./src + working-directory: ./ - uses: actions/upload-artifact@v2 if: always() with: From 1b43d899d3700aad68702d2762d6316db3cace3b Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 17:15:37 +0200 Subject: [PATCH 16/19] remove minimum coverage --- src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml b/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml index 8912390c8c..b22b915670 100644 --- a/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml +++ b/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml @@ -37,7 +37,6 @@ jobs: uses: zgosalvez/github-actions-report-lcov@v1 with: coverage-files: coverage/lcov.info - minimum-coverage: 90 artifact-name: code-coverage-report github-token: ${{ secrets.GITHUB_TOKEN }} working-directory: ./ From 03802f0e15760cda0610892070c49da7299a1198 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 17:19:30 +0200 Subject: [PATCH 17/19] rearrange jobs --- .../.github/workflows/build_test.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml b/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml index b22b915670..6c9a7f7d86 100644 --- a/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml +++ b/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml @@ -33,6 +33,13 @@ jobs: - run: npm run build - run: sudo npx playwright install-deps - run: npm test + - name: Upload Code Coverage reports + uses: actions/upload-artifact@v2 + if: always() + with: + name: code-coverage + path: coverage/ + retention-days: 30 - name: Report code coverage uses: zgosalvez/github-actions-report-lcov@v1 with: @@ -40,9 +47,3 @@ jobs: artifact-name: code-coverage-report github-token: ${{ secrets.GITHUB_TOKEN }} working-directory: ./ - - uses: actions/upload-artifact@v2 - if: always() - with: - name: coverage-report-html - path: coverage/lcov-report/ - retention-days: 30 From 788d2c1e5c4e0a4664fa6050431c53146d1e8eb1 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 17:25:41 +0200 Subject: [PATCH 18/19] [skip ci] uncomment report --- .../.github/workflows/build_test.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml b/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml index 6c9a7f7d86..f7b3170890 100644 --- a/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml +++ b/src/Umbraco.Web.UI.Client/.github/workflows/build_test.yml @@ -33,13 +33,14 @@ jobs: - run: npm run build - run: sudo npx playwright install-deps - run: npm test - - name: Upload Code Coverage reports - uses: actions/upload-artifact@v2 - if: always() - with: - name: code-coverage - path: coverage/ - retention-days: 30 + # Uncommented since the github-actions-report-lcov also generates a html report + # - name: Upload Code Coverage reports + # uses: actions/upload-artifact@v2 + # if: always() + # with: + # name: code-coverage + # path: coverage/ + # retention-days: 30 - name: Report code coverage uses: zgosalvez/github-actions-report-lcov@v1 with: From 18a73aefbccbee6b3435231b8cf35a59e05443cb Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 9 Aug 2022 17:30:07 +0200 Subject: [PATCH 19/19] make sure web-test-runner does not waste time with a html report since its now handled in a github action --- src/Umbraco.Web.UI.Client/web-test-runner.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/web-test-runner.config.mjs b/src/Umbraco.Web.UI.Client/web-test-runner.config.mjs index 0550ab6e94..60f72b3883 100644 --- a/src/Umbraco.Web.UI.Client/web-test-runner.config.mjs +++ b/src/Umbraco.Web.UI.Client/web-test-runner.config.mjs @@ -11,7 +11,7 @@ export default { playwrightLauncher({ product: 'webkit' }), ], coverageConfig: { - reporters: ['lcov', 'text-summary'], + reporters: ['lcovonly', 'text-summary'], }, testRunnerHtml: (testFramework) => `