Skip to content

Commit

Permalink
Merge pull request #1917 from 4dn-dcic/utk_cypress_01b
Browse files Browse the repository at this point in the history
Add tests to verify the presence and non-empty content of `<pre>` elements
  • Loading branch information
Onurcankaratay authored Nov 20, 2024
2 parents 27a1ce5 + 6860568 commit 00e2c8d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ fourfront
Change Log
----------

8.4.5
=====

`PR 1917: Add tests to verify the presence and non-empty content of <pre> elements <https://github.com/4dn-dcic/fourfront/pull/1917>`_

* Update: Added tests to verify the presence and non-empty content of `<pre>` elements inside static section


8.4.4
=====
Expand Down
13 changes: 13 additions & 0 deletions deploy/post_deploy_testing/cypress/e2e/01b_static_content.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@ describe('Static Page & Content Tests', function () {
cy.title().should('equal', titleText + ' – 4DN Data Portal').end(); // Ensure <head>...<title>TITLE</title>...</head> matches.
prevTitle = titleText;

// Verify the presence of <pre> elements and ensure each one is not empty.
cy.document().then((doc) => {
const elements = doc.querySelectorAll('.rst-container > div > pre, .html-container > div > pre, .markdown-container > div > pre');
if (elements.length > 0) {
cy.get('.rst-container > div > pre, .html-container > div > pre, .markdown-container > div > pre').each(($pre) => {
const textContent = $pre.text().trim();
expect(textContent).to.not.be.empty;
});
} else {
cy.log('No <pre> elements found under .rst-container > div or .html-container > div, .markdown-container > div > pre');
}
});

if (!haveWeSeenPageWithTableOfContents) {
cy.window().then((w)=>{
if (w.document.querySelectorAll('div.table-of-contents li.table-content-entry a').length > 0){
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
# Note: Various modules refer to this system as "encoded", not "fourfront".
name = "encoded"
version = "8.4.4"
version = "8.4.5"
description = "4DN-DCIC Fourfront"
authors = ["4DN-DCIC Team <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 00e2c8d

Please sign in to comment.