mirror of
https://github.com/aelve/guide.git
synced 2024-11-23 12:15:06 +03:00
Tests improved
This commit is contained in:
parent
c78b18dbb1
commit
8178475fda
@ -1,17 +1,17 @@
|
||||
import { Selector, ClientFunction } from 'testcafe'
|
||||
import VueSelector from 'testcafe-vue-selectors'
|
||||
|
||||
const baseUrl = `http://localhost:5000`
|
||||
const getLocation = ClientFunction(() => document.location.href)
|
||||
|
||||
// !!! Testcafe-vue-selectors currently dont support vue cumponents loaded by vue-loader
|
||||
|
||||
fixture`Index`
|
||||
.page`http://localhost:5000`
|
||||
.page(baseUrl)
|
||||
|
||||
test('Navigate to category page', async t => {
|
||||
await t
|
||||
.click('.test-btn')
|
||||
.expect(getLocation()).contains('http://localhost:5000/haskell')
|
||||
.expect(getLocation()).contains(`${baseUrl}/haskell`)
|
||||
})
|
||||
|
||||
test('Test search input', async inputSearch => {
|
||||
@ -22,7 +22,7 @@ test('Test search input', async inputSearch => {
|
||||
.typeText(searchInput, 'Haskell')
|
||||
.expect(searchInput.value).eql('Haskell')
|
||||
.pressKey('enter')
|
||||
.expect(getLocation()).contains('http://localhost:5000/haskell/search/results?query=Haskell')
|
||||
.expect(getLocation()).eql(`${baseUrl}/haskell/search/results?query=Haskell`)
|
||||
})
|
||||
|
||||
test('Add category', async t => {
|
||||
@ -41,13 +41,13 @@ test('Add category', async t => {
|
||||
|
||||
const newCategoryName = 'mytest-' + new Date().toISOString()
|
||||
await t.click(addButton)
|
||||
await t.expect(Selector('.aria-label="Group"').innerText === categoryGroupName)
|
||||
await t.expect(Selector('.aria-label="Group"').innerText).eql(categoryGroupName)
|
||||
await t
|
||||
.typeText('input[aria-label="Category name"]', newCategoryName)
|
||||
.click('.add-category-submit-btn')
|
||||
// Cause after adding category it opens in new tab we need to navigate back, because TestCafe doest support opening new tabs
|
||||
// https://github.com/DevExpress/testcafe/issues/2293
|
||||
await t.navigateTo('http://localhost:5000')
|
||||
await t.navigateTo(`${baseUrl}`)
|
||||
await t.expect(currentGroup.find(node => node.innerText === newCategoryName).exists)
|
||||
}
|
||||
})
|
Loading…
Reference in New Issue
Block a user