🌐 AI搜索 & 代理 主页
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c59d266
Tests: run tests locally with selenium
timmywil Dec 29, 2023
ac4238a
Tests: add github workflow for browserstack
timmywil Jan 27, 2024
569f092
Tests: remove grunt, karma, testswarm, and playwright-webkit
timmywil Feb 10, 2024
c3c385b
Docs: add testing notes to CONTRIBUTING.md
timmywil Feb 14, 2024
a393b14
Build: upgrade all packages except sinon
timmywil Feb 14, 2024
e1ba019
Tests: upgrade QUnit to 2.20.1 and re-enable IE11
timmywil Feb 16, 2024
7c9cad3
Tests: make minor version optional in browser matching
timmywil Feb 16, 2024
ba5a847
Tests: enable non-concurrent BrowserStack workflow on the main branch
timmywil Feb 16, 2024
c029790
fixup! address codeql alerts relevant to this PR
timmywil Feb 16, 2024
ea880a4
fixup! sort browsers by device version last
timmywil Feb 22, 2024
59f3d64
fixup! downgrade husky and rollup and run build on Node 10
timmywil Feb 23, 2024
0a6c3c8
fixup! patch upgrades; make test commands consistent
timmywil Feb 23, 2024
0005d3a
fixup! remove location.origin; use absolute URLs instead
timmywil Feb 23, 2024
2733595
fixup! do a browserstack run
timmywil Feb 23, 2024
65493fa
fixup! split up comment
timmywil Feb 23, 2024
5c6351f
fixup! clarify comment
timmywil Feb 23, 2024
c97ae71
fixup! fix concurrency group name
timmywil Feb 23, 2024
63d848f
fixup! add empty line
timmywil Feb 23, 2024
53534a8
fixup! more PR feedback
timmywil Feb 23, 2024
808cd7c
fixup! we hit a hash collision; use our own hashing for all but moduleId
timmywil Feb 24, 2024
303cd14
fixup! add stop-workers warning
timmywil Feb 24, 2024
47d2a06
fixup! edit browser range
timmywil Feb 24, 2024
4b49601
fixup! call derez
timmywil Feb 24, 2024
d32595e
fixup! more PR feedback
timmywil Feb 24, 2024
95a18fe
fixup! fix local runId
timmywil Feb 24, 2024
abebb78
fixup! add back parentUrl, but use protocol/host; remove mentions of …
timmywil Feb 24, 2024
5253ab9
fixup! try enabling the crossorigin attr test in browserstack
timmywil Feb 24, 2024
280fb6e
fixup! use readable test names; still include each report ID
timmywil Feb 24, 2024
fe9c314
fixup! increase acknowledge timeout for the sake of iOS 15
timmywil Feb 24, 2024
71a09e9
Revert "fixup! try enabling the crossorigin attr test in browserstack"
timmywil Feb 24, 2024
8f6c44e
fixup! fix retries by passing original options
timmywil Feb 24, 2024
8c486f9
fixup! set browserstack branch back to main
timmywil Feb 24, 2024
3d9f544
fixup! use Object.create in listeners
timmywil Feb 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! address codeql alerts relevant to this PR
  • Loading branch information
timmywil committed Feb 16, 2024
commit c0297908223d1d305bc820e2b8fd02c06cd8f9cd
10 changes: 5 additions & 5 deletions test/data/testinit.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* eslint no-multi-str: "off" */
"use strict";

var parentUrl = window.location.href.replace( /\/test\/.*$/, "/" ),
var parentUrl = window.location.origin,

// baseURL is intentionally set to "data/" instead of "".
// This is not just for convenience (since most files are in data/)
// but also to ensure that urls without prefix fail.
baseURL = parentUrl + "test/data/",
baseURL = parentUrl + "/test/data/",
supportjQuery = this.jQuery,

// NOTE: keep it in sync with build/tasks/lib/slim-exclude.js
Expand Down Expand Up @@ -365,15 +365,15 @@ this.loadTests = function() {

// Directly load tests that need evaluation before DOMContentLoaded.
if ( !jsdom && ( !esmodules || document.readyState === "loading" ) ) {
document.write( "<script src='" + parentUrl + "test/unit/ready.js'><\x2Fscript>" );
document.write( "<script src='" + parentUrl + "/test/unit/ready.js'><\x2Fscript>" );
} else {
QUnit.module( "ready", function() {
QUnit.skip( "jQuery ready tests skipped in async mode", function() {} );
} );
}

// Get testSubproject from testrunner first
require( [ parentUrl + "test/data/testrunner.js" ], function() {
require( [ parentUrl + "/test/data/testrunner.js" ], function() {

// Says whether jQuery positional selector extensions are supported.
// A full selector engine is required to support them as they need to
Expand Down Expand Up @@ -423,7 +423,7 @@ this.loadTests = function() {

if ( dep ) {
if ( !QUnit.basicTests || i === 1 ) {
require( [ parentUrl + "test/" + dep ], loadDep );
require( [ parentUrl + "/test/" + dep ], loadDep );

// When running basic tests, replace other modules with dummies to avoid overloading
// impaired clients.
Expand Down
6 changes: 3 additions & 3 deletions test/jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* global loadTests: false */

var dynamicImportSource, config, src,
parentUrl = window.location.href.replace( /\/test\/.*$/, "/" ),
parentUrl = window.location.origin,
QUnit = window.QUnit;

function getQUnitConfig() {
Expand Down Expand Up @@ -53,7 +53,7 @@
// IE doesn't support the dynamic import syntax so it would crash
// with a SyntaxError here.
dynamicImportSource = "" +
"import( `${ parentUrl }src/jquery.js` )\n" +
"import( `${ parentUrl }/src/jquery.js` )\n" +
" .then( ( { jQuery } ) => {\n" +
" window.jQuery = jQuery;\n" +
" if ( typeof loadTests === \"function\" ) {\n" +
Expand All @@ -70,7 +70,7 @@

// Otherwise, load synchronously
} else {
document.write( "<script id='jquery-js' nonce='jquery+hardcoded+nonce' src='" + parentUrl + src + "'><\x2Fscript>" );
document.write( "<script id='jquery-js' nonce='jquery+hardcoded+nonce' src='" + parentUrl + "/" + src + "'><\x2Fscript>" );
}

} )();
32 changes: 19 additions & 13 deletions test/runner/browserstack/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ async function fetchAPI( path, options = {}, versioned = true ) {
init
);
if ( !response.ok ) {
console.log( `\n${ init.method } ${ path }`, response.status, response.statusText );
console.log(
`\n${ init.method } ${ path }`,
response.status,
response.statusText
);
throw new Error( `Error fetching ${ path }` );
}
return response.json();
Expand Down Expand Up @@ -88,7 +92,10 @@ function sortBrowsers( a, b ) {
if ( a.browser > b.browser ) {
return 1;
}
const browserComparison = compareVersionNumbers( a.browser_version, b.browser_version );
const browserComparison = compareVersionNumbers(
a.browser_version,
b.browser_version
);
if ( browserComparison ) {
return browserComparison;
}
Expand Down Expand Up @@ -122,7 +129,10 @@ function matchVersion( browserVersion, version ) {
if ( !version ) {
return false;
}
const regex = new RegExp( `^${ version.replace( /\./g, "\\." ) }\\b`, "i" );
const regex = new RegExp(
`^${ version.replace( /\\/g, "\\\\" ).replace( /\./g, "\\." ) }\\b`,
"i"
);
return regex.test( browserVersion );
}

Expand All @@ -140,9 +150,11 @@ export async function filterBrowsers( filter ) {
return browsers.filter( ( browser ) => {
return (
( !filterBrowser || filterBrowser === browser.browser.toLowerCase() ) &&
( !filterVersion || matchVersion( browser.browser_version, filterVersion ) ) &&
( !filterVersion ||
matchVersion( browser.browser_version, filterVersion ) ) &&
( !filterOs || filterOs === browser.os.toLowerCase() ) &&
( !filterOsVersion || filterOsVersion === browser.os_version.toLowerCase() ) &&
( !filterOsVersion ||
filterOsVersion === browser.os_version.toLowerCase() ) &&
( !filterDevice || filterDevice === ( browser.device || "" ).toLowerCase() )
);
} );
Expand Down Expand Up @@ -269,12 +281,6 @@ export function getPlan() {
}

export async function getMaxSessions() {
const [ plan, workers ] = await Promise.all( [
getPlan(),
getWorkers()
] );
return (
plan.parallel_sessions_max_allowed -
workers.length
);
const [ plan, workers ] = await Promise.all( [ getPlan(), getWorkers() ] );
return plan.parallel_sessions_max_allowed - workers.length;
}
4 changes: 0 additions & 4 deletions test/runner/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ export async function run( {
}
break;
}
case "error": {
console.error( `Error in worker for test ${ message.id }`, message.data );
break;
}
default:
console.warn( "Received unknown message type:", message.type );
}
Expand Down