From 8178475fda7e32e08fc0eabd4caab5207b0900c5 Mon Sep 17 00:00:00 2001 From: zeot Date: Mon, 19 Nov 2018 17:35:11 +0300 Subject: [PATCH] Tests improved --- front/client/page/Index.test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/front/client/page/Index.test.js b/front/client/page/Index.test.js index d276ed9..63f3a01 100644 --- a/front/client/page/Index.test.js +++ b/front/client/page/Index.test.js @@ -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) } }) \ No newline at end of file