Overview and Test Preparation
Process the following tests on Firefox Nightly (during
add-on development only), on the minimum supported Firefox,
on Debian stable's Firefox, and on an up-to-date ungoogled
chromium flatpak. Unless otherwise stated, install the XPI
or CRX package with C-o and remove it
again when done testing.
The last note above is rather crucial: If you have previously forgotten to do so and notice the presence of some old version of this add-on when you start one of the test browsers below, better remove that version and restart the browser before installing the new version. Otherwise you may end up chasing all sorts of funny phantom symptoms.
For Firefox Nightly, start the browser as
( cd ~/work/copy-on-select-2 && ./collateral/firefox-nightly/firefox -profile collateral/tprof-nightly ) &
and update it through its "About Firefox" dialogue.
Then navigate to
about:debugging#/runtime/this-firefoxto install this add-on as temporary add-on. Alternatively, ensure that optionxpinstall.signatures.requiredis set tofalseand install this add-on as an unsigned instead of a temporary add-on.For the minimum supported Firefox, start the browser as
( cd ~/work/copy-on-select-2 && MOZ_FORCE_DISABLE_E10S=1 \ ./collateral/firefox-115/firefox -profile collateral/tprof-115 ) &
Then open the XPI package to be tested with
C-o, open a new tab to perform the tests in, load the test page in that tab, and finally open the add-on page withC-S-a. Any deviation from this order may result in the add-on not being activated!For Debian stable's Firefox, start the browser as
( cd ~/work/copy-on-select-2 && firefox -profile collateral/tprof-stable ) &
For ungoogled chromium, update its flatpak with
flatpak update io.github.ungoogled_software.ungoogled_chromium
and run it with
flatpak run io.github.ungoogled_software.ungoogled_chromium &
After installing the CRX package to be tested with
C-o, select the extension details and switch on option "Allow access to file URLs" there.Only then open a new tab to perform the tests in and load the test page in that tab. This order is important since ungoogled chromium does not seem to trigger listeners on
browser.storage.onChangedfor pages loaded before an add-on got installed.
Monitor Clipboard vs. Primary Selection
Execute the following command in a terminal to monitor and compare clipboard and primary selection on Wayland or X11:
watch -t -n1 -x bash -c \
'c=$( wl-paste ) p=$( wl-paste --primary )
printf "c:%3d %-74.74s\n" "${#c}" "${c@Q}"
printf "p:%3d %-74.74s\n" "${#p}" "${p@Q}"
test "$c" = "$p" && echo PASS || echo FAIL'
watch -t -n1 -x bash -c \
'c=$( xclip -o -se c ) p=$( xclip -o -se p )
printf "c:%3d %-74.74s\n" "${#c}" "${c@Q}"
printf "p:%3d %-74.74s\n" "${#p}" "${p@Q}"
test "$c" = "$p" && echo PASS || echo FAIL'
Prepare a Local Test File and HTTP Server
It is hard to otherwise find HTTP(non-S) servers and at some time (?) copying from HTTP-served pages has behaved differently than from HTTPS-served pages.
cp ~/work/copy-on-select-2/content/simple.html /tmp/simple.html
while :; do
{ echo $'HTTP/1.1 200 OK\r\n\r\n'; cat /tmp/simple.html; } |
nc -l 8080
done
Basic Functionality
Reset all options before performing the following tests.
After the first test pass, switch on the use of the native copy command; then perform a second pass on below tests.
Regular Text (PASS)
When shall we three meet again
In thunder, lightning, or in rain?
Disabled Text Area Text (FAIL)
Iframe Text (PASS)
(The iframe tests result in a FAIL on Firefox 115. And I am not going to document that otherwise or even work around it!)
Cross-Site Iframe Text (PASS)
Mixed Open Shadow DOM Text (BREAK)
When shall we three meet again
In thunder,
lightning,
or in rain?
Mixed Closed Shadow DOM Text (BREAK)
When shall we three meet again
In thunder,
lightning,
or in rain?
Rich Text (PASS)
When shall we three meet again
In thunder, lightning, or in rain?
Rich Text Paste (with Native Copy Only)
Copy-on-select the rich text from the previous test; paste it into the following content-editable text box and ensure that the markup is preserved.
Non-Text (FAIL/PASS)
Select the following image. Without native copy that should clear the primary selection, but not the clipboard. With native copy it should clear both.
Read-Only Text Area Text (PASS)
Read-Only Text Box Text (PASS)
ARIA Read-Only Text Box Text (PASS)
Simulate an input field that has been made read-only programatically, like GitHub has it.
ARIA Read-Only Text Area Text (PASS)
Tests Requiring Separate Pages
- cancel-event: Install a bubbling
event handler on
window.documentthat stops propagation of allmouseupevents. (GitHub issue 4) - body-change: Replace the document's body element in a delayed manner. (GitHub issue 8)
Tests Requiring External Pages
- Use
C-tC-oC-rto open local test file/tmp/simple.html. (PASS) - Copy text from an HTTP-served page. (PASS)
- Login to https://docs.google.com;
select the hamburger menu; select spreadsheets; select one of
the template spreadsheets. Ensure that copy
(
C-c) and paste (C-v) work in cells. Remove the test spreadsheet when done. (GitHub issue 1)
Input Fields
Reset all options before performing the following tests; then process below tests repeatedly as follows:
- Process the tests with options reset to default and ensure that the tests FAIL. Even in the content-editable input fields. (GitHub issue 12, GitHub issue 16)
- Select
Altas input inversion modifier; process the tests without pressing theAltkey and ensure that the tests FAIL. - Process the tests while pressing the
Altkey and ensure that the tests PASS. - Reset all options again; switch on the input field option; process the tests and ensure that the tests PASS. (GitHub issue 6)
- Select
Altas input inversion modifier; process the tests without pressing theAltkey and ensure that the tests PASS. - Process the tests while pressing the
Altkey and ensure that the tests FAIL.
Text Box Text (FAIL/PASS)
Text Area Text (FAIL/PASS)
Content-Editable Input Field (FAIL/PASS)
Content-editable input field that inherits its editable property from a surrounding element.
When shall we three meet again
In thunder, lightning, or in rain?
Mixed Content-Editable Input Field (FAIL/PASS)
Partially content-editable input field, where the middle two lines are not content-editable. Ensure to include text from the first and last line in the selection.
When shall we three meet again
In thunder, lightning, or in rain?
When the hurlyburly's done,
When the battle's lost and won.
Option Page
Save and Reset
- Open the option page; select "Reset"; toggle the first check box; select "Save"; leave the option page; reopen it and ensure that the first check box is in its toggled state.
- Then select "Reset"; leave the option page; reopen it and ensure that the first check box is in its original state.
Error Handling
- Open the option page; change the value of option "Join multi-range selections with" to a single percent sign; select "Save" and ensure that an error message is displayed below the option input element.
- Then select "Reset" and ensure that the error message is removed again.
Dependency Handling
- Open the option page; select option "Use native copy command" and ensure that option "Trim triple-click paragraph selections" gets disabled.
- Then select "Save"; leave the option page; reopen it and ensure that option "Trim triple-click paragraph selections" is still disabled.
- Then select "Reset" and ensure that option "Trim triple-click paragraph selections" gets enabled.
Dark Theme
- Open the option page; execute
( cd ~/.config && cp -p kdeglobals kdeglobals.orig ) plasma-apply-colorscheme BreezeDark
and ensure that the option page turns dark. - Then execute
plasma-apply-colorscheme BreezeLight ( cd ~/.config && mv kdeglobals.orig kdeglobals )
and ensure that the option page turns light again.
Extended Functionality
Non-Main Button Clicks (PASS)
- Select word "hurlyburly" with a double-click; copy some different text from a non-browser source; press the secondary button twice and ensure that this does not copy the word "hurlyburly" to the clipboard again.
- Repeat that test for the auxilliary button, which you should press on some link.
Main Button Clicks into Existing Selection (PASS)
- Select word "hurlyburly" with a double-click; copy some different text from a non-browser source; press the main button over the selected word "hurlyburly" and ensure that this does not copy the word "hurlyburly" to the clipboard again.
- Switch on the input field option and repeat that test with a text-boxed .
Triple-Click Whitespace Trimming (FF only, FAIL)
- Ensure that the triple-click trimming option is switched on; triple-click on the second line below and ensure that it is copied to the clipboard without leading and trailing whitespace. (We cannot change FF's primary selection, so the test result is what it is.)
When shall we three meet again
In thunder, lightning, or in rain?
Multi-Range Selection Separation (FF only, FAIL)
- Ensure that the multi-range selection separator is on
default
%0a; control-double-click two words in the first line below and ensure that they are copied to the clipboard with a separating newline character. - Repeat that test, but this time control-select one of the table cells from the second line below and a word from the first line and ensure that they are copied to the clipboard without a separating newline character.
When shall we three meet again
| In thunder, | lightning, | or in rain? |
Control-Clicks with Existing Selection (FF only, PASS)
Ensure that the multi-range selection separator is on
default %0a; select word "hurlyburly" with a
double-click; copy some different text from a non-browser
source; control-click outside of the existing selection and
ensure that this copies the word "hurlyburly" to the
clipboard again, but without any leading or trailing
newline.
Content Pages
Dark Theme on Onboarding Page
- Open the onboarding page; execute
( cd ~/.config && cp -p kdeglobals kdeglobals.orig ) plasma-apply-colorscheme BreezeDark
and ensure that the page itself, the header icon, and the favicon turn dark. - Then execute
plasma-apply-colorscheme BreezeLight ( cd ~/.config && mv kdeglobals.orig kdeglobals )
and ensure that all of the above turn light again.
Dark Theme on Index Page
- Open the index page, ensuring to refer to
it without the trailing
index.html; execute( cd ~/.config && cp -p kdeglobals kdeglobals.orig ) plasma-apply-colorscheme BreezeDark
and ensure that the page itself, the header icon, and the favicon turn dark. - Then execute
plasma-apply-colorscheme BreezeLight ( cd ~/.config && mv kdeglobals.orig kdeglobals )
and ensure that all of the above turn light again.
Random Test Notes
Setting up Firefox Installations and Profiles for Testing this Add-On
Define FF major version, tarball location, and
installation type (one of tmp
or collateral for a temporary or permanent
installation, respectively):
version=... tarball=... type=...
Create a FF installation:
cd ~/work/copy-on-select-2/$type
rm -rf firefox
tar xf $tarball
chmod -R u+w firefox-$version
rm -rf firefox-$version
mv firefox firefox-$version
# for immutable FFs only
mkdir firefox-$version/distribution
cat << 'EOF' > firefox-$version/distribution/policies.json
{
"policies": {
"DisableAppUpdate": true
}
}
EOF
# for very immutable FFs only
chmod -R a-w firefox-$version
Create a sane test profile. This still lets come through the "Choose What I Share" prompt, but pretty much nothing else.
cd ~/work/copy-on-select-2/$type
rm -rf tprof-$version
mkdir tprof-$version
cat << 'EOF' > tprof-$version/prefs.js
// do not remove this line
user_pref("app.shield.optoutstudies.enabled", false);
user_pref("browser.aboutwelcome.enabled", false);
user_pref("browser.discovery.enabled", false);
user_pref("browser.newtabpage.enabled", false);
user_pref("browser.open.lastDir", "~/work/copy-on-select-2/dist");
user_pref("browser.shell.checkDefaultBrowser", false);
user_pref("browser.startup.couldRestoreSession.count", 2);
user_pref("browser.startup.homepage", "about:blank");
user_pref("browser.tabs.warnOnClose", false);
user_pref("browser.toolbars.bookmarks.visibility", "never");
user_pref("browser.translations.automaticallyPopup", false);
user_pref("browser.warnOnQuit", false);
user_pref("browser.warnOnQuitShortcut", false);
user_pref("datareporting.healthreport.uploadEnabled", false);
user_pref("devtools.chrome.enabled", true);
user_pref("devtools.debugger.remote-enabled", true);
user_pref("layout.css.devPixelsPerPx", "1.25");
user_pref("toolkit.telemetry.reportingpolicy.firstRun", false);
user_pref("xpinstall.signatures.required", false);
EOF
To start a temporarily installed FF as set up above execute:
( cd ~/work/copy-on-select-2 && ./tmp/firefox-$version/firefox -profile tmp/tprof-$version ) &