-
Notifications
You must be signed in to change notification settings - Fork 21
[O2B-1561] Alter filter popup button to have a drop down function where the user can copy, paste and clear the filters #2146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
graduta
merged 20 commits into
main
from
feature/O2B-1561/Alter-filter-popup-button-to-have-a-drop-down-function-where-the-user-can-copy,-paste-and-clear-the-filters
Jun 18, 2026
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
8ec11aa
chore: add a url parameter to setFilterFromUrl
cd06548
feat: create dropdown options
acef2bf
fix linting issues
52cc749
chore: add tests for new buttons
3c542a4
feat: add filter restoration button
e9d5945
chore: remove restoreFilters
6c1b59e
chore: pass url to setFiltersFromUrl
5abae21
chore: switch url and notify arguments
76284d5
refactor: change computeParameters to guarentee the presence of a url
89ea57c
feat: add Warning Type enum
accbdff
refactor: move filter setting loop to it's own function
5d81c5c
fix linter issues
b42bb37
test: add warning test for page mismatch
6f12fd0
style: change warning message
62b8793
refactor: loop through warning types in _clearWarnings
05b082d
test: remove duplicate test
767a531
chore: move tests from filterPopOverPanel to warnings
d50af66
chore: pluralise the ids of copy and paste filters
eb19547
fix linting issues
68e0918
chore: add context variable
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /** | ||
| * @license | ||
| * Copyright CERN and copyright holders of ALICE O2. This software is | ||
| * distributed under the terms of the GNU General Public License v3 (GPL | ||
| * Version 3), copied verbatim in the file "COPYING". | ||
| * | ||
| * See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| * | ||
| * In applying this license CERN does not waive the privileges and immunities | ||
| * granted to it by virtue of its status as an Intergovernmental Organization | ||
| * or submit itself to any jurisdiction. | ||
| */ | ||
|
|
||
| const { expect } = require('chai'); | ||
| const { defaultBefore, defaultAfter, pressElement, takeScreenshot, expectInputValue } = require('../defaults.js'); | ||
|
|
||
| module.exports = () => { | ||
| let page; | ||
| let browser; | ||
| let context; | ||
| let url; | ||
|
|
||
| before(async () => { | ||
| [page, browser, url] = await defaultBefore(page, browser); | ||
| context = browser.defaultBrowserContext(); | ||
| context.overridePermissions(url, ['clipboard-read', 'clipboard-write', 'clipboard-sanitized-write']); | ||
| }); | ||
|
|
||
| it('Should copy url when clicking filer copy button', async () => { | ||
| const url = 'http://localhost:4000/?page=lhc-period-overview&filter[names][]=name&filter[years][]=100&filter[pdpBeamTypes][]=PbPb'; | ||
| await page.goto(url, { waitUntil: 'load' }); | ||
| await takeScreenshot(page, 'test'); | ||
| await pressElement(page, '#copy-filters', true); | ||
|
|
||
| const clipboardContents = await page.evaluate(async () => decodeURI(await navigator.clipboard.readText())); | ||
| expect(clipboardContents).to.equal(url); | ||
| }); | ||
|
|
||
| it('Should set filters when pressing paste active filters button', async () => { | ||
| const url = 'http://localhost:4000/?page=lhc-period-overview&filter[names][]=name&filter[years][]=100&filter[pdpBeamTypes][]=PbPb'; | ||
|
|
||
| await page.evaluate(async (url) => await navigator.clipboard.writeText(url), url); | ||
| await pressElement(page, '#paste-filters', true); | ||
|
|
||
| const actualUrl = page.url(); | ||
| expect(actualUrl).to.equal(url); | ||
|
|
||
| await expectInputValue(page, 'div.flex-row.items-baseline:nth-of-type(1) input[type=text]', 'name'); | ||
| await expectInputValue(page, 'div.flex-row.items-baseline:nth-of-type(2) input[type=text]', '100'); | ||
| await expectInputValue(page, 'div.flex-row.items-baseline:nth-of-type(3) input[type=text]', 'PbPb'); | ||
| }); | ||
|
|
||
| it('Should reset filters when pressing the reset all filters button', async () => { | ||
| const url = 'http://localhost:4000/?page=lhc-period-overview&filter[names][]=name&filter[years][]=100&filter[pdpBeamTypes][]=PbPb'; | ||
|
|
||
| await page.goto(url, { waitUntil: 'load' }); | ||
|
|
||
| await pressElement(page, '.dropdown #reset-filters', true); | ||
| const actualUrl = page.url(); | ||
| expect(actualUrl).to.equal('http://localhost:4000/?page=lhc-period-overview'); | ||
|
|
||
| await expectInputValue(page, '.name-filter input', ''); | ||
| await expectInputValue(page, '.year-filter input', ''); | ||
| await expectInputValue(page, '.pdpBeamTypes-filter input', ''); | ||
| }); | ||
|
|
||
| after(async () => { | ||
| await defaultAfter(page, browser); | ||
| }); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.