Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ http_archive(
],
)

# Required by @angular/build-tooling's spec-bundling rules (spec-entrypoint.bzl).
# Only the JsInfo/js_info providers are used; no toolchain setup is needed.
http_archive(
name = "aspect_rules_js",
sha256 = "75c25a0f15a9e4592bbda45b57aa089e4bf17f9176fd735351e8c6444df87b52",
strip_prefix = "rules_js-2.1.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v2.1.0/rules_js-v2.1.0.tar.gz",
)

load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")

build_bazel_rules_nodejs_dependencies()
Expand Down Expand Up @@ -236,7 +245,7 @@ yarn_install(
# this Bazel/CI setup. Apply the generated patch artifacts directly during
# yarn_install instead.
post_install_patches = [
"//patches:@angular+build-tooling+0.0.0-bf0dd632ed129ee8770b09a6e11c6497162b3edb.patch",
"//patches:@angular+build-tooling+0.0.0-98b30ab5fdeeb1df3278f5257b9a8f07abb76941.patch",
"//patches:@bazel+concatjs+5.8.1.patch",
],
yarn_lock = "//:yarn.lock",
Expand Down
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
},
"homepage": "https://github.com/tensorflow/tensorboard#readme",
"devDependencies": {
"@angular-devkit/build-angular": "^19.0.0",
"@angular/build": "^19.0.0",
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#fdca582c00d246efd580b92c37fd102b83491b15",
"@angular/cli": "^19.0.0",
"@angular/compiler": "19.2.25",
"@angular/compiler-cli": "^19.0.0",
"@angular-devkit/build-angular": "^20.0.0",
"@angular/build": "^20.0.0",
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#b87de6c1190eb38a74ce72a530331f2f184fe918",
"@angular/cli": "^20.0.0",
"@angular/compiler": "20.3.25",
"@angular/compiler-cli": "^20.0.0",
"@babel/core": "^7.16.12",
"@bazel/concatjs": "5.8.1",
"@bazel/esbuild": "5.8.1",
Expand Down Expand Up @@ -62,22 +62,22 @@
"prettier-plugin-organize-imports": "2.3.4",
"requirejs": "^2.3.7",
"tslib": "^2.3.0",
"typescript": "5.6.3",
"typescript": "5.8.3",
"yarn-deduplicate": "^5.0.0"
},
"dependencies": {
"@angular/animations": "^19.0.0",
"@angular/cdk": "^19.0.0",
"@angular/common": "19.2.25",
"@angular/core": "^19.0.0",
"@angular/forms": "^19.0.0",
"@angular/localize": "^19.0.0",
"@angular/material": "^19.0.0",
"@angular/platform-browser": "^19.0.0",
"@angular/platform-browser-dynamic": "^19.0.0",
"@angular/router": "^19.0.0",
"@ngrx/effects": "^19.0.0",
"@ngrx/store": "^19.0.0",
"@angular/animations": "^20.0.0",
"@angular/cdk": "^20.0.0",
"@angular/common": "20.3.25",
"@angular/core": "^20.0.0",
"@angular/forms": "^20.0.0",
"@angular/localize": "^20.0.0",
"@angular/material": "^20.0.0",
"@angular/platform-browser": "^20.0.0",
"@angular/platform-browser-dynamic": "^20.0.0",
"@angular/router": "^20.0.0",
"@ngrx/effects": "^20.0.0",
"@ngrx/store": "^20.0.0",
"@polymer/decorators": "^3.0.0",
"@polymer/iron-behaviors": "^3.0.1",
"@polymer/iron-collapse": "^3.0.1",
Expand Down
3 changes: 3 additions & 0 deletions tensorboard/defs/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ def tf_ng_web_test_suite(name, deps = [], external = [], **kwargs):
run_angular_linker = False,
platform = "browser",
external = external,
# io_bazel_rules_webtesting updated to browsers-0.3.4 which ships chrome 123
# chrome 123 headless crashes on es2022 class static blocks so we use es2021
target = "es2021",
)

