diff --git a/ckan-backend-dev/src/ckanext-wri/ckanext/wri/logic/action/get.py b/ckan-backend-dev/src/ckanext-wri/ckanext/wri/logic/action/get.py index 5b81b4cf..2a79d165 100644 --- a/ckan-backend-dev/src/ckanext-wri/ckanext/wri/logic/action/get.py +++ b/ckan-backend-dev/src/ckanext-wri/ckanext/wri/logic/action/get.py @@ -992,7 +992,7 @@ def recurcive_tree_ids(org, group_hierarchy_ids=[],): group_tree["highlighted"] = False group_hierarchy_ids += recurcive_tree_ids(group_tree) - if not context['user'] and group_tree["name"] in private_orgs: + if not context['user'] and (private_orgs and group_tree["name"] in private_orgs): continue results.append(group_tree) return results diff --git a/e2e-tests/cypress/e2e/private_teams.cy.js b/e2e-tests/cypress/e2e/private_teams.cy.js index 09022663..2648d6c7 100644 --- a/e2e-tests/cypress/e2e/private_teams.cy.js +++ b/e2e-tests/cypress/e2e/private_teams.cy.js @@ -9,6 +9,10 @@ const normalUserPassword = "test1234"; const parentOrg = `${uuid()}${Cypress.env("ORG_NAME_SUFFIX")}`; const org = `${uuid()}${Cypress.env("ORG_NAME_SUFFIX")}`; +Cypress.on("uncaught:exception", (err, runnable) => { + console.log(err); + return false; +}); describe("Create and edit team", () => { before(() => { @@ -35,6 +39,8 @@ describe("Create and edit team", () => { cy.get("button[type=submit]").click(); cy.visit(`/teams/${org}`).then(() => { + cy.once("uncaught:exception", () => false); + cy.wait(10000); cy.contains(org).should("exist"); }); }); @@ -43,9 +49,11 @@ describe("Create and edit team", () => { cy.logout(); cy.login(normalUser, normalUserPassword); cy.visit("/teams"); + cy.wait(10000); cy.contains(org).should("not.exist"); cy.visit(`/teams/${org}`); + cy.wait(5000); cy.contains("Team not found").should("exist"); }); @@ -59,9 +67,8 @@ describe("Create and edit team", () => { cy.get("li").contains("English").click(); cy.get("#visibility_type").click(); cy.get("li").contains("Public").click(); - cy.get("#team").click(); + cy.get("#team", { timeout: 10000 }).should("exist").click(); cy.get("li").contains(org).click(); - cy.get("input[name=application]").type("GFW"); cy.get("button").contains("Tags").click(); cy.get("#tagsSearchInput").type("Tag 1{enter}", { force: true }).clear(); cy.get("input[name=project]").focus().type("Project 1"); @@ -86,13 +93,14 @@ describe("Create and edit team", () => { it("Should edit team and assign public dataset and edit team back to private", () => { cy.visit(`/dashboard/teams/${org}/edit`).then(() => { + cy.wait(10000); cy.get("input[name=title]").should("have.value", org); - cy.get("button[aria-haspopup=listbox]").should("have.length", 2); cy.get("button#visibility").click(); cy.get("li").contains("Public").click(); cy.get("button[type=submit]").click(); }); cy.visit(`/dashboard/datasets/new`); + cy.wait(10000); cy.get("input[name=title]").type(datasetSuffix); cy.get("input[name=name]").should("have.value", datasetSuffix); cy.get("input[name=url]").type("https://google.com"); @@ -102,7 +110,6 @@ describe("Create and edit team", () => { cy.get("li").contains("Public").click(); cy.get("#team").click(); cy.get("li").contains(org).click(); - cy.get("input[name=application]").type("GFW"); cy.get("button").contains("Tags").click(); cy.get("#tagsSearchInput").type("Tag 1{enter}", { force: true }).clear(); cy.get("input[name=project]").focus().type("Project 1"); @@ -127,7 +134,6 @@ describe("Create and edit team", () => { cy.visit(`/dashboard/teams/${org}/edit`).then(() => { cy.get("input[name=title]").should("have.value", org); - cy.get("button[aria-haspopup=listbox]").should("have.length", 2); cy.get("button#visibility").click(); cy.get("li").contains("Private").click(); cy.get("button[type=submit]").click(); @@ -156,14 +162,14 @@ describe("Create and edit team", () => { cy.logout(); cy.login(normalUser, normalUserPassword); cy.visit("/teams"); - cy.contains(parentOrg); + cy.wait(9000); + cy.contains(parentOrg).should("exist"); cy.contains(org).should("not.exist"); }); it("should edit parent team to private", () => { cy.visit(`/dashboard/teams/${parentOrg}/edit`).then(() => { cy.get("input[name=title]").should("have.value", parentOrg); - cy.get("button[aria-haspopup=listbox]").should("have.length", 2); cy.get("button#visibility").click(); cy.get("li").contains("Private").click(); cy.get("button[type=submit]").click(); @@ -174,7 +180,7 @@ describe("Create and edit team", () => { cy.logout(); cy.login(normalUser, normalUserPassword); cy.visit("/teams"); - cy.contains(parentOrg); + cy.contains(parentOrg).should("not.exist"); cy.contains(org).should("not.exist"); }); diff --git a/e2e-tests/cypress/e2e/topics.cy.js b/e2e-tests/cypress/e2e/topics.cy.js index ceb95e46..613fbdf2 100644 --- a/e2e-tests/cypress/e2e/topics.cy.js +++ b/e2e-tests/cypress/e2e/topics.cy.js @@ -30,6 +30,11 @@ const facets = [ "WRI Data", ]; +Cypress.on("uncaught:exception", (err, runnable) => { + console.log(err); + return false; +}); + describe("Explore data page", () => { before(() => { // Create orgs @@ -68,31 +73,32 @@ describe("Explore data page", () => { }); }); - it("search topic", () => { cy.visit("/topics"); cy.wait(2000); cy.get('[name="search"]').type(groups[0] + "{enter}" ?? "test"); cy.contains(`${groups[0]}`, { timeout: 40000 }); }); - + it("search teams", () => { cy.visit("/teams"); cy.wait(2000); cy.get('[name="search"]').type(orgs[0] + "{enter}" ?? "test"); cy.contains(`${orgs[0]}`, { timeout: 40000 }); }); - + it("visit topic page", () => { cy.visit(`/topics/${groups[0]}`); cy.contains(`${groups[0]}`, { timeout: 40000 }); // cy.contains("Edit", { timeout: 2000 }); - cy.contains("Subtopics") + cy.contains("Subtopics"); }); it("should display not found page", () => { cy.visit("/topics/randomtopicname"); - cy.contains("Sorry, we couldn’t find the page you’re looking for.", { timeout: 40000 }); + cy.contains("Sorry, we couldn’t find the page you’re looking for.", { + timeout: 40000, + }); }); it("shoud display subtopic page", () => {