Skip to content

Commit

Permalink
Misc refactorings: No SCSS compile step, better build, cypress stuff (#…
Browse files Browse the repository at this point in the history
…123)

* Remove sass compiling of SCSS, now write plain CSS

* Automatically updating version in manifest files

* Adding meta / titles to make HTML validation more happy

* CSS reset also options and tips

---------

Co-authored-by: Simon Heimler <[email protected]>
  • Loading branch information
Fannon and Simon Heimler authored Aug 24, 2024
1 parent 93f64d4 commit 9867746
Show file tree
Hide file tree
Showing 17 changed files with 710 additions and 930 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Distribution
dist/
popup/lib/
popup/css/
popup/mockData/big.json

# Logs
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ npm install
npm run build
```

The source code for the extension can be found in [popup/](popup/) (HTML, JS and libs) and [sass/](sass/) (SCSS/CSS).
The source code for the extension can be found in [popup/](popup/) (HTML, CSS, JS and libs).

The built extensions can be found

Expand Down
2 changes: 2 additions & 0 deletions bin/updateLibs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ cat node_modules/mark.js/dist/mark.es6.min.js >> popup/lib/mark.es6.min.js
# Copy over vendor dependencies that we don't bundle, because they're only loaded on demand
cp node_modules/js-yaml/dist/js-yaml.min.js popup/lib/js-yaml.min.js
cp node_modules/\@yaireo/tagify/dist/tagify.js popup/lib/tagify.min.js
cp node_modules/\@yaireo/tagify/dist/tagify.css popup/lib/tagify.min.css
cp node_modules/minireset.css/minireset.min.css popup/lib/minireset.min.css
13 changes: 13 additions & 0 deletions bin/updateManifests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import fs from 'fs'

const packageJson = JSON.parse(fs.readFileSync('package.json').toString())
const manifestJson = JSON.parse(fs.readFileSync('manifest.json').toString())
const manifestFirefoxJson = JSON.parse(fs.readFileSync('manifest.firefox.json').toString())

console.log('Updating Manifests with version v' + packageJson.version)

manifestJson.version = packageJson.version
manifestFirefoxJson.version = packageJson.version

fs.writeFileSync('manifest.json', JSON.stringify(manifestJson, null, 2))
fs.writeFileSync('manifest.firefox.json', JSON.stringify(manifestFirefoxJson, null, 2))
6 changes: 3 additions & 3 deletions cypress/e2e/folders.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ describe('Folder View', () => {
.find('#folders-list')
.find('[x-folder=Tools]')
.click()
.get('#search-input')
cy.get('#search-input')
.should('have.value', '~Tools')
.get('#result-list')
cy.get('#result-list')
.should('not.have.length', 0)
.find('[x-original-id=9]')
.get('#result-list')
cy.get('#result-list')
.find('li.bookmark')
.checkNoErrors()
})
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/options.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ describe('Options View', () => {
.clear()
.should('have.value', '')
.type(newConfig)
.get('#edit-options-save')
cy.get('#edit-options-save')
.click()
.visit('/options.html')
.get('#user-config')
cy.get('#user-config')
.should('include.value', 'displayVisitCounter')
.should('include.value', 'displayDateAdded')
.checkNoErrors()
Expand All @@ -37,10 +37,10 @@ describe('Options View', () => {
.clear()
.should('have.value', '')
.type(newConfig)
.get('#edit-options-save')
cy.get('#edit-options-save')
.click()
.visit('/options.html')
.get('#user-config')
cy.get('#user-config')
.should('include.value', 'displayVisitCounter')
.should('include.value', 'displayDateAdded')
.checkNoErrors()
Expand Down
114 changes: 57 additions & 57 deletions cypress/e2e/search.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Search View', () => {
cy.get('#result-list').should('have.length', 1).find('#results-loading')
})
it('completes the initializing phase without errors', () => {
cy.wait(initTime).get('#results-loading').should('not.exist').checkNoErrors()
cy.get('#results-loading').should('not.exist').checkNoErrors()
})
it('starts with no results', () => {
cy.get('#result-counter').contains('(0)')
Expand All @@ -22,27 +22,27 @@ describe('Search View', () => {
it('first result is highlighted', () => {
cy.get('#search-input')
.type(`JSON Edit`)
.get('#result-list li')
cy.get('#result-list li')
.each((el, index) => {
if (index === 0) {
expect(el[0].id).to.equal('selected-result')
} else {
expect(el[0].id).to.not.equal('selected-result')
}
})
.get('#search-input')
cy.get('#search-input')
.type('{downarrow}')
.get('#result-list li')
cy.get('#result-list li')
.each((el, index) => {
if (index === 1) {
expect(el[0].id).to.equal('selected-result')
} else {
expect(el[0].id).to.not.equal('selected-result')
}
})
.get('#search-input')
cy.get('#search-input')
.type('{uparrow}')
.get('#result-list li')
cy.get('#result-list li')
.each((el, index) => {
if (index === 0) {
expect(el[0].id).to.equal('selected-result')
Expand All @@ -58,35 +58,35 @@ describe('Search View', () => {
it('includes everything expected (title, URL etc.)', () => {
cy.get('#search-input')
.type(`JSON`)
.get('#result-list')
cy.get('#result-list')
.find('[x-original-id=9]')

// Check that we have a result with a title returned
.get('[x-original-id=9]')
cy.get('[x-original-id=9]')
.find('.title')
.contains('JSON')

// Check that we have a result with an URL returned
.get('[x-original-id=9]')
cy.get('[x-original-id=9]')
.find('.url')
.contains('json')

// expect #json tag
.get('[x-original-id=9]')
cy.get('[x-original-id=9]')
.find('span.tags')
.contains('#json')

// expect ~Tools folder
.get('[x-original-id=9]')
cy.get('[x-original-id=9]')
.find('span.folder')
.contains('~Tools')

// expect lastVisited badge
.get('[x-original-id=9]')
cy.get('[x-original-id=9]')
.find('span.last-visited')

// expect score badge
.get('[x-original-id=9]')
cy.get('[x-original-id=9]')
.find('span.score')

.checkNoErrors()
Expand All @@ -96,30 +96,30 @@ describe('Search View', () => {
describe('Precise search', () => {
it('can execute a precise search successfully', () => {
cy.get('#search-approach-toggle')
.get('#search-input')
cy.get('#search-input')
.type(`JSON`)
.wait(initTime)
// Make sure we get result of all types
.get('#result-list')
cy.get('#result-list')
.should('not.have.length', 0)
.find('[x-original-id=9]')
.get('#result-list')
cy.get('#result-list')
.find('li.bookmark')
.get('#result-list')
cy.get('#result-list')
.find('li.history')
.get('#result-list')
cy.get('#result-list')
.find('li.tab')
.get('#result-list')
cy.get('#result-list')
.find('li.bookmark')
.checkNoErrors()
})
it('can execute a precise search with non-ASCII chars successfully', () => {
cy.get('#search-approach-toggle')
.get('#search-input')
cy.get('#search-input')
.type(`äe指事字₽`)
.wait(initTime)
// Only make sure that search doesn't crash
.get('#result-list')
cy.get('#result-list')
.should('not.have.length', 0)
.checkNoErrors()
})
Expand All @@ -133,9 +133,9 @@ describe('Search View', () => {
.click()
.wait(interactionTime)
.contains('FUZZY')
.get('#search-input')
cy.get('#search-input')
.type(`JSON`)
.get('li.bookmark')
cy.get('li.bookmark')
.checkNoErrors()
})

Expand All @@ -147,20 +147,20 @@ describe('Search View', () => {
.wait(interactionTime)
.contains('FUZZY')
.wait(interactionTime)
.get('#search-input')
cy.get('#search-input')
.type(`JSON`)
.get('li.bookmark')
.get('#result-list')
cy.get('li.bookmark')
cy.get('#result-list')
.should('not.have.length', 0)
.find('[x-original-id=9]')
// Check that we have all kinds of results
.get('#result-list')
cy.get('#result-list')
.find('li.bookmark')
.get('#result-list')
cy.get('#result-list')
.find('li.history')
.get('#result-list')
cy.get('#result-list')
.find('li.tab')
.get('#result-list')
cy.get('#result-list')
.find('li.bookmark')
.checkNoErrors()
})
Expand All @@ -174,11 +174,11 @@ describe('Search View', () => {
.wait(interactionTime)
.contains('FUZZY')
.wait(interactionTime)
.get('#search-input')
cy.get('#search-input')
.type(`äe指事字₽`)
.wait(initTime)
// Only make sure that search doesn't crash
.get('#result-list')
cy.get('#result-list')
.should('not.have.length', 0)
.checkNoErrors()
})
Expand All @@ -187,26 +187,26 @@ describe('Search View', () => {
it('Empty search returns recent bookmarks', () => {
cy.get('#search-input')
.type(`b `)
.get('#result-list')
cy.get('#result-list')
.find('li.bookmark')
.get('#result-list')
cy.get('#result-list')
.find('[x-original-id=9]')
.get('.tab')
cy.get('.tab')
.should('not.exist')
.get('.history')
cy.get('.history')
.should('not.exist')
.checkNoErrors()
})
it('returns only bookmark results', () => {
cy.get('#search-input')
.type(`b JSON`)
.get('#result-list')
cy.get('#result-list')
.find('[x-original-id=9]')
.get('.tab')
cy.get('.tab')
.should('not.exist')
.get('.history')
cy.get('.history')
.should('not.exist')
.get('#result-counter')
cy.get('#result-counter')
.contains('(5)')
.checkNoErrors()
})
Expand All @@ -216,26 +216,26 @@ describe('Search View', () => {
it('Empty search returns recent history', () => {
cy.get('#search-input')
.type(`h `)
.get('#result-list')
cy.get('#result-list')
.find('li.history')
.get('#result-list')
cy.get('#result-list')
.find('[x-original-id=9]')
.get('.tab')
cy.get('.tab')
.should('not.exist')
.get('.bookmark')
cy.get('.bookmark')
.should('not.exist')
.checkNoErrors()
})
it('only the history results', () => {
cy.get('#search-input')
.type(`h JSON`)
.get('#result-list')
cy.get('#result-list')
.find('[x-original-id=9]')
.get('.tab')
cy.get('.tab')
.should('not.exist')
.get('.bookmark')
cy.get('.bookmark')
.should('not.exist')
.get('#result-counter')
cy.get('#result-counter')
.contains('(3)')
.checkNoErrors()
})
Expand All @@ -245,28 +245,28 @@ describe('Search View', () => {
it('Empty search returns all open tabs', () => {
cy.get('#search-input')
.type(`t `)
.get('#result-list')
cy.get('#result-list')
.find('li.tab')
.get('#result-list')
cy.get('#result-list')
.find('[x-original-id=179]')
.get('.bookmark')
cy.get('.bookmark')
.should('not.exist')
.get('.history')
cy.get('.history')
.should('not.exist')
.checkNoErrors()
})
it('returns only the tab results', () => {
cy.get('#search-input')
.type(`t JSON`)
.get('#result-list')
cy.get('#result-list')
.find('[x-original-id=185]')
.get('#result-list')
cy.get('#result-list')
.should('have.length', 1)
.get('.bookmark')
cy.get('.bookmark')
.should('not.exist')
.get('.history')
cy.get('.history')
.should('not.exist')
.get('#result-counter')
cy.get('#result-counter')
.contains('(1)')
.checkNoErrors()
})
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/tags.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ describe('Tag View', () => {
.find('#tags-list')
.find('[x-tag=json]')
.click()
.get('#search-input')
cy.get('#search-input')
.should('have.value', '#json')
.get('#result-list')
cy.get('#result-list')
.should('not.have.length', 0)
.find('[x-original-id=9]')
.get('#result-list')
cy.get('#result-list')
.find('li.bookmark')
.checkNoErrors()
})
Expand Down
2 changes: 1 addition & 1 deletion manifest.firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Browser extension to (fuzzy) search and navigate bookmarks, history and open tabs.",
"homepage_url": "https://github.com/Fannon/search-bookmarks-history-and-tabs",
"author": "Simon Heimler",
"version": "1.9.7",
"version": "1.9.8",
"manifest_version": 2,
"applications": {
"gecko": {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Browser extension to (fuzzy) search and navigate bookmarks, history and open tabs.",
"homepage_url": "https://github.com/Fannon/search-bookmarks-history-and-tabs",
"author": "Simon Heimler",
"version": "1.9.7",
"version": "1.9.8",
"manifest_version": 3,
"permissions": [
"tabs",
Expand Down
Loading

0 comments on commit 9867746

Please sign in to comment.