Add UI tests for bridge settings
After implementing #42036 (closed), here are some things to test.
When the user has no bridges:
- "Use bridges" switch is disabled.
- "No bridges added" banner is shown.
- Heading for bridge source is "Add bridges".
- User provide dialog button is "Add new bridges..." and the dialog title similarly matches.
For all bridge dialogs:
- The final accept button should switch between "OK" and "Connect" depending on whether we have already bootstrapped or not. In the later case it should open "about:torconnect" and start bootstrapping.
- When the dialog closes, the "Your bridges" heading should be focused and screen reader user should receive a notification that their bridges have changed.
- Cancelling the dialog should not cause a change in focus, and it should return to the triggering button instead.
For the "All bridges" menu:
- Show QR code should:
- open a QR code dialog containing all bridges,
- only be available for requested and user provided bridges, and
- be hidden when the user has more than three bridges.
- Copy bridge addresses should:
- Copy bridge addresses to clipboard, and
- only be available when not a built-in bridge.
- Edit bridges should:
- open the user provide bridge dialog, with an "edit" title and the bridges pre-filled, which should not accept Lox invites, and
- only be available to user provided bridges.
- Remove all bridges should:
- always be shown,
- warn the user with a dialog,
- focus the main "Bridges" heading, and
- notify screen reader users that their bridges have been removed.
For built-in bridges dialog:
- If the user has no current built-in bridge, no option should be selected by default.
- If they do have a built-in bridge, it should be selected by default with a "Current bridge" label.
- The "Current bridge" label should appear in the accessible description only when it is visible.
When the user is using a built-in bridge:
- "Built-in" should appear after "Your bridges" title.
- The "All bridges" menu should only contain "Remove all bridges".
- The built-in type and description should appear.
- The "Connected" label should only appear when one of the built-in bridges is used in a circuit.
For the user provide dialog, when the user supplies addresses:
- If a bridge address is incorrect, their should be an error alert. The bridge input should be marked as incorrect with
aria-valid
andaria-errormessage
should point to the alert. - The error should clear as soon as the user makes some change.
- Pressing "Next" should show a summary of the bridges, including their bridge type and emojis.
- The changes are only committed if "OK" or "Connect" is pressed in the last stage.
When the user is using a manually added bridge address, or a requested bridge, or uses Lox:
- The correct source should appear after "Your bridges" title.
- Each bridge address should have its own row.
- Shows the bridge type: "obfs4", "meek", "snowflake", or simply "Tor".
- Shows the four bridge emojis.
- If the bridge is connected (part of a circuit), it should include a "Connected" status cell.
- Otherwise the status cell should say "No Status" and only be visible on screen if it has keyboard focus.
- Arrow keys should navigate the bridge. Direction should be reversed for right-to-left vs left-to-right.
- The "Bridge options" button should only appear when the row has hover or focus.
- The "Bridge options" button should receive focus, rather than the cell it is within.
- The "Bridge options" menu option "Show QR code" should show the QR dialog for a single address.
- The option "Copy bridge address" should copy the single address.
- The option "Remove bridge" should remove a single bridge. Screen reader notification should be triggered, and focus should reset to the first cell. If this was the last bridge then bridges should be disabled instead and focus should reset to the "Bridges" heading with a different notification.
- "Show QR code" and "Remove bridge" should not be shown for Lox.
When the user has a manually added bridge or a requested bridge:
- "Help other connect" heading should show.
- "Copy addresses" button should show, to copy all addresses.
- "Show QR code" button should show, to open the QR dialog for all bridges. Should be disabled if we have too many bridges.
When the user has a Lox bridge source:
- Lox description should show.
- Next upgrade should be described, with different details depending on the next level.
- Number of days until the upgrade should be shown.
- If there has been an upgrade or a blockage, an alert should be show instead. Should be tested with a single upgrade, multiple upgrades, a single blockage, multiple blockages, and a mix of upgrade and blockage. Invites should only be shown if the user started or ended with invites.
- "Got it" button should clear the alert and return focus to the next upgrade heading.