From 85520de14e5d626ab3861708e4891f3ff62c4da3 Mon Sep 17 00:00:00 2001 From: David Manthey Date: Fri, 29 Jul 2022 16:47:53 -0400 Subject: [PATCH] Add some tests. --- .../web_client_specs/imageViewerSpec.js | 56 ++++++++++++++++++- test/test_files/.large_image_config.yaml | 56 +++++++++++++++++++ tox.ini | 1 - 3 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 test/test_files/.large_image_config.yaml diff --git a/girder/test_girder/web_client_specs/imageViewerSpec.js b/girder/test_girder/web_client_specs/imageViewerSpec.js index ca9b96962..4b282e705 100644 --- a/girder/test_girder/web_client_specs/imageViewerSpec.js +++ b/girder/test_girder/web_client_specs/imageViewerSpec.js @@ -25,7 +25,7 @@ $(function () { describe('test accessing a multi-frame image', function () { it('go to users page', girderTest.goToUsersPage()); - it('Got to a user page and then the Public folder', function () { + it('Go to a user page and then the Public folder', function () { runs(function () { $('a.g-user-link').trigger('click'); }); @@ -186,6 +186,60 @@ $(function () { girderTest.waitForLoad(); }); }); + describe('test metadata in item lists', function () { + it('go to users page', girderTest.goToUsersPage()); + it('Go to a user page and then the Public folder', function () { + runs(function () { + $('a.g-user-link').trigger('click'); + }); + waitsFor(function () { + return ( + $('button:contains("Actions")').length === 1 && + $('a.g-folder-list-link:contains(Public):visible').length === 1); + }, 'user page to appear'); + runs(function () { + $('a.g-folder-list-link:contains(Public)').trigger('click'); + }); + waitsFor(function () { + return $('.g-folder-actions-button:visible').length === 1; + }, 'the folder to appear'); + girderTest.waitForLoad(); + }); + it('test the metadata columns are not shown', function () { + runs(function () { + expect($('.large_image_container').length).toBeGreaterThan(0); + expect($('.large_image_thumbnail').length).toBeGreaterThan(0); + expect($('.li-column-metadata').length).toBe(0); + }); + }); + it('upload test file', function () { + girderTest.waitForLoad(); + runs(function () { + $('.g-folder-list-link:first').click(); + }); + girderTest.waitForLoad(); + runs(function () { + girderTest.binaryUpload('${large_image}/../../test/test_files/.large_image_config.yaml'); + }); + girderTest.waitForLoad(); + }); + it('test the metadata columns is shown', function () { + runs(function () { + expect($('.large_image_container').length).toBe(0); + expect($('.large_image_thumbnail').length).toBeGreaterThan(0); + expect($('.li-column-metadata').length).toBeGreaterThan(0); + }); + }); + it('navigate back to image', function () { + waitsFor(function () { + return $('a.g-item-list-link').filter(function () { return $(this).text() !== '.large_image_config.yaml'}).length > 0; + }, 'link to appear'); + runs(function () { + $('a.g-item-list-link').filter(function () { return $(this).text() !== '.large_image_config.yaml'}).click(); + }); + girderTest.waitForLoad(); + }); + }); describe('Image Viewer selection', function () { var viewers = [], jQuery; // use the original jQuery diff --git a/test/test_files/.large_image_config.yaml b/test/test_files/.large_image_config.yaml new file mode 100644 index 000000000..9f5012ef1 --- /dev/null +++ b/test/test_files/.large_image_config.yaml @@ -0,0 +1,56 @@ +access: + # Show to user and higher + user: + # itemList adjustments + itemList: + # Show these columns + columns: + - + type: image + value: thumbnail + title: Thumbnail + - + type: image + value: label + title: Label + - + type: image + value: macro + title: Macro + - + type: record + value: name + - + type: metadata + value: Stain + format: text + - + type: metadata + value: Classification + format: number + - + type: metadata + value: gloms.length + - + type: record + value: size + - + type: record + value: controls + itemListDialog: + # Show these columns + columns: + - + type: image + value: thumbnail + title: Thumbnail + - + type: record + value: name + - + type: metadata + value: Stain + format: text + - + type: record + value: size diff --git a/tox.ini b/tox.ini index c84007afd..8900894f1 100644 --- a/tox.ini +++ b/tox.ini @@ -93,7 +93,6 @@ description = Lint python code skipsdist = true skip_install = true deps = - flake8 flake8-bugbear flake8-docstrings flake8-isort