diff --git a/.github/workflows/tests-ci.yml b/.github/workflows/tests-ci.yml index e13c4cb15..3bf4a3179 100644 --- a/.github/workflows/tests-ci.yml +++ b/.github/workflows/tests-ci.yml @@ -85,12 +85,17 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} test-with-browsers: - name: test-with-browsers (${{ matrix.browser }}) + name: test-with-browsers (group ${{ matrix.group }}) # Run browser tests using macOS so that WebKit tests don't fail under a Linux environment runs-on: macos-latest strategy: + # parallelism strategy: agent takes as long as roughly all other pkgs combined. matrix: - browser: ['--group chromium', ' --group firefox', '--group webkit'] + include: + - group: "A" + packages: "--workspace packages/agent --workspace packages/dids " + - group: "B" + packages: "--workspace packages/common --workspace packages/crypto --workspace packages/credentials --workspace packages/user-agent --workspace packages/proxy-agent --workspace packages/api --workspace packages/identity-agent" steps: - name: Checkout source uses: actions/checkout@v4 @@ -134,16 +139,16 @@ jobs: - name: Build esm run: npm run build:esm --ws - - name: Build browser bundles - run: npm run build:browser --ws + - name: Build browser for matrix ${{ matrix.group }} + run: npm run build:browser ${{ matrix.packages }} - name: Run dwn-server (background) run: | node node_modules/@web5/dwn-server/dist/esm/src/main.js & echo "DWN_SERVER_BACKGROUND_PROCESS=$!" >> $GITHUB_ENV - - name: Run tests for matrix ${{ matrix.browser }} - run: npm run test:browser --ws -- ${{ matrix.browser }} + - name: Run tests for matrix ${{ matrix.group }} + run: npm run test:browser ${{ matrix.packages }} - name: Terminate dwn-server run: kill $DWN_SERVER_BACKGROUND_PROCESS || true diff --git a/packages/agent/web-test-runner.config.cjs b/packages/agent/web-test-runner.config.cjs index 47bdd14e3..1e3a26457 100644 --- a/packages/agent/web-test-runner.config.cjs +++ b/packages/agent/web-test-runner.config.cjs @@ -6,8 +6,20 @@ const playwrightLauncher = * @type {import('@web/test-runner').TestRunnerConfig} */ module.exports = { - playwright : true, - nodeResolve : true, + files : 'tests/compiled/**/*.spec.js', + playwright : true, + nodeResolve : true, + browsers : [ + playwrightLauncher({ + product: 'chromium', + }), + playwrightLauncher({ + product: 'firefox', + }), + playwrightLauncher({ + product: 'webkit', + }), + ], testsFinishTimeout : 300000, concurrentBrowsers : 2, testFramework : { @@ -15,33 +27,4 @@ module.exports = { timeout: '30000', }, }, - groups: [ - { - name : 'chromium', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'chromium', - }), - ], - }, - { - name : 'firefox', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'firefox', - }), - ], - }, - { - name : 'webkit', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'webkit', - }), - ], - }, - ], }; diff --git a/packages/api/web-test-runner.config.cjs b/packages/api/web-test-runner.config.cjs index 0837bf14c..e5adb980d 100644 --- a/packages/api/web-test-runner.config.cjs +++ b/packages/api/web-test-runner.config.cjs @@ -6,8 +6,20 @@ const playwrightLauncher = * @type {import('@web/test-runner').TestRunnerConfig} */ module.exports = { - playwright : true, - nodeResolve : true, + files : 'tests/compiled/**/*.spec.js', + playwright : true, + nodeResolve : true, + browsers : [ + playwrightLauncher({ + product: 'chromium', + }), + playwrightLauncher({ + product: 'firefox', + }), + playwrightLauncher({ + product: 'webkit', + }), + ], testsFinishTimeout : 300000, concurrentBrowsers : 2, testFramework : { @@ -15,33 +27,4 @@ module.exports = { timeout: '15000', }, }, - groups: [ - { - name : 'chromium', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'chromium', - }), - ], - }, - { - name : 'firefox', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'firefox', - }), - ], - }, - { - name : 'webkit', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'webkit', - }), - ], - }, - ], }; diff --git a/packages/common/web-test-runner.config.cjs b/packages/common/web-test-runner.config.cjs index 0837bf14c..e5adb980d 100644 --- a/packages/common/web-test-runner.config.cjs +++ b/packages/common/web-test-runner.config.cjs @@ -6,8 +6,20 @@ const playwrightLauncher = * @type {import('@web/test-runner').TestRunnerConfig} */ module.exports = { - playwright : true, - nodeResolve : true, + files : 'tests/compiled/**/*.spec.js', + playwright : true, + nodeResolve : true, + browsers : [ + playwrightLauncher({ + product: 'chromium', + }), + playwrightLauncher({ + product: 'firefox', + }), + playwrightLauncher({ + product: 'webkit', + }), + ], testsFinishTimeout : 300000, concurrentBrowsers : 2, testFramework : { @@ -15,33 +27,4 @@ module.exports = { timeout: '15000', }, }, - groups: [ - { - name : 'chromium', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'chromium', - }), - ], - }, - { - name : 'firefox', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'firefox', - }), - ], - }, - { - name : 'webkit', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'webkit', - }), - ], - }, - ], }; diff --git a/packages/credentials/web-test-runner.config.cjs b/packages/credentials/web-test-runner.config.cjs index 0837bf14c..e5adb980d 100644 --- a/packages/credentials/web-test-runner.config.cjs +++ b/packages/credentials/web-test-runner.config.cjs @@ -6,8 +6,20 @@ const playwrightLauncher = * @type {import('@web/test-runner').TestRunnerConfig} */ module.exports = { - playwright : true, - nodeResolve : true, + files : 'tests/compiled/**/*.spec.js', + playwright : true, + nodeResolve : true, + browsers : [ + playwrightLauncher({ + product: 'chromium', + }), + playwrightLauncher({ + product: 'firefox', + }), + playwrightLauncher({ + product: 'webkit', + }), + ], testsFinishTimeout : 300000, concurrentBrowsers : 2, testFramework : { @@ -15,33 +27,4 @@ module.exports = { timeout: '15000', }, }, - groups: [ - { - name : 'chromium', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'chromium', - }), - ], - }, - { - name : 'firefox', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'firefox', - }), - ], - }, - { - name : 'webkit', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'webkit', - }), - ], - }, - ], }; diff --git a/packages/crypto/web-test-runner.config.cjs b/packages/crypto/web-test-runner.config.cjs index 0837bf14c..e5adb980d 100644 --- a/packages/crypto/web-test-runner.config.cjs +++ b/packages/crypto/web-test-runner.config.cjs @@ -6,8 +6,20 @@ const playwrightLauncher = * @type {import('@web/test-runner').TestRunnerConfig} */ module.exports = { - playwright : true, - nodeResolve : true, + files : 'tests/compiled/**/*.spec.js', + playwright : true, + nodeResolve : true, + browsers : [ + playwrightLauncher({ + product: 'chromium', + }), + playwrightLauncher({ + product: 'firefox', + }), + playwrightLauncher({ + product: 'webkit', + }), + ], testsFinishTimeout : 300000, concurrentBrowsers : 2, testFramework : { @@ -15,33 +27,4 @@ module.exports = { timeout: '15000', }, }, - groups: [ - { - name : 'chromium', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'chromium', - }), - ], - }, - { - name : 'firefox', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'firefox', - }), - ], - }, - { - name : 'webkit', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'webkit', - }), - ], - }, - ], }; diff --git a/packages/dids/web-test-runner.config.cjs b/packages/dids/web-test-runner.config.cjs index 0837bf14c..e5adb980d 100644 --- a/packages/dids/web-test-runner.config.cjs +++ b/packages/dids/web-test-runner.config.cjs @@ -6,8 +6,20 @@ const playwrightLauncher = * @type {import('@web/test-runner').TestRunnerConfig} */ module.exports = { - playwright : true, - nodeResolve : true, + files : 'tests/compiled/**/*.spec.js', + playwright : true, + nodeResolve : true, + browsers : [ + playwrightLauncher({ + product: 'chromium', + }), + playwrightLauncher({ + product: 'firefox', + }), + playwrightLauncher({ + product: 'webkit', + }), + ], testsFinishTimeout : 300000, concurrentBrowsers : 2, testFramework : { @@ -15,33 +27,4 @@ module.exports = { timeout: '15000', }, }, - groups: [ - { - name : 'chromium', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'chromium', - }), - ], - }, - { - name : 'firefox', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'firefox', - }), - ], - }, - { - name : 'webkit', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'webkit', - }), - ], - }, - ], }; diff --git a/packages/identity-agent/web-test-runner.config.cjs b/packages/identity-agent/web-test-runner.config.cjs index 0837bf14c..e5adb980d 100644 --- a/packages/identity-agent/web-test-runner.config.cjs +++ b/packages/identity-agent/web-test-runner.config.cjs @@ -6,8 +6,20 @@ const playwrightLauncher = * @type {import('@web/test-runner').TestRunnerConfig} */ module.exports = { - playwright : true, - nodeResolve : true, + files : 'tests/compiled/**/*.spec.js', + playwright : true, + nodeResolve : true, + browsers : [ + playwrightLauncher({ + product: 'chromium', + }), + playwrightLauncher({ + product: 'firefox', + }), + playwrightLauncher({ + product: 'webkit', + }), + ], testsFinishTimeout : 300000, concurrentBrowsers : 2, testFramework : { @@ -15,33 +27,4 @@ module.exports = { timeout: '15000', }, }, - groups: [ - { - name : 'chromium', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'chromium', - }), - ], - }, - { - name : 'firefox', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'firefox', - }), - ], - }, - { - name : 'webkit', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'webkit', - }), - ], - }, - ], }; diff --git a/packages/proxy-agent/web-test-runner.config.cjs b/packages/proxy-agent/web-test-runner.config.cjs index 0837bf14c..e5adb980d 100644 --- a/packages/proxy-agent/web-test-runner.config.cjs +++ b/packages/proxy-agent/web-test-runner.config.cjs @@ -6,8 +6,20 @@ const playwrightLauncher = * @type {import('@web/test-runner').TestRunnerConfig} */ module.exports = { - playwright : true, - nodeResolve : true, + files : 'tests/compiled/**/*.spec.js', + playwright : true, + nodeResolve : true, + browsers : [ + playwrightLauncher({ + product: 'chromium', + }), + playwrightLauncher({ + product: 'firefox', + }), + playwrightLauncher({ + product: 'webkit', + }), + ], testsFinishTimeout : 300000, concurrentBrowsers : 2, testFramework : { @@ -15,33 +27,4 @@ module.exports = { timeout: '15000', }, }, - groups: [ - { - name : 'chromium', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'chromium', - }), - ], - }, - { - name : 'firefox', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'firefox', - }), - ], - }, - { - name : 'webkit', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'webkit', - }), - ], - }, - ], }; diff --git a/packages/user-agent/web-test-runner.config.cjs b/packages/user-agent/web-test-runner.config.cjs index 0837bf14c..e5adb980d 100644 --- a/packages/user-agent/web-test-runner.config.cjs +++ b/packages/user-agent/web-test-runner.config.cjs @@ -6,8 +6,20 @@ const playwrightLauncher = * @type {import('@web/test-runner').TestRunnerConfig} */ module.exports = { - playwright : true, - nodeResolve : true, + files : 'tests/compiled/**/*.spec.js', + playwright : true, + nodeResolve : true, + browsers : [ + playwrightLauncher({ + product: 'chromium', + }), + playwrightLauncher({ + product: 'firefox', + }), + playwrightLauncher({ + product: 'webkit', + }), + ], testsFinishTimeout : 300000, concurrentBrowsers : 2, testFramework : { @@ -15,33 +27,4 @@ module.exports = { timeout: '15000', }, }, - groups: [ - { - name : 'chromium', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'chromium', - }), - ], - }, - { - name : 'firefox', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'firefox', - }), - ], - }, - { - name : 'webkit', - files : 'tests/compiled/**/*.spec.js', - browsers : [ - playwrightLauncher({ - product: 'webkit', - }), - ], - }, - ], };