Developer-Dashboard
view release on metacpan or search on metacpan
t/22-api-dashboard-playwright.t view on Meta::CPAN
}
return $pid;
}
# _playwright_script()
# Purpose: return the embedded Node.js Playwright browser flow used by this Perl test.
# Input: none.
# Output: JavaScript source text string.
sub _playwright_script {
return <<'JAVASCRIPT';
const assert = require('assert');
const fs = require('fs');
const { chromium } = require(process.env.PLAYWRIGHT_DIR);
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function waitForFile(path, shouldExist) {
const deadline = Date.now() + 10000;
while (Date.now() < deadline) {
const exists = fs.existsSync(path);
if (!!exists === !!shouldExist) return;
t/23-api-dashboard-import-fixture-playwright.t view on Meta::CPAN
kill 'TERM', $args{pid} if kill 0, $args{pid};
waitpid( $args{pid}, 0 );
}
# _playwright_script()
# Purpose: return the embedded Node.js Playwright import flow used by this Perl test.
# Input: none.
# Output: JavaScript source text string.
sub _playwright_script {
return <<'JAVASCRIPT';
const fs = require('fs');
const { chromium } = require(process.env.PLAYWRIGHT_DIR);
async function waitForCollection(page, name, shouldExist) {
await page.waitForFunction(
({ collectionName, shouldExist: shouldHaveCollection }) => {
const names = Array.from(document.querySelectorAll('.api-collection-card h3')).map((node) => node.textContent.trim());
return shouldHaveCollection ? names.includes(collectionName) : !names.includes(collectionName);
},
{ collectionName: name, shouldExist }
);
}
t/24-api-dashboard-tabs-playwright.t view on Meta::CPAN
}
return $pid;
}
# _playwright_script()
# Purpose: return the embedded Node.js Playwright tab-layout flow used by this Perl test.
# Input: none.
# Output: JavaScript source text string.
sub _playwright_script {
return <<'JAVASCRIPT';
const { chromium } = require(process.env.PLAYWRIGHT_DIR);
async function main() {
const browser = await chromium.launch({
executablePath: process.env.CHROMIUM_BIN,
headless: true,
args: ['--no-sandbox', '--disable-dev-shm-usage'],
});
const consoleErrors = [];
t/25-api-dashboard-large-import-playwright.t view on Meta::CPAN
kill 'TERM', $args{pid} if kill 0, $args{pid};
waitpid( $args{pid}, 0 );
}
# _playwright_script()
# Purpose: return the embedded Node.js Playwright import flow used by this Perl test.
# Input: none.
# Output: JavaScript source text string.
sub _playwright_script {
return <<'JAVASCRIPT';
const fs = require('fs');
const { chromium } = require(process.env.PLAYWRIGHT_DIR);
async function waitForImportBanner(page, collectionName) {
await page.waitForFunction(
(name) => {
const banner = document.querySelector('#api-banner');
return !!(banner && banner.textContent.includes(`Imported Postman collection "${name}".`));
},
collectionName,
{ timeout: 30000 }
);
t/27-sql-dashboard-playwright.t view on Meta::CPAN
home => $home_root,
repo_lib => $repo_lib,
dashboard_bin => $dashboard_bin,
pid => $dashboard_pid,
) if $dashboard_pid;
done_testing;
sub _playwright_script {
return <<'JS';
const path = require('path');
const { chromium } = require(path.join(process.env.PLAYWRIGHT_DIR, 'index.js'));
async function main() {
const browser = await chromium.launch({
executablePath: process.env.CHROMIUM_BIN,
headless: true
});
const page = await browser.newPage();
const pageErrors = [];
const consoleMessages = [];
page.on('pageerror', (error) => {
t/31-sql-dashboard-sqlite-playwright.t view on Meta::CPAN
) if $dashboard_pid;
done_testing;
# _playwright_script()
# Purpose: build the Chromium Playwright regression script for the real SQLite browser matrix.
# Input: no arguments.
# Output: JavaScript source string that writes JSON case results to stdout.
sub _playwright_script {
return <<'JS';
const path = require('path');
const { chromium } = require(path.join(process.env.PLAYWRIGHT_DIR, 'index.js'));
async function main() {
const browser = await chromium.launch({
executablePath: process.env.CHROMIUM_BIN,
headless: true
});
const page = await browser.newPage();
const consoleMessages = [];
const pageErrors = [];
const cases = [];
t/32-sql-dashboard-rdbms-playwright.t view on Meta::CPAN
return 1;
}
# _playwright_script()
# Purpose: build the generic Chromium Playwright regression script for one server-backed SQL dashboard driver.
# Input: no arguments.
# Output: JavaScript source string that writes JSON case results to stdout.
sub _playwright_script {
return <<'JS';
const path = require('path');
const { chromium } = require(path.join(process.env.PLAYWRIGHT_DIR, 'index.js'));
async function main() {
const browser = await chromium.launch({
executablePath: process.env.CHROMIUM_BIN,
headless: true
});
const page = await browser.newPage();
const consoleMessages = [];
const pageErrors = [];
const cases = [];
( run in 3.400 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )