From 3b7a3a7450b35eb4c9e7248fc87e5d2c7e7f24e9 Mon Sep 17 00:00:00 2001 From: alexkiro <1538458+alexkiro@users.noreply.github.com> Date: Tue, 16 Jul 2024 10:52:54 +0300 Subject: [PATCH] Fix codeql issues (#639) * Add integrity checks to third-party scripts * Add the form role for accessibility * Add test for search and global goals * Fix potential XSS This is only a debug dev-only tool, but will still trigger CodeQL * Remove unused code - Initially added in f116bb521259485784e390cacef6c427e1509ba3 - Removed usage in 9b46ff7b49895675e3ad39902aca3020a895584b --- cypress/e2e/2014-2021/test-global-goals.cy.js | 12 ++++ cypress/e2e/2014-2021/test-search.cy.js | 11 +++ public/cooperation.html | 2 +- public/funding.html | 2 +- public/index.html | 2 +- public/projects.html | 2 +- templates/base.html | 2 +- templates/embed_sandbox.html | 2 +- templates/search/main.html | 68 ++++++------------- 9 files changed, 50 insertions(+), 53 deletions(-) create mode 100644 cypress/e2e/2014-2021/test-global-goals.cy.js create mode 100644 cypress/e2e/2014-2021/test-search.cy.js diff --git a/cypress/e2e/2014-2021/test-global-goals.cy.js b/cypress/e2e/2014-2021/test-global-goals.cy.js new file mode 100644 index 00000000..5eae6482 --- /dev/null +++ b/cypress/e2e/2014-2021/test-global-goals.cy.js @@ -0,0 +1,12 @@ +describe("test projects", () => { + it("check projects", () => { + cy.visit("/"); + cy.get("a").contains("Global Goals").click(); + cy.get(".indicator") + .first() + .should("contain", "50,000") + .and("contain", "Indicator 1"); + cy.contains("€42,000"); + cy.contains("Life on land"); + }); +}); diff --git a/cypress/e2e/2014-2021/test-search.cy.js b/cypress/e2e/2014-2021/test-search.cy.js new file mode 100644 index 00000000..15e3cd81 --- /dev/null +++ b/cypress/e2e/2014-2021/test-search.cy.js @@ -0,0 +1,11 @@ +describe("test projects", () => { + it("check projects", () => { + cy.visit("/"); + cy.get("form[role=search] input[type=search]").type("programme"); + cy.get("form[role=search]").submit(); + cy.contains("1 programme found"); + cy.contains("Romania"); + cy.contains("Completed"); + cy.contains("Programme 1"); + }); +}); diff --git a/public/cooperation.html b/public/cooperation.html index 4211f914..1f135daf 100644 --- a/public/cooperation.html +++ b/public/cooperation.html @@ -42,7 +42,7 @@
  • Projects
  • -