Skip to content

Commit

Permalink
Merge pull request #572 from VirtualFlyBrain/development
Browse files Browse the repository at this point in the history
Many test fixes and a loading without template fix for dual alignment
  • Loading branch information
Robbie1977 authored May 28, 2020
2 parents c88dd34 + 4ee6b39 commit 9c432fa
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ARG geppettoDatasourceRelease=development
ARG geppettoModelSwcRelease=v1.0.1
ARG geppettoFrontendRelease=VFBv2.1.0.3
ARG geppettoClientRelease=VFBv2.1.0.6
ARG ukAcVfbGeppettoRelease=v2.1.0.3
ARG ukAcVfbGeppettoRelease=development

ARG mvnOpt="-Dhttps.protocols=TLSv1.2 -DskipTests --quiet -Pmaster"

Expand Down
9 changes: 5 additions & 4 deletions tests/jest/vfb/3d-viewer-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const puppeteer = require('puppeteer');
const { TimeoutError } = require('puppeteer/Errors');

import { getUrlFromProjectId } from './cmdline.js';
import { wait4selector, click, closeModalWindow} from './utils';
import { wait4selector, click, closeModalWindow, flexWindowClick} from './utils';
import * as ST from './selectors';

const baseURL = process.env.url || 'http://localhost:8080/org.geppetto.frontend';
Expand Down Expand Up @@ -39,7 +39,7 @@ describe('VFB 3D Viewer Component Tests', () => {
})

it('Term info component created after load', async () => {
await wait4selector(page, 'div#VFBTermInfo_el_0_component', { visible: true })
await wait4selector(page, 'div#VFBTermInfo_el_0_component', { visible: true, timeout : 120000 })
})

