From f1ccea5a33c172284b57202ef5448c0e116f2145 Mon Sep 17 00:00:00 2001 From: Erzhan Torokulov Date: Wed, 10 Nov 2021 12:26:15 +0300 Subject: [PATCH] Add browser extension sg cli support (#27276) * Add 'sg test bext|bext-integration|bext-e2e' to run corresponding tests * Add 'sg run bext' to start bext in dev mode --- client/browser/README.md | 9 ++++++--- sg.config.yaml | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/client/browser/README.md b/client/browser/README.md index efbe8e959f8..a0ddf9686bc 100644 --- a/client/browser/README.md +++ b/client/browser/README.md @@ -127,10 +127,13 @@ Click reload for Sourcegraph at `about:debugging` ## Testing -- Unit tests: `yarn test` -- E2E tests: `yarn test-e2e` +- Unit tests: `sg test bext` +- Integration tests: `sg test bext-integration` +- E2E tests: + - `EXTENSION_PERMISSIONS_ALL_URLS=true yarn --cwd client/browser build` + - `sg test bext-e2e` -### e2e tests +### E2E tests The test suite in `end-to-end/github.test.ts` runs on the release branch `bext/release` in both Chrome and Firefox against a Sourcegraph Docker instance. diff --git a/sg.config.yaml b/sg.config.yaml index 44f52769e75..aa10671842d 100644 --- a/sg.config.yaml +++ b/sg.config.yaml @@ -708,6 +708,10 @@ commands: debug-env: cmd: env + bext: + cmd: yarn --cwd client/browser dev + install: yarn + checks: docker: cmd: docker version @@ -973,6 +977,18 @@ tests: cmd: yarn test-integration install: ENTERPRISE=1 yarn build-web + bext: + cmd: yarn --cwd client/browser test + + bext-integration: + cmd: yarn --cwd client/browser test-integration + + bext-e2e: + cmd: yarn run download-puppeteer-browser && yarn --cwd client/browser mocha ./src/end-to-end/github.test.ts ./src/end-to-end/gitlab.test.ts + env: + SOURCEGRAPH_BASE_URL: https://sourcegraph.com + PERCY_BROWSER_EXECUTABLE: node_modules/puppeteer/.local-chromium/linux-901812/chrome-linux/chrome + frontend: cmd: yarn run jest --testPathIgnorePatterns end-to-end regression integration storybook