-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,263 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
import pageactions from './pageactions' | ||
|
||
export default async function () { | ||
await pageactions() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
export default async function () {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
|
||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>Test runner</title> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
</head> | ||
<body> | ||
<h1>Test runner</h1> | ||
|
||
<script type="module"> | ||
import { TestManager } from 'resource://app/modules/TestManager.sys.mjs' | ||
import 'resource://app/modules/tests/integrations/_index.sys.mjs' | ||
|
||
// @ts-check | ||
/// <reference types="@browser/link" /> | ||
console.log('start import') | ||
|
||
console.log('import int') | ||
|
||
console.log('call') | ||
TestManager.call() | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
// @ts-check | ||
/// <reference types="@browser/link" /> | ||
import { | ||
createTAPReporter, | ||
hold, | ||
report, | ||
test, | ||
} from 'resource://app/modules/zora.sys.mjs' | ||
|
||
const TEST_PORT = 3948 | ||
|
||
/** @typedef {import('resource://app/modules/TestManager.sys.mjs').TestManagerInterface} TestManagerInst */ | ||
|
||
/** @implements {TestManagerInst} */ | ||
class TestManagerSingleton { | ||
/** | ||
* @private | ||
* @type {import('resource://app/modules/TestManager.sys.mjs').Test[]} | ||
*/ | ||
tests = [] | ||
|
||
/** | ||
* @param {string} name | ||
* @param {import('resource://app/modules/TestManager.sys.mjs').BrowserTestFunction} spec | ||
* @param {import('resource://app/modules/zora.sys.mjs').ITestOptions} [options] | ||
*/ | ||
browserTest(name, spec, options) { | ||
this.tests.push({ name, spec, options }) | ||
} | ||
|
||
async call() { | ||
hold() | ||
|
||
console.log('Starting tests') | ||
let testIndex = 0 | ||
for (const { name, spec, options } of this.tests) { | ||
testIndex += 1 | ||
console.time(`test-${testIndex}`) | ||
/** @type {Window} */ | ||
// @ts-expect-error Incorrect type gen | ||
const window = Services.ww.openWindow( | ||
// @ts-expect-error Incorrect type generation | ||
null, | ||
Services.prefs.getStringPref('app.content'), | ||
'_blank', | ||
'chrome,dialog=no,all', | ||
undefined, | ||
) | ||
|
||
await new Promise((res) => | ||
window.addEventListener('DOMContentLoaded', res), | ||
) | ||
const testFn = spec(window) | ||
await test(name, testFn, options) | ||
window.close() | ||
console.time(`test-${testIndex}`) | ||
} | ||
|
||
let log = '' | ||
const reporter = createTAPReporter({ log: (s) => (log += s + '\n') }) | ||
await report({ reporter }) | ||
|
||
await fetch(`http://localhost:${TEST_PORT}/results`, { | ||
method: 'POST', | ||
body: log, | ||
}) | ||
} | ||
} | ||
|
||
export const TestManager = new TestManagerSingleton() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.