// it('Hide Quick Help Modal Window', async () => {
Expand Down Expand Up @@ -108,8 +108,9 @@ describe('VFB 3D Viewer Component Tests', () => {
// There's 4 div elements with same class (slice viewer, 3d viewer, term info and tree browser), since the 3D Viewer
// was previously minimized and maximized it should now occupy the third position
await page.evaluate(async () => {
let flexComponents = document.getElementsByClassName("flexlayout__tab_button_trailing").length;
document.getElementsByClassName("flexlayout__tab_button_trailing")[flexComponents-1].click();
flexWindowClick("3D Viewer","flexlayout__tab_button_trailing");
//let flexComponents = document.getElementsByClassName("flexlayout__tab_button_trailing").length;
//document.getElementsByClassName("flexlayout__tab_button_trailing")[flexComponents-1].click();
});
expect(
await page.evaluate(async () => document.getElementById("CanvasContainer_component"))
Expand Down
2 changes: 1 addition & 1 deletion tests/jest/vfb/menu-component-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('VFB Menu Component Tests', () => {
it('All Available Datasets Opens', async () => {
await page.evaluate(async () => document.getElementById("All Available Datasets").click());
// Wait for results to appear, this means datasets were returned
await wait4selector(page, 'tbody > .standard-row:nth-child(1) > .query-results-name-column > div > a', { visible: true , timeout : 10000});
await wait4selector(page, 'tbody > .standard-row:nth-child(1) > .query-results-name-column > div > a', { visible: true , timeout : 500000});
})

it('Term info correctly populated with dataset after query results clicked', async () => {
Expand Down
10 changes: 5 additions & 5 deletions tests/jest/vfb/query-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as ST from './selectors';
const baseURL = process.env.url || 'http://localhost:8080/org.geppetto.frontend';
const PROJECT_URL = baseURL + "/geppetto?i=VFB_00017894";

const QUERY_TRIGGER_URL = baseURL + "/geppetto?id=VFB_00000001&i=VFB_00017894&q=FBbt_00003678,neuronspostsynaptic"
const QUERY_TRIGGER_URL = baseURL + "/geppetto?id=VFB_00000001&i=VFB_00017894,VFB_00000001&q=FBbt_00003678,neuronspostsynaptic"

/**
* Tests query panel component by searching for 'medu' and running query on it
Expand Down Expand Up @@ -42,7 +42,7 @@ describe('VFB Query Component Tests', () => {
})

it('Term info component created after load', async () => {
await wait4selector(page, 'div#VFBTermInfo_el_0_component', { visible: true })
await wait4selector(page, 'div#VFBTermInfo_el_0_component', { visible: true, timeout : 120000 })
})

// it('Hide Quick Help Modal Window', async () => {
Expand All @@ -58,12 +58,12 @@ describe('VFB Query Component Tests', () => {
//Tests running query 'medu' in the query panel
describe('Test Query Panel', () => {
it('Query builder button appeared', async () => {
await wait4selector(page, 'i.fa-quora', { visible: true })
await wait4selector(page, 'i.fa-quora', { visible: true, timeout : 120000 })
})

it('Query builder is visible', async () => {
await click(page, 'i.fa-quora');
await wait4selector(page, '#querybuilder', { visible: true })
await wait4selector(page, '#querybuilder', { visible: true, timeout : 120000 })
})

it('Typing medu in the query builder search bar', async () => {
Expand Down Expand Up @@ -146,7 +146,7 @@ describe('Test URL Trigger Query Builder', () => {
describe('Query Results Component Trigger by URL', () => {
it('Query builder is visible', async () => {
await click(page, 'i.fa-quora');
await wait4selector(page, '#querybuilder', { visible: true })
await wait4selector(page, '#querybuilder', { visible: true, timeout : 120000 })
})

it('Result "EB-IDFP VSB-PB slice 4 glomerulus neuron" present in the query builder', async () => {
Expand Down
15 changes: 8 additions & 7 deletions tests/jest/vfb/slice-viewer-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const puppeteer = require('puppeteer');
const { TimeoutError } = require('puppeteer/Errors');

import { getUrlFromProjectId } from './cmdline.js';
import { wait4selector, click, closeModalWindow } from './utils';
import { wait4selector, click, closeModalWindow, flexWindowClick } from './utils';
import * as ST from './selectors';

const baseURL = process.env.url || 'http://localhost:8080/org.geppetto.frontend';
Expand Down Expand Up @@ -40,7 +40,7 @@ describe('VFB Slice Viewer Component Tests', () => {
})

it('Term info component created after load', async () => {
await wait4selector(page, 'div#VFBTermInfo_el_1_component', { visible: true })
await wait4selector(page, 'div#VFBTermInfo_el_0_component', { visible: true , timeout : 120000 })
})

// it('Hide Quick Help Modal Window', async () => {
Expand All @@ -62,12 +62,12 @@ describe('VFB Slice Viewer Component Tests', () => {
//Opens query panel and runs query for 'medu'. This will be used later to test stack viewer got a new mesh as a result of this query run
describe('Test Query Panel', () => {
it('Query builder button appeared', async () => {
await wait4selector(page, 'i.fa-quora', { visible: true })
await wait4selector(page, 'div.focusTermDivR i.fa-quora', { visible: true, timeout : 120000 })
})

it('Query builder is visible', async () => {
await click(page, 'i.fa-quora');
await wait4selector(page, '#querybuilder', { visible: true })
await click(page, 'div.focusTermDivR i.fa-quora');
await wait4selector(page, '#querybuilder', { visible: true, timeout : 120000 })
})

it('Typing medu in the query builder search bar', async () => {
Expand Down Expand Up @@ -214,8 +214,9 @@ describe('VFB Slice Viewer Component Tests', () => {
// There's 3 div elements with same class (slice viewer, 3d viewer and term info), since the Slice Viewer
// was previously minimized and maximized it should now occupy the third position
await page.evaluate(async () =>{
let flexComponents = document.getElementsByClassName("flexlayout__tab_button_trailing").length;
document.getElementsByClassName("flexlayout__tab_button_trailing")[flexComponents-1].click();
flexWindowClick("Slice Viewer", "flexlayout__tab_button_trailing");
//let flexComponents = document.getElementsByClassName("flexlayout__tab_button_trailing").length;
//document.getElementsByClassName("flexlayout__tab_button_trailing")[flexComponents-1].click();
});
expect(
await page.evaluate(async () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/jest/vfb/term-info-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const puppeteer = require('puppeteer');
const { TimeoutError } = require('puppeteer/Errors');

import { getUrlFromProjectId } from './cmdline.js';
import { wait4selector, click , closeModalWindow} from './utils';
import { wait4selector, click , closeModalWindow, flexWindowClick} from './utils';
import * as ST from './selectors';

const baseURL = process.env.url || 'http://localhost:8080/org.geppetto.frontend';
Expand Down Expand Up @@ -96,7 +96,7 @@ describe('VFB Term Info Component Tests', () => {
})
it('Term info closed', async () => {
// There's 4 div elements with same class (slice viewer, 3d viewer, term info and tree browser), the forth one belongs to the term info
await page.evaluate(async () => document.getElementsByClassName("flexlayout__tab_button_trailing")[2].click());
await flexWindowClick("Term Info","flexlayout__tab_button_trailing");
await wait4selector(page, '#vfbterminfowidget', { visible: false, timeout : 5000})
})

Expand Down
2 changes: 1 addition & 1 deletion tests/jest/vfb/tree-browser-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('VFB Tree Browser Component Tests', () => {
it('Click on "eye" icon to render "adult cerebral ganglion" mesh', async () => {
await click(page, '#VFBTree_component i.fa-eye');
// Wait for 'color picker' selector to show, this is the sign that the click on the eye button worked and the mesh was rendered
await wait4selector(page, 'i.fa-tint', { visible: true, timeout : 500000 })
await wait4selector(page, '#VFBTree_component i.fa-tint', { visible: true, timeout : 500000 })
})

it('Mesh for "adult cerebral ganglion" rendered in canvas after clicking on eye icon next to node', async () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/jest/vfb/url-params-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const neuronTest = function(project){
})

it('Term info component created after load', async () => {
await wait4selector(page, 'div#VFBTermInfo_el_0_component', { visible: true})
await wait4selector(page, 'div#VFBTermInfo_el_0_component', { visible: true, timeout : 120000})
})

it('Term info component correctly populated with "fru-M-200266 (VFB_00000001)" as Name', async () => {
Expand Down Expand Up @@ -151,7 +151,7 @@ describe('VFB URL Parameters id= and i= Tests', () => {
//Tests metadata in term info component and clicking on links
describe('Test Term Info Component', () => {
it('Term info component created after load', async () => {
await wait4selector(page, 'div#VFBTermInfo_el_0_component', { visible: true , timeout : 120000 })
await wait4selector(page, 'div#VFBTermInfo_el_0_component', { visible: true , timeout : 240000 })
})

it('Term info component correctly populated with "adult gnathal ganglion" as Name', async () => {
Expand Down
12 changes: 11 additions & 1 deletion tests/jest/vfb/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const wait4selector = async (page, selector, settings = {}) => {


export const click = async (page, selector) => {
await wait4selector(page, selector, { visible: true, timeout: 1000});
await wait4selector(page, selector, { visible: true, timeout: 100000});
let success = undefined;
try {
await page.evaluate((selector) => document.querySelector(selector).click(), selector);
Expand All @@ -35,4 +35,14 @@ export const closeModalWindow = async (page) => {
var evt = new KeyboardEvent('keydown', {'keyCode':27, 'which':27});
document.dispatchEvent (evt);
});
}

export const flexWindowClick = async (title, selector) => {
var i;
for (i = 0; i < document.getElementsByClassName("flexlayout__tab_button_content").length; i++) {
if (document.getElementsByClassName("flexlayout__tab_button_content")[i].innerText == title) {
document.getElementsByClassName(selector)[i].click();
break;
}
}
}

0 comments on commit 9c432fa

Please sign in to comment.