mirror of
https://github.com/aelve/guide.git
synced 2024-11-30 11:32:29 +03:00
65800eda6a
* Split hackage * WIP * Migrate to newer safecopy-migrate * Fix migrate * Rename description to summary for item * Fix link to templates * Frontend tests fix for pr #249 * Change the path back * WIP. Fix templates * Update back/src/Guide/Api/Types.hs * Remove unnecessary stuff from .gitignore * Revert style changes * Two spaces * _itemDescription has been renamed * Remove the Hackage test * name_on_hackage -> hackage * Fix Hackage param' type * front changes from kind to hackage * Fix tests * Try fix templete * Revert last commit * Comment front test in travis
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
import { Selector } from 'testcafe'
|
|
|
|
fixture`ItemAddDelete`
|
|
.page`http://localhost:5000/haskell/data-structures-fum5aqch`
|
|
|
|
const newItemName = 'mytest-' + new Date().toISOString()
|
|
|
|
test('Add New Item to category', async t => {
|
|
const addItemBtn = Selector('.add-item-btn')
|
|
const addItemInput = Selector('input[aria-label="Item name"]')
|
|
|
|
await t
|
|
.click(addItemBtn)
|
|
.typeText(addItemInput, newItemName)
|
|
.pressKey('enter')
|
|
|
|
const articleHeadings = Selector('.article-hd-textlg')
|
|
const articleHeadingsCount = await articleHeadings.count
|
|
|
|
// for (let i = 0; i < articleHeadingsCount; i++) {
|
|
// await t.expect(Selector('.article-hd-textlg').nth(i).innerText).contains(newItemName)
|
|
// }
|
|
await t.expect(Selector('.article-hd-textlg').nth(articleHeadingsCount - 1).innerText).contains(newItemName)
|
|
})
|
|
|
|
test('Delete Item from category', async t => {
|
|
const delItemBtn = Selector(() => {
|
|
const buttons = document.querySelectorAll('.item-del-btn')
|
|
let last = buttons[buttons.length - 1]
|
|
return last
|
|
})
|
|
|
|
const delSubmitBtn = Selector('.confirm-btn')
|
|
await t
|
|
.click(delItemBtn)
|
|
.click(delSubmitBtn)
|
|
|
|
const articleHeadings = Selector('.article-hd-textlg')
|
|
const articleHeadingsCount = await articleHeadings.count
|
|
|
|
for (let i = 0; i < articleHeadingsCount; i++) {
|
|
await t.expect(articleHeadings.nth(i).innerText).notContains(newItemName)
|
|
}
|
|
})
|