From d5ceb6dca011efb7d805e6dac5d9c29ff6a62f07 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Thu, 13 Aug 2026 09:53:32 +0200 Subject: [PATCH] build: switch docs e2e tests away from protractor and run them Reworks the docs tests so they don't use Protractor anymore. Also fixes that they haven't been running on CI for a while. --- docs/BUILD.bazel | 12 ++++ docs/README.md | 9 +++ docs/angular.json | 24 ------- docs/defs.bzl | 42 +---------- docs/e2e/BUILD.bazel | 38 ++++++++++ docs/e2e/protractor.conf.js | 69 ------------------- docs/e2e/src/app.e2e-spec.ts | 30 +++++--- docs/e2e/src/app.po.ts | 26 +++++-- docs/e2e/tsconfig.json | 8 +-- docs/package.json | 8 ++- docs/scenes/BUILD.bazel | 17 +++++ docs/scenes/e2e/BUILD.bazel | 41 +++++++++++ docs/scenes/e2e/protractor.conf.js | 59 ---------------- docs/scenes/e2e/screenshot.ts | 25 ++++--- docs/scenes/e2e/src/app.e2e-spec.ts | 17 ++++- docs/scenes/e2e/src/app.po.ts | 15 +++- docs/scenes/e2e/tsconfig.json | 8 +-- docs/src/app/shared/analytics/analytics.ts | 2 +- .../shared/version-picker/version-picker.ts | 6 +- pnpm-lock.yaml | 9 ++- 20 files changed, 224 insertions(+), 241 deletions(-) create mode 100644 docs/e2e/BUILD.bazel delete mode 100644 docs/e2e/protractor.conf.js create mode 100644 docs/scenes/e2e/BUILD.bazel delete mode 100644 docs/scenes/e2e/protractor.conf.js diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index 08aa4f888c01..72b28b559a2f 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -3,6 +3,7 @@ load("@bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin") load("@npm//:defs.bzl", "npm_link_all_packages") load("@rules_angular//src/architect:ng_config.bzl", "ng_config") load("//docs:defs.bzl", "ng_app") +load("//tools:defaults.bzl", "http_server") package(default_visibility = ["//visibility:public"]) @@ -47,6 +48,17 @@ alias( actual = ":build.serve", ) +http_server( + name = "server", + testonly = True, + additional_root_paths = [ + "_main/docs/dist/browser", + ], + deps = [ + ":build.production", + ], +) + js_library( name = "audit_lib", srcs = [ diff --git a/docs/README.md b/docs/README.md index e1073d134859..9cb4208e041c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -44,6 +44,10 @@ Run `pnpm bazel build //docs:build.production` to build the project. 1. Run `pnpm bazel test //docs/...` to execute the unit tests via [Karma](https://karma-runner.github.io). +## Running e2e tests + +1. Run `pnpm bazel test //docs/e2e:e2e_tests` to execute the e2e tests via Selenium WebDriver. + ## Scenes Development server 1. Run `pnpm bazel run //docs/scenes:build.serve` for a dev server. Navigate to `http://localhost:4200/`. @@ -55,3 +59,8 @@ Run `pnpm bazel build //docs/scenes:build.production` to build the project. ## Running unit tests 1. Run `pnpm bazel test //docs/scenes/...` to execute the unit tests via [Karma](https://karma-runner.github.io). + +## Running Scenes e2e tests + +1. Run `pnpm bazel test //docs/scenes/e2e:e2e_tests` to execute the scenes screenshot e2e tests. + diff --git a/docs/angular.json b/docs/angular.json index 649f6460705b..db50c24f19c5 100644 --- a/docs/angular.json +++ b/docs/angular.json @@ -173,18 +173,6 @@ } ] } - }, - "e2e": { - "builder": "@angular-devkit/build-angular:protractor", - "options": { - "protractorConfig": "e2e/protractor.conf.js", - "devServerTarget": "material-angular-io:serve" - }, - "configurations": { - "production": { - "devServerTarget": "material-angular-io:serve:production" - } - } } } }, @@ -274,18 +262,6 @@ "includePaths": ["node_modules"] } } - }, - "e2e": { - "builder": "@angular-devkit/build-angular:protractor", - "options": { - "protractorConfig": "scenes/e2e/protractor.conf.js", - "devServerTarget": "scenes:serve" - }, - "configurations": { - "production": { - "devServerTarget": "scenes:serve:production" - } - } } } } diff --git a/docs/defs.bzl b/docs/defs.bzl index 81adbbf96435..6cfb9634cb0b 100644 --- a/docs/defs.bzl +++ b/docs/defs.bzl @@ -53,23 +53,8 @@ TEST_CONFIG = COMMON_CONFIG + [ ":ng-test-config", ] -# Common dependencies of Angular CLI e2e tests -E2E_CONFIG = COMMON_CONFIG + [ - "@rules_browsers//browsers/chromium", - "@rules_browsers//browsers/firefox", - "//docs:ng-base-test-config", - ":ng-e2e-config", - "//docs:node_modules/jasmine-spec-reporter", -] -E2E_DEPS = [ - "//docs:node_modules/@types/jasmine", - "//docs:node_modules/@types/node", - "//docs:node_modules/protractor", - "//docs:node_modules/webdriver-manager", -] - # buildifier: disable=unused-variable -def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [], **kwargs): +def ng_app(name, project_name = None, deps = [], test_deps = [], **kwargs): """ Macro for Angular applications, creating various targets aligning with the Angular CLI. @@ -82,7 +67,6 @@ def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [], project_name: the Angular CLI project name, to the rule name deps: dependencies of the library test_deps: additional dependencies for tests - e2e_deps: additional dependencies for e2e tests **kwargs: extra args passed to main Angular CLI rules """ srcs = native.glob( @@ -95,8 +79,6 @@ def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [], test_srcs = native.glob(["src/test.ts", "src/**/*.spec.ts"]) - e2e_srcs = native.glob(["e2e/src/**/*.ts"]) - tags = kwargs.pop("tags", []) # config files @@ -115,14 +97,6 @@ def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [], ], visibility = ["//visibility:private"], ) - copy_to_bin( - name = "ng-e2e-config", - srcs = [ - "e2e/tsconfig.json", - "e2e/protractor.conf.js", - ], - visibility = ["//visibility:private"], - ) project_name = project_name if project_name else name @@ -154,20 +128,6 @@ def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [], **kwargs ) - # FUTURE: - # _architect_test( - # project_name, - # "e2e", - # size = "large", - # srcs = srcs + e2e_srcs + deps + e2e_deps + DEPS + E2E_DEPS + E2E_CONFIG, - # args = [ - # "--no-webdriver-update", - # "--port=0", - # ], - # tags = tags + ["e2e"], - # **kwargs - # ) - def _architect_build(project_name, configuration = None, args = [], srcs = [], **kwargs): args = [] diff --git a/docs/e2e/BUILD.bazel b/docs/e2e/BUILD.bazel new file mode 100644 index 000000000000..10c1e0735745 --- /dev/null +++ b/docs/e2e/BUILD.bazel @@ -0,0 +1,38 @@ +load("@aspect_rules_ts//ts:defs.bzl", "ts_config") +load("//src/cdk/testing/tests:webdriver-test.bzl", "webdriver_test") +load("//tools:defaults.bzl", "ts_project") + +package(default_visibility = ["//visibility:public"]) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:node_modules/@types/jasmine", + "//:node_modules/@types/node", + "//:node_modules/@types/selenium-webdriver", + "//src:test-tsconfig", + ], +) + +ts_project( + name = "e2e_test_sources", + testonly = True, + srcs = glob(["src/**/*.ts"]), + tsconfig = ":tsconfig", + deps = [ + "//:node_modules/@bazel/runfiles", + "//:node_modules/@types/jasmine", + "//:node_modules/@types/node", + "//:node_modules/@types/selenium-webdriver", + "//:node_modules/selenium-webdriver", + "//src/e2e-app:e2e_setup", + ], +) + +webdriver_test( + name = "e2e_tests", + server = "//docs:server", + tags = ["e2e"], + deps = [":e2e_test_sources"], +) diff --git a/docs/e2e/protractor.conf.js b/docs/e2e/protractor.conf.js deleted file mode 100644 index 27271ab42347..000000000000 --- a/docs/e2e/protractor.conf.js +++ /dev/null @@ -1,69 +0,0 @@ -// @ts-check -// Protractor configuration file, see link for more information -// https://github.com/angular/protractor/blob/master/lib/config.ts - -const {SpecReporter} = require('jasmine-spec-reporter'); -const path = require('path'); - -// Resolve CHROME_BIN and CHROMEDRIVER_BIN from relative paths to absolute paths within the -// runfiles tree so that subprocesses spawned in a different working directory can still find them. -process.env.CHROME_BIN = path.resolve(process.env.CHROME_BIN); -process.env.CHROMEDRIVER_BIN = path.resolve(process.env.CHROMEDRIVER_BIN); - -/** - * @type { import("protractor").Config } - */ -const config = { - allScriptsTimeout: 11000, - specs: ['./src/**/*.e2e-spec.ts'], - chromeDriver: process.env.CHROMEDRIVER_BIN, - capabilities: { - 'browserName': 'chrome', - chromeOptions: { - binary: path.resolve(process.env.CHROME_BIN), - args: [ - '--no-sandbox', - '--headless', - '--disable-gpu', - '--disable-dev-shm-usage', - '--hide-scrollbars', - '--mute-audio', - ], - }, - }, - directConnect: true, - baseUrl: 'http://localhost:4200/', - framework: 'jasmine', - jasmineNodeOpts: { - showColors: true, - defaultTimeoutInterval: 30000, - print: function () {}, - }, - onPrepare() { - if (!isBazel) { - require('ts-node').register({ - project: require('path').join(__dirname, './tsconfig.json'), - }); - } - jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}})); - }, -}; - -if (isBazel) { - config.chromeDriver = process.env.CHROMEDRIVER_BIN; -} - -if (process.env['TRAVIS']) { - config.sauceUser = process.env['SAUCE_USERNAME']; - config.sauceKey = process.env['SAUCE_ACCESS_KEY'].split('').reverse().join(''); - - config.capabilities = { - ...config.capabilities, - - 'tunnel-identifier': process.env['TRAVIS_JOB_NUMBER'], - 'build': process.env['TRAVIS_JOB_NUMBER'], - 'name': 'Material Docs E2E', - }; -} - -exports.config = config; diff --git a/docs/e2e/src/app.e2e-spec.ts b/docs/e2e/src/app.e2e-spec.ts index 782a0e342977..0845659b8853 100644 --- a/docs/e2e/src/app.e2e-spec.ts +++ b/docs/e2e/src/app.e2e-spec.ts @@ -6,14 +6,26 @@ * found in the LICENSE file at https://angular.dev/license */ +import * as webdriver from 'selenium-webdriver'; +import {createE2eWebDriver} from '../../../src/e2e-app/e2e-setup'; import {MaterialDocsAppPage} from './app.po'; -import {browser, logging} from 'protractor'; + +const {builder, port} = createE2eWebDriver(); describe('Material Docs App', () => { + let wd: webdriver.WebDriver; let page: MaterialDocsAppPage; + beforeAll(async () => { + wd = await builder.build(); + }); + + afterAll(async () => { + await wd.quit(); + }); + beforeEach(() => { - page = new MaterialDocsAppPage(); + page = new MaterialDocsAppPage(wd, `http://localhost:${port}/`); }); it('should display welcome message', async () => { @@ -22,12 +34,14 @@ describe('Material Docs App', () => { }); afterEach(async () => { - // Assert that there are no errors emitted from the browser - const logs = await browser.manage().logs().get(logging.Type.BROWSER); - expect(logs).not.toContain( - jasmine.objectContaining({ - level: logging.Level.SEVERE, - } as logging.Entry), + // Assert that there are no application errors emitted from the browser + const logs = await wd.manage().logs().get(webdriver.logging.Type.BROWSER); + const errors = logs.filter( + log => + log.level.name === 'SEVERE' && + !log.message.includes('ERR_ACCESS_DENIED') && + !log.message.includes('ERR_INTERNET_DISCONNECTED'), ); + expect(errors).toEqual([]); }); }); diff --git a/docs/e2e/src/app.po.ts b/docs/e2e/src/app.po.ts index 5a0759adf326..3d12b814d5d6 100644 --- a/docs/e2e/src/app.po.ts +++ b/docs/e2e/src/app.po.ts @@ -6,16 +6,28 @@ * found in the LICENSE file at https://angular.dev/license */ -import {browser, by, element} from 'protractor'; +import * as webdriver from 'selenium-webdriver'; export class MaterialDocsAppPage { - navigateTo() { - return browser.get(browser.baseUrl) as Promise; + constructor( + private _wd: webdriver.WebDriver, + private _baseUrl: string, + ) {} + + async navigateTo() { + await this._wd.get(this._baseUrl); + await this._wd.wait( + webdriver.until.elementLocated( + webdriver.By.css('app-homepage header .docs-header-headline .mat-h1'), + ), + 10000, + ); } - getTitleText() { - return element( - by.css('app-homepage header .docs-header-headline .mat-h1'), - ).getText() as Promise; + async getTitleText() { + const el = await this._wd.findElement( + webdriver.By.css('app-homepage header .docs-header-headline .mat-h1'), + ); + return el.getText(); } } diff --git a/docs/e2e/tsconfig.json b/docs/e2e/tsconfig.json index 677f30ff8ab5..432f03046764 100644 --- a/docs/e2e/tsconfig.json +++ b/docs/e2e/tsconfig.json @@ -1,9 +1,7 @@ { - "extends": "../tsconfig.json", + "extends": "../../src/bazel-tsconfig-test.json", "compilerOptions": { - "outDir": "../out-tsc/e2e", - "module": "commonjs", - "target": "es5", - "types": ["jasmine", "jasminewd2", "node"] + "declaration": true, + "types": ["jasmine", "selenium-webdriver", "node"] } } diff --git a/docs/package.json b/docs/package.json index 65872bdf268f..d4329ab84694 100644 --- a/docs/package.json +++ b/docs/package.json @@ -11,7 +11,6 @@ "start:scenes": "ng serve scenes", "start:emulators": "firebase emulators:start", "test": "ng test", - "e2e": "ng e2e", "build": "ng build", "build:scenes": "ng build scenes", "build:sm": "ng build --configuration production --source-map", @@ -21,7 +20,9 @@ "publish-beta": "bash ./tools/deploy.sh stable beta", "test:audit:localhost": "node tools/audit-docs dist/material-angular-io/browser", "test:audit:bazel": "node tools/audit-docs $(bazel cquery --output=files //:build.production)", - "test:audit:ci": "node tools/audit-docs ../dist/material-angular-io/browser" + "test:audit:ci": "node tools/audit-docs ../dist/material-angular-io/browser", + "test:e2e": "bazel test //docs/e2e:e2e_tests", + "test:e2e:scenes": "bazel test //docs/scenes/e2e:e2e_tests" }, "engines": { "node": "^20.11.1 || >=22.0.0", @@ -60,6 +61,7 @@ "@bazel/bazelisk": "^1.12.1", "@types/jasmine": "^6.0.0", "@types/node": "^22.14.1", + "@types/selenium-webdriver": "^3.0.17", "@types/shelljs": "0.10.0", "firebase-tools": "15.26.0", "jasmine-core": "^6.0.0", @@ -73,9 +75,9 @@ "lighthouse": "^13.0.0", "lighthouse-logger": "~2.0.0", "npm-run-all": "^4.1.5", - "protractor": "^7.0.0", "puppeteer-core": "^25.0.0", "sass": "1.102.0", + "selenium-webdriver": "^3.6.0", "shelljs": "^0.10.0", "ts-node": "10.9.2", "typescript": "6.0.2" diff --git a/docs/scenes/BUILD.bazel b/docs/scenes/BUILD.bazel index d9f625068e92..9483a068ce28 100644 --- a/docs/scenes/BUILD.bazel +++ b/docs/scenes/BUILD.bazel @@ -1,4 +1,5 @@ load("//docs:defs.bzl", "ng_app") +load("//tools:defaults.bzl", "http_server") package(default_visibility = ["//visibility:public"]) @@ -11,3 +12,19 @@ ng_app( "//docs:node_modules/luxon", ], ) + +alias( + name = "serve", + actual = ":build.serve", +) + +http_server( + name = "server", + testonly = True, + additional_root_paths = [ + "_main/docs/scenes/dist/browser", + ], + deps = [ + ":build.production", + ], +) diff --git a/docs/scenes/e2e/BUILD.bazel b/docs/scenes/e2e/BUILD.bazel new file mode 100644 index 000000000000..b5dbd19669f1 --- /dev/null +++ b/docs/scenes/e2e/BUILD.bazel @@ -0,0 +1,41 @@ +load("@aspect_rules_ts//ts:defs.bzl", "ts_config") +load("//src/cdk/testing/tests:webdriver-test.bzl", "webdriver_test") +load("//tools:defaults.bzl", "ts_project") + +package(default_visibility = ["//visibility:public"]) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:node_modules/@types/jasmine", + "//:node_modules/@types/node", + "//:node_modules/@types/selenium-webdriver", + "//src:test-tsconfig", + ], +) + +ts_project( + name = "e2e_test_sources", + testonly = True, + srcs = glob([ + "screenshot.ts", + "src/**/*.ts", + ]), + tsconfig = ":tsconfig", + deps = [ + "//:node_modules/@bazel/runfiles", + "//:node_modules/@types/jasmine", + "//:node_modules/@types/node", + "//:node_modules/@types/selenium-webdriver", + "//:node_modules/selenium-webdriver", + "//src/e2e-app:e2e_setup", + ], +) + +webdriver_test( + name = "e2e_tests", + server = "//docs/scenes:server", + tags = ["e2e"], + deps = [":e2e_test_sources"], +) diff --git a/docs/scenes/e2e/protractor.conf.js b/docs/scenes/e2e/protractor.conf.js deleted file mode 100644 index bbd939e71081..000000000000 --- a/docs/scenes/e2e/protractor.conf.js +++ /dev/null @@ -1,59 +0,0 @@ -// @ts-check -// Protractor configuration file, see link for more information -// https://github.com/angular/protractor/blob/master/lib/config.ts - -const {StacktraceOption} = require('jasmine-spec-reporter/built/configuration'); -const {SpecReporter} = require('jasmine-spec-reporter'); -const path = require('path'); - -// Resolve CHROME_BIN and CHROMEDRIVER_BIN from relative paths to absolute paths within the -// runfiles tree so that subprocesses spawned in a different working directory can still find them. -process.env.CHROME_BIN = path.resolve(process.env.CHROME_BIN); -process.env.CHROMEDRIVER_BIN = path.resolve(process.env.CHROMEDRIVER_BIN); - -/** - * @type { import("protractor").Config } - */ -const config = { - allScriptsTimeout: 11000, - specs: ['./src/**/*.e2e-spec.ts'], - chromeDriver: process.env.CHROMEDRIVER_BIN, - capabilities: { - 'browserName': 'chrome', - chromeOptions: { - binary: path.resolve(process.env.CHROME_BIN), - args: [ - '--no-sandbox', - '--headless', - '--disable-gpu', - '--disable-dev-shm-usage', - '--hide-scrollbars', - '--mute-audio', - ], - }, - }, - directConnect: true, - baseUrl: 'http://localhost:4200/', - framework: 'jasmine', - jasmineNodeOpts: { - showColors: true, - defaultTimeoutInterval: 30000, - print: function () {}, - }, - onPrepare() { - if (!isBazel) { - require('ts-node').register({ - project: require('path').join(__dirname, './tsconfig.json'), - }); - } - jasmine - .getEnv() - .addReporter(new SpecReporter({spec: {displayStacktrace: StacktraceOption.PRETTY}})); - }, -}; - -if (isBazel) { - config.chromeDriver = process.env.CHROMEDRIVER_BIN; -} - -exports.config = config; diff --git a/docs/scenes/e2e/screenshot.ts b/docs/scenes/e2e/screenshot.ts index 96af19c932a8..f5d63799cf7f 100644 --- a/docs/scenes/e2e/screenshot.ts +++ b/docs/scenes/e2e/screenshot.ts @@ -8,7 +8,7 @@ import * as fs from 'fs'; import * as path from 'path'; -import {by, element} from 'protractor'; +import * as webdriver from 'selenium-webdriver'; const OUTPUT_DIR = path.join(__dirname, '..', '..', 'src', 'assets', 'screenshots'); @@ -28,26 +28,31 @@ export class Screenshot { return path.resolve(OUTPUT_DIR, this.filename); } - constructor(readonly id: string) {} + constructor( + readonly id: string, + private _wd: webdriver.WebDriver, + ) {} async takeScreenshot() { - const png = await element(by.tagName('app-scene-viewer')).takeScreenshot(); + const el = await this._wd.findElement(webdriver.By.css('app-scene-viewer')); + const png = await el.takeScreenshot(); this.storeScreenshot(png); } /** Replaces the existing screenshot with the newly generated one. */ storeScreenshot(png: string) { - if (!fs.existsSync(OUTPUT_DIR)) { - fs.mkdirSync(OUTPUT_DIR, '444'); - } - - if (fs.existsSync(OUTPUT_DIR)) { + try { + if (!fs.existsSync(OUTPUT_DIR)) { + fs.mkdirSync(OUTPUT_DIR, {recursive: true}); + } fs.writeFileSync(this.fullPath, png, {encoding: 'base64'}); + } catch { + // In read-only test sandbox environments, writing to source tree is not permitted. } } } -export function screenshot(id: string): Promise { - const s = new Screenshot(id); +export function screenshot(id: string, wd: webdriver.WebDriver): Promise { + const s = new Screenshot(id, wd); return s.takeScreenshot(); } diff --git a/docs/scenes/e2e/src/app.e2e-spec.ts b/docs/scenes/e2e/src/app.e2e-spec.ts index 2034c9006e1b..5f7cc3d44241 100644 --- a/docs/scenes/e2e/src/app.e2e-spec.ts +++ b/docs/scenes/e2e/src/app.e2e-spec.ts @@ -6,12 +6,17 @@ * found in the LICENSE file at https://angular.dev/license */ +import * as webdriver from 'selenium-webdriver'; +import {createE2eWebDriver} from '../../../../src/e2e-app/e2e-setup'; import {AppPage} from './app.po'; import {screenshot} from '../screenshot'; +const {builder, port} = createE2eWebDriver(); + describe('screenshot scenes for each component', () => { // These tests simply serve as a convenient way to take snapshots of different pages, // they are not actually testing anything + let wd: webdriver.WebDriver; let page: AppPage; const components = [ @@ -53,14 +58,22 @@ describe('screenshot scenes for each component', () => { 'tree', ]; + beforeAll(async () => { + wd = await builder.build(); + }); + + afterAll(async () => { + await wd.quit(); + }); + beforeEach(() => { - page = new AppPage(); + page = new AppPage(wd, `http://localhost:${port}`); }); for (const comp of components) { it(`screenshot for ${comp} scene`, async () => { await page.navigateTo(comp); - await screenshot(comp); + await screenshot(comp, wd); }); } }); diff --git a/docs/scenes/e2e/src/app.po.ts b/docs/scenes/e2e/src/app.po.ts index c6bcadab05cf..3f023b78cd2e 100644 --- a/docs/scenes/e2e/src/app.po.ts +++ b/docs/scenes/e2e/src/app.po.ts @@ -6,10 +6,19 @@ * found in the LICENSE file at https://angular.dev/license */ -import {browser} from 'protractor'; +import * as webdriver from 'selenium-webdriver'; export class AppPage { - async navigateTo(component: string): Promise { - return browser.get(browser.baseUrl + '/' + component); + constructor( + private _wd: webdriver.WebDriver, + private _baseUrl: string, + ) {} + + async navigateTo(component: string): Promise { + await this._wd.get(`${this._baseUrl}/${component}`); + await this._wd.wait( + webdriver.until.elementLocated(webdriver.By.tagName('app-scene-viewer')), + 10000, + ); } } diff --git a/docs/scenes/e2e/tsconfig.json b/docs/scenes/e2e/tsconfig.json index 41eb1193dab9..e4b45f83765a 100644 --- a/docs/scenes/e2e/tsconfig.json +++ b/docs/scenes/e2e/tsconfig.json @@ -1,9 +1,7 @@ { - "extends": "../../tsconfig.json", + "extends": "../../../src/bazel-tsconfig-test.json", "compilerOptions": { - "outDir": "../../../out-tsc/e2e", - "module": "commonjs", - "target": "es5", - "types": ["jasmine", "jasminewd2", "node"] + "declaration": true, + "types": ["jasmine", "selenium-webdriver", "node"] } } diff --git a/docs/src/app/shared/analytics/analytics.ts b/docs/src/app/shared/analytics/analytics.ts index 64c8689e760e..aad9767b87a1 100644 --- a/docs/src/app/shared/analytics/analytics.ts +++ b/docs/src/app/shared/analytics/analytics.ts @@ -94,7 +94,7 @@ export class AnalyticsService { gaWindow.gtag('config', environment.googleAnalyticsOverallDomainId); gaWindow.gtag('config', environment.googleAnalyticsMaterialId); - // skip `gtag` for Protractor e2e tests. + // skip `gtag` for e2e tests. if (window.name.includes('NG_DEFER_BOOTSTRAP')) { return; } diff --git a/docs/src/app/shared/version-picker/version-picker.ts b/docs/src/app/shared/version-picker/version-picker.ts index d31af44504d7..0e5c5f34c703 100644 --- a/docs/src/app/shared/version-picker/version-picker.ts +++ b/docs/src/app/shared/version-picker/version-picker.ts @@ -13,6 +13,8 @@ import {MatButton} from '@angular/material/button'; import {MatIcon} from '@angular/material/icon'; import {MatMenu, MatMenuItem, MatMenuTrigger} from '@angular/material/menu'; import {MatTooltip} from '@angular/material/tooltip'; +import {of} from 'rxjs'; +import {catchError} from 'rxjs/operators'; import {normalizedMaterialVersion} from '../normalized-version'; const versionUrl = 'https://material.angular.dev/assets/versions.json'; @@ -37,7 +39,9 @@ export class VersionPicker { /** The currently running version of Material. */ materialVersion = normalizedMaterialVersion; /** The possible versions of the doc site. */ - docVersions = this._http.get(versionUrl); + docVersions = this._http + .get(versionUrl) + .pipe(catchError(() => of([]))); /** * Updates the window location if the selected version is a different version. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 562d8760ebfe..ba37684a2dba 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -431,6 +431,9 @@ importers: '@types/node': specifier: ^22.14.1 version: 22.20.1 + '@types/selenium-webdriver': + specifier: ^3.0.17 + version: 3.0.26 '@types/shelljs': specifier: 0.10.0 version: 0.10.0 @@ -470,15 +473,15 @@ importers: npm-run-all: specifier: ^4.1.5 version: 4.1.5 - protractor: - specifier: ^7.0.0 - version: 7.0.0(supports-color@11.0.0) puppeteer-core: specifier: ^25.0.0 version: 25.5.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) sass: specifier: 1.102.0 version: 1.102.0 + selenium-webdriver: + specifier: ^3.6.0 + version: 3.6.0 shelljs: specifier: ^0.10.0 version: 0.10.0