tests: UX Test for project list deletion, sort, filter (#3480)
* tests: UX Test for project list deletion, sort, filter Signed-off-by: Kush Trivedi <kushthedude@gmail.com>
This commit is contained in:
parent
f94bb5e8f4
commit
900ff2db9a
@ -2,8 +2,8 @@ const foodMini = require('./food.mini.js')
|
||||
const foodSmall = require('./food.small.js')
|
||||
|
||||
const fixtures = {
|
||||
'food.mini': foodMini,
|
||||
'food.small': foodSmall,
|
||||
'food.mini': foodMini,
|
||||
'food.small': foodSmall,
|
||||
}
|
||||
|
||||
export default fixtures
|
||||
|
@ -1,7 +1,7 @@
|
||||
const fixture = [
|
||||
['NDB_No', 'Shrt_Desc', 'Water', 'Energ_Kcal'],
|
||||
['01001', 'BUTTER,WITH SALT', '15.87', '717'],
|
||||
['01002', 'BUTTER,WHIPPED,WITH SALT', '15.87', '717'],
|
||||
['NDB_No', 'Shrt_Desc', 'Water', 'Energ_Kcal'],
|
||||
['01001', 'BUTTER,WITH SALT', '15.87', '717'],
|
||||
['01002', 'BUTTER,WHIPPED,WITH SALT', '15.87', '717'],
|
||||
]
|
||||
|
||||
export default fixture
|
||||
|
@ -4,7 +4,7 @@ describe(__filename, function () {
|
||||
cy.loadProject('food.mini', projectName)
|
||||
cy.visitOpenRefine()
|
||||
cy.navigateTo('Open Project')
|
||||
cy.get('#projects-list table').contains(projectName)
|
||||
cy.get('#projects-list table').should('contain', projectName)
|
||||
})
|
||||
|
||||
it('Visit a project from the Open project page, ensure link is working', function () {
|
||||
@ -13,6 +13,62 @@ describe(__filename, function () {
|
||||
cy.visitOpenRefine()
|
||||
cy.navigateTo('Open Project')
|
||||
cy.get('#projects-list table').contains(projectName).click()
|
||||
cy.get('#project-name-button').contains(projectName)
|
||||
cy.get('#project-name-button').should('contain', projectName)
|
||||
})
|
||||
it('Ensure projects are sorted on basis of names', function () {
|
||||
const projectName = 'projectA'
|
||||
const projectName2 = 'projectZ'
|
||||
var positionA, positionZ
|
||||
cy.loadProject('food.mini', projectName)
|
||||
cy.loadProject('food.mini', projectName2)
|
||||
cy.visitOpenRefine()
|
||||
cy.navigateTo('Open Project')
|
||||
cy.get('#projects-list table').contains('Name').click()
|
||||
// cy.get('#projects-list tbody>tr').eq(0).should('contain','projectA');
|
||||
// cy.get('#projects-list table').contains("Name").click();
|
||||
// cy.get('#projects-list tbody>tr').eq(0).should('contain', 'projectZ');
|
||||
// hack since all projects are not being deleted
|
||||
|
||||
cy.get('a.project-name')
|
||||
.contains('projectA')
|
||||
.then((projectALink) => {
|
||||
cy.get('a.project-name')
|
||||
.contains('projectZ')
|
||||
.then((projectZLink) => {
|
||||
positionA = projectALink.parent().parent().index()
|
||||
positionZ = projectZLink.parent().parent().index()
|
||||
expect(positionA).to.be.lessThan(positionZ)
|
||||
})
|
||||
})
|
||||
cy.get('#projects-list table').contains('Name').click()
|
||||
cy.get('a.project-name')
|
||||
.contains('projectA')
|
||||
.then((projectALink) => {
|
||||
cy.get('a.project-name')
|
||||
.contains('projectZ')
|
||||
.then((projectZLink) => {
|
||||
positionA = projectALink.parent().parent().index()
|
||||
positionZ = projectZLink.parent().parent().index()
|
||||
expect(positionA).to.be.greaterThan(positionZ)
|
||||
})
|
||||
})
|
||||
})
|
||||
it('Ensure project is deleted from database as well as UI', function () {
|
||||
const projectName = Date.now()
|
||||
cy.loadProject('food.mini', projectName)
|
||||
cy.visitOpenRefine()
|
||||
cy.navigateTo('Open Project')
|
||||
cy.contains('td', projectName)
|
||||
.siblings()
|
||||
.find('.delete-project')
|
||||
.click()
|
||||
cy.get('#projects-list').should('not.contain', projectName)
|
||||
cy.request(
|
||||
'GET',
|
||||
'http://127.0.0.1:3333/command/core/get-all-project-metadata'
|
||||
).then((response) => {
|
||||
var responseText = JSON.stringify(response.body)
|
||||
expect(responseText).to.not.have.string(projectName)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -1,9 +1,9 @@
|
||||
describe(__filename, function () {
|
||||
it('Open an existing project by visiting the URL directly', function () {
|
||||
const projectName = Date.now()
|
||||
cy.loadProject('food.mini', projectName).then((projectId) => {
|
||||
cy.visitProject(projectId)
|
||||
cy.get('#project-name-button').contains(projectName)
|
||||
})
|
||||
})
|
||||
it('Open an existing project by visiting the URL directly', function () {
|
||||
const projectName = Date.now()
|
||||
cy.loadProject('food.mini', projectName).then((projectId) => {
|
||||
cy.visitProject(projectId)
|
||||
cy.get('#project-name-button').contains(projectName)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -1,10 +1,10 @@
|
||||
describe(__filename, function () {
|
||||
it('Export a project', function () {
|
||||
const testProjectName = Date.now()
|
||||
cy.loadAndVisitProject('food.mini', testProjectName)
|
||||
cy.get('#export-button').click()
|
||||
cy.get('.menu-container a')
|
||||
.contains('OpenRefine project archive to file')
|
||||
.click()
|
||||
})
|
||||
it('Export a project', function () {
|
||||
const testProjectName = Date.now()
|
||||
cy.loadAndVisitProject('food.mini', testProjectName)
|
||||
cy.get('#export-button').click()
|
||||
cy.get('.menu-container a')
|
||||
.contains('OpenRefine project archive to file')
|
||||
.click()
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user