diff --git a/DEVELOP.md b/DEVELOP.md index 09baa07..3154bce 100644 --- a/DEVELOP.md +++ b/DEVELOP.md @@ -161,24 +161,6 @@ e.g. `./tests/pdifftests/run.sh -d chrome` to run with the Chrome driver, or `./tests/pdifftests/run.sh -c examine -f base` to filter the tests to those in the 'examine' class with 'base' in their name. -Depnding on your version of firefox, you may find it useful to specify the path -to the binary you'd like the tests to run on with `--firefox-path` (you can also -set this in `.seltestrc`, see -[the github page for seltest](https://github.com/ihodes/seltest)). - -Our tests are generated with Firefox -[release 34](https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/34.0/), on -OSX. You can download this, save it somewhere (maybe in your virtualenv folder), -and then point `seltest` to it like so, in `~/.seltestrc`: - -``` -[arguments] ---firefox-path=~/directory/to/Firefox.app/Contents/MacOS/firefox-bin -``` - -Be sure to turn off auto-update in Firefox preferences if you plan on opening -it. Seltest will automatically disable updates when running tests. - To determine whether there are any pixels that have changed before/after, and to generate a perceptual diff that will make it clear where the changes are, you can use [webdiff](https://github.com/danvk/webdiff): `git webdiff`. diff --git a/cycledash/static/js/examine/RecordStore.js b/cycledash/static/js/examine/RecordStore.js index cf44e5a..ed07ff5 100644 --- a/cycledash/static/js/examine/RecordStore.js +++ b/cycledash/static/js/examine/RecordStore.js @@ -114,7 +114,7 @@ function createRecordStore(run, igvHttpfsUrl, dispatcher, opt_testDataSource) { // Required: lets the dispatcher know that the Store is done processing. return true; } - if (dispatcher) dispatcherToken = dispatcher.register(receiver); + if (dispatcher) dispatcherToken = dispatcher.register(receiver); /** * Queries the backend for the set of genotypes matching the current @@ -122,7 +122,7 @@ function createRecordStore(run, igvHttpfsUrl, dispatcher, opt_testDataSource) { * * NB: mutates store state! */ - function _updateGenotypes({append}) { + function updateGenotypes({append}) { // Example query: // {"range": {"contig": 1, "start": 800000, "end": 2000000}, // "sortBy": [{"columnName": "sample:DP", "order": "desc"}, @@ -154,9 +154,6 @@ function createRecordStore(run, igvHttpfsUrl, dispatcher, opt_testDataSource) { notifyChange(); // notify of pending request deferredGenotypes(vcfId, query) .done(response => { - if (!_.isEqual(currentPendingQuery, query)) { - return; // A subsequent request has superceded this one. - } if (append) { _.extend(keyToRecordIndex, generateKeyToRecordIndex(response.records, records.length)); @@ -180,8 +177,6 @@ function createRecordStore(run, igvHttpfsUrl, dispatcher, opt_testDataSource) { notifyChange(); }); } - var updateGenotypes = - _.debounce(_.throttle(_updateGenotypes, 500 /* ms */), 500 /* ms */); // Ignore all currently pending requests (presumably because there's a newer one). function ignorePendingRequests() { @@ -426,8 +421,7 @@ function createRecordStore(run, igvHttpfsUrl, dispatcher, opt_testDataSource) { } } - // There's no need to debounce this update -- make it so now! - _updateGenotypes({append: false}); + updateGenotypes({append: false}); getComments(); function notifyChange() { diff --git a/tests/pdifftests/README.md b/tests/pdifftests/README.md index 4b15c22..76a946a 100644 --- a/tests/pdifftests/README.md +++ b/tests/pdifftests/README.md @@ -1,14 +1,15 @@ -Notes on working with image diff tests --------------------------------------- +Notes on working with perceptual diff tests +------------------------------------------- -There are some notes in [DEVELOP.md](/DEVELOP.md) about how to run the dpxdt tests to -check for changes. This document describes how to update and extend them. +There are some notes in [DEVELOP.md](/DEVELOP.md) about how to run the +perceptual diff tests to check for changes. This document describes how to +update and extend them. CycleDash requires a PostgreSQL database to run, and a rabbitmq workqueue to process new inputs. For the tests to be reproducible, it needs its own instances of each of these. -You must have postgres running to update the dpxdt tests, e.g. by running: +You must have Postgres running to update the tests, e.g. by running: postgres -D /usr/local/var/postgres diff --git a/tests/pdifftests/images/examine_bad-query.png b/tests/pdifftests/images/examine_bad-query.png index 5afbaec..0078701 100644 Binary files a/tests/pdifftests/images/examine_bad-query.png and b/tests/pdifftests/images/examine_bad-query.png differ diff --git a/tests/pdifftests/images/examine_base.png b/tests/pdifftests/images/examine_base.png index eedf792..65c640b 100644 Binary files a/tests/pdifftests/images/examine_base.png and b/tests/pdifftests/images/examine_base.png differ diff --git a/tests/pdifftests/images/examine_comments-edit.png b/tests/pdifftests/images/examine_comments-edit.png index b2e641e..4674fea 100644 Binary files a/tests/pdifftests/images/examine_comments-edit.png and b/tests/pdifftests/images/examine_comments-edit.png differ diff --git a/tests/pdifftests/images/examine_comments-view.png b/tests/pdifftests/images/examine_comments-view.png index b4a4cc5..3ec079f 100644 Binary files a/tests/pdifftests/images/examine_comments-view.png and b/tests/pdifftests/images/examine_comments-view.png differ diff --git a/tests/pdifftests/images/examine_filter.png b/tests/pdifftests/images/examine_filter.png index 4a7c673..f5a384c 100644 Binary files a/tests/pdifftests/images/examine_filter.png and b/tests/pdifftests/images/examine_filter.png differ diff --git a/tests/pdifftests/images/examine_sorted.png b/tests/pdifftests/images/examine_sorted.png index eedf792..d8873fd 100644 Binary files a/tests/pdifftests/images/examine_sorted.png and b/tests/pdifftests/images/examine_sorted.png differ diff --git a/tests/pdifftests/images/examine_tooltip.png b/tests/pdifftests/images/examine_tooltip.png index dd1b537..c8c11e4 100644 Binary files a/tests/pdifftests/images/examine_tooltip.png and b/tests/pdifftests/images/examine_tooltip.png differ diff --git a/tests/pdifftests/images/examine_validation.png b/tests/pdifftests/images/examine_validation.png index e21692a..6d41909 100644 Binary files a/tests/pdifftests/images/examine_validation.png and b/tests/pdifftests/images/examine_validation.png differ diff --git a/tests/pdifftests/images/runs_info.png b/tests/pdifftests/images/runs_info.png index c686d2e..9a6ea83 100644 Binary files a/tests/pdifftests/images/runs_info.png and b/tests/pdifftests/images/runs_info.png differ diff --git a/tests/pdifftests/images/runs_page.png b/tests/pdifftests/images/runs_page.png index 0701387..af156ae 100644 Binary files a/tests/pdifftests/images/runs_page.png and b/tests/pdifftests/images/runs_page.png differ diff --git a/tests/pdifftests/images/website_comments.png b/tests/pdifftests/images/website_comments.png index 875a0a5..e1e596f 100644 Binary files a/tests/pdifftests/images/website_comments.png and b/tests/pdifftests/images/website_comments.png differ diff --git a/tests/pdifftests/run.sh b/tests/pdifftests/run.sh index 9e2333f..1edfdae 100755 --- a/tests/pdifftests/run.sh +++ b/tests/pdifftests/run.sh @@ -1,8 +1,15 @@ -#!/usr/bin/env sh +#!/bin/bash + source tests/ENV.sh + python run.py > tests/pdifftests/log.txt 2>&1 & RUN_PID=$! echo pid of test server is $RUN_PID echo logging to tests/pdifftests/log.txt + +function finish { + kill $RUN_PID +} +trap finish EXIT + sel update -b phantomjs -o tests/pdifftests/images "$@" tests/pdifftests -kill $RUN_PID diff --git a/tests/pdifftests/test.py b/tests/pdifftests/test.py index fda021d..877f3cc 100644 --- a/tests/pdifftests/test.py +++ b/tests/pdifftests/test.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from seltest import url, waitfor, Base +from seltest import url, waitfor, dontwaitfor, Base from selenium.webdriver.support.ui import Select from selenium.webdriver.common.action_chains import ActionChains @@ -45,6 +45,7 @@ def bams(self, driver): class Examine(Base): window_size = [1280, 800] base_url = BASE + '/runs/1/examine' + wait_for = {'css_selector': '.query-status', 'classes': ['good']} def base(self, driver): """Initial view of a fully-loaded Examine page.""" @@ -59,7 +60,7 @@ def sorted(self, driver): @waitfor('[data-attribute="info:DP"] .tooltip') def tooltip(self, driver): """Examine page showing a Normal Read Depth tooltip.""" - dp = driver.find_element_by_css_selector('[data-attribute="info:DP"]') + dp = driver.find_element_by_css_selector('[data-attribute="sample:RD"]') hover = ActionChains(driver).move_to_element(dp) hover.perform() @@ -81,6 +82,8 @@ def comments_edit(self, driver): assert btn.text.lower() == 'edit' btn.click() + @dontwaitfor('.query-status') + @waitfor('.query-status', classes=['bad']) def bad_query(self, driver): """Examine page showing a poorly formed query.""" input = driver.find_element_by_css_selector('input[type="text"].tt-input')