test(docs-infra): run basic smoke tests against PR previews (#26649)
This makes the tests run agaisnt the deployed production versions (as part of the `aio_monitoring` job) more reliable. PR Close #26649
This commit is contained in:
parent
8bf51db3e7
commit
0367d14044
|
@ -30,6 +30,8 @@
|
|||
"setup-local": "yarn aio-use-local && yarn example-use-local",
|
||||
"postsetup-local": "yarn postsetup",
|
||||
"set-opensearch-url": "node --eval \"const sh = require('shelljs'); sh.set('-e'); sh.sed('-i', /PLACEHOLDER_URL/g, process.argv[1], 'dist/assets/opensearch.xml');\"",
|
||||
"presmoke-tests": "yarn update-webdriver",
|
||||
"smoke-tests": "protractor tests/deployment/e2e/protractor.conf.js --suite smoke --baseUrl",
|
||||
"test-pwa-score": "node scripts/test-pwa-score",
|
||||
"test-pwa-score-localhost": "run-p --race \"~~http-server dist -p 4200 --silent\" \"test-pwa-score http://localhost:4200 {1} {2}\" --",
|
||||
"example-e2e": "yarn example-check-local && node ./tools/examples/run-example-e2e",
|
||||
|
|
|
@ -45,8 +45,9 @@ get(previewabilityCheckUrl).
|
|||
const totalSecs = Math.round((previewCheckInterval * previewCheckAttempts) / 1000);
|
||||
throw new Error(`Preview still not available after ${totalSecs}s.`);
|
||||
}).
|
||||
// The preview is now available. Run the PWA tests.
|
||||
then(() => runPwaTests());
|
||||
// The preview is now available. Run the tests.
|
||||
then(() => yarnRun('smoke-tests', previewUrl)).
|
||||
then(() => yarnRun('test-pwa-score', previewUrl, minPwaScore));
|
||||
}).
|
||||
catch(onError);
|
||||
|
||||
|
@ -93,15 +94,6 @@ function reportNoPreview(reason) {
|
|||
console.log(`No (public) preview available. (Reason: ${reason})`);
|
||||
}
|
||||
|
||||
function runPwaTests() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const spawnOptions = {cwd: __dirname, stdio: 'inherit'};
|
||||
spawn('yarn', ['test-pwa-score', previewUrl, minPwaScore], spawnOptions).
|
||||
on('error', reject).
|
||||
on('exit', code => (code === 0 ? resolve : reject)());
|
||||
});
|
||||
}
|
||||
|
||||
function validateArgs(args) {
|
||||
if (args.length !== 3) {
|
||||
const relativeScriptPath = relative('.', __filename.replace(/\.js$/, ''));
|
||||
|
@ -119,3 +111,12 @@ function wait(delay) {
|
|||
console.log(`Waiting ${delay}ms...`);
|
||||
return new Promise(resolve => setTimeout(resolve, delay));
|
||||
}
|
||||
|
||||
function yarnRun(script, ...args) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const spawnOptions = {cwd: __dirname, stdio: 'inherit'};
|
||||
spawn('yarn', [script, ...args], spawnOptions).
|
||||
on('error', reject).
|
||||
on('exit', code => (code === 0 ? resolve : reject)());
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
|
||||
exports.config = {
|
||||
allScriptsTimeout: 11000,
|
||||
specs: [
|
||||
'./*.e2e-spec.ts'
|
||||
],
|
||||
suites: {
|
||||
full: './*.e2e-spec.ts',
|
||||
smoke: './smoke-tests.e2e-spec.ts',
|
||||
},
|
||||
suite: 'full',
|
||||
capabilities: {
|
||||
browserName: 'chrome',
|
||||
// For Travis
|
||||
|
|
Loading…
Reference in New Issue