mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 16:11:57 +00:00
bext: refactor integration tests (#33598)
This commit is contained in:
parent
e4b5135446
commit
dab3ed4915
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -5,4 +5,3 @@ cmd/repo-updater/repos/testdata/** linguist-generated=true
|
||||
**/*.pb.go linguist-generated=true
|
||||
CHANGELOG.md merge=union
|
||||
**/mock_*_test.go linguist-generated=true
|
||||
*.har filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
2
client/browser/.gitignore
vendored
2
client/browser/.gitignore
vendored
@ -21,3 +21,5 @@ npm-debug.log.*
|
||||
/.gtm/
|
||||
|
||||
code-intel-extensions
|
||||
|
||||
*.har
|
||||
|
||||
@ -141,16 +141,13 @@ Click reload for Sourcegraph at `about:debugging`
|
||||
|
||||
- Unit tests: `sg test bext`
|
||||
- Integration tests
|
||||
- install [git lfs](https://git-lfs.github.com) if it's not installed
|
||||
- run
|
||||
- fetch snapshots with `git lfs fetch`
|
||||
- build browser extension with `sg test bext-build`
|
||||
- run tests with `sg test bext-integration`
|
||||
- develop
|
||||
- add/edit test case or at least its part with navigation to a certain page
|
||||
- if there's no page snapshot for created test or page URL referenced in the existing test has been changed, test will fail with 'Page not found' error
|
||||
- to generate or update page snapshots for tests run `yarn record-integration`
|
||||
- after pushing the updated snapshots to remote they will be stored on GitHub LFS and snapshot files will contain references to that storage
|
||||
- E2E tests: `sg test bext-build` & `sg test bext-e2e`
|
||||
|
||||
### E2E tests
|
||||
|
||||
@ -28,7 +28,8 @@
|
||||
"clean": "rm -rf build/ dist/ *.zip *.xpi .checksum",
|
||||
"test": "jest --testPathIgnorePatterns end-to-end integration",
|
||||
"test-e2e": "mocha './src/end-to-end/**/*.test.ts'",
|
||||
"test-integration": "TS_NODE_PROJECT=src/integration/tsconfig.json SOURCEGRAPH_BASE_URL=https://sourcegraph.com mocha --parallel=$CI --retries=2 ./src/integration/**/*.test.ts",
|
||||
"run-integration": "TS_NODE_PROJECT=src/integration/tsconfig.json SOURCEGRAPH_BASE_URL=https://sourcegraph.com mocha --parallel=$CI --retries=2 ./src/integration/**/*.test.ts",
|
||||
"test-integration": "node scripts/test-integration",
|
||||
"record-integration": "node scripts/record-integration",
|
||||
"create-source-zip": "node scripts/create-source-zip"
|
||||
},
|
||||
|
||||
@ -1,30 +1,36 @@
|
||||
const { Console } = require('console')
|
||||
|
||||
const { readdir, readFile } = require('mz/fs')
|
||||
const shelljs = require('shelljs')
|
||||
|
||||
const recordSnapshot = grepValue =>
|
||||
shelljs.exec(
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
`POLLYJS_MODE=record SOURCEGRAPH_BASE_URL=https://sourcegraph.com yarn test-integration --grep='${grepValue}'`,
|
||||
(error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error(error)
|
||||
return
|
||||
}
|
||||
console.log(`stdout: ${stdout}`)
|
||||
console.error(`stderr: ${stderr}`)
|
||||
}
|
||||
)
|
||||
const { compressRecordings, deleteRecordings } = require('./utils')
|
||||
|
||||
;(async () => {
|
||||
const recordSnapshot = grepValue =>
|
||||
new Promise((resolve, reject) => {
|
||||
shelljs.exec(
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
`POLLYJS_MODE=record SOURCEGRAPH_BASE_URL=https://sourcegraph.com yarn run-integration --grep='${grepValue}'`,
|
||||
(code, stdout, stderr) => {
|
||||
console.log(`stdout: ${stdout}`)
|
||||
console.log(`stderr: ${stderr}`)
|
||||
|
||||
if (code === 0) {
|
||||
resolve()
|
||||
}
|
||||
|
||||
const error = new Error()
|
||||
error.code = code
|
||||
reject(error)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
const recordTests = async () => {
|
||||
// 1. Record by --grep args
|
||||
const args = process.argv.slice(2)
|
||||
for (let index = 0; index < args.length; ++index) {
|
||||
if (args[index] === '--grep' && !!args[index + 1]) {
|
||||
recordSnapshot(args[index + 1])
|
||||
return
|
||||
}
|
||||
if (args[index].startsWith('--grep=')) {
|
||||
recordSnapshot(args.replace('--grep=', ''))
|
||||
await recordSnapshot(args[index + 1])
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -43,9 +49,17 @@ const recordSnapshot = grepValue =>
|
||||
.filter(Boolean)
|
||||
.map(matchArray => matchArray[2])
|
||||
|
||||
for (const testName of testNames) {
|
||||
recordSnapshot(testName)
|
||||
await Promise.all(testNames.map(testName => recordSnapshot(testName)))
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-void
|
||||
void (async () => {
|
||||
try {
|
||||
await recordTests()
|
||||
await compressRecordings()
|
||||
process.exit(0)
|
||||
} catch (error) {
|
||||
await deleteRecordings()
|
||||
process.exit(error.code ?? 1)
|
||||
}
|
||||
})().catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
})()
|
||||
|
||||
12
client/browser/scripts/test-integration.js
Normal file
12
client/browser/scripts/test-integration.js
Normal file
@ -0,0 +1,12 @@
|
||||
const shelljs = require('shelljs')
|
||||
|
||||
const { decompressRecordings, deleteRecordings } = require('./utils')
|
||||
|
||||
// eslint-disable-next-line no-void
|
||||
void (async () => {
|
||||
await decompressRecordings()
|
||||
shelljs.exec('POLLYJS_MODE=replay yarn run-integration', async code => {
|
||||
await deleteRecordings()
|
||||
process.exit(code)
|
||||
})
|
||||
})()
|
||||
107
client/browser/scripts/utils.js
Normal file
107
client/browser/scripts/utils.js
Normal file
@ -0,0 +1,107 @@
|
||||
const { pipeline } = require('stream')
|
||||
const { promisify } = require('util')
|
||||
const { createGzip, unzip } = require('zlib')
|
||||
|
||||
const { readdir, writeFile, readFile, unlink, createReadStream, createWriteStream } = require('mz/fs')
|
||||
|
||||
const fixturesPath = './src/integration/__fixtures__'
|
||||
const recordingFileName = 'recording.har'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
const buildCompressedFilePath = filePath => `${filePath}.gz`
|
||||
const buildDecompressedFilePath = compressedFilePath => compressedFilePath.replace(/\.gz$/, '')
|
||||
|
||||
const findRecordingPath = async (path, isCompressed) => {
|
||||
const content = await readdir(path, { withFileTypes: true })
|
||||
|
||||
if (content.length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
if (content[0].isDirectory()) {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
return findRecordingPath(`${path}/${content[0].name}`, isCompressed)
|
||||
}
|
||||
|
||||
const recording = content.find(
|
||||
element =>
|
||||
element.isFile() &&
|
||||
element.name === (isCompressed ? buildCompressedFilePath(recordingFileName) : recordingFileName)
|
||||
)
|
||||
|
||||
if (recording) {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
return `${path}/${recording.name}`
|
||||
}
|
||||
}
|
||||
|
||||
const pipe = promisify(pipeline)
|
||||
const compress = async (input, output) => {
|
||||
const gzip = createGzip()
|
||||
const source = createReadStream(input)
|
||||
const destination = createWriteStream(output)
|
||||
await pipe(source, gzip, destination)
|
||||
}
|
||||
|
||||
const compressRecordings = async () => {
|
||||
const folders = await readdir(fixturesPath)
|
||||
|
||||
await Promise.all(
|
||||
folders.map(async folder => {
|
||||
const filePath = await findRecordingPath(`${fixturesPath}/${folder}`, false)
|
||||
|
||||
if (filePath) {
|
||||
try {
|
||||
await compress(filePath, buildCompressedFilePath(filePath))
|
||||
await unlink(filePath) // delete original recording
|
||||
} catch (error) {
|
||||
console.error('An error occurred:', error)
|
||||
process.exitCode = 1
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
const unzipAsPromise = promisify(unzip)
|
||||
const decompressRecordings = async () => {
|
||||
const folders = await readdir(fixturesPath)
|
||||
|
||||
await Promise.all(
|
||||
folders.map(async folder => {
|
||||
const filePath = await findRecordingPath(`${fixturesPath}/${folder}`, true)
|
||||
|
||||
if (filePath) {
|
||||
try {
|
||||
const content = await readFile(filePath, 'base64')
|
||||
const result = await unzipAsPromise(Buffer.from(content, 'base64'))
|
||||
await writeFile(buildDecompressedFilePath(filePath), result)
|
||||
} catch (error) {
|
||||
console.error('An error occurred:', error)
|
||||
process.exitCode = 1
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
const deleteRecordings = async () => {
|
||||
const folders = await readdir(fixturesPath)
|
||||
|
||||
await Promise.all(
|
||||
folders.map(async folder => {
|
||||
const filePath = await findRecordingPath(`${fixturesPath}/${folder}`, false)
|
||||
|
||||
if (filePath) {
|
||||
try {
|
||||
await unlink(filePath) // delete original recording
|
||||
} catch (error) {
|
||||
console.error('An error occurred:', error)
|
||||
process.exitCode = 1
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = { compressRecordings, decompressRecordings, deleteRecordings }
|
||||
Binary file not shown.
Binary file not shown.
BIN
client/browser/src/integration/__fixtures__/git_hub_pull_request_pages_commit_view_has_sourcegraph_icon_button_and_provides_hover_tooltips_for_pull_requests_in_split_mode/has_sourcegraph_icon_button_and_provides_hover_tooltips_for_pull_requests_in_split_mode_773639707/recording.har
(Stored with Git LFS)
generated
BIN
client/browser/src/integration/__fixtures__/git_hub_pull_request_pages_commit_view_has_sourcegraph_icon_button_and_provides_hover_tooltips_for_pull_requests_in_split_mode/has_sourcegraph_icon_button_and_provides_hover_tooltips_for_pull_requests_in_split_mode_773639707/recording.har
(Stored with Git LFS)
generated
Binary file not shown.
Binary file not shown.
BIN
client/browser/src/integration/__fixtures__/git_hub_pull_request_pages_commit_view_has_sourcegraph_icon_button_and_provides_hover_tooltips_for_pull_requests_in_unified_mode/has_sourcegraph_icon_button_and_provides_hover_tooltips_for_pull_requests_in_unified_mode_618850985/recording.har
(Stored with Git LFS)
generated
BIN
client/browser/src/integration/__fixtures__/git_hub_pull_request_pages_commit_view_has_sourcegraph_icon_button_and_provides_hover_tooltips_for_pull_requests_in_unified_mode/has_sourcegraph_icon_button_and_provides_hover_tooltips_for_pull_requests_in_unified_mode_618850985/recording.har
(Stored with Git LFS)
generated
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
client/browser/src/integration/__fixtures__/git_hub_search_pages_search_results_page_search_on_sourcegraph_click_navigates_to_sourcegraph_search_page_with_proper_result_type_and_language/search_on_sourcegraph_click_navigates_to_sourcegraph_search_page_with_proper_result_type_a_708823018/recording.har
(Stored with Git LFS)
generated
BIN
client/browser/src/integration/__fixtures__/git_hub_search_pages_search_results_page_search_on_sourcegraph_click_navigates_to_sourcegraph_search_page_with_proper_result_type_and_language/search_on_sourcegraph_click_navigates_to_sourcegraph_search_page_with_proper_result_type_a_708823018/recording.har
(Stored with Git LFS)
generated
Binary file not shown.
BIN
client/browser/src/integration/__fixtures__/git_hub_search_pages_search_results_page_search_on_sourcegraph_click_navigates_to_sourcegraph_search_page_with_proper_type_and_query/search_on_sourcegraph_click_navigates_to_sourcegraph_search_page_with_proper_type_and_que_1166304504/recording.har
(Stored with Git LFS)
generated
BIN
client/browser/src/integration/__fixtures__/git_hub_search_pages_search_results_page_search_on_sourcegraph_click_navigates_to_sourcegraph_search_page_with_proper_type_and_query/search_on_sourcegraph_click_navigates_to_sourcegraph_search_page_with_proper_type_and_que_1166304504/recording.har
(Stored with Git LFS)
generated
Binary file not shown.
BIN
client/browser/src/integration/__fixtures__/git_hub_search_pages_search_results_page_search_on_sourcegraph_click_navigates_to_sourcegraph_search_page_with_proper_type_and_search_query_from_search_input/search_on_sourcegraph_click_navigates_to_sourcegraph_search_page_with_proper_type_and_sea_2172073946/recording.har
(Stored with Git LFS)
generated
BIN
client/browser/src/integration/__fixtures__/git_hub_search_pages_search_results_page_search_on_sourcegraph_click_navigates_to_sourcegraph_search_page_with_proper_type_and_search_query_from_search_input/search_on_sourcegraph_click_navigates_to_sourcegraph_search_page_with_proper_type_and_sea_2172073946/recording.har
(Stored with Git LFS)
generated
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
client/browser/src/integration/__fixtures__/git_hub_shows_hover_tooltips_when_hovering_a_token_and_respects_enable_single_click_to_go_to_definition_setting/shows_hover_tooltips_when_hovering_a_token_and_respects_enable_single_click_to_go_to_defi_4078478237/recording.har
(Stored with Git LFS)
generated
BIN
client/browser/src/integration/__fixtures__/git_hub_shows_hover_tooltips_when_hovering_a_token_and_respects_enable_single_click_to_go_to_definition_setting/shows_hover_tooltips_when_hovering_a_token_and_respects_enable_single_click_to_go_to_defi_4078478237/recording.har
(Stored with Git LFS)
generated
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,42 +0,0 @@
|
||||
import { createDriverForTest, Driver } from '@sourcegraph/shared/src/testing/driver'
|
||||
|
||||
import { BrowserIntegrationTestContext, createBrowserIntegrationTestContext } from './context'
|
||||
import { closeInstallPageTab } from './shared'
|
||||
|
||||
describe('After install page', () => {
|
||||
let driver: Driver
|
||||
before(async () => {
|
||||
driver = await createDriverForTest({ loadExtension: true })
|
||||
await closeInstallPageTab(driver.browser)
|
||||
if (driver.sourcegraphBaseUrl !== 'https://sourcegraph.com') {
|
||||
await driver.setExtensionSourcegraphUrl()
|
||||
}
|
||||
})
|
||||
after(() => driver?.close())
|
||||
|
||||
let testContext: BrowserIntegrationTestContext
|
||||
beforeEach(async function () {
|
||||
testContext = await createBrowserIntegrationTestContext({
|
||||
driver,
|
||||
currentTest: this.currentTest!,
|
||||
directory: __dirname,
|
||||
})
|
||||
|
||||
// Requests to other origins that we need to ignore to prevent breaking tests.
|
||||
testContext.server
|
||||
.get('https://storage.googleapis.com/sourcegraph-assets/code-host-integration/*path')
|
||||
.intercept((request, response) => {
|
||||
response.sendStatus(200)
|
||||
})
|
||||
|
||||
// Ensure that the same assets are requested in all environments.
|
||||
await driver.page.emulateMediaFeatures([{ name: 'prefers-color-scheme', value: 'light' }])
|
||||
})
|
||||
|
||||
afterEach(() => testContext?.dispose())
|
||||
|
||||
it('renders after install page content', async () => {
|
||||
await driver.openBrowserExtensionPage('after_install')
|
||||
await driver.page.$("[data-testid='after-install-page-content']")
|
||||
})
|
||||
})
|
||||
@ -37,7 +37,12 @@ describe('GitHub', () => {
|
||||
directory: __dirname,
|
||||
})
|
||||
|
||||
mockUrls(['https://api.github.com/_private/browser/*', 'https://collector.github.com/*path'])
|
||||
mockUrls([
|
||||
'https://api.github.com/_private/browser/*',
|
||||
'https://collector.github.com/*path',
|
||||
'https://github.com/favicon.ico',
|
||||
'https://github.githubassets.com/favicons/*path',
|
||||
])
|
||||
|
||||
testContext.server.any('https://api.github.com/repos/*').intercept((request, response) => {
|
||||
response
|
||||
@ -244,10 +249,6 @@ describe('GitHub', () => {
|
||||
hasRedirectedToDefinition = true
|
||||
})
|
||||
|
||||
testContext.server.get('https://github.com/favicon.ico').intercept((request, response) => {
|
||||
response.sendStatus(200)
|
||||
})
|
||||
|
||||
const openPageAndGetToken = async () => {
|
||||
await driver.page.goto(
|
||||
'https://github.com/sourcegraph/jsonrpc2/blob/4fb7cd90793ee6ab445f466b900e6bffb9b63d78/call_opt.go'
|
||||
@ -757,57 +758,16 @@ describe('GitHub', () => {
|
||||
describe('Search pages', () => {
|
||||
const sourcegraphSearchPage = 'https://sourcegraph.com/search'
|
||||
|
||||
describe('Simple and advanced search pages', () => {
|
||||
beforeEach(() => {
|
||||
mockUrls(['https://github.githubassets.com/favicons/*path'])
|
||||
})
|
||||
const pages = [
|
||||
{ name: 'Simple search page', url: 'https://github.com/search' },
|
||||
{ name: 'Advanced search page', url: 'https://github.com/search/advanced' },
|
||||
]
|
||||
|
||||
const pages = ['https://github.com/search', 'https://github.com/search/advanced']
|
||||
|
||||
it('render "Search on Sourcegraph" button', async () => {
|
||||
for (const page of pages) {
|
||||
for (const page of pages) {
|
||||
describe(page.name, () => {
|
||||
it('if search input has value "Search on Sourcegraph" click navigates to Sourcegraph search page with type "repo" and search query', async () => {
|
||||
await driver.newPage()
|
||||
await driver.page.goto(page)
|
||||
|
||||
const linkToSourcegraph = await driver.page.waitForSelector(
|
||||
'[data-testid="search-on-sourcegraph"]',
|
||||
{ timeout: 3000 }
|
||||
)
|
||||
|
||||
assert(linkToSourcegraph, 'Expected link to Sourcegraph search page exists')
|
||||
}
|
||||
})
|
||||
|
||||
it('if search input is empty "Search on Sourcegraph" click navigates to Sourcegraph search page with type "repo" and empty search query', async () => {
|
||||
for (const page of pages) {
|
||||
await driver.newPage()
|
||||
await driver.page.goto(page)
|
||||
|
||||
const linkToSourcegraph = await driver.page.waitForSelector(
|
||||
'[data-testid="search-on-sourcegraph"]',
|
||||
{ timeout: 3000 }
|
||||
)
|
||||
let hasRedirectedToSourcegraphSearch = false
|
||||
testContext.server.get(sourcegraphSearchPage).intercept(request => {
|
||||
if (request.query.q === 'type:repo') {
|
||||
hasRedirectedToSourcegraphSearch = true
|
||||
}
|
||||
})
|
||||
|
||||
await linkToSourcegraph?.click()
|
||||
await driver.page.waitForTimeout(3000)
|
||||
|
||||
assert(
|
||||
hasRedirectedToSourcegraphSearch,
|
||||
'Expected to be redirected to Sourcegraph search page with type "repo" and empty query'
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
it('if search input has value "Search on Sourcegraph" click navigates to Sourcegraph search page with type "repo" and search query', async () => {
|
||||
for (const page of pages) {
|
||||
await driver.newPage()
|
||||
await driver.page.goto(page)
|
||||
await driver.page.goto(page.url)
|
||||
|
||||
const query = 'Hello world!'
|
||||
const searchInput = await driver.page.waitForSelector('#search_form input[type="text"]')
|
||||
@ -815,6 +775,9 @@ describe('GitHub', () => {
|
||||
'[data-testid="search-on-sourcegraph"]',
|
||||
{ timeout: 3000 }
|
||||
)
|
||||
|
||||
assert(linkToSourcegraph, 'Expected link to Sourcegraph search page exists')
|
||||
|
||||
let hasRedirectedToSourcegraphSearch = false
|
||||
testContext.server.get(sourcegraphSearchPage).intercept(request => {
|
||||
if (['type:repo', query].every(value => request.query.q?.includes(value))) {
|
||||
@ -830,15 +793,14 @@ describe('GitHub', () => {
|
||||
hasRedirectedToSourcegraphSearch,
|
||||
'Expected to be redirected to Sourcegraph search page with type "repo" and search query'
|
||||
)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// global and repository search pages
|
||||
describe('Search results page', () => {
|
||||
beforeEach(() => {
|
||||
mockUrls([
|
||||
'https://github.githubassets.com/favicons/*path',
|
||||
'https://github.com/_graphql/GetSuggestedNavigationDestinations',
|
||||
'https://github.com/**/commits/checks-statuses-rollups',
|
||||
'https://github.com/commits/badges',
|
||||
@ -856,16 +818,8 @@ describe('GitHub', () => {
|
||||
const repoSearchPage = `https://github.com/${repo}/search`
|
||||
|
||||
const pages = [
|
||||
{
|
||||
url: globalSearchPage,
|
||||
htmlResultLangSelector: 'ul.filter-list li:nth-child(1) a.filter-item',
|
||||
commitResultTypeSelector: 'nav.menu .menu-item:nth-child(3)',
|
||||
},
|
||||
{
|
||||
url: repoSearchPage,
|
||||
htmlResultLangSelector: 'ul.filter-list li:nth-child(2) a.filter-item',
|
||||
commitResultTypeSelector: 'nav.menu .menu-item:nth-child(2)',
|
||||
},
|
||||
{ name: 'Global search page', url: globalSearchPage },
|
||||
{ name: 'Repo search page', url: repoSearchPage },
|
||||
]
|
||||
|
||||
const viewportM = { width: 768, height: 1024 }
|
||||
@ -873,11 +827,13 @@ describe('GitHub', () => {
|
||||
|
||||
const viewportConfigs = [
|
||||
{
|
||||
name: 'M',
|
||||
viewport: viewportM,
|
||||
sourcegraphButtonSelector: '#pageSearchFormSourcegraphButton [data-testid="search-on-sourcegraph"]',
|
||||
searchInputSelector: ".application-main form.js-site-search-form input.form-control[name='q']",
|
||||
},
|
||||
{
|
||||
name: 'L',
|
||||
viewport: viewportL,
|
||||
searchInputSelector: "header form.js-site-search-form input.form-control[name='q']",
|
||||
sourcegraphButtonSelector:
|
||||
@ -885,152 +841,89 @@ describe('GitHub', () => {
|
||||
},
|
||||
]
|
||||
|
||||
it('renders "Search on Sourcegraph" button', async () => {
|
||||
for (const page of pages) {
|
||||
const url = buildGitHubSearchResultsURL(page.url, 'hello')
|
||||
for (const page of pages) {
|
||||
describe(page.name, () => {
|
||||
for (const viewportConfig of viewportConfigs) {
|
||||
describe(`Viewport: ${viewportConfig.name}`, () => {
|
||||
it('"Search on Sourcegraph" click navigates to Sourcegraph search page with proper result type, language and search query from search input', async () => {
|
||||
const initialQuery = 'fix'
|
||||
|
||||
for (const { sourcegraphButtonSelector } of viewportConfigs) {
|
||||
await driver.page.goto(url)
|
||||
const url = buildGitHubSearchResultsURL(page.url, initialQuery)
|
||||
const query = 'issue'
|
||||
|
||||
const linkToSourcegraph = await driver.page.waitForSelector(sourcegraphButtonSelector, {
|
||||
timeout: 3000,
|
||||
await driver.newPage()
|
||||
await driver.page.goto(url)
|
||||
await driver.page.setViewport(viewportConfig.viewport)
|
||||
|
||||
let hasRedirectedToSourcegraphSearch = false
|
||||
let lang = ''
|
||||
testContext.server.get(sourcegraphSearchPage).intercept(request => {
|
||||
const resultQuery = `${initialQuery} ${query}`
|
||||
const parameters = ['type:commit', `lang:${lang}`, resultQuery]
|
||||
|
||||
if (page.url === repoSearchPage) {
|
||||
parameters.push(`repo:${repo}`)
|
||||
}
|
||||
|
||||
hasRedirectedToSourcegraphSearch = parameters.every(value =>
|
||||
request.query.q?.includes(value)
|
||||
)
|
||||
})
|
||||
|
||||
// filter results by language (handled by client-side routing)
|
||||
const langLinkHandle = await driver.page.$(
|
||||
'ul.filter-list li:first-child a.filter-item'
|
||||
)
|
||||
assert(langLinkHandle, 'Expected language result type link to exist')
|
||||
lang = await langLinkHandle.evaluate(node => {
|
||||
if (!(node instanceof HTMLAnchorElement) || !node.href) {
|
||||
return ''
|
||||
}
|
||||
|
||||
return new URL(node.href).searchParams.get('l') || ''
|
||||
})
|
||||
await langLinkHandle.click()
|
||||
await driver.page.waitForTimeout(3000)
|
||||
|
||||
// filter results by type (handled by client-side routing)
|
||||
const commitsLinkHandle = await driver.page.$(
|
||||
"nav.menu a.menu-item[href*='type=commits']"
|
||||
)
|
||||
assert(commitsLinkHandle, 'Expected commits result type link to exist')
|
||||
await commitsLinkHandle.click()
|
||||
await driver.page.waitForTimeout(3000)
|
||||
|
||||
const searchInput = await driver.page.waitForSelector(
|
||||
viewportConfig.searchInputSelector
|
||||
)
|
||||
// For some reason puppeteer when typing into input field prepends the exising value.
|
||||
// To replicate the natural behavior we navigate to the end of exisiting value and then start typing.
|
||||
await searchInput?.focus()
|
||||
for (const _char of initialQuery) {
|
||||
await driver.page.keyboard.press('ArrowRight')
|
||||
}
|
||||
await searchInput?.type(` ${query}`, { delay: 100 })
|
||||
await driver.page.keyboard.press('Escape') // if input focus opened dropdown, ensure the latter is closed
|
||||
|
||||
const linkToSourcegraph = await driver.page.waitForSelector(
|
||||
viewportConfig.sourcegraphButtonSelector,
|
||||
{
|
||||
timeout: 3000,
|
||||
}
|
||||
)
|
||||
assert(linkToSourcegraph, 'Expected link to Sourcegraph search page exists')
|
||||
await linkToSourcegraph?.click()
|
||||
await driver.page.waitForTimeout(3000)
|
||||
|
||||
assert(
|
||||
hasRedirectedToSourcegraphSearch,
|
||||
'Expected to be redirected to Sourcegraph search page with type "commit", language "HTML" and search query'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
assert(linkToSourcegraph, 'Expected link to Sourcegraph search page exists')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
it('"Search on Sourcegraph" click navigates to Sourcegraph search page with proper type and query', async () => {
|
||||
const searchTerm = 'hello'
|
||||
|
||||
for (const page of pages) {
|
||||
const url = buildGitHubSearchResultsURL(page.url, searchTerm)
|
||||
|
||||
for (const { viewport, sourcegraphButtonSelector } of viewportConfigs) {
|
||||
await driver.newPage()
|
||||
await driver.page.goto(url)
|
||||
await driver.page.setViewport(viewport)
|
||||
|
||||
const linkToSourcegraph = await driver.page.waitForSelector(sourcegraphButtonSelector, {
|
||||
timeout: 3000,
|
||||
})
|
||||
|
||||
let hasRedirectedToSourcegraphSearch = false
|
||||
testContext.server.get(sourcegraphSearchPage).intercept(request => {
|
||||
if (page.url === globalSearchPage) {
|
||||
hasRedirectedToSourcegraphSearch = ['type:repo', searchTerm].every(value =>
|
||||
request.query.q?.includes(value)
|
||||
)
|
||||
} else if (page.url === repoSearchPage) {
|
||||
hasRedirectedToSourcegraphSearch = [`repo:${repo}`, searchTerm].every(value =>
|
||||
request.query.q?.includes(value)
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
await linkToSourcegraph?.click()
|
||||
await driver.page.waitForTimeout(3000)
|
||||
|
||||
assert(
|
||||
hasRedirectedToSourcegraphSearch,
|
||||
'Expected to be redirected to Sourcegraph search page with proper result type and query'
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
it('"Search on Sourcegraph" click navigates to Sourcegraph search page with proper type and search query from search input', async () => {
|
||||
const initialQuery = 'hello'
|
||||
|
||||
for (const page of pages) {
|
||||
const url = buildGitHubSearchResultsURL(page.url, initialQuery)
|
||||
const query = 'world'
|
||||
|
||||
for (const { viewport, sourcegraphButtonSelector, searchInputSelector } of viewportConfigs) {
|
||||
await driver.newPage()
|
||||
await driver.page.goto(url.toString())
|
||||
await driver.page.setViewport(viewport)
|
||||
|
||||
const searchInput = await driver.page.waitForSelector(searchInputSelector)
|
||||
const linkToSourcegraph = await driver.page.waitForSelector(sourcegraphButtonSelector, {
|
||||
timeout: 3000,
|
||||
})
|
||||
let hasRedirectedToSourcegraphSearch = false
|
||||
testContext.server.get(sourcegraphSearchPage).intercept(request => {
|
||||
const resultQuery = `${initialQuery} ${query}`
|
||||
|
||||
if (page.url === globalSearchPage) {
|
||||
hasRedirectedToSourcegraphSearch = ['type:repo', resultQuery].every(value =>
|
||||
request.query.q?.includes(value)
|
||||
)
|
||||
} else if (page.url === repoSearchPage) {
|
||||
hasRedirectedToSourcegraphSearch = [`repo:${repo}`, resultQuery].every(value =>
|
||||
request.query.q?.includes(value)
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
// For some reason puppeteer when typing into input field prepends the exising value.
|
||||
// To replicate the natural behavior we navigate to the end of exisiting value and then start typing.
|
||||
await searchInput?.focus()
|
||||
for (const _char of initialQuery) {
|
||||
await driver.page.keyboard.press('ArrowRight')
|
||||
}
|
||||
await searchInput?.type(` ${query}`, { delay: 100 })
|
||||
await driver.page.keyboard.press('Escape') // if input focus opened dropdown, ensure the latter is closed
|
||||
|
||||
await linkToSourcegraph?.click()
|
||||
await driver.page.waitForTimeout(1000)
|
||||
|
||||
assert(
|
||||
hasRedirectedToSourcegraphSearch,
|
||||
'Expected to be redirected to Sourcegraph search page with type "repo" and input search query'
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
it('"Search on Sourcegraph" click navigates to Sourcegraph search page with proper result type and language', async () => {
|
||||
const searchTerm = 'hello'
|
||||
|
||||
for (const page of pages) {
|
||||
const url = buildGitHubSearchResultsURL(page.url, searchTerm)
|
||||
|
||||
await driver.newPage()
|
||||
await driver.page.goto(url)
|
||||
await driver.page.setViewport(viewportL)
|
||||
|
||||
let hasRedirectedToSourcegraphSearch = false
|
||||
testContext.server.get(sourcegraphSearchPage).intercept(request => {
|
||||
if (['type:commit', 'lang:HTML', searchTerm].every(value => request.query.q?.includes(value))) {
|
||||
hasRedirectedToSourcegraphSearch = true
|
||||
}
|
||||
})
|
||||
|
||||
// filter results by language (handled by client-side routing)
|
||||
const htmlButton = await driver.page.waitForSelector(page.htmlResultLangSelector)
|
||||
await htmlButton?.click()
|
||||
await driver.page.waitForTimeout(3000)
|
||||
|
||||
// filter results by type (handled by client-side routing)
|
||||
const commitsButton = await driver.page.waitForSelector(page.commitResultTypeSelector)
|
||||
commitsButton?.click()
|
||||
await driver.page.waitForTimeout(3000)
|
||||
|
||||
const linkToSourcegraph = await driver.page.waitForSelector(
|
||||
'#headerSearchInputSourcegraphButton [data-testid="search-on-sourcegraph"]',
|
||||
{ timeout: 3000 }
|
||||
)
|
||||
await linkToSourcegraph?.click()
|
||||
await driver.page.waitForTimeout(3000)
|
||||
|
||||
assert(
|
||||
hasRedirectedToSourcegraphSearch,
|
||||
'Expected to be redirected to Sourcegraph search page with type "commit", language "HTML" and search query'
|
||||
)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -23,12 +23,12 @@ The default run type.
|
||||
- **Pipeline setup**: Trigger async
|
||||
- Client PR preview
|
||||
- **Linters and static analysis**: Prettier, Misc linters, Yarn deduplicate lint
|
||||
- **Client checks**: Puppeteer tests prep, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), ESLint, Build TS, Stylelint
|
||||
- **Client checks**: Puppeteer tests prep, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Puppeteer tests for chrome extension, Test (client/browser), ESLint, Build TS, Stylelint
|
||||
- Upload build trace
|
||||
|
||||
- Pipeline for `GraphQL` changes:
|
||||
- **Linters and static analysis**: Prettier, Misc linters, GraphQL lint
|
||||
- **Client checks**: Puppeteer tests prep, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), ESLint, Build TS, Stylelint
|
||||
- **Client checks**: Puppeteer tests prep, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Puppeteer tests for chrome extension, Test (client/browser), ESLint, Build TS, Stylelint
|
||||
- **Go checks**: Test (all), Test (enterprise/internal/codeintel/stores/dbstore), Test (enterprise/internal/codeintel/stores/lsifstore), Test (enterprise/internal/insights), Test (internal/database), Test (internal/repos), Test (enterprise/internal/batches), Test (cmd/frontend), Test (enterprise/internal/database), Test (enterprise/cmd/frontend/internal/batches/resolvers), Build
|
||||
- Upload build trace
|
||||
|
||||
@ -81,6 +81,7 @@ Base pipeline (more steps might be included based on branch changes):
|
||||
- ESLint
|
||||
- Build TS
|
||||
- Stylelint
|
||||
- Puppeteer tests for chrome extension
|
||||
- Test (client/browser)
|
||||
- Test (all)
|
||||
- E2E for chrome extension
|
||||
@ -96,7 +97,7 @@ Base pipeline (more steps might be included based on branch changes):
|
||||
- **Image builds**: Build alpine-3.12, Build alpine-3.14, Build cadvisor, Build codeinsights-db, Build codeintel-db, Build frontend, Build github-proxy, Build gitserver, Build grafana, Build indexed-searcher, Build jaeger-agent, Build jaeger-all-in-one, Build minio, Build postgres-12-alpine, Build postgres_exporter, Build precise-code-intel-worker, Build prometheus, Build redis-cache, Build redis-store, Build redis_exporter, Build repo-updater, Build search-indexer, Build searcher, Build symbols, Build syntax-highlighter, Build worker, Build migrator, Build server, Build sg
|
||||
- **Image security scans**: Scan alpine-3.12, Scan alpine-3.14, Scan cadvisor, Scan codeinsights-db, Scan codeintel-db, Scan frontend, Scan github-proxy, Scan gitserver, Scan grafana, Scan indexed-searcher, Scan jaeger-agent, Scan jaeger-all-in-one, Scan minio, Scan postgres-12-alpine, Scan postgres_exporter, Scan precise-code-intel-worker, Scan prometheus, Scan redis-cache, Scan redis-store, Scan redis_exporter, Scan repo-updater, Scan search-indexer, Scan searcher, Scan symbols, Scan syntax-highlighter, Scan worker, Scan migrator, Scan server, Scan sg
|
||||
- **Linters and static analysis**: Prettier, Misc linters, GraphQL lint, SVG lint, Yarn deduplicate lint, Docker linters, Check and build docsite
|
||||
- **Client checks**: Puppeteer tests prep, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), ESLint, Build TS, Stylelint
|
||||
- **Client checks**: Puppeteer tests prep, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Puppeteer tests for chrome extension, Test (client/browser), ESLint, Build TS, Stylelint
|
||||
- **Go checks**: Test (all), Test (enterprise/internal/codeintel/stores/dbstore), Test (enterprise/internal/codeintel/stores/lsifstore), Test (enterprise/internal/insights), Test (internal/database), Test (internal/repos), Test (enterprise/internal/batches), Test (cmd/frontend), Test (enterprise/internal/database), Test (enterprise/cmd/frontend/internal/batches/resolvers), Build
|
||||
- **DB backcompat tests**: Backcompat test (all), Backcompat test (enterprise/internal/codeintel/stores/dbstore), Backcompat test (enterprise/internal/codeintel/stores/lsifstore), Backcompat test (enterprise/internal/insights), Backcompat test (internal/database), Backcompat test (internal/repos), Backcompat test (enterprise/internal/batches), Backcompat test (cmd/frontend), Backcompat test (enterprise/internal/database), Backcompat test (enterprise/cmd/frontend/internal/batches/resolvers)
|
||||
- **CI script tests**: test-trace-command.sh
|
||||
@ -115,7 +116,7 @@ Base pipeline (more steps might be included based on branch changes):
|
||||
- **Image builds**: Build alpine-3.12, Build alpine-3.14, Build cadvisor, Build codeinsights-db, Build codeintel-db, Build frontend, Build github-proxy, Build gitserver, Build grafana, Build indexed-searcher, Build jaeger-agent, Build jaeger-all-in-one, Build minio, Build postgres-12-alpine, Build postgres_exporter, Build precise-code-intel-worker, Build prometheus, Build redis-cache, Build redis-store, Build redis_exporter, Build repo-updater, Build search-indexer, Build searcher, Build symbols, Build syntax-highlighter, Build worker, Build migrator, Build server, Build sg, Build executor image, Build docker registry mirror image
|
||||
- **Image security scans**: Scan alpine-3.12, Scan alpine-3.14, Scan cadvisor, Scan codeinsights-db, Scan codeintel-db, Scan frontend, Scan github-proxy, Scan gitserver, Scan grafana, Scan indexed-searcher, Scan jaeger-agent, Scan jaeger-all-in-one, Scan minio, Scan postgres-12-alpine, Scan postgres_exporter, Scan precise-code-intel-worker, Scan prometheus, Scan redis-cache, Scan redis-store, Scan redis_exporter, Scan repo-updater, Scan search-indexer, Scan searcher, Scan symbols, Scan syntax-highlighter, Scan worker, Scan migrator, Scan server, Scan sg
|
||||
- **Linters and static analysis**: Prettier, Misc linters, GraphQL lint, SVG lint, Yarn deduplicate lint, Docker linters, Check and build docsite
|
||||
- **Client checks**: Puppeteer tests prep, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), ESLint, Build TS, Stylelint
|
||||
- **Client checks**: Puppeteer tests prep, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Puppeteer tests for chrome extension, Test (client/browser), ESLint, Build TS, Stylelint
|
||||
- **Go checks**: Test (all), Test (enterprise/internal/codeintel/stores/dbstore), Test (enterprise/internal/codeintel/stores/lsifstore), Test (enterprise/internal/insights), Test (internal/database), Test (internal/repos), Test (enterprise/internal/batches), Test (cmd/frontend), Test (enterprise/internal/database), Test (enterprise/cmd/frontend/internal/batches/resolvers), Build
|
||||
- **DB backcompat tests**: Backcompat test (all), Backcompat test (enterprise/internal/codeintel/stores/dbstore), Backcompat test (enterprise/internal/codeintel/stores/lsifstore), Backcompat test (enterprise/internal/insights), Backcompat test (internal/database), Backcompat test (internal/repos), Backcompat test (enterprise/internal/batches), Backcompat test (cmd/frontend), Backcompat test (enterprise/internal/database), Backcompat test (enterprise/cmd/frontend/internal/batches/resolvers)
|
||||
- **CI script tests**: test-trace-command.sh
|
||||
@ -133,6 +134,7 @@ Base pipeline (more steps might be included based on branch changes):
|
||||
- ESLint
|
||||
- Build TS
|
||||
- Stylelint
|
||||
- Puppeteer tests for chrome extension
|
||||
- Test (client/browser)
|
||||
- Test (all)
|
||||
- E2E for chrome extension
|
||||
@ -151,7 +153,7 @@ Base pipeline (more steps might be included based on branch changes):
|
||||
- **Image builds**: Build alpine-3.12, Build alpine-3.14, Build cadvisor, Build codeinsights-db, Build codeintel-db, Build frontend, Build github-proxy, Build gitserver, Build grafana, Build indexed-searcher, Build jaeger-agent, Build jaeger-all-in-one, Build minio, Build postgres-12-alpine, Build postgres_exporter, Build precise-code-intel-worker, Build prometheus, Build redis-cache, Build redis-store, Build redis_exporter, Build repo-updater, Build search-indexer, Build searcher, Build symbols, Build syntax-highlighter, Build worker, Build migrator, Build server, Build sg, Build executor image
|
||||
- **Image security scans**: Scan alpine-3.12, Scan alpine-3.14, Scan cadvisor, Scan codeinsights-db, Scan codeintel-db, Scan frontend, Scan github-proxy, Scan gitserver, Scan grafana, Scan indexed-searcher, Scan jaeger-agent, Scan jaeger-all-in-one, Scan minio, Scan postgres-12-alpine, Scan postgres_exporter, Scan precise-code-intel-worker, Scan prometheus, Scan redis-cache, Scan redis-store, Scan redis_exporter, Scan repo-updater, Scan search-indexer, Scan searcher, Scan symbols, Scan syntax-highlighter, Scan worker, Scan migrator, Scan server, Scan sg
|
||||
- **Linters and static analysis**: Prettier, Misc linters, GraphQL lint, SVG lint, Yarn deduplicate lint, Docker linters, Check and build docsite
|
||||
- **Client checks**: Puppeteer tests prep, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), ESLint, Build TS, Stylelint
|
||||
- **Client checks**: Puppeteer tests prep, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Puppeteer tests for chrome extension, Test (client/browser), ESLint, Build TS, Stylelint
|
||||
- **Go checks**: Test (all), Test (enterprise/internal/codeintel/stores/dbstore), Test (enterprise/internal/codeintel/stores/lsifstore), Test (enterprise/internal/insights), Test (internal/database), Test (internal/repos), Test (enterprise/internal/batches), Test (cmd/frontend), Test (enterprise/internal/database), Test (enterprise/cmd/frontend/internal/batches/resolvers), Build
|
||||
- **DB backcompat tests**: Backcompat test (all), Backcompat test (enterprise/internal/codeintel/stores/dbstore), Backcompat test (enterprise/internal/codeintel/stores/lsifstore), Backcompat test (enterprise/internal/insights), Backcompat test (internal/database), Backcompat test (internal/repos), Backcompat test (enterprise/internal/batches), Backcompat test (cmd/frontend), Backcompat test (enterprise/internal/database), Backcompat test (enterprise/cmd/frontend/internal/batches/resolvers)
|
||||
- **CI script tests**: test-trace-command.sh
|
||||
@ -175,7 +177,7 @@ Base pipeline (more steps might be included based on branch changes):
|
||||
- **Image builds**: Build alpine-3.12, Build alpine-3.14, Build cadvisor, Build codeinsights-db, Build codeintel-db, Build frontend, Build github-proxy, Build gitserver, Build grafana, Build indexed-searcher, Build jaeger-agent, Build jaeger-all-in-one, Build minio, Build postgres-12-alpine, Build postgres_exporter, Build precise-code-intel-worker, Build prometheus, Build redis-cache, Build redis-store, Build redis_exporter, Build repo-updater, Build search-indexer, Build searcher, Build symbols, Build syntax-highlighter, Build worker, Build migrator, Build server, Build sg, Build executor image
|
||||
- **Image security scans**: Scan alpine-3.12, Scan alpine-3.14, Scan cadvisor, Scan codeinsights-db, Scan codeintel-db, Scan frontend, Scan github-proxy, Scan gitserver, Scan grafana, Scan indexed-searcher, Scan jaeger-agent, Scan jaeger-all-in-one, Scan minio, Scan postgres-12-alpine, Scan postgres_exporter, Scan precise-code-intel-worker, Scan prometheus, Scan redis-cache, Scan redis-store, Scan redis_exporter, Scan repo-updater, Scan search-indexer, Scan searcher, Scan symbols, Scan syntax-highlighter, Scan worker, Scan migrator, Scan server, Scan sg
|
||||
- **Linters and static analysis**: Prettier, Misc linters, GraphQL lint, SVG lint, Yarn deduplicate lint, Docker linters, Check and build docsite
|
||||
- **Client checks**: Puppeteer tests prep, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), ESLint, Build TS, Stylelint
|
||||
- **Client checks**: Puppeteer tests prep, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Puppeteer tests for chrome extension, Test (client/browser), ESLint, Build TS, Stylelint
|
||||
- **Go checks**: Test (all), Test (enterprise/internal/codeintel/stores/dbstore), Test (enterprise/internal/codeintel/stores/lsifstore), Test (enterprise/internal/insights), Test (internal/database), Test (internal/repos), Test (enterprise/internal/batches), Test (cmd/frontend), Test (enterprise/internal/database), Test (enterprise/cmd/frontend/internal/batches/resolvers), Build
|
||||
- **DB backcompat tests**: Backcompat test (all), Backcompat test (enterprise/internal/codeintel/stores/dbstore), Backcompat test (enterprise/internal/codeintel/stores/lsifstore), Backcompat test (enterprise/internal/insights), Backcompat test (internal/database), Backcompat test (internal/repos), Backcompat test (enterprise/internal/batches), Backcompat test (cmd/frontend), Backcompat test (enterprise/internal/database), Backcompat test (enterprise/cmd/frontend/internal/batches/resolvers)
|
||||
- **CI script tests**: test-trace-command.sh
|
||||
|
||||
@ -212,26 +212,24 @@ func addWebApp(pipeline *bk.Pipeline) {
|
||||
|
||||
// Builds and tests the browser extension.
|
||||
func addBrowserExt(pipeline *bk.Pipeline) {
|
||||
// Broken: https://github.com/sourcegraph/sourcegraph/issues/33484
|
||||
// Browser extension integration tests
|
||||
// for _, browser := range []string{"chrome"} {
|
||||
// pipeline.AddStep(
|
||||
// fmt.Sprintf(":%s: Puppeteer tests for %s extension", browser, browser),
|
||||
// withYarnCache(),
|
||||
// bk.Env("EXTENSION_PERMISSIONS_ALL_URLS", "true"),
|
||||
// bk.Env("BROWSER", browser),
|
||||
// bk.Env("LOG_BROWSER_CONSOLE", "true"),
|
||||
// bk.Env("SOURCEGRAPH_BASE_URL", "https://sourcegraph.com"),
|
||||
// bk.Env("POLLYJS_MODE", "replay"), // ensure that we use existing recordings
|
||||
// bk.Cmd("git-lfs fetch"),
|
||||
// bk.Cmd("yarn --frozen-lockfile --network-timeout 60000"),
|
||||
// bk.Cmd("yarn workspace @sourcegraph/browser -s run build"),
|
||||
// bk.Cmd("yarn run cover-browser-integration"),
|
||||
// bk.Cmd("yarn nyc report -r json"),
|
||||
// bk.Cmd("dev/ci/codecov.sh -c -F typescript -F integration"),
|
||||
// bk.ArtifactPaths("./puppeteer/*.png"),
|
||||
// )
|
||||
// }
|
||||
for _, browser := range []string{"chrome"} {
|
||||
pipeline.AddStep(
|
||||
fmt.Sprintf(":%s: Puppeteer tests for %s extension", browser, browser),
|
||||
withYarnCache(),
|
||||
bk.Env("EXTENSION_PERMISSIONS_ALL_URLS", "true"),
|
||||
bk.Env("BROWSER", browser),
|
||||
bk.Env("LOG_BROWSER_CONSOLE", "true"),
|
||||
bk.Env("SOURCEGRAPH_BASE_URL", "https://sourcegraph.com"),
|
||||
bk.Env("POLLYJS_MODE", "replay"), // ensure that we use existing recordings
|
||||
bk.Cmd("yarn --frozen-lockfile --network-timeout 60000"),
|
||||
bk.Cmd("yarn workspace @sourcegraph/browser -s run build"),
|
||||
bk.Cmd("yarn run cover-browser-integration"),
|
||||
bk.Cmd("yarn nyc report -r json"),
|
||||
bk.Cmd("dev/ci/codecov.sh -c -F typescript -F integration"),
|
||||
bk.ArtifactPaths("./puppeteer/*.png"),
|
||||
)
|
||||
}
|
||||
|
||||
// Browser extension unit tests
|
||||
pipeline.AddStep(":jest::chrome: Test (client/browser)",
|
||||
|
||||
@ -950,7 +950,7 @@ tests:
|
||||
cmd: EXTENSION_PERMISSIONS_ALL_URLS=true yarn workspace @sourcegraph/browser build
|
||||
|
||||
bext-integration:
|
||||
cmd: POLLYJS_MODE=replay yarn workspace @sourcegraph/browser test-integration
|
||||
cmd: yarn workspace @sourcegraph/browser test-integration
|
||||
|
||||
bext-e2e:
|
||||
cmd: yarn workspace @sourcegraph/browser mocha ./src/end-to-end/github.test.ts ./src/end-to-end/gitlab.test.ts
|
||||
|
||||
Loading…
Reference in New Issue
Block a user