Skip to content

Commit 2953f27

Browse files
authored
fix: Fix the web functionality tests (#43)
1 parent 7cf5a0a commit 2953f27

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed
Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
1-
describe('Smoke tests', () => {
2-
beforeEach(async () => {
3-
await page.goto(process.env.SOURCEGRAPH_URL || '')
4-
})
1+
const searchUrl = process.env.SOURCEGRAPH_URL || ''
2+
const resultCountSelector = '[data-testid="streaming-progress-skipped"]'
3+
const searchQuery = 'repo:^github.com/sourcegraph/smoke-tests-test-repository$'
4+
const expectedResultString = '1 result'
55

6+
describe('Smoke tests', () => {
67
it('successfully loads the application', async () => {
8+
await page.goto(searchUrl)
79
await expect(page).toMatch('Sourcegraph')
810
})
911

1012
it('successful runs a search', async () => {
11-
// Update search input
12-
await page.waitForSelector('.test-query-input textarea')
13-
await expect(page).toFill(
14-
'.test-query-input textarea',
15-
'repo:^github.com/sourcegraph/smoke-tests-test-repository$'
16-
)
17-
18-
// Click search button
19-
await expect(page).toClick('.test-search-button')
13+
// Perform a search by navigating to a search results page with the q parameter
14+
await page.goto(searchUrl + `?q=${encodeURIComponent(searchQuery)}`)
2015

2116
// Expect results count is shown correctly
22-
await page.waitForSelector('[data-testid="streaming-progress-count"]')
23-
await expect(page).toMatchElement('[data-testid="streaming-progress-count"]', {
24-
text: '1 result',
17+
await page.waitForSelector(resultCountSelector)
18+
await expect(page).toMatchElement(resultCountSelector, {
19+
text: expectedResultString,
2520
})
2621
})
2722
})

0 commit comments

Comments
 (0)