Skip to content

Commit

Permalink
E2E minor fixes in Variant Browser, Header, Catalog browsers #411
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioaltamura committed Feb 16, 2022
1 parent 2377ace commit 0086f12
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 43 deletions.
6 changes: 3 additions & 3 deletions cypress/integration/003-header-bar-post-login.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ context("3 - Header bar (post-login): Checks each menu item in header-bar resolv
it("3.2 - checks Case Portal menu item", () => {
cy.get("a[data-id=clinicalAnalysisPortal]", {timeout: TIMEOUT}).click({force: true});
cy.get("div.page-title h2", {timeout: TIMEOUT}).should("be.visible").and("contain", "Case Portal");
checkResults("opencga-clinical-analysis-grid");
checkResults("clinical-analysis-grid");
});

it("3.3 - checks Sample Browser menu item", () => {
cy.get("a[data-id=sample]", {timeout: TIMEOUT}).click({force: true});
cy.get("div.page-title h2", {timeout: TIMEOUT}).should("be.visible").and("contain", "Sample Browser");
checkResults("opencga-sample-grid");
checkResults("sample-grid");
});

it("3.4 - checks Individual Browser menu item", () => {
Expand All @@ -56,7 +56,7 @@ context("3 - Header bar (post-login): Checks each menu item in header-bar resolv
it("3.5 - checks Family Browser menu item", () => {
cy.get("a[data-id=family]", {timeout: TIMEOUT}).click({force: true});
cy.get("div.page-title h2", {timeout: TIMEOUT}).should("be.visible").and("contain", "Family Browser"); // should assertion comes from Chai and it follows its logic
checkResultsOrNot("opencga-family-grid");
checkResultsOrNot("family-grid");
});

it("3.6 - checks study selector menu items", () => {
Expand Down
13 changes: 5 additions & 8 deletions cypress/integration/004-opencga-variant-browser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ context("4. Variant Browser", () => {
cy.get("variant-browser-grid .columns-toggle-wrapper ul li").and("have.length.gt", 1);

cy.get("variant-browser-grid .columns-toggle-wrapper ul li a").click({multiple: true, timeout: TIMEOUT}); // deactivate all the columns
cy.get("variant-browser-grid .bootstrap-table .fixed-table-container tr[data-index=0] > td", {timeout: TIMEOUT}).should("have.lengthOf", 1);
cy.get("variant-browser-grid .bootstrap-table .fixed-table-container tr[data-index=0] > td", {timeout: TIMEOUT}).should("have.lengthOf", 13); // we are hiding only the columns with rowspan=2

cy.get("variant-browser-grid .columns-toggle-wrapper ul li a").click({multiple: true, timeout: TIMEOUT}); // reactivate all the columns
cy.get("variant-browser-grid .bootstrap-table .fixed-table-container tr[data-index=0] > td", {timeout: TIMEOUT}).should("have.length.gt", 1);
cy.get("variant-browser-grid .bootstrap-table .fixed-table-container tr[data-index=0] > td", {timeout: TIMEOUT}).should("have.length.gt", 13);

});

Expand All @@ -60,17 +60,14 @@ context("4. Variant Browser", () => {
cy.get("input[data-cy='modal-filter-description']").type(randomString(3));
cy.get("button[data-cy='modal-filter-save-button']").click(); // confirm save

cy.get(".swal2-actions").contains(/Yes|OK/).click(); // dismiss notification (either new filter or overwrite a saved one)
cy.get("button[data-cy='filter-button']").click();
cy.contains(".notification-manager .alert", "Filter has been saved", {timeout: TIMEOUT}).should("be.visible");
cy.get("ul.saved-filter-wrapper").contains(name);
cy.get(`span.action-buttons i[data-cy=delete][data-filter-id='${name}']`).click();
cy.get(".swal2-title").contains("Are you sure?");
cy.get(".swal2-confirm").click(); // confirm deletion action

// cy.get(".swal2-content", {timeout: TIMEOUT}).contains("Filter has been deleted.");
// this selector doesn't work without .should("be.visible") assertion because it refers to the previous #swal2-content which has been detatched from DOM before
cy.contains(".swal2-content", "Filter has been deleted", {timeout: TIMEOUT}).should("be.visible");
cy.get(".swal2-confirm").click({force: true}); // dismiss confirmation modal
cy.contains(".notification-manager .alert", "Filter has been deleted", {timeout: TIMEOUT}).should("be.visible");
// cy.get(".swal2-confirm").click({force: true}); // dismiss confirmation modal
cy.get("opencga-active-filters button[data-filter-name='ct']").click();
});

Expand Down
20 changes: 10 additions & 10 deletions cypress/integration/007-opencga-sample-browser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,30 @@ context("7 - Sample Browser", () => {
cy.get("a[data-id=sample]", {timeout: TIMEOUT}).click({force: true});
cy.get("div.page-title h2", {timeout: TIMEOUT}).should("be.visible").and("contain", "Sample Browser");

checkResults("opencga-sample-grid");
getResult("opencga-sample-grid").then($text => {
checkResults("sample-grid");
getResult("sample-grid").then($text => {
selectToken("sample-id-autocomplete", $text);
});

cy.get(".lhs button[data-filter-name]").should("have.length", 1);
cy.get("div.search-button-wrapper button").click();
checkResults("opencga-sample-grid");
checkResults("sample-grid");

cy.get("#somatic + .subsection-content label").contains("True").click({force: true}); // setting filter Somatic = true

cy.get("opencga-active-filters button[data-filter-name='id']").click();
cy.get("opencga-active-filters button[data-filter-name='somatic']").click();
cy.get(".lhs button[data-filter-name]").should("have.length", 0);

checkResults("opencga-sample-grid");
changePage("opencga-sample-grid", 2);
checkResults("opencga-sample-grid");
changePage("opencga-sample-grid", 1);
checkResults("opencga-sample-grid");
checkResults("sample-grid");
changePage("sample-grid", 2);
checkResults("sample-grid");
changePage("sample-grid", 1);
checkResults("sample-grid");

dateFilterCheck("opencga-sample-grid");
dateFilterCheck("sample-grid");

annotationFilterCheck("opencga-sample-grid");
annotationFilterCheck("sample-grid");

});
it("7.2 - aggregated query", () => {
Expand Down
42 changes: 21 additions & 21 deletions cypress/integration/009-opencga-family-browser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,40 +28,40 @@ context("9 - Family Browser", () => {
cy.get("a[data-id=family]", {timeout: TIMEOUT}).click({force: true});
cy.get("div.page-title h2", {timeout: TIMEOUT}).should("be.visible").and("contain", "Family Browser");

checkResultsOrNot("opencga-family-grid");
checkResultsOrNot("family-grid");

hasResults("opencga-family-grid").then($bool => {
hasResults("family-grid").then($bool => {
if ($bool) {
// run other tests in case there are results
getResult("opencga-family-grid", 1).then($text => {
getResult("family-grid", 1).then($text => {
selectToken("family-id-autocomplete", $text);
cy.get(".lhs button[data-filter-name]").should("have.length", 1);
cy.get("div.search-button-wrapper button").click();
});
checkResults("opencga-family-grid");
checkResults("family-grid");
cy.get("opencga-active-filters button[data-filter-name='id']").click();

checkResults("opencga-family-grid");
getResult("opencga-family-grid", 3, 0, "html").then($html => {
checkResults("family-grid");
getResult("family-grid", 3, 0, "html").then($html => {
cy.wrap($html).get("span[data-cy]").then($text => {
cy.get(".subsection-content[data-cy=disorders] input").type($text.first().text() + "{enter}");
cy.get("div.search-button-wrapper button").click();
checkResults("opencga-family-grid");
checkResults("family-grid");
cy.get("opencga-active-filters button[data-filter-name='disorders']").click();
});
});
checkResults("opencga-family-grid");
changePage("opencga-family-grid", 2);
checkResults("opencga-family-grid");
changePage("opencga-family-grid", 1);
checkResults("opencga-family-grid");
checkResults("family-grid");
changePage("family-grid", 2);
checkResults("family-grid");
changePage("family-grid", 1);
checkResults("family-grid");

// sort id ASC
cy.get("opencga-family-grid table .th-inner.sortable").contains("Family").click();
checkResults("opencga-family-grid");
getResult("opencga-family-grid", 1, 0).then($f1 => {
getResult("opencga-family-grid", 1, 1).then($f2 => {
getResult("opencga-family-grid", 1, 2).then($f3 => {
cy.get("family-grid table .th-inner.sortable").contains("Family").click();
checkResults("family-grid");
getResult("family-grid", 1, 0).then($f1 => {
getResult("family-grid", 1, 1).then($f2 => {
getResult("family-grid", 1, 2).then($f3 => {
const sorted = [$f1, $f2, $f3];
sorted.sort();
expect(JSON.stringify([$f1, $f2, $f3]), "Families are sorted").to.be.equal(JSON.stringify(sorted));
Expand All @@ -71,8 +71,8 @@ context("9 - Family Browser", () => {
});
});

dateFilterCheck("opencga-family-grid");
annotationFilterCheck("opencga-family-grid");
dateFilterCheck("family-grid");
annotationFilterCheck("family-grid");
}
});
});
Expand All @@ -81,9 +81,9 @@ context("9 - Family Browser", () => {
cy.get("a[data-id=family]", {timeout: TIMEOUT}).click({force: true});
cy.get("div.page-title h2", {timeout: TIMEOUT}).should("be.visible").and("contain", "Family Browser");

checkResultsOrNot("opencga-family-grid");
checkResultsOrNot("family-grid");

hasResults("opencga-family-grid").then($bool => {
hasResults("family-grid").then($bool => {
if ($bool) {
// in case there are actually results, run the aggregated tests
cy.get("a[href='#facet_tab']").click({force: true});
Expand Down
3 changes: 2 additions & 1 deletion src/core/notification-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default class NotificationManager {

// Initialize notifications parent
this.parent = document.createElement("div");
this.parent.classList.add("notification-manager");
Object.assign(this.parent.style, {
"left": "50%",
"maxWidth": this.config.display?.width || "600px",
Expand Down Expand Up @@ -52,7 +53,7 @@ export default class NotificationManager {
${options.buttons && options.buttons?.length > 0 ? `
<div align="right" style="margin-top:12px;">
${options.buttons.map((button, index) => `
<button data-index="${index}" class="${buttonClass}">
<button data-index="${index}" class="${buttonClass}">
${button.text || ""}
</button>
`).join("")}
Expand Down

0 comments on commit 0086f12

Please sign in to comment.