This is the Sauce Labs Sample Application which is designed to be used from desktop web browsers
To set up the development environment directly on your host computer:
-
You'll need Node.js
>=24.9.0installed (see.nvmrc/package.jsonengines— this is a hard requirement of the Sauce Visual Storybook integration, not just a preference). If you don't have Node installed, we recommend installing NVM to assist managing multiple active Node.js versions (nvm usewill pick up.nvmrcautomatically). -
Install Google Chrome for running the end-to-end tests locally
-
Clone the project somewhere on your computer
git clone git@github.com:<your-username>/sample-app-web.git -
Install all dependencies by running this command from the root of the project
npm install
To set up error reporting with your Backtrace instance:
- Open
src/index.jsxfile and find theBacktraceClient.initializefunction call:BacktraceClient.initialize({ name: 'Swag Store', version: '3.0.0', url: 'https://submit.backtrace.io/UNIVERSE/TOKEN/json', userAttributes: () => ({ user: currentUser(), shoppingCart: ShoppingCart.getCartContents() }) })
- Replace
UNIVERSEandTOKENinurlwith your universe and token.
For more details, see the docs about React integration with Backtrace.
-
Build the application with
npm run startThis starts the Vite dev server, opens Chrome, and loads the website on http://localhost:3000/
-
Click around - this is the app!
To enable additional insight in Backtrace, you can send built sourcemaps and sources to Backtrace:
-
Open
.backtracejsrcfile -
Replace
UNIVERSEandTOKENinupload.urlwith your universe and token. -
Build the application with
npm run build -
Run
backtrace-jsnpm run backtrace.sourcemaps -
Serve the production build (sourcemaps integration won't work with
npm run start, which serves unbuilt source)npm run preview -
New uploaded errors should display with sourcemaps attached!
For more details, see the docs about sourcemap integration with Backtrace.
This website uses components which can be tested with Storybook. To run Storybook execute the following command:
npm run storybook
This will open Storybook on http://localhost:6006/. More information about Storybook can be found here.
The E2E suite lives in test/e2e (a separate npm project using WebdriverIO 9 + Chrome, driven by the bundled chromedriver package — no separate Selenium server or Java install needed). Install its dependencies once:
npm --prefix ./test/e2e install
Make sure the application is running on http://localhost:3000/ (see above steps), then:
npm --prefix ./test/e2e run test.local
This will run the application test suite against your local Chrome.
Running on Sauce Labs uses Environment Variables to authenticate credentials. You can find a guide on how to do this here.
npm --prefix ./test/e2e run test.saucelabs.usto run tests on the Sauce Labs US Data Centernpm --prefix ./test/e2e run test.saucelabs.euto run tests on the Sauce Labs EU Data Center
Make sure you've added the
SAUCE_USERNAMEandSAUCE_ACCESS_KEYvariables to your environment variables.
Components are visually tested with Sauce Visual's Storybook integration (@saucelabs/visual-storybook):
npm run test.storybook
This builds on Storybook's own test runner to visit every story with Playwright (across chromium, firefox, and webkit — see test-runner-jest.config.mjs), take a snapshot, and upload it to Sauce Visual for review/diffing. Requires Node >=24.9.0 (see Requirements above).
Each PR (any branch other than main) will also run this in CI.
Make sure you've added the
SAUCE_USERNAMEandSAUCE_ACCESS_KEYvariables to your environment variables.
Merges to main need to manually be triggered in Actions > github pages release and will automatically deploy to: