-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(aio): add monitoring for angular.io
This commit configures a periodic job to be run on CircleCI, performing several checks against the actual apps deployed to production (https://angular.io) and staging (https://next.angular.io). Fixes #21942
- Loading branch information
Showing
6 changed files
with
173 additions
and
13 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
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,38 @@ | ||
#!/usr/bin/env bash | ||
set +x -eu -o pipefail | ||
|
||
( | ||
readonly thisDir="$(cd $(dirname ${BASH_SOURCE[0]}); pwd)" | ||
readonly aioDir="$(realpath $thisDir/..)" | ||
|
||
readonly appPtorConf="$aioDir/tests/e2e/protractor.conf.js" | ||
readonly cfgPtorConf="$aioDir/tests/deployment-config/e2e/protractor.conf.js" | ||
readonly minPwaScore="95" | ||
readonly urls=( | ||
"https://angular.io/" | ||
"https://next.angular.io" | ||
) | ||
|
||
cd "$aioDir" | ||
|
||
# Install dependencies. | ||
echo -e "\nInstalling dependencies in '$aioDir'...\n-----" | ||
yarn install --frozen-lockfile | ||
yarn update-webdriver | ||
|
||
# Run checks for all URLs. | ||
for url in "${urls[@]}"; do | ||
echo -e "\nChecking '$url'...\n-----" | ||
|
||
# Run e2e tests. | ||
yarn protractor "$appPtorConf" --baseUrl "$url" | ||
|
||
# Run deployment config tests. | ||
yarn protractor "$cfgPtorConf" --baseUrl "$url" | ||
|
||
# Run PWA-score tests. | ||
yarn test-pwa-score "$url" "$minPwaScore" | ||
done | ||
|
||
echo -e "\nAll checks passed!" | ||
) |
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,46 @@ | ||
// Protractor configuration file, see link for more information | ||
// https://github.com/angular/protractor/blob/master/lib/config.ts | ||
|
||
exports.config = { | ||
allScriptsTimeout: 11000, | ||
specs: [ | ||
'./*.e2e-spec.ts' | ||
], | ||
capabilities: { | ||
browserName: 'chrome', | ||
// For Travis | ||
chromeOptions: { | ||
binary: process.env.CHROME_BIN, | ||
args: ['--no-sandbox'] | ||
} | ||
}, | ||
directConnect: true, | ||
framework: 'jasmine', | ||
jasmineNodeOpts: { | ||
showColors: true, | ||
defaultTimeoutInterval: 30000, | ||
print: function() {} | ||
}, | ||
params: { | ||
sitemapUrls: [], | ||
legacyUrls: [], | ||
}, | ||
beforeLaunch() { | ||
const {register} = require('ts-node'); | ||
register({}); | ||
}, | ||
onPrepare() { | ||
const {SpecReporter} = require('jasmine-spec-reporter'); | ||
const {browser} = require('protractor'); | ||
const {loadLegacyUrls, loadRemoteSitemapUrls} = require('../shared/helpers'); | ||
|
||
return Promise.all([ | ||
browser.getProcessedConfig(), | ||
loadRemoteSitemapUrls(browser.baseUrl), | ||
loadLegacyUrls(), | ||
]).then(([config, sitemapUrls, legacyUrls]) => { | ||
Object.assign(config.params, {sitemapUrls, legacyUrls}); | ||
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}})); | ||
}); | ||
} | ||
}; |
35 changes: 35 additions & 0 deletions
35
aio/tests/deployment-config/e2e/testDeployedRedirection.e2e-spec.ts
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,35 @@ | ||
import { browser } from 'protractor'; | ||
|
||
describe(browser.baseUrl, () => { | ||
const sitemapUrls = browser.params.sitemapUrls; | ||
const legacyUrls = browser.params.legacyUrls; | ||
|
||
beforeEach(() => browser.waitForAngularEnabled(false)); | ||
afterEach(() => browser.waitForAngularEnabled(true)); | ||
|
||
describe('(with sitemap URLs)', () => { | ||
sitemapUrls.forEach((url, i) => { | ||
it(`should not redirect '${url}' (${i + 1}/${sitemapUrls.length})`, async () => { | ||
browser.get(url); | ||
|
||
const expectedUrl = browser.baseUrl + url; | ||
const actualUrl = (await browser.getCurrentUrl()).replace(/\?.*$/, ''); | ||
|
||
expect(actualUrl).toBe(expectedUrl); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('(with legacy URLs)', () => { | ||
legacyUrls.forEach(([fromUrl, toUrl], i) => { | ||
it(`should redirect '${fromUrl}' to '${toUrl}' (${i + 1}/${legacyUrls.length})`, async () => { | ||
browser.get(fromUrl); | ||
|
||
const expectedUrl = (/^http/.test(toUrl) ? '' : browser.baseUrl.replace(/\/$/, '')) + toUrl; | ||
const actualUrl = (await browser.getCurrentUrl()).replace(/\?.*$/, ''); | ||
|
||
expect(actualUrl).toBe(expectedUrl); | ||
}); | ||
}); | ||
}); | ||
}); |
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