From f7761d536451bb126e5ef1f83104bf425eb38ebe Mon Sep 17 00:00:00 2001 From: Erik Luo Date: Mon, 18 Nov 2019 10:11:36 -0800 Subject: [PATCH 1/4] working on test --- .../components/tf_tensorboard/test/BUILD | 30 +++++++++++++++++++ .../components/tf_tensorboard/test/index.html | 30 ------------------- .../tf_tensorboard/test/tensorboardTests.ts | 15 +++++++--- .../{tensorboardTests.html => tests.html} | 11 ++++--- .../tf_tensorboard/tf-tensorboard.html | 4 ++- 5 files changed, 49 insertions(+), 41 deletions(-) create mode 100644 tensorboard/components/tf_tensorboard/test/BUILD delete mode 100644 tensorboard/components/tf_tensorboard/test/index.html rename tensorboard/components/tf_tensorboard/test/{tensorboardTests.html => tests.html} (83%) diff --git a/tensorboard/components/tf_tensorboard/test/BUILD b/tensorboard/components/tf_tensorboard/test/BUILD new file mode 100644 index 0000000000..cc1e7dcbf2 --- /dev/null +++ b/tensorboard/components/tf_tensorboard/test/BUILD @@ -0,0 +1,30 @@ +package( + default_testonly = True, + default_visibility = ["//tensorboard:internal"], +) + +load("//tensorboard/defs:web.bzl", "tf_web_library", "tf_web_test") + +licenses(["notice"]) # Apache 2.0 + +tf_web_test( + name = "test", + src = "/tf-tensorboard/test/tests.html", + web_library = ":test_web_library", +) + +tf_web_library( + name = "test_web_library", + srcs = [ + "autoReloadTests.ts", + "tensorboardTests.ts", + "tests.html", + ], + path = "/tf-tensorboard/test", + deps = [ + "//tensorboard/components:analytics", + "//tensorboard/components/tf_imports:polymer", + "//tensorboard/components/tf_imports:web_component_tester", + "//tensorboard/components/tf_tensorboard", + ], +) diff --git a/tensorboard/components/tf_tensorboard/test/index.html b/tensorboard/components/tf_tensorboard/test/index.html deleted file mode 100644 index d54f3b6d5b..0000000000 --- a/tensorboard/components/tf_tensorboard/test/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - diff --git a/tensorboard/components/tf_tensorboard/test/tensorboardTests.ts b/tensorboard/components/tf_tensorboard/test/tensorboardTests.ts index 5c8ca6e2ac..74f22a8790 100644 --- a/tensorboard/components/tf_tensorboard/test/tensorboardTests.ts +++ b/tensorboard/components/tf_tensorboard/test/tensorboardTests.ts @@ -13,6 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ namespace tf_tensorboard { + const {expect} = chai; + + declare function fixture(id: string): void; + describe('tf-tensorboard tests', () => { window.HTMLImports.whenReady(() => { let tensorboard: any; @@ -23,11 +27,14 @@ namespace tf_tensorboard { }); it('renders injected content', function() { - let injected = tensorboard.querySelector('#inject-me'); - chai.assert.isNotNull(injected); + let overview = tensorboard.querySelector('#custom-overview'); + expect(overview.assignedSlot.name).to.equal('injected-overview'); + + let headerItems = tensorboard.querySelector('#custom-header-items'); + expect(headerItems.assignedSlot.name).to.equal('injected-header-items'); }); - it('reloads the active dashboard on request', (done) => { + xit('reloads the active dashboard on request', (done) => { tensorboard.$.tabs.set('selected', 'scalars'); setTimeout(() => { let called = false; @@ -40,7 +47,7 @@ namespace tf_tensorboard { }); }); - describe('top right global icons', function() { + xdescribe('top right global icons', function() { it('Clicking the reload button will call reload', function() { let called = false; tensorboard.reload = function() { diff --git a/tensorboard/components/tf_tensorboard/test/tensorboardTests.html b/tensorboard/components/tf_tensorboard/test/tests.html similarity index 83% rename from tensorboard/components/tf_tensorboard/test/tensorboardTests.html rename to tensorboard/components/tf_tensorboard/test/tests.html index c8d9e02d7a..3f11975917 100644 --- a/tensorboard/components/tf_tensorboard/test/tensorboardTests.html +++ b/tensorboard/components/tf_tensorboard/test/tests.html @@ -19,19 +19,18 @@ - + -
+ Settings
- +