From a5569198eec7d6d11d8447e177518f9124b97f51 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Wed, 15 May 2024 15:19:23 -0400 Subject: [PATCH 1/2] Tests: remove code supporting jenkins and testswarm Closes gh-2256 --- Gruntfile.js | 1 - package.json | 1 - tests/lib/bootstrap.js | 9 +-------- tests/unit/datepicker/options.js | 8 -------- tests/unit/draggable/options.js | 15 +++++---------- tests/unit/position/core.js | 3 --- 6 files changed, 6 insertions(+), 31 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index d6707becad..174db85cd0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -511,7 +511,6 @@ grunt.registerTask( "lint", [ ] ); grunt.registerTask( "build", [ "requirejs", "concat" ] ); grunt.registerTask( "default", [ "lint", "build" ] ); -grunt.registerTask( "jenkins", [ "build" ] ); grunt.registerTask( "sizer", [ "requirejs:js", "uglify:main", "compare_size:all" ] ); grunt.registerTask( "sizer_all", [ "requirejs:js", "uglify", "compare_size" ] ); diff --git a/package.json b/package.json index 081eb81d1d..926a1ce6e9 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,6 @@ "load-grunt-tasks": "5.1.0", "rimraf": "4.4.1", "selenium-webdriver": "4.18.1", - "testswarm": "1.1.2", "yargs": "17.7.2" }, "keywords": [] diff --git a/tests/lib/bootstrap.js b/tests/lib/bootstrap.js index fd9b1eb654..acc79d3791 100644 --- a/tests/lib/bootstrap.js +++ b/tests/lib/bootstrap.js @@ -14,14 +14,12 @@ requirejs.config( { "qunit-assert-classes": "../../lib/vendor/qunit-assert-classes/qunit-assert-classes", "qunit-assert-close": "../../lib/vendor/qunit-assert-close/qunit-assert-close", "qunit": "../../../external/qunit/qunit", - "testswarm": "https://swarm.jquery.org/js/inject.js?" + ( new Date() ).getTime(), "ui": "../../../ui" }, shim: { "globalize/ja-JP": [ "globalize" ], "jquery-simulate": [ "jquery" ], - "qunit-assert-close": [ "qunit" ], - "testswarm": [ "qunit" ] + "qunit-assert-close": [ "qunit" ] } } ); @@ -67,11 +65,6 @@ function requireTests( dependencies, noBackCompat ) { dependencies = preDependencies.concat( dependencies ); - // Load the TestSwarm injector, if necessary - if ( parseUrl().swarmURL ) { - dependencies.push( "testswarm" ); - } - requireModules( dependencies, function( QUnit ) { QUnit.start(); } ); diff --git a/tests/unit/datepicker/options.js b/tests/unit/datepicker/options.js index bf2fccc1f0..6615f2351e 100644 --- a/tests/unit/datepicker/options.js +++ b/tests/unit/datepicker/options.js @@ -98,14 +98,6 @@ QUnit.test( "change", function( assert ) { } ); ( function() { - var url = window.location.search; - url = decodeURIComponent( url.slice( url.indexOf( "swarmURL=" ) + 9 ) ); - - // TODO: This test occassionally fails in IE in TestSwarm - if ( $.ui.ie && url && url.indexOf( "http" ) === 0 ) { - return; - } - QUnit.test( "invocation", function( assert ) { var ready = assert.async(); var button, image, diff --git a/tests/unit/draggable/options.js b/tests/unit/draggable/options.js index c98c9f9d81..129c23692b 100644 --- a/tests/unit/draggable/options.js +++ b/tests/unit/draggable/options.js @@ -1173,9 +1173,7 @@ QUnit.test( "#6817: auto scroll goes double distance when dragging", function( a scroll: true, stop: function( e, ui ) { assert.equal( ui.offset.top, newY, "offset of item matches pointer position after scroll" ); - - // TODO: fix IE8 testswarm IFRAME positioning bug so assert.close can be turned back to equal - assert.close( ui.offset.top - offsetBefore.top, distance, 1, "offset of item only moves expected distance after scroll" ); + assert.equal( ui.offset.top - offsetBefore.top, distance, 1, "offset of item only moves expected distance after scroll" ); } } ), scrollSensitivity = element.draggable( "option", "scrollSensitivity" ), @@ -1231,9 +1229,8 @@ QUnit.test( "snap, snapMode, and snapTolerance", function( assert ) { moves: 1 } ); - // TODO: fix IE8 testswarm IFRAME positioning bug so assert.close can be turned back to equal - assert.close( element.offset().left, newX, 1, "doesn't snap outside the snapTolerance" ); - assert.close( element.offset().top, newY, 1, "doesn't snap outside the snapTolerance" ); + assert.equal( element.offset().left, newX, 1, "doesn't snap outside the snapTolerance" ); + assert.equal( element.offset().top, newY, 1, "doesn't snap outside the snapTolerance" ); newX += 3; @@ -1362,10 +1359,8 @@ QUnit.test( "#8459: element can snap to an element that was removed during drag" assert.ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" ); assert.ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" ); } else { - - // TODO: fix IE8 testswarm IFRAME positioning bug so assert.close can be turned back to equal - assert.close( element.offset().left, newX, 1, "doesn't snap to a removed element" ); - assert.close( element.offset().top, newY, 1, "doesn't snap to a removed element" ); + assert.equal( element.offset().left, newX, 1, "doesn't snap to a removed element" ); + assert.equal( element.offset().top, newY, 1, "doesn't snap to a removed element" ); } } ); diff --git a/tests/unit/position/core.js b/tests/unit/position/core.js index 9483e716de..ae016f34c3 100644 --- a/tests/unit/position/core.js +++ b/tests/unit/position/core.js @@ -396,8 +396,6 @@ QUnit.test( "collision: fit, no collision", function( assert ) { }, "with offset" ); } ); -// Currently failing in IE8 due to the iframe used by TestSwarm -if ( !/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ) ) { QUnit.test( "collision: fit, collision", function( assert ) { assert.expect( 2 + ( scrollTopSupport() ? 1 : 0 ) ); @@ -428,7 +426,6 @@ QUnit.test( "collision: fit, collision", function( assert ) { win.scrollTop( 0 ).scrollLeft( 0 ); } } ); -} QUnit.test( "collision: flip, no collision", function( assert ) { assert.expect( 2 ); From 16fafc1233b70c5c705d9e5832680815288c638a Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Sun, 2 Jun 2024 11:48:01 -0400 Subject: [PATCH 2/2] Tests: add dispatchable workflow for running tests in all supported browsers - reduce max worker restarts to avoid extra long runs Closes gh-2256 --- .github/workflows/browserstack.yml | 73 ++++++++++++++++++++++++++++++ tests/runner/browsers.js | 4 +- tests/runner/run.js | 2 +- 3 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/browserstack.yml diff --git a/.github/workflows/browserstack.yml b/.github/workflows/browserstack.yml new file mode 100644 index 0000000000..6dcc7528f7 --- /dev/null +++ b/.github/workflows/browserstack.yml @@ -0,0 +1,73 @@ +name: Browserstack + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + environment: browserstack + env: + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} + BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} + NODE_VERSION: 20.x + name: | + ${{ matrix.BROWSER }} | ${{ matrix.JQUERYS.name }} + concurrency: + group: ${{ matrix.BROWSER }}-${{ matrix.JQUERYS.name }} + strategy: + fail-fast: false + matrix: + BROWSER: + - 'Chrome_latest' + - 'Chrome_latest-1' + - 'Edge_18' + - 'Edge_latest' + - 'Edge_latest-1' + - 'Firefox_latest' + - 'Firefox_latest-1' + - 'IE_11' + - 'Opera_latest' + - 'Opera_latest-1' + - 'Safari_latest' + - 'Safari_latest-1' + JQUERYS: + - versions: --jquery 3.x-git --jquery git + name: jQuery git + - versions: --jquery 3.7.1 --jquery 3.6.4 --jquery 3.5.1 --jquery 3.4.1 --jquery 3.3.1 --jquery 3.2.1 --jquery 3.1.1 --jquery 3.0.0 + name: jQuery 3.x + - versions: --jquery 2.2.4 --jquery 2.1.4 --jquery 2.0.3 + name: jQuery 2.x + - versions: --jquery 1.12.4 --jquery 1.11.3 --jquery 1.10.2 --jquery 1.9.1 --jquery 1.8.3 + name: jQuery 1.x + + steps: + - name: Checkout + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Cache + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock- + + - name: Install dependencies + run: npm install + + - name: Build jQuery UI + run: npm run build + + - name: Run tests + run: | + npm run test:unit -- -v \ + --browserstack "${{ matrix.BROWSER }}" \ + ${{ matrix.JQUERYS.versions }} \ + --run-id ${{ github.run_id }} \ + --retries 3 --hard-retries 1 diff --git a/tests/runner/browsers.js b/tests/runner/browsers.js index 1ddccdf785..5b55142e21 100644 --- a/tests/runner/browsers.js +++ b/tests/runner/browsers.js @@ -29,7 +29,7 @@ const workers = Object.create( null ); const ACKNOWLEDGE_INTERVAL = 1000; const ACKNOWLEDGE_TIMEOUT = 60 * 1000 * 5; -const MAX_WORKER_RESTARTS = 5; +const MAX_WORKER_RESTARTS = 3; // No report after the time limit // should refresh the worker @@ -64,7 +64,7 @@ export async function createBrowserWorker( url, browser, options, restarts = 0 ) worker = await createWorker( { ...browser, url: encodeURI( url ), - project: "jquery", + project: "jquery-ui", build: `Run ${ runId }`, // This is the maximum timeout allowed diff --git a/tests/runner/run.js b/tests/runner/run.js index 9c4f8d479b..dbb6c7dc80 100644 --- a/tests/runner/run.js +++ b/tests/runner/run.js @@ -277,7 +277,7 @@ export async function run( { for ( const browser of browsers ) { for ( const suite of suites ) { - queueRuns( [ suite ], browser ); + queueRuns( suite, browser ); } }