Skip to content

Commit

Permalink
Add some tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Aug 1, 2022
1 parent 50b32a6 commit 85520de
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 2 deletions.
56 changes: 55 additions & 1 deletion girder/test_girder/web_client_specs/imageViewerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Expand Down Expand Up @@ -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
Expand Down
56 changes: 56 additions & 0 deletions test/test_files/.large_image_config.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ description = Lint python code
skipsdist = true
skip_install = true
deps =
flake8
flake8-bugbear
flake8-docstrings
flake8-isort
Expand Down

0 comments on commit 85520de

Please sign in to comment.