Skip to content

Commit

Permalink
Add tests of basic settings functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgaya committed May 16, 2021
1 parent a9958fa commit 2d91e55
Show file tree
Hide file tree
Showing 8 changed files with 209 additions and 47 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Version 1.3

- Add per-domain settings for deduplicating by thumbnail
- Automate basic browser tests using Selenium
- Minor fixes/improvements

## Version 1.2
Expand Down
3 changes: 3 additions & 0 deletions chrome.jq
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@
"48": "icons/icon48.png",
"128": "icons/icon128.png"
})

# Chrome emits a spurious warning about browser_specific_settings
| del(.browser_specific_settings)
6 changes: 6 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
"description": "Hide duplicate posts on pre-redesign Reddit.",
"homepage_url": "https://nickgaya.github.io/rededup/",

"browser_specific_settings": {
"gecko": {
"id": "{68f0c654-5a3d-423b-b846-2b3ab68d05dd}"
}
},

"icons": {
"48": "icons/icon.svg",
"96": "icons/icon.svg"
Expand Down
5 changes: 4 additions & 1 deletion rededup.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ async function getLinkInfo(thing, pageType, settings) {
if (settings.showHashValues) {
const hashElt = document.createElement('code');
hashElt.textContent = bufToHex(linkInfo.thumbnailHash);
getTagline(thing, pageType).append(' [', hashElt, ']');
const spanElt = document.createElement('span');
spanElt.classList.add('rededup-hash');
spanElt.append(' [', hashElt, ']');
getTagline(thing, pageType).append(spanElt);
}
} catch (error) {
console.warn("Failed to get thumbnail hash", thumbnailImg,
Expand Down
3 changes: 2 additions & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ gecko-webdriver to be installed on your system.

To run the tests:

export REDEDUP_PATH=../artifacts/rededup-<version>-fx.zip npm test
export REDEDUP_PATH=../artifacts/rededup-<version>-fx.zip
npm test

By default, the tests run in "headless" mode. To enable the browser GUI, you
can set the environment variable `BROWSER_GUI=true`.
39 changes: 17 additions & 22 deletions tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"devDependencies": {
"chai": "^4.3.4",
"mocha": "^8.4.0",
"selenium-webdriver": "^4.0.0-beta.3"
"selenium-webdriver": "^4.0.0-beta.3",
"uuid": "^8.3.2"
},
"mocha": {
"ui": "tdd"
Expand Down
Loading

0 comments on commit 2d91e55

Please sign in to comment.