karma_web_test_suite(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ describe('Timeline Container', () => {
);
expect(sliders.length).toBe(1);
const [slider] = sliders;
expect(slider.attributes['ng-reflect-min']).toBe('0');
expect(slider.attributes['ng-reflect-max']).toBe(
String(numExecutions - displayCount)
expect(slider.componentInstance.min).toBe(0);
expect(slider.componentInstance.max).toBe(
numExecutions - displayCount
);
const thumb = slider.query(By.css('input'));
expect(thumb.attributes['aria-valuetext']).toBe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ describe('image card', () => {
expect(
imgEl.nativeElement.src.endsWith(`/imageData?imageId=${imageId}`)
).toBe(true);
expect(thumb.nativeElement.getAttribute('ng-reflect-value')).toBe(
stepIndex?.toString()
);
expect(thumb.nativeElement.value).toBe(stepIndex?.toString());
}

it('renders empty message when there is no data', () => {
Expand Down
16 changes: 6 additions & 10 deletions tensorboard/webapp/metrics/views/right_pane/right_pane_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,20 +441,16 @@ describe('metrics right_pane', () => {
);
});

it('sets the card width to the value provided', fakeAsync(() => {
it('sets the card width to the value provided', () => {
store.overrideSelector(selectors.getMetricsCardMinWidth, 400);
const fixture = TestBed.createComponent(SettingsViewContainer);
fixture.detectChanges();

// For some unknown reason sliders which do not display a thumb do not
// update aria-valuetext properly in tests. As a workaround I am using
// the ng-reflect-value attribute for this test.
expect(
select(fixture, CARD_WIDTH_SLIDER)
.query(By.css('input'))
.nativeElement.getAttribute('ng-reflect-value')
).toBe('400');
}));
const settingsView = fixture.debugElement.query(
By.directive(SettingsViewComponent)
).componentInstance as SettingsViewComponent;
expect(settingsView.cardMinWidth).toBe(400);
});

it('does not set invalid value', () => {
store.overrideSelector(selectors.getMetricsCardMinWidth, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,9 @@ describe('scalar column editor', () => {

expect(checkboxes.length).toEqual(2);
expect(checkboxes[0].nativeElement.innerText).toEqual('Smoothed');
expect(
checkboxes[0].nativeElement.attributes.getNamedItem('ng-reflect-checked')
.value
).toEqual('true');
expect(checkboxes[0].componentInstance.checked).toBe(true);
expect(checkboxes[1].nativeElement.innerText).toEqual('Value');
expect(
checkboxes[1].nativeElement.attributes.getNamedItem('ng-reflect-checked')
.value
).toEqual('false');
expect(checkboxes[1].componentInstance.checked).toBe(false);
}));

describe('toggling', () => {
Expand Down
23 changes: 14 additions & 9 deletions tensorboard/webapp/widgets/histogram/histogram_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ describe('histogram test', () => {
fixture.componentInstance.mode = HistogramMode.OVERLAY;
fixture.componentInstance.timeProperty = TimeProperty.STEP;
fixture.detectChanges();
mockContentRect(fixture);
intersectionObserver.simulateVisibilityChange(fixture, true);

const tooltipData = simulateMouseMove(fixture, 1, 5, 10);
Expand Down Expand Up @@ -1349,23 +1350,27 @@ describe('histogram test', () => {
}
);
fixture.detectChanges();
mockContentRect(fixture);
intersectionObserver.simulateVisibilityChange(fixture, true);
const testController = fixture.debugElement.query(
const cardFobDebugEl = fixture.debugElement.query(
By.directive(CardFobControllerComponent)
).componentInstance;
const fobStartPosition = testController.root.nativeElement
.querySelector('.time-fob-wrapper')
.getBoundingClientRect().top;

// Simulate dragging fob to step 10.
);
const testController = cardFobDebugEl.componentInstance;
/*
* Drag the fob from step 0 to step 10.
* `controllerRootTop` is the top of the card fob controller host in viewport coords, the same point the component uses internally in getMousePositionFromEvent.
* `clientY` param is in viewport coords with 0 at the top. With mockContentRect using height 50, step 5 sits at pixel 23.75 and step 10 at 27.5 on this axis, anything above 23.75 and up to 27.5 snaps to step 10.
*/
const controllerRootTop =
cardFobDebugEl.nativeElement.getBoundingClientRect().top;
testController.startDrag(
Fob.START,
TimeSelectionAffordance.FOB,
new MouseEvent('mouseDown')
);
const fakeEvent = new MouseEvent('mousemove', {
clientY: 5 + fobStartPosition, // Add the difference between step 5 and 10, which is equal to 5.
movementY: 1,
clientY: controllerRootTop + 25,
movementY: 1, // positive value means moving down, required for isMovingHigher to pick a higher step
});
testController.mouseMove(fakeEvent);
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,9 @@ describe('line_chart_v2/lib/formatter test', () => {

describe('formatLong', () => {
it('formats using localization', () => {
// jasmine + Angular seems to mock out the timezone by default (to UTC).
expect(
wallTimeFormatter.formatLong(new Date('2020-1-5 13:23').getTime())
).toBe('January 5, 2020, 1:23:00.000 PM UTC');
).toBe('January 5, 2020 at 1:23:00.000 PM UTC');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jasmine + Angular seems to mock out the timezone by default (to UTC).
Chrome 123 (Angular 20) icu upgrade changed the en-US date time separator from a
omma to the word at so Jan 5 2020 at 1:23 PM instead of comma

});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,15 @@ describe('line_chart_v2/lib/integration test', () => {
describe('webgl', () => {
it('invokes onContextLost after losing webgl context', async () => {
const canvas = document.createElement('canvas');

// webgl context creation fails on macos arm64 headless so we probe first
// and call pending to skip gracefully instead of crashing the whole suite
const probe = document.createElement('canvas');
if (!probe.getContext('webgl') && !probe.getContext('webgl2')) {
pending('WebGL not available in this environment');
return;
}

chart = new ChartImpl({
type: RendererType.WEBGL,
container: canvas,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,14 @@ describe('line_chart_v2/lib/renderer test', () => {
}

beforeEach(() => {
// webgl context creation fails on macos arm64 headless so we probe first
// and call pending to skip gracefully instead of crashing the whole suite
const probe = document.createElement('canvas');
if (!probe.getContext('webgl') && !probe.getContext('webgl2')) {
pending('WebGL not available in this environment');
return;
}

scene = new THREE.Scene();
spyOn(TEST_ONLY.ThreeWrapper, 'createScene').and.returnValue(scene);

Expand Down
27 changes: 15 additions & 12 deletions tensorboard/webapp/widgets/range_input/range_input_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ limitations under the License.
==============================================================================*/

import {ChangeDetectionStrategy, Component, Input} from '@angular/core';
import {ComponentFixture, TestBed} from '@angular/core/testing';
import {
ComponentFixture,
TestBed,
fakeAsync,
tick,
} from '@angular/core/testing';
import {FormsModule} from '@angular/forms';
import {MatSliderModule} from '@angular/material/slider';
import {By} from '@angular/platform-browser';
Expand Down Expand Up @@ -107,20 +112,20 @@ describe('range input test', () => {
});

describe('slider', () => {
it('uses correct values in slider', () => {
it('uses correct values in slider', fakeAsync(() => {
const {fixture} = createComponent({
lowerValue: 2,
upperValue: 3,
});
// MatSliderThumb sets the initial value async thru NgModel so tick is
// needed before nativeElement.value is ready.
tick();
fixture.detectChanges();

let thumbs = fixture.debugElement.queryAll(By.css('mat-slider input'));
expect(thumbs[0].nativeElement.getAttribute('ng-reflect-model')).toEqual(
'2'
);
expect(thumbs[1].nativeElement.getAttribute('ng-reflect-model')).toEqual(
'3'
);
});
expect(thumbs[0].nativeElement.value).toEqual('2');
expect(thumbs[1].nativeElement.value).toEqual('3');
}));

it('dispatches actions when slider emits valueChange event', () => {
const {fixture, onRangeValuesChanged} = createComponent({
Expand Down Expand Up @@ -150,9 +155,7 @@ describe('range input test', () => {
});

const slider = fixture.debugElement.queryAll(By.css('mat-slider'))[0];
expect(slider.nativeElement.getAttribute('ng-reflect-step')).toEqual(
'0.5'
);
expect(slider.componentInstance.step).toBe(0.5);
});
});

Expand Down
75 changes: 2 additions & 73 deletions third_party/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ TensorBoard external dependencies that can be loaded in WORKSPACE files.
"""

load("@bazel_tools//tools/build_defs/repo:java.bzl", "java_import_external")
load("@io_bazel_rules_webtesting//web:web.bzl", "platform_archive")
load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.3.bzl", "browser_repositories")
load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.4.bzl", "browser_repositories")
load("//third_party:fonts.bzl", "tensorboard_fonts_workspace")
load("//third_party:python.bzl", "tensorboard_python_workspace")
load("//third_party:js.bzl", "tensorboard_js_workspace")
load("//third_party:python.bzl", "tensorboard_python_workspace")
load("//third_party:rust.bzl", "tensorboard_rust_workspace")

def tensorboard_workspace(name = ""):
Expand All @@ -41,78 +40,8 @@ def tensorboard_workspace(name = ""):
actual = "@com_github_grpc_grpc//src/compiler:grpc_python_plugin",
)

# We use our own browser definition based on the archives defined below, but
# this seems to be required by the rules_webtesting dependency.
browser_repositories(chromium = True)

# Chromium browser for multiple platforms, pinned to Chromium 84.0.4147.0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

browser_repositories already registers the Chrome 122 and 123 binaries for all platforms through browsers-0.3.4.bzl. These got removed because calling them after browser_repositories just overrides the newer 122/123 binaries with the old Chrome 84, so they silently downgrading the browser used in tests.

platform_archive(
name = "org_chromium_chromium_linux_x64",
licenses = ["notice"], # BSD 3-clause (maybe more?)
sha256 = "49b25bf32b797558eb7957ac7c60e065433bdef278f669291f71edd329505e27",
urls = [
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/768959/chrome-linux.zip",
],
named_files = {
"CHROMIUM": "chrome-linux/chrome",
},
)

platform_archive(
name = "org_chromium_chromium_macos",
licenses = ["notice"], # BSD 3-clause (maybe more?)
sha256 = "f0c7dc5c26061e2f179d1cb9819cb786d2c37cca9f53155e57ac2b6ab60c5cbc",
urls = [
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/768938/chrome-mac.zip",
],
named_files = {
"CHROMIUM": "chrome-mac/Chromium.app/Contents/MacOS/chromium",
},
)

platform_archive(
name = "org_chromium_chromium_windows",
licenses = ["notice"], # BSD 3-clause (maybe more?)
sha256 = "f441a079046a35afc249a95d29356f33945c0a60b59236b9cf6db532c69dba6f",
urls = [
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/768952/chrome-win.zip",
],
named_files = {
"CHROMIUM": "chrome-win/chrome.exe",
},
)

# Chromium webdriver for multiple platforms.
platform_archive(
name = "org_chromium_chromedriver_linux_x64",
licenses = ["reciprocal"], # BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like), Academic Free License v. 2.0, BSD 2-clause, MIT
sha256 = "71eafe087900dbca4bc0b354a1d172df48b31a4a502e21f7c7b156d7e76c95c7",
urls = [
"https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip",
],
named_files = {"CHROMEDRIVER": "chromedriver"},
)

platform_archive(
name = "org_chromium_chromedriver_macos",
licenses = ["reciprocal"], # BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like), Academic Free License v. 2.0, BSD 2-clause, MIT
sha256 = "fd32a27148f44796a55f5ce3397015c89ebd9f600d9dda2bcaca54575e2497ae",
urls = [
"https://chromedriver.storage.googleapis.com/2.41/chromedriver_mac64.zip",
],
named_files = {"CHROMEDRIVER": "chromedriver"},
)

platform_archive(
name = "org_chromium_chromedriver_windows",
licenses = ["reciprocal"], # BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like), Academic Free License v. 2.0, BSD 2-clause, MIT
sha256 = "a8fa028acebef7b931ef9cb093f02865f9f7495e49351f556e919f7be77f072e",
urls = [
"https://chromedriver.storage.googleapis.com/2.38/chromedriver_win32.zip",
],
named_files = {"CHROMEDRIVER": "chromedriver"},
)

java_import_external(
name = "org_apache_commons_lang3",
jar_sha256 = "de2e1dcdcf3ef917a8ce858661a06726a9a944f28e33ad7f9e08bea44dc3c230",
Expand Down
Loading
Loading