Skip to content

Commit

Permalink
Merge branch 'd3bootstrap' into d3bootstrap_delsec branch, just updat…
Browse files Browse the repository at this point in the history
…ing to be able to further develop on delsec branch.
  • Loading branch information
jorisvanzundert committed Dec 18, 2023
2 parents 5fc3562 + ae4b375 commit e24f46a
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 144 deletions.
139 changes: 0 additions & 139 deletions frontend-e2e/cypress/e2e/_shared_variables.js

This file was deleted.

2 changes: 1 addition & 1 deletion frontend-e2e/cypress/e2e/guests_privileges.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ [email protected] (pw AdminPass) has one tradition
Verbum uncorrected, private
*/

import { test_traditions } from "./_shared_variables";
import test_traditions from '../fixtures/test_traditions.json';

beforeEach(() => {
cy.visit(`${Cypress.env('CY_STEMMAWEB_FRONTEND_URL')}/`);
Expand Down
2 changes: 1 addition & 1 deletion frontend-e2e/cypress/e2e/sections.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ reordering of sections. Functionalities to be tested:
*/

import { test_traditions } from './_shared_variables.js';
import test_traditions from '../fixtures/test_traditions.json';

beforeEach(() => {
cy.visit(`${Cypress.env('CY_STEMMAWEB_FRONTEND_URL')}/`);
Expand Down
65 changes: 63 additions & 2 deletions frontend-e2e/cypress/e2e/stemwebdialog.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,74 @@ Tests to add:
*/

import stemweb_algorithms from '../fixtures/stemweb_algorithms.json'
const len_stemweb_algorithms = stemweb_algorithms.length;

beforeEach(() => {
cy.visit(`${Cypress.env('CY_STEMMAWEB_FRONTEND_URL')}/`);
});

describe('Stemweb dialog should work properly', () => {
it.skip('under construction', () => {
// ...
it('under construction', () => {
// click on button "Run Stemweb" should open Stemweb dialog
cy.contains('Run Stemweb').click();
cy.get('stemmaweb-dialog .modal-content').as('stemwebmodal');
cy.get('@stemwebmodal').contains('Generate a Stemweb tree').should('be.visible');

// Dropdown should show names of Stemweb algorithms
// (currently: RHM, Neighbour Joining, and Neighbour Net, and Pars)
cy.get('@stemwebmodal').find('select>option')
.should('have.length', len_stemweb_algorithms) // number of options is ok
.each(($el, index, $list) => {
const optionText = $el.text().trim();
cy.get('@stemwebmodal').find('select').select(optionText); // click on optionText
cy.get('@stemwebmodal').find('select option:selected') // get the selected option
.invoke("text").then((txt) => {
const selected = txt.trim();
expect(selected).equal(optionText); // ok, desired option is selected
expect(optionText).equal(stemweb_algorithms[index].text); // and it matches the test data

// Click info badge ('i') should show description of algorithm
cy.get('@stemwebmodal').find('form').find('svg') // .its('length').then((len) => {cy.log(len)});
.should('have.length', 1)
.click();
cy.get('@stemwebmodal').find('#algorithm-info')
.invoke('html').then((innerHTML) => {
expect(innerHTML).equal(stemweb_algorithms[index].description);
});

// Click on RHM should reveal argument field 'Iterations'
if (optionText === 'RHM') {
cy.get('@stemwebmodal').find('#algorithm-args').find('#iterations_input').should('be.visible');
// Click on other algorithms should not show any argument fields
} else {
cy.get('@stemwebmodal').find('#algorithm-args').children().should('not.exist');
}
});
});

// Click on Cancel closes dialog
cy.get('@stemwebmodal').should('be.visible');
cy.get('@stemwebmodal').find('button').contains('Cancel').trigger('mouseover').click();
cy.get('@stemwebmodal').should('not.be.visible');

// Click on "Run" (not implemented yet, just closes dialog for now)
cy.contains('Run Stemweb').click();
cy.get('stemmaweb-dialog .modal-content').as('stemwebmodal');
cy.get('@stemwebmodal').contains('Generate a Stemweb tree').should('be.visible');
cy.get('@stemwebmodal').find('button').contains('Run').its('length').then((len) => {cy.log('length:' + len)});
cy.get('@stemwebmodal').find('button').contains('Run').trigger('mouseover').click();
cy.get('@stemwebmodal').should('not.be.visible'); // fuzzy

// Click on anywhere outside dialog closes dialog
cy.contains('Run Stemweb').click();
cy.get('stemmaweb-dialog .modal-content').as('stemwebmodal');
cy.get('@stemwebmodal').contains('Generate a Stemweb tree').should('be.visible');
cy.get('@stemwebmodal').closest("#modalDialog").then((elem) => {
cy.log("#modalDialog:", elem);
});
cy.get('@stemwebmodal').closest("#modalDialog").its('length').then((len) => {cy.log('length:' + len)}); // seems to help against fuzziness
cy.get('@stemwebmodal').closest("#modalDialog").trigger('mouseover', { 'timeout': 10000 }).click('left');
cy.get('@stemwebmodal').should('not.be.visible');
});
});
2 changes: 1 addition & 1 deletion frontend-e2e/cypress/e2e/traditions.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Cypress tests to be added:
*/

import { test_traditions } from './_shared_variables.js';
import test_traditions from '../fixtures/test_traditions.json';

beforeEach(() => {
cy.visit(`${Cypress.env('CY_STEMMAWEB_FRONTEND_URL')}/`);
Expand Down
22 changes: 22 additions & 0 deletions frontend-e2e/cypress/fixtures/stemweb_algorithms.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"value" : "2",
"text" : "RHM",
"description" : "The Roos-Heikkila-Myllymaki (RHM) method is similar to the maximum parsimony method. Both of them optimize a bifurcating tree structure to minimize a cost function. In RHM, the cost function is based on data compression which measures not only whether two variants are the same or not but also how different they are. The comparison is done in blocks of about ten words, which implies that change of word order is also handled in a sensible way: a change in word order will typically result in a smaller cost than changing the words into completely new ones. Because the comparison is based on the actual words, RHM requires that the actual text versions are given as the input in CSV (comma-separated values) format. RHM utilizes a stochastic search technique to minimize the cost of the stemma. The search procedure may easily get stuck in a suboptimal stemma unless the number of iterations is large enough. The best way to find out whether the number of iterations is large enough is to run RHM several times and to see if the resulting stemmata are similar or not. If not, it usually helps to increase the number of iterations. Note that it is often not possible to obtain identical stemmata in every run even if the number of iterations is very large."
},
{
"value" : "3",
"text" : "Neighbour Joining",
"description" : "Neighbor-Joining (NJ) is a classical phylogenetic algorithm which operates in a bottom-up fashion, combining at each step two taxa or groups of taxa. Choosing which groups of taxa to combine is based on distances between the taxa. NJ is very fast and it is guaranteed to converge to the true underlying phylogenetic tree (or stemma) if one exists as the length of the sequences (or texts) increases. However, in practice it is often slightly less accurate than, for instance, maximum parsimony or RHM. Note that the version implemented in this server takes as input a set of sequences in Nexus format and computes their pairwise distances using Hamming distance (the number of differences divided by the length of the sequences). This may or may not be desirable. If another distance is preferred, or if for instance, a so called Jukes-Cantor correction is called for, it is necessary to use some other tools. NJ is available in most phylogenetic software tools."
},
{
"value" : "4",
"text" : "Neighbour Net",
"description" : "Neighbour Net algorithm"
},
{
"value" : "100",
"text" : "Pars",
"description" : "The program \"pars\", from the Phylip bio-statistical software package, produces a maximum-parsimony distance tree of the witnesses. More information on maximum parsimony can be found <a href=\"https://wiki.hiit.fi/display/stemmatology/Maximum+parsimony\">here</a>. Please note that Phylip \"pars\" only supports a maximum of eight variants readings in any one variant location in the text. If your text displays more divergence than this at any point, please consider disregarding orthographic and spelling variation below, or use one of the other algorithms."
}
]
126 changes: 126 additions & 0 deletions frontend-e2e/cypress/fixtures/test_traditions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
[
{ "title" : "Notre besoin",
"filetype" : "stemmaweb",
"owner" : "[email protected]",
"language" : "French",
"access" : "Public",
"sectionscount" : 1,
"sections" : [
{ "name" : "DEFAULT",
"language" : "French"
}
],
"direction" : "Left to Right",
"witnesses" : ["A", "B", "C", "D", "F", "J", "L", "M", "S", "T1", "T2", "U", "V"],
"stemmata" : [
"Stemweb stemma",
"Stemweb stemma duplicate"
]
},
{ "title" : "Florilegium \"Coislinianum B\"",
"filetype" : "csv",
"owner" : "[email protected]",
"language" : "Greek",
"access" : "Private",
"sectionscount" : 3,
"sections" : [
{ "name" : "section 'w'",
"language" : "Greek"
},
{ "name" : "section 'x'",
"language" : "Greek"
},
{ "name" : "section 'y'",
"language" : "Greek"
}
],
"direction" : "Left to Right",
"witnesses" : ["A", "B", "C", "D", "E", "F", "G", "H", "K", "P", "Q", "S", "T"],
"stemmata" : [
"stemma of Tomas"
]
},
{ "title" : "Legend's fragment",
"filetype" : "stemmaweb",
"owner" : "[email protected]",
"language" : "Latin",
"access" : "Private",
"sectionscount" : 2,
"sections" : [
{ "name" : "DEFAULT",
"language" : "Latin"
},
{ "name" : "section 2",
"language" : "Latin"
}
],
"direction" : "Left to Right",
"witnesses" : ["A", "Ab", "B", "BA", "BL", "BLu", "BS", "BSt", "BU", "Bc", "C", "Dr", "Ef", "F", "G", "Gh", "H", "Ho", "JG", "K", "L", "Li", "M", "MN", "N", "O", "P", "Q", "S", "Sk", "St", "T", "U", "V", "Vg", "X", "Y"],
"stemmata" : []
},

{ "title" : "Ժամանակագրութիւն checked",
"filetype" : "graphml",
"owner" : "[email protected]",
"language" : "Armenian",
"access" : "Private",
"sectionscount" : 1,
"sections" : [
{ "name" : "milestone-401",
"language" : "Armenian"
}
],
"direction" : "Left to Right",
"witnesses" : ["A", "B", "Bz430", "Bz644", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M1775", "M2855", "M2899", "M3380", "M6605", "M6686", "M8232", "O", "V", "W", "W243", "W246", "X", "Y", "Z"],
"stemmata" : [
"First attempt",
"RHM 1641561271_0"
]
},
{ "title" : "John verse",
"filetype" : "stemmaweb",
"owner" : "[email protected]",
"language" : "Greek",
"access" : "Public",
"sectionscount" : 1,
"sections" : [
{ "name" : "DEFAULT",
"language" : "Greek"
}
],
"direction" : "Left to Right",
"witnesses" : ["P60", "P66", "base", "w1", "w11", "w13", "w17", "w19", "w2", "w21", "w211", "w22", "w28", "w290", "w3", "w30", "w32", "w33", "w34", "w36", "w37", "w38", "w39", "w41", "w44", "w45", "w54", "w7"],
"stemmata" : []
},
{ "title" : "Arabic snippet",
"filetype" : "csv",
"owner" : "[email protected]",
"language" : "Arabic",
"access" : "Private",
"sectionscount" : 1,
"sections" : [
{ "name" : "DEFAULT",
"language" : "Arabic"
}
],
"direction" : "Right to Left",
"witnesses" : ["A", "B"],
"stemmata" : []
},

{ "title" : "Verbum uncorrected",
"filetype" : "stemmaweb",
"owner" : "[email protected]",
"language" : "Latin",
"access" : "Private",
"sectionscount" : 1,
"sections" : [
{ "name" : "DEFAULT",
"language" : "Latin"
}
],
"direction" : "Left to Right",
"witnesses" : ["Ba96", "Er16", "Go325", "Gr314", "Kf133", "Kr185", "Kr299", "Mü11475", "Mü22405", "Mü28315", "MüU151", "Sg524", "Wi3818"],
"stemmata" : []
}
]

0 comments on commit e24f46a

Please sign in to comment.