Skip to content

Commit

Permalink
fix: Fix the web functionality tests (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
marekweb authored Nov 16, 2022
1 parent 7cf5a0a commit 2953f27
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions packages/web-functionality/src/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
describe('Smoke tests', () => {
beforeEach(async () => {
await page.goto(process.env.SOURCEGRAPH_URL || '')
})
const searchUrl = process.env.SOURCEGRAPH_URL || ''
const resultCountSelector = '[data-testid="streaming-progress-skipped"]'
const searchQuery = 'repo:^github.com/sourcegraph/smoke-tests-test-repository$'
const expectedResultString = '1 result'

describe('Smoke tests', () => {
it('successfully loads the application', async () => {
await page.goto(searchUrl)
await expect(page).toMatch('Sourcegraph')
})

it('successful runs a search', async () => {
// Update search input
await page.waitForSelector('.test-query-input textarea')
await expect(page).toFill(
'.test-query-input textarea',
'repo:^github.com/sourcegraph/smoke-tests-test-repository$'
)

// Click search button
await expect(page).toClick('.test-search-button')
// Perform a search by navigating to a search results page with the q parameter
await page.goto(searchUrl + `?q=${encodeURIComponent(searchQuery)}`)

// Expect results count is shown correctly
await page.waitForSelector('[data-testid="streaming-progress-count"]')
await expect(page).toMatchElement('[data-testid="streaming-progress-count"]', {
text: '1 result',
await page.waitForSelector(resultCountSelector)
await expect(page).toMatchElement(resultCountSelector, {
text: expectedResultString,
})
})
})

0 comments on commit 2953f27

Please sign in to comment.