Skip to content

Commit

Permalink
profilesLoad test: use templates literal instead of string concat
Browse files Browse the repository at this point in the history
  • Loading branch information
ndushay committed Oct 22, 2018
1 parent 6bc2bf0 commit 9bc69e3
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions __tests__/integration/profilesLoad.test.js
Expand Up @@ -22,40 +22,40 @@ describe('Profiles load', () => {
it('displays appropriate input fields and labels', async () => {
// TODO: full input field functionality #54 - separate test file, perhaps
const edition_label_sel = 'label[title="http://access.rdatoolkit.org/2.5.html"]'
await expect_value_in_selector_textContent(edition_label_sel + ' > a', 'Edition Statement (RDA 2.5)')
await expect_value_in_selector_textContent(`${edition_label_sel} > a`, 'Edition Statement (RDA 2.5)')
var sel_attr_text = await page.$eval('input[placeholder="Edition Statement (RDA 2.5)"]', e => e.getAttribute('type'))
expect(sel_attr_text).toMatch('text')

const pub_date_label_sel = 'label[title="http://id.loc.gov/ontologies/bflc.html#p_projectedProvisionDate"]'
await expect_value_in_selector_textContent(pub_date_label_sel + ' > a', 'Projected publication date (YYMM)')
await expect_value_in_selector_textContent(`${pub_date_label_sel} > a`, 'Projected publication date (YYMM)')
sel_attr_text = await page.$eval('input[placeholder="Projected publication date (YYMM)"]', e => e.getAttribute('type'))
expect(sel_attr_text).toMatch('text')
})

describe('controlled vocabulary for input field', () => {
let mode_of_issuance_sel = 'div#bfeditor-formdiv > form > div > div.form-group:nth-child(11)'
let input_div_sel = mode_of_issuance_sel + ' > div.col-sm-8'
let button_group_sel = input_div_sel + ' > div.form-group > div.btn-toolbar > div.btn-group'
let twitter_span_sel = input_div_sel + ' > span.twitter-typeahead'
let input_div_sel = `${mode_of_issuance_sel} > div.col-sm-8`
let button_group_sel = `${input_div_sel} > div.form-group > div.btn-toolbar > div.btn-group`
let twitter_span_sel = `${input_div_sel} > span.twitter-typeahead`

it('displays populated default value and trash icon', async () => {
await expect_value_in_selector_textContent(button_group_sel + ' > button.btn-default[title="single unit"]', 'single unit')
await expect_sel_to_exist(button_group_sel + ' > button.btn-danger > span.glyphicon-trash')
await expect_value_in_selector_textContent(`${button_group_sel} > button.btn-default[title="single unit"]`, 'single unit')
await expect_sel_to_exist(`${button_group_sel} > button.btn-danger > span.glyphicon-trash`)
})
it('can delete existing value', async () => {
await expect_sel_to_exist(button_group_sel + ' > button.btn-default[title="single unit"]')
await page.click(button_group_sel + ' > button.btn-danger > span.glyphicon-trash')
await expect_sel_not_to_exist(button_group_sel + ' > button.btn-default[title="single unit"]')
await expect_sel_to_exist(`${button_group_sel} > button.btn-default[title="single unit"]`)
await page.click(`${button_group_sel} > button.btn-danger > span.glyphicon-trash`)
await expect_sel_not_to_exist(`${button_group_sel} > button.btn-default[title="single unit"]`)
});
it('has twitter typehead', async () => {
await expect_sel_to_exist(twitter_span_sel + ' > input.typeahead.form-control.tt-input')
await expect_sel_to_exist(twitter_span_sel + ' > span.tt-dropdown-menu > div.tt-dataset-issuance')
await expect_sel_to_exist(`${twitter_span_sel} > input.typeahead.form-control.tt-input`)
await expect_sel_to_exist(`${twitter_span_sel} > span.tt-dropdown-menu > div.tt-dataset-issuance`)
})
it('can set value from controlled vocab', async () => {
// TODO: see #80
const input_sel = twitter_span_sel + ' > input.typeahead.form-control.tt-input'
const input_sel = `${twitter_span_sel} > input.typeahead.form-control.tt-input`
await page.click(input_sel) // works for putting cursor there, but popupdropdown doesn't appear
// can't find any children of twitter_span_sel + ' > span.tt-dropdown-menu > div.tt-dataset-issuance'
// can't find any children of `${twitter_span_sel} > span.tt-dropdown-menu > div.tt-dataset-issuance`
// perhaps the popup with the values is a separate window ?
// await page.screenshot({path: 'screenshot.png', fullPage: true})
// await page.keyboard.press('ArrowDown')
Expand All @@ -67,21 +67,21 @@ describe('Profiles load', () => {
it('displays appropriate single buttons to modals for fields using other profiles', async () => {
// TODO: full modal input field functionality #55 - separate test file, perhaps
const series_div_sel = 'div#bfeditor-formdiv > form > div > div.form-group:nth-child(10)'
await expect_value_in_selector_textContent(series_div_sel + '> label.control-label', 'Series Statement')
await expect_value_in_selector_textContent(`${series_div_sel} > label.control-label`, 'Series Statement')
// TODO: modal buttons aren't loading - not retrieving profiles - #79
// await expect_value_in_selector_textContent(series_div_sel + ' > div > div.btn-group > button', 'Series Statement')
// await expect_value_in_selector_textContent(`${series_div_sel} > div > div.btn-group > button`, 'Series Statement')

const related_div_sel = 'div#bfeditor-formdiv > form > div > div.form-group:nth-child(18)'
await expect_value_in_selector_textContent(related_div_sel + '> label.control-label', 'Related Manifestation')
await expect_value_in_selector_textContent(`${related_div_sel} > label.control-label`, 'Related Manifestation')
// TODO: modal buttons aren't loading - not retrieving profiles - #79
// await expect_value_in_selector_textContent(related_div_sel + ' > div > div > button', 'Related Manifestation')
// await expect_value_in_selector_textContent(`${related_div_sel} > div > div > button`, 'Related Manifestation')
})
it('displays appropriate multiple buttons to modals for fields using other profiles', async () => {
// TODO: full modal input field functionality #55 - separate test file, perhaps
const title_div_sel = 'div#bfeditor-formdiv > form > div > div.form-group:nth-child(5)'
await expect_value_in_selector_textContent(title_div_sel + ' > label', 'Title Information')
await expect_value_in_selector_textContent(`${title_div_sel} > label`, 'Title Information')
// TODO: modal buttons aren't loading - not retrieving profiles - #79
// await expect_value_in_selector_textContent(title_div_sel + ' > div > div > button', 'Instance Title')
// await expect_value_in_selector_textContent(`${title_div_sel} > div > div > button`, 'Instance Title')
})
it('has cancel button', async () => {
// TODO: full cancel button functionality #77 - separate test file, or here?
Expand Down

0 comments on commit 9bc69e3

Please sign in to comment.