Merge pull request #3588 from singhakshita/hyperlink-issue-tests
fixed href tag creation for URLs in cell text, fixes #2519
This commit is contained in:
commit
79aa260442
@ -1,28 +1,28 @@
|
||||
describe(__filename, function () {
|
||||
it('Ensure cells are blanked down', function () {
|
||||
const fixture = [
|
||||
['a', 'b', 'c'],
|
||||
it('Ensure cells are blanked down', function () {
|
||||
const fixture = [
|
||||
['a', 'b', 'c'],
|
||||
|
||||
['0a', 'identical', '0c'],
|
||||
['1a', 'identical', '1c'],
|
||||
['2a', '2b', '2c'],
|
||||
['3a', 'also identical', '3c'],
|
||||
['4a', 'also identical', '4c'],
|
||||
['5a', 'also identical', '5c'],
|
||||
]
|
||||
['0a', 'identical', '0c'],
|
||||
['1a', 'identical', '1c'],
|
||||
['2a', '2b', '2c'],
|
||||
['3a', 'also identical', '3c'],
|
||||
['4a', 'also identical', '4c'],
|
||||
['5a', 'also identical', '5c'],
|
||||
]
|
||||
|
||||
cy.loadAndVisitProject(fixture)
|
||||
cy.loadAndVisitProject(fixture)
|
||||
|
||||
// click
|
||||
cy.columnActionClick('b', ['Edit cells', 'Blank down'])
|
||||
// click
|
||||
cy.columnActionClick('b', ['Edit cells', 'Blank down'])
|
||||
|
||||
// ensure notification and cell content
|
||||
cy.assertNotificationContainingText('Blank down 3 cells')
|
||||
cy.assertCellEquals(0, 'b', 'identical') // untouched
|
||||
cy.assertCellEquals(1, 'b', null) // blanked
|
||||
cy.assertCellEquals(2, 'b', '2b') // untouched
|
||||
cy.assertCellEquals(3, 'b', 'also identical') // untouched
|
||||
cy.assertCellEquals(4, 'b', null) // blanked
|
||||
cy.assertCellEquals(5, 'b', null) // blanked
|
||||
})
|
||||
// ensure notification and cell content
|
||||
cy.assertNotificationContainingText('Blank down 3 cells')
|
||||
cy.assertCellEquals(0, 'b', 'identical') // untouched
|
||||
cy.assertCellEquals(1, 'b', null) // blanked
|
||||
cy.assertCellEquals(2, 'b', '2b') // untouched
|
||||
cy.assertCellEquals(3, 'b', 'also identical') // untouched
|
||||
cy.assertCellEquals(4, 'b', null) // blanked
|
||||
cy.assertCellEquals(5, 'b', null) // blanked
|
||||
})
|
||||
})
|
||||
|
@ -1,23 +1,23 @@
|
||||
describe(__filename, function () {
|
||||
it('Ensure multiple whitespaces are collapsed', function () {
|
||||
const fixture = [
|
||||
['NDB_No', 'Shrt_Desc'],
|
||||
['01001', 'THIS IS A TEST'],
|
||||
['01002', 'THIS IS ANOTHER TEST'],
|
||||
['01003', 'THIS IS a THIRD TEST'],
|
||||
]
|
||||
cy.loadAndVisitProject(fixture)
|
||||
it('Ensure multiple whitespaces are collapsed', function () {
|
||||
const fixture = [
|
||||
['NDB_No', 'Shrt_Desc'],
|
||||
['01001', 'THIS IS A TEST'],
|
||||
['01002', 'THIS IS ANOTHER TEST'],
|
||||
['01003', 'THIS IS a THIRD TEST'],
|
||||
]
|
||||
cy.loadAndVisitProject(fixture)
|
||||
|
||||
cy.columnActionClick('Shrt_Desc', [
|
||||
'Edit cells',
|
||||
'Common transforms',
|
||||
'Collapse consecutive whitespace',
|
||||
])
|
||||
cy.columnActionClick('Shrt_Desc', [
|
||||
'Edit cells',
|
||||
'Common transforms',
|
||||
'Collapse consecutive whitespace',
|
||||
])
|
||||
|
||||
// Check notification and cell content
|
||||
cy.assertNotificationContainingText('Text transform on 2 cells')
|
||||
cy.assertCellEquals(0, 'Shrt_Desc', 'THIS IS A TEST')
|
||||
cy.assertCellEquals(1, 'Shrt_Desc', 'THIS IS ANOTHER TEST')
|
||||
cy.assertCellEquals(2, 'Shrt_Desc', 'THIS IS a THIRD TEST')
|
||||
})
|
||||
// Check notification and cell content
|
||||
cy.assertNotificationContainingText('Text transform on 2 cells')
|
||||
cy.assertCellEquals(0, 'Shrt_Desc', 'THIS IS A TEST')
|
||||
cy.assertCellEquals(1, 'Shrt_Desc', 'THIS IS ANOTHER TEST')
|
||||
cy.assertCellEquals(2, 'Shrt_Desc', 'THIS IS a THIRD TEST')
|
||||
})
|
||||
})
|
||||
|
@ -0,0 +1,23 @@
|
||||
describe(__filename, function () {
|
||||
it('verify <a>href tags created for URLs within cell text', function () {
|
||||
const fixture = [
|
||||
['tests'],
|
||||
['2021-01-31https://www.google.com'],
|
||||
[
|
||||
'https://www.wikidata.org/wiki/Property:P670 https://www.wikidata.org/wiki/Property:P669 are now mapped to https://schema.org/streetAddress via https://www.wikidata.org/wiki/Property:P2235',
|
||||
],
|
||||
['vhjhjjj https://github.com/OpenRefine/OpenRefine/issues/2519'],
|
||||
]
|
||||
cy.loadAndVisitProject(fixture)
|
||||
|
||||
cy.getCell(0, 'tests').contains('2021-01-31https://www.google.com')
|
||||
cy.getCell(1, 'tests')
|
||||
.children('div')
|
||||
.children('a')
|
||||
.should('have.attr', 'href')
|
||||
cy.getCell(2, 'tests')
|
||||
.children('div')
|
||||
.children('a')
|
||||
.should('have.attr', 'href')
|
||||
})
|
||||
})
|
@ -1,28 +1,28 @@
|
||||
describe(__filename, function () {
|
||||
it('Ensure only some cells are converted to dates', function () {
|
||||
const fixture = [
|
||||
['NDB_No', 'A Date'],
|
||||
['01001', '2021-01-01'],
|
||||
['01002', '2021-01-01 05:35:15'],
|
||||
['01003', 'THIS SHOULD NOT BE TOUCHED'],
|
||||
]
|
||||
cy.loadAndVisitProject(fixture)
|
||||
it('Ensure only some cells are converted to dates', function () {
|
||||
const fixture = [
|
||||
['NDB_No', 'A Date'],
|
||||
['01001', '2021-01-01'],
|
||||
['01002', '2021-01-01 05:35:15'],
|
||||
['01003', 'THIS SHOULD NOT BE TOUCHED'],
|
||||
]
|
||||
cy.loadAndVisitProject(fixture)
|
||||
|
||||
// Update grid
|
||||
cy.columnActionClick('A Date', [
|
||||
'Edit cells',
|
||||
'Common transforms',
|
||||
'To date',
|
||||
])
|
||||
// Update grid
|
||||
cy.columnActionClick('A Date', [
|
||||
'Edit cells',
|
||||
'Common transforms',
|
||||
'To date',
|
||||
])
|
||||
|
||||
// Check notification and cell content
|
||||
cy.assertNotificationContainingText('Text transform on 2 cells')
|
||||
cy.assertCellEquals(0, 'A Date', '2021-01-01T00:00:00Z')
|
||||
cy.assertCellEquals(1, 'A Date', '2021-01-01T05:35:15Z')
|
||||
cy.assertCellEquals(2, 'A Date', 'THIS SHOULD NOT BE TOUCHED')
|
||||
// Check notification and cell content
|
||||
cy.assertNotificationContainingText('Text transform on 2 cells')
|
||||
cy.assertCellEquals(0, 'A Date', '2021-01-01T00:00:00Z')
|
||||
cy.assertCellEquals(1, 'A Date', '2021-01-01T05:35:15Z')
|
||||
cy.assertCellEquals(2, 'A Date', 'THIS SHOULD NOT BE TOUCHED')
|
||||
|
||||
// ensure cells are marked as non-string
|
||||
cy.assertCellNotString(0, 'A Date')
|
||||
cy.assertCellNotString(1, 'A Date')
|
||||
})
|
||||
// ensure cells are marked as non-string
|
||||
cy.assertCellNotString(0, 'A Date')
|
||||
cy.assertCellNotString(1, 'A Date')
|
||||
})
|
||||
})
|
||||
|
@ -1,52 +1,52 @@
|
||||
describe(__filename, function () {
|
||||
it('Ensure some cells are converted to numbers, and some remains untouched (int)', function () {
|
||||
const fixture = [
|
||||
['NDB_No', 'A Number'],
|
||||
['01001', 'This is not a number'],
|
||||
['01002', '42'],
|
||||
['01003', '43'],
|
||||
]
|
||||
cy.loadAndVisitProject(fixture)
|
||||
it('Ensure some cells are converted to numbers, and some remains untouched (int)', function () {
|
||||
const fixture = [
|
||||
['NDB_No', 'A Number'],
|
||||
['01001', 'This is not a number'],
|
||||
['01002', '42'],
|
||||
['01003', '43'],
|
||||
]
|
||||
cy.loadAndVisitProject(fixture)
|
||||
|
||||
// click
|
||||
cy.columnActionClick('A Number', [
|
||||
'Edit cells',
|
||||
'Common transforms',
|
||||
'To number',
|
||||
])
|
||||
// click
|
||||
cy.columnActionClick('A Number', [
|
||||
'Edit cells',
|
||||
'Common transforms',
|
||||
'To number',
|
||||
])
|
||||
|
||||
// Ensure notification and cell content
|
||||
cy.assertNotificationContainingText('Text transform on 2 cells')
|
||||
cy.assertCellEquals(0, 'A Number', 'This is not a number')
|
||||
cy.assertCellEquals(1, 'A Number', '42')
|
||||
cy.assertCellEquals(2, 'A Number', '43')
|
||||
// Ensure notification and cell content
|
||||
cy.assertNotificationContainingText('Text transform on 2 cells')
|
||||
cy.assertCellEquals(0, 'A Number', 'This is not a number')
|
||||
cy.assertCellEquals(1, 'A Number', '42')
|
||||
cy.assertCellEquals(2, 'A Number', '43')
|
||||
|
||||
// Ensure a numeric type is applied to the cell
|
||||
cy.assertCellNotString(1, 'A Number')
|
||||
cy.assertCellNotString(2, 'A Number')
|
||||
})
|
||||
// Ensure a numeric type is applied to the cell
|
||||
cy.assertCellNotString(1, 'A Number')
|
||||
cy.assertCellNotString(2, 'A Number')
|
||||
})
|
||||
|
||||
it('Ensure toNumber works with floats', function () {
|
||||
const fixture = [
|
||||
['NDB_No', 'A Number'],
|
||||
['01001', '42.2'],
|
||||
['01002', '43.5'],
|
||||
['01002', '43.50000'],
|
||||
['01002', '43.500001'],
|
||||
]
|
||||
cy.loadAndVisitProject(fixture)
|
||||
it('Ensure toNumber works with floats', function () {
|
||||
const fixture = [
|
||||
['NDB_No', 'A Number'],
|
||||
['01001', '42.2'],
|
||||
['01002', '43.5'],
|
||||
['01002', '43.50000'],
|
||||
['01002', '43.500001'],
|
||||
]
|
||||
cy.loadAndVisitProject(fixture)
|
||||
|
||||
// click
|
||||
cy.columnActionClick('A Number', [
|
||||
'Edit cells',
|
||||
'Common transforms',
|
||||
'To number',
|
||||
])
|
||||
// click
|
||||
cy.columnActionClick('A Number', [
|
||||
'Edit cells',
|
||||
'Common transforms',
|
||||
'To number',
|
||||
])
|
||||
|
||||
// Ensure cell content
|
||||
cy.assertCellEquals(0, 'A Number', '42.2')
|
||||
cy.assertCellEquals(1, 'A Number', '43.5')
|
||||
cy.assertCellEquals(2, 'A Number', '43.5')
|
||||
cy.assertCellEquals(3, 'A Number', '43.500001')
|
||||
})
|
||||
// Ensure cell content
|
||||
cy.assertCellEquals(0, 'A Number', '42.2')
|
||||
cy.assertCellEquals(1, 'A Number', '43.5')
|
||||
cy.assertCellEquals(2, 'A Number', '43.5')
|
||||
cy.assertCellEquals(3, 'A Number', '43.500001')
|
||||
})
|
||||
})
|
||||
|
@ -1,21 +1,21 @@
|
||||
describe(__filename, function () {
|
||||
it('Ensure multiple leading/tailing whitespaces are trimmed', function () {
|
||||
const fixture = [
|
||||
['NDB_No', 'A column'],
|
||||
['01001', 'TEST'],
|
||||
]
|
||||
it('Ensure multiple leading/tailing whitespaces are trimmed', function () {
|
||||
const fixture = [
|
||||
['NDB_No', 'A column'],
|
||||
['01001', 'TEST'],
|
||||
]
|
||||
|
||||
cy.loadAndVisitProject(fixture)
|
||||
cy.editCell(0, 'A column', ' TEST ')
|
||||
cy.loadAndVisitProject(fixture)
|
||||
cy.editCell(0, 'A column', ' TEST ')
|
||||
|
||||
cy.columnActionClick('A column', [
|
||||
'Edit cells',
|
||||
'Common transforms',
|
||||
'Trim leading and trailing whitespace',
|
||||
])
|
||||
cy.columnActionClick('A column', [
|
||||
'Edit cells',
|
||||
'Common transforms',
|
||||
'Trim leading and trailing whitespace',
|
||||
])
|
||||
|
||||
// ensure notification and cell content
|
||||
cy.assertNotificationContainingText('Text transform on 1 cells')
|
||||
cy.assertCellEquals(0, 'A column', 'TEST')
|
||||
})
|
||||
// ensure notification and cell content
|
||||
cy.assertNotificationContainingText('Text transform on 1 cells')
|
||||
cy.assertCellEquals(0, 'A column', 'TEST')
|
||||
})
|
||||
})
|
||||
|
@ -1,22 +1,22 @@
|
||||
describe(__filename, function () {
|
||||
it('Ensure escaped html entities are unescaped', function () {
|
||||
const fixture = [
|
||||
['NDB_No', 'A column'],
|
||||
['01001', '<img src="test" />'],
|
||||
['01001', '<img src="test" />'],
|
||||
]
|
||||
it('Ensure escaped html entities are unescaped', function () {
|
||||
const fixture = [
|
||||
['NDB_No', 'A column'],
|
||||
['01001', '<img src="test" />'],
|
||||
['01001', '<img src="test" />'],
|
||||
]
|
||||
|
||||
cy.loadAndVisitProject(fixture, 'ok')
|
||||
cy.loadAndVisitProject(fixture, 'ok')
|
||||
|
||||
cy.columnActionClick('A column', [
|
||||
'Edit cells',
|
||||
'Common transforms',
|
||||
'Unescape HTML entities',
|
||||
])
|
||||
cy.columnActionClick('A column', [
|
||||
'Edit cells',
|
||||
'Common transforms',
|
||||
'Unescape HTML entities',
|
||||
])
|
||||
|
||||
// ensure notification and cell content
|
||||
cy.assertNotificationContainingText('Text transform on 1 cells')
|
||||
cy.assertCellEquals(0, 'A column', '<img src="test" />')
|
||||
cy.assertCellEquals(1, 'A column', '<img src="test" />')
|
||||
})
|
||||
// ensure notification and cell content
|
||||
cy.assertNotificationContainingText('Text transform on 1 cells')
|
||||
cy.assertCellEquals(0, 'A column', '<img src="test" />')
|
||||
cy.assertCellEquals(1, 'A column', '<img src="test" />')
|
||||
})
|
||||
})
|
||||
|
@ -1,27 +1,27 @@
|
||||
describe(__filename, function () {
|
||||
it('Ensure cells are filled down', function () {
|
||||
const fixture = [
|
||||
['a', 'b', 'c'],
|
||||
it('Ensure cells are filled down', function () {
|
||||
const fixture = [
|
||||
['a', 'b', 'c'],
|
||||
|
||||
['0a', '0b', '0c'],
|
||||
['1a', null, '1c'],
|
||||
['2a', '2b', '2c'],
|
||||
['3a', null, '3c'],
|
||||
['4a', null, '4c'],
|
||||
['5a', '5b', '5c'],
|
||||
]
|
||||
['0a', '0b', '0c'],
|
||||
['1a', null, '1c'],
|
||||
['2a', '2b', '2c'],
|
||||
['3a', null, '3c'],
|
||||
['4a', null, '4c'],
|
||||
['5a', '5b', '5c'],
|
||||
]
|
||||
|
||||
cy.loadAndVisitProject(fixture)
|
||||
// click
|
||||
cy.columnActionClick('b', ['Edit cells', 'Fill down'])
|
||||
cy.loadAndVisitProject(fixture)
|
||||
// click
|
||||
cy.columnActionClick('b', ['Edit cells', 'Fill down'])
|
||||
|
||||
// ensure notification and cell content
|
||||
cy.assertNotificationContainingText('Fill down 3 cells in column b')
|
||||
cy.assertCellEquals(0, 'b', '0b') // untouched
|
||||
cy.assertCellEquals(1, 'b', '0b') // filled
|
||||
cy.assertCellEquals(2, 'b', '2b') // untouched
|
||||
cy.assertCellEquals(3, 'b', '2b') // filled
|
||||
cy.assertCellEquals(4, 'b', '2b') // filled
|
||||
cy.assertCellEquals(5, 'b', '5b') // untouched
|
||||
})
|
||||
// ensure notification and cell content
|
||||
cy.assertNotificationContainingText('Fill down 3 cells in column b')
|
||||
cy.assertCellEquals(0, 'b', '0b') // untouched
|
||||
cy.assertCellEquals(1, 'b', '0b') // filled
|
||||
cy.assertCellEquals(2, 'b', '2b') // untouched
|
||||
cy.assertCellEquals(3, 'b', '2b') // filled
|
||||
cy.assertCellEquals(4, 'b', '2b') // filled
|
||||
cy.assertCellEquals(5, 'b', '5b') // untouched
|
||||
})
|
||||
})
|
||||
|
@ -3,415 +3,415 @@
|
||||
* It's using "text facet" as it is the most simple facet
|
||||
*/
|
||||
describe(__filename, function () {
|
||||
it('Verify facets panel (left-panel) appears with no facets yet', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets')
|
||||
.should('exist')
|
||||
.contains('Using facets and filters')
|
||||
})
|
||||
it('Verify facets panel (left-panel) appears with no facets yet', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets')
|
||||
.should('exist')
|
||||
.contains('Using facets and filters')
|
||||
})
|
||||
|
||||
it('Test the display of multiple facets', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
it('Test the display of multiple facets', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
|
||||
cy.getFacetContainer('NDB_No').should('exist')
|
||||
cy.getFacetContainer('Shrt_Desc').should('exist')
|
||||
cy.getFacetContainer('Water').should('exist')
|
||||
})
|
||||
cy.getFacetContainer('NDB_No').should('exist')
|
||||
cy.getFacetContainer('Shrt_Desc').should('exist')
|
||||
cy.getFacetContainer('Water').should('exist')
|
||||
})
|
||||
|
||||
it('Test the Remove All button', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets .facets-container .facet-container').should(
|
||||
'have.length',
|
||||
2
|
||||
)
|
||||
it('Test the Remove All button', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets .facets-container .facet-container').should(
|
||||
'have.length',
|
||||
2
|
||||
)
|
||||
|
||||
cy.get('#refine-tabs-facets a').contains('Remove All').click()
|
||||
cy.get('#refine-tabs-facets .facets-container .facet-container').should(
|
||||
'have.length',
|
||||
0
|
||||
)
|
||||
cy.get('#refine-tabs-facets')
|
||||
.should('exist')
|
||||
.contains('Using facets and filters')
|
||||
})
|
||||
cy.get('#refine-tabs-facets a').contains('Remove All').click()
|
||||
cy.get('#refine-tabs-facets .facets-container .facet-container').should(
|
||||
'have.length',
|
||||
0
|
||||
)
|
||||
cy.get('#refine-tabs-facets')
|
||||
.should('exist')
|
||||
.contains('Using facets and filters')
|
||||
})
|
||||
|
||||
it('Test the Reset All button', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
cy.columnActionClick('Energ_Kcal', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets .facets-container .facet-container').should(
|
||||
'have.length',
|
||||
2
|
||||
)
|
||||
it('Test the Reset All button', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
cy.columnActionClick('Energ_Kcal', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets .facets-container .facet-container').should(
|
||||
'have.length',
|
||||
2
|
||||
)
|
||||
|
||||
// Click to facet 1, select first value
|
||||
cy.getFacetContainer('Water')
|
||||
.find('.facet-choice:first-child .facet-choice-label')
|
||||
.click()
|
||||
cy.getFacetContainer('Water')
|
||||
.find('.facet-choice:first-child')
|
||||
.should('have.class', 'facet-choice-selected')
|
||||
// Click to facet 1, select first value
|
||||
cy.getFacetContainer('Water')
|
||||
.find('.facet-choice:first-child .facet-choice-label')
|
||||
.click()
|
||||
cy.getFacetContainer('Water')
|
||||
.find('.facet-choice:first-child')
|
||||
.should('have.class', 'facet-choice-selected')
|
||||
|
||||
// Click to facet 2, select first value
|
||||
cy.getFacetContainer('Energ_Kcal')
|
||||
.find('.facet-choice:first-child .facet-choice-label')
|
||||
.click()
|
||||
cy.getFacetContainer('Energ_Kcal')
|
||||
.find('.facet-choice:first-child')
|
||||
.should('have.class', 'facet-choice-selected')
|
||||
// Click to facet 2, select first value
|
||||
cy.getFacetContainer('Energ_Kcal')
|
||||
.find('.facet-choice:first-child .facet-choice-label')
|
||||
.click()
|
||||
cy.getFacetContainer('Energ_Kcal')
|
||||
.find('.facet-choice:first-child')
|
||||
.should('have.class', 'facet-choice-selected')
|
||||
|
||||
cy.get('#refine-tabs-facets a').contains('Reset All').click()
|
||||
cy.get('#refine-tabs-facets a').contains('Reset All').click()
|
||||
|
||||
// all facets selections should be gone
|
||||
cy.getFacetContainer('Water')
|
||||
.find('.facet-choice:first-child')
|
||||
.should('not.have.class', 'facet-choice-selected')
|
||||
cy.getFacetContainer('Energ_Kcal')
|
||||
.find('.facet-choice:first-child')
|
||||
.should('not.have.class', 'facet-choice-selected')
|
||||
})
|
||||
// all facets selections should be gone
|
||||
cy.getFacetContainer('Water')
|
||||
.find('.facet-choice:first-child')
|
||||
.should('not.have.class', 'facet-choice-selected')
|
||||
cy.getFacetContainer('Energ_Kcal')
|
||||
.find('.facet-choice:first-child')
|
||||
.should('not.have.class', 'facet-choice-selected')
|
||||
})
|
||||
|
||||
it('Create a simple text facet, check various elements in a Facet', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets').should('exist')
|
||||
it('Create a simple text facet, check various elements in a Facet', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets').should('exist')
|
||||
|
||||
cy.getFacetContainer('Water').should('exist')
|
||||
cy.getFacetContainer('Water').contains('182 choices')
|
||||
cy.getFacetContainer('Water').contains('Sort by')
|
||||
cy.getFacetContainer('Water').contains('Cluster')
|
||||
})
|
||||
cy.getFacetContainer('Water').should('exist')
|
||||
cy.getFacetContainer('Water').contains('182 choices')
|
||||
cy.getFacetContainer('Water').contains('Sort by')
|
||||
cy.getFacetContainer('Water').contains('Cluster')
|
||||
})
|
||||
|
||||
it('Delete a facet', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
it('Delete a facet', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
|
||||
cy.getFacetContainer('Water').find('a.facet-title-remove').click()
|
||||
cy.getFacetContainer('Water').should('not.exist')
|
||||
})
|
||||
cy.getFacetContainer('Water').find('a.facet-title-remove').click()
|
||||
cy.getFacetContainer('Water').should('not.exist')
|
||||
})
|
||||
|
||||
it('Test editing a facet ("change")', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.getFacetContainer('NDB_No')
|
||||
.find('a[bind="changeButton"]')
|
||||
.contains('change')
|
||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
||||
cy.get('.dialog-container .dialog-header').contains(
|
||||
`Edit Facet's Expression`
|
||||
)
|
||||
})
|
||||
it('Test editing a facet ("change")', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.getFacetContainer('NDB_No')
|
||||
.find('a[bind="changeButton"]')
|
||||
.contains('change')
|
||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
||||
cy.get('.dialog-container .dialog-header').contains(
|
||||
`Edit Facet's Expression`
|
||||
)
|
||||
})
|
||||
|
||||
it('Test editing a facet / Preview', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
it('Test editing a facet / Preview', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
|
||||
// test the tab
|
||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
||||
cy.get('.dialog-container #expression-preview-tabs-preview').should(
|
||||
'be.visible'
|
||||
)
|
||||
// test the content
|
||||
cy.get('.dialog-container #expression-preview-tabs-preview').contains(
|
||||
'row'
|
||||
)
|
||||
})
|
||||
// test the tab
|
||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
||||
cy.get('.dialog-container #expression-preview-tabs-preview').should(
|
||||
'be.visible'
|
||||
)
|
||||
// test the content
|
||||
cy.get('.dialog-container #expression-preview-tabs-preview').contains(
|
||||
'row'
|
||||
)
|
||||
})
|
||||
|
||||
it('Test editing a facet / History', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
||||
it('Test editing a facet / History', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
||||
|
||||
// test the tab
|
||||
cy.get('.dialog-container a[bind="or_dialog_history"]').click()
|
||||
cy.get('.dialog-container #expression-preview-tabs-history').should(
|
||||
'be.visible'
|
||||
)
|
||||
// test the content
|
||||
cy.get('.dialog-container #expression-preview-tabs-history').contains(
|
||||
'Expression'
|
||||
)
|
||||
})
|
||||
// test the tab
|
||||
cy.get('.dialog-container a[bind="or_dialog_history"]').click()
|
||||
cy.get('.dialog-container #expression-preview-tabs-history').should(
|
||||
'be.visible'
|
||||
)
|
||||
// test the content
|
||||
cy.get('.dialog-container #expression-preview-tabs-history').contains(
|
||||
'Expression'
|
||||
)
|
||||
})
|
||||
|
||||
it('Test editing a facet / Starred', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
||||
it('Test editing a facet / Starred', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
||||
|
||||
// test the tab
|
||||
cy.get('.dialog-container a[bind="or_dialog_starred"]').click()
|
||||
cy.get('.dialog-container #expression-preview-tabs-starred').should(
|
||||
'be.visible'
|
||||
)
|
||||
// test the content
|
||||
cy.get('.dialog-container #expression-preview-tabs-starred').contains(
|
||||
'Expression'
|
||||
)
|
||||
})
|
||||
// test the tab
|
||||
cy.get('.dialog-container a[bind="or_dialog_starred"]').click()
|
||||
cy.get('.dialog-container #expression-preview-tabs-starred').should(
|
||||
'be.visible'
|
||||
)
|
||||
// test the content
|
||||
cy.get('.dialog-container #expression-preview-tabs-starred').contains(
|
||||
'Expression'
|
||||
)
|
||||
})
|
||||
|
||||
it('Test editing a facet / Help', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
||||
it('Test editing a facet / Help', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
||||
|
||||
// test the tab
|
||||
cy.get('.dialog-container a[bind="or_dialog_help"]').click()
|
||||
cy.get('.dialog-container #expression-preview-tabs-help').should(
|
||||
'be.visible'
|
||||
)
|
||||
// test the content
|
||||
cy.get('.dialog-container #expression-preview-tabs-help').contains(
|
||||
'Variables'
|
||||
)
|
||||
})
|
||||
// test the tab
|
||||
cy.get('.dialog-container a[bind="or_dialog_help"]').click()
|
||||
cy.get('.dialog-container #expression-preview-tabs-help').should(
|
||||
'be.visible'
|
||||
)
|
||||
// test the content
|
||||
cy.get('.dialog-container #expression-preview-tabs-help').contains(
|
||||
'Variables'
|
||||
)
|
||||
})
|
||||
|
||||
it('Create a facet, Sorts, by count', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets').should('exist')
|
||||
it('Create a facet, Sorts, by count', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets').should('exist')
|
||||
|
||||
// Ensure sort should be by name by default
|
||||
cy.getFacetContainer('Water').contains('0.24')
|
||||
cy.getFacetContainer('Water').find('a[bind="sortByCountLink"]').click()
|
||||
// Sort should now be by count
|
||||
cy.getFacetContainer('Water').contains('15.87')
|
||||
})
|
||||
// Ensure sort should be by name by default
|
||||
cy.getFacetContainer('Water').contains('0.24')
|
||||
cy.getFacetContainer('Water').find('a[bind="sortByCountLink"]').click()
|
||||
// Sort should now be by count
|
||||
cy.getFacetContainer('Water').contains('15.87')
|
||||
})
|
||||
|
||||
it('Create a facet, Sorts multiple', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets').should('exist')
|
||||
it('Create a facet, Sorts multiple', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets').should('exist')
|
||||
|
||||
// Sort should be by name by default
|
||||
cy.getFacetContainer('Water').contains('0.24')
|
||||
cy.getFacetContainer('Water').find('a[bind="sortByCountLink"]').click()
|
||||
// Sort should now be by count
|
||||
cy.getFacetContainer('Water').contains('15.87')
|
||||
cy.getFacetContainer('Water').find('a[bind="sortByNameLink"]').click()
|
||||
cy.getFacetContainer('Water').contains('0.24')
|
||||
})
|
||||
// Sort should be by name by default
|
||||
cy.getFacetContainer('Water').contains('0.24')
|
||||
cy.getFacetContainer('Water').find('a[bind="sortByCountLink"]').click()
|
||||
// Sort should now be by count
|
||||
cy.getFacetContainer('Water').contains('15.87')
|
||||
cy.getFacetContainer('Water').find('a[bind="sortByNameLink"]').click()
|
||||
cy.getFacetContainer('Water').contains('0.24')
|
||||
})
|
||||
|
||||
it('Test include/exlude filters', function () {
|
||||
// Because the toggle of include/exclude buttons is unstable
|
||||
// we force include/exclude to be visible
|
||||
// This test focus solely on ensuring that filters are effectively applied to the grid
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
it('Test include/exlude filters', function () {
|
||||
// Because the toggle of include/exclude buttons is unstable
|
||||
// we force include/exclude to be visible
|
||||
// This test focus solely on ensuring that filters are effectively applied to the grid
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
|
||||
// force visibility
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice-toggle')
|
||||
.invoke('attr', 'style', 'visibility:visible')
|
||||
// force visibility
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice-toggle')
|
||||
.invoke('attr', 'style', 'visibility:visible')
|
||||
|
||||
// include ALLSPICE,GROUND, and check rows
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice')
|
||||
.contains('ALLSPICE,GROUND')
|
||||
.parent()
|
||||
.find('.facet-choice-toggle')
|
||||
.click()
|
||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'ALLSPICE,GROUND')
|
||||
cy.get('#tool-panel').contains('1 matching rows')
|
||||
// include ALLSPICE,GROUND, and check rows
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice')
|
||||
.contains('ALLSPICE,GROUND')
|
||||
.parent()
|
||||
.find('.facet-choice-toggle')
|
||||
.click()
|
||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'ALLSPICE,GROUND')
|
||||
cy.get('#tool-panel').contains('1 matching rows')
|
||||
|
||||
// OR is refreshing facets, need to show the toggle again
|
||||
cy.waitForOrOperation()
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice-toggle')
|
||||
.invoke('attr', 'style', 'visibility:visible')
|
||||
// OR is refreshing facets, need to show the toggle again
|
||||
cy.waitForOrOperation()
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice-toggle')
|
||||
.invoke('attr', 'style', 'visibility:visible')
|
||||
|
||||
// include CELERY SEED, and check rows
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice')
|
||||
.contains('ANISE SEED')
|
||||
.parent()
|
||||
.find('.facet-choice-toggle')
|
||||
.click()
|
||||
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'ANISE SEED')
|
||||
cy.get('#tool-panel').contains('2 matching rows')
|
||||
// include CELERY SEED, and check rows
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice')
|
||||
.contains('ANISE SEED')
|
||||
.parent()
|
||||
.find('.facet-choice-toggle')
|
||||
.click()
|
||||
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'ANISE SEED')
|
||||
cy.get('#tool-panel').contains('2 matching rows')
|
||||
|
||||
// OR ir refreshing facets, need to show the toggle again
|
||||
cy.waitForOrOperation()
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice-toggle')
|
||||
.invoke('attr', 'style', 'visibility:visible')
|
||||
// OR ir refreshing facets, need to show the toggle again
|
||||
cy.waitForOrOperation()
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice-toggle')
|
||||
.invoke('attr', 'style', 'visibility:visible')
|
||||
|
||||
// include a third one, CELERY SEED, and check rows
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice')
|
||||
.contains('BUTTER OIL,ANHYDROUS')
|
||||
.parent()
|
||||
.find('.facet-choice-toggle')
|
||||
.click()
|
||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER OIL,ANHYDROUS') // this row is added first
|
||||
cy.get('#tool-panel').contains('3 matching rows')
|
||||
// include a third one, CELERY SEED, and check rows
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice')
|
||||
.contains('BUTTER OIL,ANHYDROUS')
|
||||
.parent()
|
||||
.find('.facet-choice-toggle')
|
||||
.click()
|
||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER OIL,ANHYDROUS') // this row is added first
|
||||
cy.get('#tool-panel').contains('3 matching rows')
|
||||
|
||||
// OR ir refreshing facets, need to show the toggle again
|
||||
cy.waitForOrOperation()
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice-toggle')
|
||||
.invoke('attr', 'style', 'visibility:visible')
|
||||
// OR ir refreshing facets, need to show the toggle again
|
||||
cy.waitForOrOperation()
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice-toggle')
|
||||
.invoke('attr', 'style', 'visibility:visible')
|
||||
|
||||
// EXCLUDE ALLSPICE,GROUND
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice')
|
||||
.contains('ALLSPICE,GROUND')
|
||||
.parent()
|
||||
.find('.facet-choice-toggle')
|
||||
.click()
|
||||
cy.get('#tool-panel').contains('2 matching rows')
|
||||
})
|
||||
// EXCLUDE ALLSPICE,GROUND
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice')
|
||||
.contains('ALLSPICE,GROUND')
|
||||
.parent()
|
||||
.find('.facet-choice-toggle')
|
||||
.click()
|
||||
cy.get('#tool-panel').contains('2 matching rows')
|
||||
})
|
||||
|
||||
it('Test include/exclude, invert', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
it('Test include/exclude, invert', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
|
||||
// do a basic facetting, expect 1 row
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice-toggle')
|
||||
.invoke('attr', 'style', 'visibility:visible')
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice')
|
||||
.contains('ALLSPICE,GROUND')
|
||||
.parent()
|
||||
.find('.facet-choice-toggle')
|
||||
.click()
|
||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'ALLSPICE,GROUND')
|
||||
cy.get('#tool-panel').contains('1 matching rows')
|
||||
// do a basic facetting, expect 1 row
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice-toggle')
|
||||
.invoke('attr', 'style', 'visibility:visible')
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice')
|
||||
.contains('ALLSPICE,GROUND')
|
||||
.parent()
|
||||
.find('.facet-choice-toggle')
|
||||
.click()
|
||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'ALLSPICE,GROUND')
|
||||
cy.get('#tool-panel').contains('1 matching rows')
|
||||
|
||||
// now invert, expect 198 rows
|
||||
cy.getFacetContainer('Shrt_Desc').find('a[bind="invertButton"]').click()
|
||||
cy.waitForOrOperation()
|
||||
cy.get('#tool-panel').contains('198 matching rows')
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('a[bind="invertButton"]')
|
||||
.should('have.class', 'facet-mode-inverted')
|
||||
// now invert, expect 198 rows
|
||||
cy.getFacetContainer('Shrt_Desc').find('a[bind="invertButton"]').click()
|
||||
cy.waitForOrOperation()
|
||||
cy.get('#tool-panel').contains('198 matching rows')
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('a[bind="invertButton"]')
|
||||
.should('have.class', 'facet-mode-inverted')
|
||||
|
||||
// remove invert
|
||||
cy.getFacetContainer('Shrt_Desc').find('a[bind="invertButton"]').click()
|
||||
cy.waitForOrOperation()
|
||||
cy.get('#tool-panel').contains('1 matching rows')
|
||||
})
|
||||
// remove invert
|
||||
cy.getFacetContainer('Shrt_Desc').find('a[bind="invertButton"]').click()
|
||||
cy.waitForOrOperation()
|
||||
cy.get('#tool-panel').contains('1 matching rows')
|
||||
})
|
||||
|
||||
it('Test facet reset', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
it('Test facet reset', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
|
||||
// do a basic facetting, expect 1 row
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice-toggle')
|
||||
.invoke('attr', 'style', 'visibility:visible')
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice')
|
||||
.contains('ALLSPICE,GROUND')
|
||||
.parent()
|
||||
.find('.facet-choice-toggle')
|
||||
.click()
|
||||
cy.get('#tool-panel').contains('1 matching rows')
|
||||
// do a basic facetting, expect 1 row
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice-toggle')
|
||||
.invoke('attr', 'style', 'visibility:visible')
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice')
|
||||
.contains('ALLSPICE,GROUND')
|
||||
.parent()
|
||||
.find('.facet-choice-toggle')
|
||||
.click()
|
||||
cy.get('#tool-panel').contains('1 matching rows')
|
||||
|
||||
// now reset, expect 199
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('a[bind="resetButton"]')
|
||||
.contains('reset')
|
||||
.click()
|
||||
cy.get('#tool-panel').contains('199 rows')
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('a[bind="resetButton"]')
|
||||
.should('not.be.visible')
|
||||
})
|
||||
// now reset, expect 199
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('a[bind="resetButton"]')
|
||||
.contains('reset')
|
||||
.click()
|
||||
cy.get('#tool-panel').contains('199 rows')
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('a[bind="resetButton"]')
|
||||
.should('not.be.visible')
|
||||
})
|
||||
|
||||
/**
|
||||
* This test ensure the refresh button behavior when editing a facet
|
||||
* The grid is updated with a duplicate on "BUTTER,WITH SALT"
|
||||
* Then we ensure the number of occurences is respected
|
||||
*/
|
||||
it('Test refresh reset', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
/**
|
||||
* This test ensure the refresh button behavior when editing a facet
|
||||
* The grid is updated with a duplicate on "BUTTER,WITH SALT"
|
||||
* Then we ensure the number of occurences is respected
|
||||
*/
|
||||
it('Test refresh reset', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
|
||||
cy.get('.facet-choice').should('have.length', 2)
|
||||
cy.get('.facet-choice:nth-child(1)').contains(
|
||||
'BUTTER,WHIPPED,WITH SALT'
|
||||
)
|
||||
cy.get('.facet-choice:nth-child(2)').contains('BUTTER,WITH SALT')
|
||||
cy.get('.facet-choice').should('have.length', 2)
|
||||
cy.get('.facet-choice:nth-child(1)').contains(
|
||||
'BUTTER,WHIPPED,WITH SALT'
|
||||
)
|
||||
cy.get('.facet-choice:nth-child(2)').contains('BUTTER,WITH SALT')
|
||||
|
||||
cy.editCell(1, 'Shrt_Desc', 'BUTTER,WITH SALT')
|
||||
cy.get('#refine-tabs-facets .browsing-panel-controls-refresh')
|
||||
.contains('Refresh')
|
||||
.click()
|
||||
cy.get('.facet-choice').should('have.length', 1)
|
||||
cy.get('.facet-choice:first-child').contains('BUTTER,WITH SALT')
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice-count')
|
||||
.contains(2)
|
||||
})
|
||||
cy.editCell(1, 'Shrt_Desc', 'BUTTER,WITH SALT')
|
||||
cy.get('#refine-tabs-facets .browsing-panel-controls-refresh')
|
||||
.contains('Refresh')
|
||||
.click()
|
||||
cy.get('.facet-choice').should('have.length', 1)
|
||||
cy.get('.facet-choice:first-child').contains('BUTTER,WITH SALT')
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-choice-count')
|
||||
.contains(2)
|
||||
})
|
||||
|
||||
it('Test facet by choice count', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-body-controls')
|
||||
.contains('Facet by choice counts')
|
||||
.click()
|
||||
it('Test facet by choice count', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
cy.getFacetContainer('Shrt_Desc')
|
||||
.find('.facet-body-controls')
|
||||
.contains('Facet by choice counts')
|
||||
.click()
|
||||
|
||||
cy.get(`#refine-tabs-facets .facets-container .facet-container#facet-1`)
|
||||
.should('exist')
|
||||
.contains('Shrt_Desc')
|
||||
})
|
||||
cy.get(`#refine-tabs-facets .facets-container .facet-container#facet-1`)
|
||||
.should('exist')
|
||||
.contains('Shrt_Desc')
|
||||
})
|
||||
|
||||
it('Test the mass edit from a Facet', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
it('Test the mass edit from a Facet', function () {
|
||||
cy.loadAndVisitProject('food.small')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
|
||||
cy.getFacetContainer('Water').within(() => {
|
||||
cy.get('.facet-choice')
|
||||
.contains('15.87')
|
||||
.parent()
|
||||
.trigger('mouseover')
|
||||
.find('a.facet-choice-edit')
|
||||
.contains('edit')
|
||||
.should('be.visible')
|
||||
.click()
|
||||
})
|
||||
cy.getFacetContainer('Water').within(() => {
|
||||
cy.get('.facet-choice')
|
||||
.contains('15.87')
|
||||
.parent()
|
||||
.trigger('mouseover')
|
||||
.find('a.facet-choice-edit')
|
||||
.contains('edit')
|
||||
.should('be.visible')
|
||||
.click()
|
||||
})
|
||||
|
||||
// mass edit all cells that have Water = 15.87
|
||||
cy.get('.data-table-cell-editor textarea').type(50)
|
||||
cy.get('.data-table-cell-editor button').contains('Apply').click()
|
||||
// mass edit all cells that have Water = 15.87
|
||||
cy.get('.data-table-cell-editor textarea').type(50)
|
||||
cy.get('.data-table-cell-editor button').contains('Apply').click()
|
||||
|
||||
// ensure rows has been modified
|
||||
cy.getCell(0, 'Water').should('to.contain', 50)
|
||||
cy.getCell(1, 'Water').should('to.contain', 50)
|
||||
// ensure rows has been modified
|
||||
cy.getCell(0, 'Water').should('to.contain', 50)
|
||||
cy.getCell(1, 'Water').should('to.contain', 50)
|
||||
|
||||
// ensure modification is made only to the rows that had 15.87, not the others
|
||||
cy.getCell(2, 'Water').should('to.contain', 0.24)
|
||||
})
|
||||
// ensure modification is made only to the rows that had 15.87, not the others
|
||||
cy.getCell(2, 'Water').should('to.contain', 0.24)
|
||||
})
|
||||
|
||||
// // This test is unstable, mouseover behavior is unpredictable
|
||||
// // This might be because the element is detached from the DOM in the middle
|
||||
// // it('Test include/exlude toggle', function () {
|
||||
// // cy.loadAndVisitProject('food.small');
|
||||
// // cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"]').trigger('mouseover');
|
||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').contains('include').should('be.visible');
|
||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').click();
|
||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').contains('exclude');
|
||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').click();
|
||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').contains('include');
|
||||
// // });
|
||||
// // This test is unstable, mouseover behavior is unpredictable
|
||||
// // This might be because the element is detached from the DOM in the middle
|
||||
// // it('Test include/exlude toggle', function () {
|
||||
// // cy.loadAndVisitProject('food.small');
|
||||
// // cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"]').trigger('mouseover');
|
||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').contains('include').should('be.visible');
|
||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').click();
|
||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').contains('exclude');
|
||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').click();
|
||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').contains('include');
|
||||
// // });
|
||||
|
||||
// it('Test collapsing facet panels', function () {
|
||||
// The following test does not work
|
||||
// Because the facet panels uses soem weird CSS with overflow:hidden, Cypress can not detect it
|
||||
// //// # cy.loadAndVisitProject('food.small');
|
||||
// //// # cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||
// //// # ensure facet inner panel is visible
|
||||
// //// # cy.get('#refine-tabs-facets .facets-container li:nth-child(1) .facet-body-inner').should('be.visible');
|
||||
// //// #collapse the panel
|
||||
// //// # cy.get('#refine-tabs-facets .facets-container li:nth-child(1) a[bind="minimizeButton"]').click();
|
||||
// ////
|
||||
// it('Test collapsing facet panels', function () {
|
||||
// The following test does not work
|
||||
// Because the facet panels uses soem weird CSS with overflow:hidden, Cypress can not detect it
|
||||
// //// # cy.loadAndVisitProject('food.small');
|
||||
// //// # cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||
// //// # ensure facet inner panel is visible
|
||||
// //// # cy.get('#refine-tabs-facets .facets-container li:nth-child(1) .facet-body-inner').should('be.visible');
|
||||
// //// #collapse the panel
|
||||
// //// # cy.get('#refine-tabs-facets .facets-container li:nth-child(1) a[bind="minimizeButton"]').click();
|
||||
// ////
|
||||
})
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Utility method to load an expression panel, used by almost all the tests
|
||||
*/
|
||||
function loadExpressionPanel() {
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Custom text facet'])
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Custom text facet'])
|
||||
}
|
||||
|
||||
/**
|
||||
@ -10,304 +10,304 @@ function loadExpressionPanel() {
|
||||
* Need to wait for OpenRefine to preview the result, hence the cy.wait
|
||||
*/
|
||||
function typeExpression(expression) {
|
||||
cy.get('textarea.expression-preview-code').type(expression)
|
||||
cy.wait(250)
|
||||
cy.get('textarea.expression-preview-code').type(expression)
|
||||
cy.wait(250)
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a unique GREL expression to be used for testing
|
||||
*/
|
||||
function generateUniqueExpression() {
|
||||
return `value+${Date.now()}`
|
||||
return `value+${Date.now()}`
|
||||
}
|
||||
|
||||
describe(__filename, function () {
|
||||
it('Test the layout of the expression panel', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
it('Test the layout of the expression panel', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
|
||||
cy.get('.dialog-container').within(() => {
|
||||
cy.get('td[bind="or_dialog_expr"]').contains('Expression')
|
||||
cy.get(
|
||||
'select[bind="expressionPreviewLanguageSelect"] option'
|
||||
).should('have.length', 3)
|
||||
cy.get('textarea.expression-preview-code').should('exist')
|
||||
cy.get('.dialog-container').within(() => {
|
||||
cy.get('td[bind="or_dialog_expr"]').contains('Expression')
|
||||
cy.get(
|
||||
'select[bind="expressionPreviewLanguageSelect"] option'
|
||||
).should('have.length', 3)
|
||||
cy.get('textarea.expression-preview-code').should('exist')
|
||||
|
||||
cy.get('.dialog-footer button:nth-child(1)').should(
|
||||
'to.contain',
|
||||
'OK'
|
||||
)
|
||||
cy.get('.dialog-footer button:nth-child(2)').should(
|
||||
'to.contain',
|
||||
'Cancel'
|
||||
)
|
||||
})
|
||||
})
|
||||
cy.get('.dialog-footer button:nth-child(1)').should(
|
||||
'to.contain',
|
||||
'OK'
|
||||
)
|
||||
cy.get('.dialog-footer button:nth-child(2)').should(
|
||||
'to.contain',
|
||||
'Cancel'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
it('Test a valid Grel expression', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
typeExpression('value.toLowercase()')
|
||||
cy.get('.expression-preview-parsing-status').contains(
|
||||
'No syntax error.'
|
||||
)
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||
).should('to.contain', 'butter,with salt')
|
||||
})
|
||||
it('Test a valid Grel expression', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
typeExpression('value.toLowercase()')
|
||||
cy.get('.expression-preview-parsing-status').contains(
|
||||
'No syntax error.'
|
||||
)
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||
).should('to.contain', 'butter,with salt')
|
||||
})
|
||||
|
||||
it('Test a valid Python expression', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
||||
'jython'
|
||||
)
|
||||
typeExpression('return value.lower()')
|
||||
cy.get('.expression-preview-parsing-status').contains(
|
||||
'No syntax error.'
|
||||
)
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||
).should('to.contain', 'butter,with salt')
|
||||
})
|
||||
it('Test a valid Python expression', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
||||
'jython'
|
||||
)
|
||||
typeExpression('return value.lower()')
|
||||
cy.get('.expression-preview-parsing-status').contains(
|
||||
'No syntax error.'
|
||||
)
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||
).should('to.contain', 'butter,with salt')
|
||||
})
|
||||
|
||||
it('Test a valid Clojure expression', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
||||
'clojure'
|
||||
)
|
||||
typeExpression('(.. value (toLowerCase) )')
|
||||
cy.get('.expression-preview-parsing-status').contains(
|
||||
'No syntax error.'
|
||||
)
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||
).should('to.contain', 'butter,with salt')
|
||||
})
|
||||
it('Test a valid Clojure expression', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
||||
'clojure'
|
||||
)
|
||||
typeExpression('(.. value (toLowerCase) )')
|
||||
cy.get('.expression-preview-parsing-status').contains(
|
||||
'No syntax error.'
|
||||
)
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||
).should('to.contain', 'butter,with salt')
|
||||
})
|
||||
|
||||
it('Test a Grel syntax error', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
typeExpression('()')
|
||||
cy.get('.expression-preview-parsing-status').contains('Parsing error')
|
||||
})
|
||||
it('Test a Grel syntax error', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
typeExpression('()')
|
||||
cy.get('.expression-preview-parsing-status').contains('Parsing error')
|
||||
})
|
||||
|
||||
it('Test a Python syntax error', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
||||
'jython'
|
||||
)
|
||||
typeExpression('(;)')
|
||||
cy.get('.expression-preview-parsing-status').contains('Internal error')
|
||||
})
|
||||
it('Test a Python syntax error', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
||||
'jython'
|
||||
)
|
||||
typeExpression('(;)')
|
||||
cy.get('.expression-preview-parsing-status').contains('Internal error')
|
||||
})
|
||||
|
||||
it('Test a Clojure syntax error', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
||||
'clojure'
|
||||
)
|
||||
typeExpression('(;)')
|
||||
cy.get('.expression-preview-parsing-status').contains(
|
||||
'Syntax error reading source'
|
||||
)
|
||||
})
|
||||
it('Test a Clojure syntax error', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
||||
'clojure'
|
||||
)
|
||||
typeExpression('(;)')
|
||||
cy.get('.expression-preview-parsing-status').contains(
|
||||
'Syntax error reading source'
|
||||
)
|
||||
})
|
||||
|
||||
it('Test a Grel language error', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
typeExpression('value.thisGrelFunctionDoesNotExists()')
|
||||
cy.get('.expression-preview-parsing-status').contains(
|
||||
'Unknown function thisGrelFunctionDoesNotExists'
|
||||
)
|
||||
})
|
||||
it('Test a Grel language error', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
typeExpression('value.thisGrelFunctionDoesNotExists()')
|
||||
cy.get('.expression-preview-parsing-status').contains(
|
||||
'Unknown function thisGrelFunctionDoesNotExists'
|
||||
)
|
||||
})
|
||||
|
||||
it('Test a Python language error', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
||||
'jython'
|
||||
)
|
||||
typeExpression('return value.thisPythonFunctionDoesNotExists()')
|
||||
it('Test a Python language error', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
||||
'jython'
|
||||
)
|
||||
typeExpression('return value.thisPythonFunctionDoesNotExists()')
|
||||
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||
).should('to.contain', 'Error: Traceback')
|
||||
})
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||
).should('to.contain', 'Error: Traceback')
|
||||
})
|
||||
|
||||
it('Test a Clojure language error', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
||||
'clojure'
|
||||
)
|
||||
typeExpression('(.. value (thisClojureFunctionDoesNotExists) )')
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||
).should('to.contain', 'Error: No matching method')
|
||||
})
|
||||
it('Test a Clojure language error', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
||||
'clojure'
|
||||
)
|
||||
typeExpression('(.. value (thisClojureFunctionDoesNotExists) )')
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||
).should('to.contain', 'Error: No matching method')
|
||||
})
|
||||
|
||||
it('Test switching from one langage to another', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
typeExpression('(.. value (toLowerCase) )')
|
||||
// error is expected, this is clojure language
|
||||
cy.get('.expression-preview-parsing-status').should(
|
||||
'to.contain',
|
||||
'Parsing error'
|
||||
)
|
||||
// switching to clojure
|
||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
||||
'clojure'
|
||||
)
|
||||
cy.get('.expression-preview-parsing-status').should(
|
||||
'not.to.contain',
|
||||
'Parsing error'
|
||||
)
|
||||
})
|
||||
it('Test switching from one langage to another', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
typeExpression('(.. value (toLowerCase) )')
|
||||
// error is expected, this is clojure language
|
||||
cy.get('.expression-preview-parsing-status').should(
|
||||
'to.contain',
|
||||
'Parsing error'
|
||||
)
|
||||
// switching to clojure
|
||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
||||
'clojure'
|
||||
)
|
||||
cy.get('.expression-preview-parsing-status').should(
|
||||
'not.to.contain',
|
||||
'Parsing error'
|
||||
)
|
||||
})
|
||||
|
||||
it('Test the preview (GREL)', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
typeExpression('value.toLowercase()')
|
||||
it('Test the preview (GREL)', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
typeExpression('value.toLowercase()')
|
||||
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(1) td:last-child'
|
||||
).should('to.contain', 'value.toLowercase()')
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||
).should('to.contain', 'butter,with salt')
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(3) td:last-child'
|
||||
).should('to.contain', 'butter,whipped,with salt')
|
||||
})
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(1) td:last-child'
|
||||
).should('to.contain', 'value.toLowercase()')
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||
).should('to.contain', 'butter,with salt')
|
||||
cy.get(
|
||||
'.expression-preview-table-wrapper tr:nth-child(3) td:last-child'
|
||||
).should('to.contain', 'butter,whipped,with salt')
|
||||
})
|
||||
|
||||
it('Test the help tab', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('#expression-preview-tabs li').contains('Help').click()
|
||||
cy.get('#expression-preview-tabs-help').should('be.visible')
|
||||
cy.get('#expression-preview-tabs-help').should(
|
||||
'to.contain',
|
||||
`The current cell. It has a few fields: 'value', 'recon' and 'errorMessage'.`
|
||||
)
|
||||
})
|
||||
it('Test the help tab', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('#expression-preview-tabs li').contains('Help').click()
|
||||
cy.get('#expression-preview-tabs-help').should('be.visible')
|
||||
cy.get('#expression-preview-tabs-help').should(
|
||||
'to.contain',
|
||||
`The current cell. It has a few fields: 'value', 'recon' and 'errorMessage'.`
|
||||
)
|
||||
})
|
||||
|
||||
it('Test the history behavior, ensure expressions are stored', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
// Because history is shared across projects, we need to use an expression that is unique
|
||||
it('Test the history behavior, ensure expressions are stored', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
// Because history is shared across projects, we need to use an expression that is unique
|
||||
|
||||
// Use a first unique expression
|
||||
const uniqueExpression = generateUniqueExpression()
|
||||
loadExpressionPanel()
|
||||
typeExpression(uniqueExpression)
|
||||
cy.get('.dialog-footer button').contains('OK').click()
|
||||
// ensure the function has been added to the facet
|
||||
cy.get('#refine-tabs-facets').contains(
|
||||
uniqueExpression.replace('()', '')
|
||||
)
|
||||
// Use a first unique expression
|
||||
const uniqueExpression = generateUniqueExpression()
|
||||
loadExpressionPanel()
|
||||
typeExpression(uniqueExpression)
|
||||
cy.get('.dialog-footer button').contains('OK').click()
|
||||
// ensure the function has been added to the facet
|
||||
cy.get('#refine-tabs-facets').contains(
|
||||
uniqueExpression.replace('()', '')
|
||||
)
|
||||
|
||||
// Reload and review history
|
||||
// Ensure the previously used expression is listed
|
||||
loadExpressionPanel()
|
||||
cy.get('#expression-preview-tabs li').contains('History').click()
|
||||
cy.get('#expression-preview-tabs-history')
|
||||
.should('be.visible')
|
||||
.should('to.contain', uniqueExpression)
|
||||
})
|
||||
// Reload and review history
|
||||
// Ensure the previously used expression is listed
|
||||
loadExpressionPanel()
|
||||
cy.get('#expression-preview-tabs li').contains('History').click()
|
||||
cy.get('#expression-preview-tabs-history')
|
||||
.should('be.visible')
|
||||
.should('to.contain', uniqueExpression)
|
||||
})
|
||||
|
||||
it('Test the reuse of expressions from the history', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
// Because history is shared across projects, we need to build and use an expression that is unique
|
||||
const uniqueExpression = generateUniqueExpression()
|
||||
loadExpressionPanel()
|
||||
typeExpression(uniqueExpression)
|
||||
cy.get('.dialog-footer button').contains('OK').click()
|
||||
cy.get('#refine-tabs-facets').contains(
|
||||
uniqueExpression.replace('()', '')
|
||||
)
|
||||
it('Test the reuse of expressions from the history', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
// Because history is shared across projects, we need to build and use an expression that is unique
|
||||
const uniqueExpression = generateUniqueExpression()
|
||||
loadExpressionPanel()
|
||||
typeExpression(uniqueExpression)
|
||||
cy.get('.dialog-footer button').contains('OK').click()
|
||||
cy.get('#refine-tabs-facets').contains(
|
||||
uniqueExpression.replace('()', '')
|
||||
)
|
||||
|
||||
// Reload and review history
|
||||
// Ensure the previously used expression is there
|
||||
// Use it
|
||||
loadExpressionPanel()
|
||||
cy.get('#expression-preview-tabs li').contains('History').click()
|
||||
cy.get('#expression-preview-tabs-history tr td')
|
||||
.contains(uniqueExpression)
|
||||
.parent()
|
||||
.find('a')
|
||||
.contains('Reuse')
|
||||
.click()
|
||||
// Reload and review history
|
||||
// Ensure the previously used expression is there
|
||||
// Use it
|
||||
loadExpressionPanel()
|
||||
cy.get('#expression-preview-tabs li').contains('History').click()
|
||||
cy.get('#expression-preview-tabs-history tr td')
|
||||
.contains(uniqueExpression)
|
||||
.parent()
|
||||
.find('a')
|
||||
.contains('Reuse')
|
||||
.click()
|
||||
|
||||
// Expression must be populated in the textarea, after clicking on 'reuse'
|
||||
cy.get('textarea.expression-preview-code').should(
|
||||
'have.value',
|
||||
uniqueExpression
|
||||
)
|
||||
})
|
||||
// Expression must be populated in the textarea, after clicking on 'reuse'
|
||||
cy.get('textarea.expression-preview-code').should(
|
||||
'have.value',
|
||||
uniqueExpression
|
||||
)
|
||||
})
|
||||
|
||||
it('Test the history, star', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
it('Test the history, star', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
|
||||
// Cleanup step
|
||||
// Because starred expression are shared across projects, see #3499
|
||||
// We need to un-star all previously starred expressions
|
||||
loadExpressionPanel()
|
||||
cy.get('#expression-preview-tabs li').contains('Starred').click()
|
||||
cy.get(
|
||||
'#expression-preview-tabs-starred .expression-preview-table-wrapper table'
|
||||
).then(($table) => {
|
||||
if ($table.find('tr').length > 1) {
|
||||
cy.get(
|
||||
'#expression-preview-tabs-starred .expression-preview-table-wrapper table a'
|
||||
)
|
||||
.contains('Remove')
|
||||
.each(($btn) => {
|
||||
cy.wrap($btn).click()
|
||||
cy.get('.dialog-container:last-child button')
|
||||
.contains('OK')
|
||||
.click()
|
||||
})
|
||||
}
|
||||
})
|
||||
cy.get('.dialog-footer button').contains('Cancel').click()
|
||||
// End cleanup
|
||||
// Cleanup step
|
||||
// Because starred expression are shared across projects, see #3499
|
||||
// We need to un-star all previously starred expressions
|
||||
loadExpressionPanel()
|
||||
cy.get('#expression-preview-tabs li').contains('Starred').click()
|
||||
cy.get(
|
||||
'#expression-preview-tabs-starred .expression-preview-table-wrapper table'
|
||||
).then(($table) => {
|
||||
if ($table.find('tr').length > 1) {
|
||||
cy.get(
|
||||
'#expression-preview-tabs-starred .expression-preview-table-wrapper table a'
|
||||
)
|
||||
.contains('Remove')
|
||||
.each(($btn) => {
|
||||
cy.wrap($btn).click()
|
||||
cy.get('.dialog-container:last-child button')
|
||||
.contains('OK')
|
||||
.click()
|
||||
})
|
||||
}
|
||||
})
|
||||
cy.get('.dialog-footer button').contains('Cancel').click()
|
||||
// End cleanup
|
||||
|
||||
// Load an expression
|
||||
loadExpressionPanel()
|
||||
const uniqueExpression = generateUniqueExpression()
|
||||
typeExpression(uniqueExpression)
|
||||
cy.get('.dialog-footer button').contains('OK').click()
|
||||
// Load an expression
|
||||
loadExpressionPanel()
|
||||
const uniqueExpression = generateUniqueExpression()
|
||||
typeExpression(uniqueExpression)
|
||||
cy.get('.dialog-footer button').contains('OK').click()
|
||||
|
||||
// Star the expression
|
||||
loadExpressionPanel()
|
||||
cy.get('#expression-preview-tabs li').contains('History').click()
|
||||
cy.get('.expression-preview-table-wrapper tr td')
|
||||
.contains(uniqueExpression)
|
||||
.parent()
|
||||
.find('a.data-table-star-off')
|
||||
.click()
|
||||
// Star the expression
|
||||
loadExpressionPanel()
|
||||
cy.get('#expression-preview-tabs li').contains('History').click()
|
||||
cy.get('.expression-preview-table-wrapper tr td')
|
||||
.contains(uniqueExpression)
|
||||
.parent()
|
||||
.find('a.data-table-star-off')
|
||||
.click()
|
||||
|
||||
// List starred expressions, en ensure the expression is listed
|
||||
cy.get('#expression-preview-tabs li').contains('Starred').click()
|
||||
cy.get(
|
||||
'#expression-preview-tabs-starred .expression-preview-table-wrapper table'
|
||||
).contains(uniqueExpression)
|
||||
})
|
||||
// List starred expressions, en ensure the expression is listed
|
||||
cy.get('#expression-preview-tabs li').contains('Starred').click()
|
||||
cy.get(
|
||||
'#expression-preview-tabs-starred .expression-preview-table-wrapper table'
|
||||
).contains(uniqueExpression)
|
||||
})
|
||||
|
||||
it('Simple test to ensure the expression panel can be closed with OK', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('.dialog-footer button').contains('OK').click()
|
||||
cy.get('.dialog-container').should('not.to.exist')
|
||||
})
|
||||
it('Simple test to ensure the expression panel can be closed with OK', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('.dialog-footer button').contains('OK').click()
|
||||
cy.get('.dialog-container').should('not.to.exist')
|
||||
})
|
||||
|
||||
it('Simple test to ensure the expression panel can be closed with Cancel', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('.dialog-footer button').contains('Cancel').click()
|
||||
cy.get('.dialog-container').should('not.to.exist')
|
||||
})
|
||||
it('Simple test to ensure the expression panel can be closed with Cancel', function () {
|
||||
cy.loadAndVisitProject('food.mini')
|
||||
loadExpressionPanel()
|
||||
cy.get('.dialog-footer button').contains('Cancel').click()
|
||||
cy.get('.dialog-container').should('not.to.exist')
|
||||
})
|
||||
})
|
||||
|
1607
main/tests/cypress/package-lock.json
generated
Normal file
1607
main/tests/cypress/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@
|
||||
"test": "cypress run --browser electron --headless --quiet",
|
||||
"lint": "prettier --write .",
|
||||
"check-lint": "prettier --check ."
|
||||
},
|
||||
},
|
||||
"dependencies": {
|
||||
"cypress": "6.2.1",
|
||||
"cypress-file-upload": "^5.0.2",
|
||||
|
@ -96,16 +96,39 @@ DataTableCellUI.prototype._render = function() {
|
||||
nonstringSpan.className = 'data-table-value-nonstring';
|
||||
nonstringSpan.textContent = cell.v;
|
||||
divContent.appendChild(nonstringSpan);
|
||||
} else if (URL.looksLikeUrl(cell.v)) {
|
||||
var url = document.createElement('a');
|
||||
url.textContent = cell.v;
|
||||
url.setAttribute('href', cell.v);
|
||||
url.setAttribute('target', '_blank');
|
||||
divContent.appendChild(url);
|
||||
} else {
|
||||
var span = document.createElement('span');
|
||||
span.textContent = cell.v;
|
||||
divContent.appendChild(span);
|
||||
}
|
||||
else{
|
||||
var arr = cell.v.split(" ");
|
||||
var spanArr =[];
|
||||
for( var i=0;i<arr.length;i++){
|
||||
if(URL.looksLikeUrl(arr[i])){
|
||||
if(spanArr.length !=0 ){
|
||||
var span = document.createElement('span');
|
||||
span.textContent = spanArr.join(" ");
|
||||
divContent.appendChild(span).appendChild(document.createTextNode('\u00A0'));
|
||||
spanArr = [];
|
||||
}
|
||||
var url = document.createElement('a');
|
||||
url.textContent = arr[i];
|
||||
url.setAttribute('href', arr[i]);
|
||||
url.setAttribute('target', '_blank');
|
||||
divContent.appendChild(url);
|
||||
if( i== arr.length-1){
|
||||
divContent.appendChild(url)
|
||||
}
|
||||
else{
|
||||
divContent.appendChild(url).appendChild(document.createTextNode('\u00A0'));
|
||||
}
|
||||
}
|
||||
else{
|
||||
spanArr.push(arr[i]);
|
||||
}
|
||||
}
|
||||
if(spanArr.length !=0){
|
||||
var span = document.createElement('span');
|
||||
span.textContent = spanArr.join(" ");
|
||||
divContent.appendChild(span);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var divContentRecon = $(divContent);
|
||||
|
Loading…
Reference in New Issue
Block a user