You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Debugging and Updating Tests](#debugging-and-updating-tests)
16
19
-[Debug Mode](#debug-mode)
17
20
-[Headless Mode](#headless-mode)
18
21
-[Execute only selected page tests](#execute-only-selected-page-tests)
19
22
-[Start tests from a specific point](#start-tests-from-a-specific-point)
23
+
-[Adding new tests](#adding-new-tests)
24
+
-[Known failures](#known-failures)
20
25
-[CI / CD](#ci--cd)
26
+
-[Running actions](#running-actions)
27
+
-[Actions Setup](#actions-setup)
28
+
-[Using Github Secrets](#using-github-secrets)
21
29
22
30
## Goals and Intent
23
31
24
-
The aim of this project is to track and anticipate the compatibility of the Bitwarden extension features in controlled, static test scenarios as well as popular live scenarios. To that end, this project should:
32
+
This project primarily serves to identify potential regressions of Bitwarden browser extension features that interact with a user's visited pages (e.g. injected content scripts). It achieves this by simulating common user journeys in controlled, static test scenarios (collected in our [pattern library](https://github.com/bitwarden/test-the-web)).
33
+
34
+
As a secondary concern, BIT aspires to track and anticipate feature compatibility breakage in popular live scenarios. To that end, BIT provides a "test bench" for debugging and developing improvements in the extension injected experiences.
35
+
36
+
### Testing Philosophy
25
37
26
-
- incur requests against live sites as little as possible (no signing in, traversing deeply in the site, etc.)
27
38
- use the same login portals and experiences that users would
28
-
- test the span of likely login experiences
29
-
- enable regular reporting and early notification on site breakages and code regressions with the Bitwarden extension
30
-
- enable testing of other extension experiences that interact with browser client content
39
+
- test the duration of likely login experiences
40
+
- enable regular reporting and early notifications on experience breakages with the Bitwarden extension injected experiences
41
+
- in the case of live site tests, incur requests against live sites as little as possible:
42
+
- no signing in
43
+
- avoid traversing deeply into the site experience
44
+
- any automation should be scheduled infrequently
31
45
32
46
## Limitations
33
47
34
48
- Extension builds can only be tested with Chromium clients at present.
49
+
- BIT can test the browser client builds against active feature flags, but only those supported by the server utilized by the [self-host image](https://github.com/bitwarden/self-host/releases/tag/v2025.7.2) (aka [Bitwarden Unified](https://bitwarden.com/help/install-and-deploy-unified-beta/)) found in the [Docker compose configuration](./docker-compose.yml). Because of release timings, this can mean some feature-flagged experiences available in the server will not immediately be available for testing in BIT (until the updated self-host image is released and updated in the Docker compose configuration).
50
+
- Similarly the Bitwarden web client served and used with BIT is pinned to the self-host image version.
51
+
52
+
### Live tests
53
+
35
54
- Some live tests can be inconsistently flaky due to factors such as live experiments changing the received experience, external dependencies taking too long to load, ads/trackers, and general network instability.
55
+
- Consequently, due to these factors, live site tests require more upkeep and may fall out of date more frequently.
36
56
- Some website prequalify emails/usernames before allowing password entry and/or use captchas in multi-step login flows. In these cases, we're typically only testing that the username/email was filled out properly.
37
57
38
58
## Requirements
@@ -41,7 +61,7 @@ The aim of this project is to track and anticipate the compatibility of the Bitw
41
61
-[node](https://nodejs.org/en)
42
62
-[Bitwarden CLI](https://bitwarden.com/help/cli/)
43
63
-[OpenSSL](https://www.openssl.org/)
44
-
-[NVM](https://github.com/nvm-sh/nvm#installing-and-updating) (optional if not using nvm; manually manage your node version to `.nvmrc`)
64
+
-[NVM](https://github.com/nvm-sh/nvm#installing-and-updating) (optional, if not using nvm; manually manage your node version to `.nvmrc`)
45
65
46
66
## Quick start
47
67
@@ -56,6 +76,9 @@ The aim of this project is to track and anticipate the compatibility of the Bitw
56
76
## Setup
57
77
58
78
- Create an `.env` file in the root directory with values pointing to the vault you want to test against (use `.env.example` as guidance) and populate it with your desired values
79
+
80
+
> Important! Once you've generated installation and crypto values for your `.env` file, DO NOT CHANGE the seeding values (`VAULT_EMAIL`, `VAULT_PASSWORD`, `KDF_ITERATIONS`). Doing so requires regenerating your installation and crypto secret values and rebuilding/updating server.
81
+
59
82
- Run `npm run setup:install` to generate and add installation values to your dotfile
60
83
- Alternatively, you can generate them at `https://bitwarden.com/host` and add them to your dotfile manually as `BW_INSTALLATION_ID` and `BW_INSTALLATION_KEY`
61
84
- Run `npm run setup:crypto` to generate and add crypto values to your dotfile
@@ -100,20 +123,25 @@ Create and start the containers and volumes with `docker compose up -d --build -
100
123
- If you have already created the test account in the vault, use `npm run seed:vault:ciphers` to only seed the vault with the test credentials.
101
124
- If you need to completely delete/refresh any previously loaded test credentials run the command `npm run seed:vault:ciphers:refresh`
102
125
126
+
#### Importing vault items (optional)
127
+
128
+
You may import a vault in the form of a [Bitwarden-formatted JSON file](https://bitwarden.com/help/condition-bitwarden-import/). Place the file in the root of the project with the filename `vault.json` and run the command `npm run seed:vault:import`.
129
+
103
130
## Running Tests
104
131
105
-
- If targeting a local environment:
132
+
- If targeting a local environment (not using the self-host image):
106
133
- Ensure your targeted `API` and `Identity` services are configured and running (either [locally](https://contributing.bitwarden.com/getting-started/server/guide) or via Docker)
107
134
- Ensure the Web Vault client is running (either with `npm run test:webserve` locally or via Docker)
108
135
- Don't forget to [include your SSL key and cert file](https://contributing.bitwarden.com/getting-started/clients/web-vault/) in the `clients/apps/web` folder
109
136
- Run headless testing with `npm run test:static:headless`
110
137
- Run headed tests in debug mode with `npm run test:static:debug`
111
138
- Run only the public pages testing with `npm run test:public:debug`
112
139
- Test builds use the Manifest v3 version of the browser client by default; the v2 version can be built with `npm run build:extension:v2`
140
+
- Run accessibility (a11y) tests with `test:a11y:browser` or `test:a11y:web`. An a11y report will be generated for those respective clients.
113
141
114
142
## Feature flags
115
143
116
-
The Bitwarden documentation [describes how to make use of implemented feature flags](https://contributing.bitwarden.com/contributing/feature-flags/#local-configuration-json-file). Here, your flag key-value pairs can be added to the `flags.json` file. Note, changes to this file will require rebuilding the Docker image.
144
+
The Bitwarden documentation [describes how to make use of implemented feature flags](https://contributing.bitwarden.com/contributing/feature-flags/#local-configuration-json-file). Here, your flag key-value pairs can be added to the `flags.json` file. Note, changes to this file will require rebuilding the Docker image (e.g. `docker compose up -d --build --remove-orphans`).
117
145
118
146
## Debugging and Updating Tests
119
147
@@ -139,6 +167,51 @@ If debug mode is not active, `onlyTest` values will be ignored.
139
167
140
168
Passing the environment variable `START_FROM_TEST_URL` with the url of the test you wish to start with can help avoid re-running "known good" tests, when using `onlyTest` is impractical (e.g. `START_FROM_TEST_URL=https://www.pinterest.com/login/ npm run test:static:debug`)
141
169
170
+
### Adding new tests
171
+
172
+
Test scenarios are collected and defined at [`/tests`](./tests/). These scenarios (autofilling inputs, inline menu functions, etc) will run against the pages defined in `testPages` at [constants/test-pages.ts](./constants/test-pages.ts). Add scenarios by creating a new `.spec.ts` file in the appropriate `/tests` location. New cases/scenarios can be added by creating a new entry in the `testPages` const at [constants/test-pages.ts](./constants/test-pages.ts). Keep in mind this will only tell playwright where to look for the test page. To create the new pages/patterns themselves, see the [test-the-web](https://github.com/bitwarden/test-the-web) project.
173
+
174
+
> Important! Do not create/modify scenarios and/or tests to pass where a user case wouldn't.
175
+
176
+
#### Known failures
177
+
178
+
User scenarios that are known to fail testing in specific cases are added to the `knownFailures` property of [`testPages`](./constants/test-pages.ts) (the listed tests will skip the owning test page). New failures added to this property should include a brief description of the kind of failure experienced, along with a ticket number tracking the issue.
179
+
142
180
## CI / CD
143
181
144
-
In order to leverage the provided Github Actions testing workflows, you'll need to create an actions secret named `ENV_FILE` in your project repo settings at `https://github.com/<your fork owner>/browser-interactions-testing/settings/secrets/actions`. The value of that secret should be the contents of your `.env` in Base64 format.
182
+
### Running actions
183
+
184
+
Github Action workflows have been created to make running BIT easy for those who do not wish to set up and run the test suite locally. For properly permissioned individuals, this can be achieved with the following steps:
185
+
186
+
- Navigate to `https://github.com/bitwarden/browser-interactions-testing/actions` (or the equivalent for your forked project)
187
+
- Pick and click on the workflow you'd like to run in the left column under "Actions" (**Run all tests with `Test-all`**)
188
+
- By default, `Test-all` will run all the static tests with the same feature flag configuration as the Bitwarden US Production environment.
189
+
- You may alternatively provide the URL of a public vault configuration (e.g. `https://<your hosted vault domain>/api/config`)
190
+
- By default, `Test-all-custom-flags` will run all the static tests with no feature flags active.
191
+
- You may alternatively provide a JSON object of your desired feature flag configuration.
192
+
- Both `Test-all` and `Test-all-custom-flags` workflows will run automatically on changes to the repo or when triggered manually
193
+
- If you are testing against a particular branch of the browser client, replace the value of "main" in the proper input with the desired branch name. Keep in mind the action requires a build artifact to exist, so the branch must first be pushed up to the `clients` repo with a PR (draft mode is fine) that has successfully built.
194
+
- Click the "Run workflow" button dropdown near the top right of the section.
195
+
- If desired, make your input modifications for the workflow, otherwise the default configurations will be used
196
+
- Click "Run workflow" to use the default options.
197
+
- After a moment or two, your workflow run should appear in the workflow runs list. Click it to view progress or summarized results.
198
+
199
+
> Note: The workflows typically require a few minutes (~5-7) to complete.
> Important! BIT can fail a workflow run prematurely if there is no artifact built for the target branch/PR. In these cases, re-running BIT after a artifact build is successful will allow the testing to proceed.
In order to leverage the provided Github Actions testing workflows, you'll need to create an actions secret named `ENV-FILE` along with `BW-INSTALLATION-ID` and `BW-INSTALLATION-KEY` with the values you would otherwise use in your `.env` file at root. These secrets will need to be configured in your project's Azure secrets store.
210
+
211
+
The value of the `ENV-FILE` secret should be the contents of your `.env` in Base64 format.
212
+
213
+
> Note: the `ENV-FILE` pattern will be deprecated in the future in favor of independent environment variable secrets (a la `BW-INSTALLATION-ID` and `BW-INSTALLATION-KEY`).
214
+
215
+
### Using Github Secrets
216
+
217
+
Prior to migrating to Azure, BIT has previously used Github secrets. You can find an example of what those look like for your workflow in tracked [workflow file history](https://github.com/bitwarden/browser-interactions-testing/commit/0dee61dc59836c4cb1a86693c1d3411e8d42e257#diff-12d2c3c126fcc84106dce4b6d2be2220f018661b111a5382ad6effc1047f66ae) and you can configure them for your project at `https://github.com/<your fork owner>/browser-interactions-testing/settings/secrets/actions`.
0 commit comments