* test: Improved the way we handle fixtures, #3505 * Added a fix for an invalid call to loadAndVisitProject, added cypress download path to gitignore
This commit is contained in:
parent
61fe0ed458
commit
a421447a8f
1
main/tests/cypress/.gitignore
vendored
1
main/tests/cypress/.gitignore
vendored
@ -3,5 +3,6 @@ node_modules
|
|||||||
.env.local
|
.env.local
|
||||||
cypress/videos
|
cypress/videos
|
||||||
cypress/screenshots
|
cypress/screenshots
|
||||||
|
cypress/downloads
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
cypress.env.json
|
cypress.env.json
|
9
main/tests/cypress/cypress/fixtures/fixtures.js
Normal file
9
main/tests/cypress/cypress/fixtures/fixtures.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
const foodMini = require('./food.mini.js')
|
||||||
|
const foodSmall = require('./food.small.js')
|
||||||
|
|
||||||
|
const fixtures = {
|
||||||
|
'food.mini': foodMini,
|
||||||
|
'food.small': foodSmall,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default fixtures
|
@ -1,3 +1,3 @@
|
|||||||
NDB_No,Shrt_Desc,Water,Energ_Kcal
|
"NDB_No","Shrt_Desc","Water","Energ_Kcal"
|
||||||
01001,"BUTTER,WITH SALT",15.87,717
|
"01001","BUTTER,WITH SALT","15.87","717"
|
||||||
01002,"BUTTER,WHIPPED,WITH SALT",15.87,717
|
"01002","BUTTER,WHIPPED,WITH SALT","15.87","717"
|
|
7
main/tests/cypress/cypress/fixtures/food.mini.js
Normal file
7
main/tests/cypress/cypress/fixtures/food.mini.js
Normal file
@ -0,0 +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'],
|
||||||
|
]
|
||||||
|
|
||||||
|
export default fixture
|
10604
main/tests/cypress/cypress/fixtures/food.small.js
Normal file
10604
main/tests/cypress/cypress/fixtures/food.small.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('List an existing project, ensure a newly created project is displayed', function () {
|
it('List an existing project, ensure a newly created project is displayed', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now()
|
||||||
cy.loadProject('food.mini.csv', projectName)
|
cy.loadProject('food.mini', projectName)
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine()
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project')
|
||||||
cy.get('#projects-list table').contains(projectName)
|
cy.get('#projects-list table').contains(projectName)
|
||||||
@ -9,7 +9,7 @@ describe(__filename, function () {
|
|||||||
|
|
||||||
it('Visit a project from the Open project page, ensure link is working', function () {
|
it('Visit a project from the Open project page, ensure link is working', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now()
|
||||||
cy.loadProject('food.mini.csv', projectName)
|
cy.loadProject('food.mini', projectName)
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine()
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project')
|
||||||
cy.get('#projects-list table').contains(projectName).click()
|
cy.get('#projects-list table').contains(projectName).click()
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Open an existing project by visiting the URL directly', function () {
|
it('Open an existing project by visiting the URL directly', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now()
|
||||||
cy.loadProject('food.mini.csv', projectName).then((projectId) => {
|
cy.loadProject('food.mini', projectName).then((projectId) => {
|
||||||
cy.visitProject(projectId)
|
cy.visitProject(projectId)
|
||||||
cy.get('#project-name-button').contains(projectName)
|
cy.get('#project-name-button').contains(projectName)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('A numeric facet must be casted first', function () {
|
it('A numeric facet must be casted first', function () {
|
||||||
cy.loadAndVisitProject('food.small.csv')
|
cy.loadAndVisitProject('food.small')
|
||||||
cy.columnActionClick('Water', ['Facet', 'Numeric facet'])
|
cy.columnActionClick('Water', ['Facet', 'Numeric facet'])
|
||||||
cy.get('#refine-tabs-facets .facets-container li:first-child').contains(
|
cy.get('#refine-tabs-facets .facets-container li:first-child').contains(
|
||||||
'No numeric value present.'
|
'No numeric value present.'
|
||||||
@ -8,7 +8,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Changing the type of the column for numeric', function () {
|
it('Changing the type of the column for numeric', function () {
|
||||||
cy.loadAndVisitProject('food.small.csv')
|
cy.loadAndVisitProject('food.small')
|
||||||
cy.columnActionClick('Water', ['Facet', 'Numeric facet'])
|
cy.columnActionClick('Water', ['Facet', 'Numeric facet'])
|
||||||
cy.get('#refine-tabs-facets .facets-container li:first-child').contains(
|
cy.get('#refine-tabs-facets .facets-container li:first-child').contains(
|
||||||
'No numeric value present.'
|
'No numeric value present.'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Test the facets text (no facets yet)', function () {
|
it('Test the facets text (no facets yet)', function () {
|
||||||
cy.loadAndVisitProject('food.small.csv')
|
cy.loadAndVisitProject('food.small')
|
||||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||||
cy.get('#refine-tabs-facets')
|
cy.get('#refine-tabs-facets')
|
||||||
.should('exist')
|
.should('exist')
|
||||||
@ -8,7 +8,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Create a simple text facet', function () {
|
it('Create a simple text facet', function () {
|
||||||
cy.loadAndVisitProject('food.small.csv')
|
cy.loadAndVisitProject('food.small')
|
||||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||||
cy.get('#refine-tabs-facets').should('exist')
|
cy.get('#refine-tabs-facets').should('exist')
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Create a facet, Sort by count', function () {
|
it('Create a facet, Sort by count', function () {
|
||||||
cy.loadAndVisitProject('food.small.csv')
|
cy.loadAndVisitProject('food.small')
|
||||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||||
cy.get('#refine-tabs-facets').should('exist')
|
cy.get('#refine-tabs-facets').should('exist')
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Create a facet, Sort by count, then by name', function () {
|
it('Create a facet, Sort by count, then by name', function () {
|
||||||
cy.loadAndVisitProject('food.small.csv')
|
cy.loadAndVisitProject('food.small')
|
||||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||||
cy.get('#refine-tabs-facets').should('exist')
|
cy.get('#refine-tabs-facets').should('exist')
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Test the display of multiple facets', function () {
|
it('Test the display of multiple facets', function () {
|
||||||
cy.loadAndVisitProject('food.small.csv')
|
cy.loadAndVisitProject('food.small')
|
||||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||||
@ -89,7 +89,7 @@ describe(__filename, function () {
|
|||||||
// it('Test collapsing facet panels', function () {
|
// it('Test collapsing facet panels', function () {
|
||||||
// The following test does not work
|
// The following test does not work
|
||||||
// Because the facet panels uses soem weird CSS with overflow:hidden, Cypress can not detect it
|
// Because the facet panels uses soem weird CSS with overflow:hidden, Cypress can not detect it
|
||||||
// //// # cy.loadAndVisitProject('food.small.csv');
|
// //// # cy.loadAndVisitProject('food.small');
|
||||||
// //// # cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
// //// # cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||||
// //// # ensure facet inner panel is visible
|
// //// # ensure facet inner panel is visible
|
||||||
// //// # cy.get('#refine-tabs-facets .facets-container li:nth-child(1) .facet-body-inner').should('be.visible');
|
// //// # cy.get('#refine-tabs-facets .facets-container li:nth-child(1) .facet-body-inner').should('be.visible');
|
||||||
@ -99,7 +99,7 @@ describe(__filename, function () {
|
|||||||
// });
|
// });
|
||||||
|
|
||||||
it('Test editing a facet', function () {
|
it('Test editing a facet', function () {
|
||||||
cy.loadAndVisitProject('food.small.csv')
|
cy.loadAndVisitProject('food.small')
|
||||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||||
cy.get(
|
cy.get(
|
||||||
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
||||||
@ -113,7 +113,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Test editing a facet / Preview', function () {
|
it('Test editing a facet / Preview', function () {
|
||||||
cy.loadAndVisitProject('food.small.csv')
|
cy.loadAndVisitProject('food.small')
|
||||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||||
cy.get(
|
cy.get(
|
||||||
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
||||||
@ -129,7 +129,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Test editing a facet / History', function () {
|
it('Test editing a facet / History', function () {
|
||||||
cy.loadAndVisitProject('food.small.csv')
|
cy.loadAndVisitProject('food.small')
|
||||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||||
cy.get(
|
cy.get(
|
||||||
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
||||||
@ -147,7 +147,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Test editing a facet / Starred', function () {
|
it('Test editing a facet / Starred', function () {
|
||||||
cy.loadAndVisitProject('food.small.csv')
|
cy.loadAndVisitProject('food.small')
|
||||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||||
cy.get(
|
cy.get(
|
||||||
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
||||||
@ -165,7 +165,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Test editing a facet / Help', function () {
|
it('Test editing a facet / Help', function () {
|
||||||
cy.loadAndVisitProject('food.small.csv')
|
cy.loadAndVisitProject('food.small')
|
||||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||||
cy.get(
|
cy.get(
|
||||||
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Perform a basic sort', function () {
|
it('Perform a basic sort', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
|
|
||||||
// sort and confirm
|
// sort and confirm
|
||||||
cy.columnActionClick('Shrt_Desc', ['Sort'])
|
cy.columnActionClick('Shrt_Desc', ['Sort'])
|
||||||
@ -16,7 +16,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Perform a basic sort + Reverse', function () {
|
it('Perform a basic sort + Reverse', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
|
|
||||||
// sort and confirm
|
// sort and confirm
|
||||||
cy.columnActionClick('Shrt_Desc', ['Sort'])
|
cy.columnActionClick('Shrt_Desc', ['Sort'])
|
||||||
@ -42,7 +42,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Perform a basic sort + Remove Sort', function () {
|
it('Perform a basic sort + Remove Sort', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
|
|
||||||
// sort and confirm
|
// sort and confirm
|
||||||
cy.columnActionClick('Shrt_Desc', ['Sort'])
|
cy.columnActionClick('Shrt_Desc', ['Sort'])
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensure the Edit button is visible on mouse over a cell', function () {
|
it('Ensure the Edit button is visible on mouse over a cell', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
|
|
||||||
cy.getCell(1, 'Water').trigger('mouseover')
|
cy.getCell(1, 'Water').trigger('mouseover')
|
||||||
cy.getCell(1, 'Water')
|
cy.getCell(1, 'Water')
|
||||||
@ -9,7 +9,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Ensure the Edit button opens a popup', function () {
|
it('Ensure the Edit button opens a popup', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
cy.getCell(1, 'Shrt_Desc')
|
cy.getCell(1, 'Shrt_Desc')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
@ -22,7 +22,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Test a simple edit', function () {
|
it('Test a simple edit', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
cy.getCell(1, 'Shrt_Desc')
|
cy.getCell(1, 'Shrt_Desc')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
@ -38,7 +38,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Test a simple edit, using keyboard shortcut', function () {
|
it('Test a simple edit, using keyboard shortcut', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
cy.getCell(1, 'Shrt_Desc')
|
cy.getCell(1, 'Shrt_Desc')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
@ -53,7 +53,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Test the cancel button', function () {
|
it('Test the cancel button', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
cy.getCell(1, 'Shrt_Desc')
|
cy.getCell(1, 'Shrt_Desc')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
@ -69,7 +69,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Test the cancel button, using keyboard shortcut', function () {
|
it('Test the cancel button, using keyboard shortcut', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
cy.getCell(1, 'Shrt_Desc')
|
cy.getCell(1, 'Shrt_Desc')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
@ -85,7 +85,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Test edit all identical cells', function () {
|
it('Test edit all identical cells', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
cy.getCell(1, 'Water')
|
cy.getCell(1, 'Water')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
@ -104,7 +104,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Test edit all identical cells, using the shortcut', function () {
|
it('Test edit all identical cells, using the shortcut', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
cy.getCell(1, 'Water')
|
cy.getCell(1, 'Water')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Export a project', function () {
|
it('Export a project', function () {
|
||||||
const testProjectName = Date.now()
|
const testProjectName = Date.now()
|
||||||
cy.loadAndVisitProject('food.mini.csv', testProjectName)
|
cy.loadAndVisitProject('food.mini', testProjectName)
|
||||||
cy.get('#export-button').click()
|
cy.get('#export-button').click()
|
||||||
cy.get('.menu-container a')
|
cy.get('.menu-container a')
|
||||||
.contains('OpenRefine project archive to file')
|
.contains('OpenRefine project archive to file')
|
||||||
.click()
|
.click()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Apply a JSON', function () {
|
it('Apply a JSON', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
|
|
||||||
cy.get('#or-proj-undoRedo').click()
|
cy.get('#or-proj-undoRedo').click()
|
||||||
cy.get('#refine-tabs-history .history-panel-controls')
|
cy.get('#refine-tabs-history .history-panel-controls')
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Test select/unselect all', function () {
|
it('Test select/unselect all', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
cy.deleteColumn('NDB_No')
|
cy.deleteColumn('NDB_No')
|
||||||
cy.deleteColumn('Shrt_Desc')
|
cy.deleteColumn('Shrt_Desc')
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Test select/unselect individual entries', function () {
|
it('Test select/unselect individual entries', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
cy.deleteColumn('NDB_No')
|
cy.deleteColumn('NDB_No')
|
||||||
cy.deleteColumn('Shrt_Desc')
|
cy.deleteColumn('Shrt_Desc')
|
||||||
cy.get('#or-proj-undoRedo').click()
|
cy.get('#or-proj-undoRedo').click()
|
||||||
@ -119,7 +119,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Test the close button', function () {
|
it('Test the close button', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
cy.deleteColumn('NDB_No')
|
cy.deleteColumn('NDB_No')
|
||||||
cy.get('#or-proj-undoRedo').click()
|
cy.get('#or-proj-undoRedo').click()
|
||||||
cy.get('#refine-tabs-history .history-panel-controls')
|
cy.get('#refine-tabs-history .history-panel-controls')
|
||||||
@ -132,7 +132,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Ensure action are recorded in the extract panel', function () {
|
it('Ensure action are recorded in the extract panel', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
cy.deleteColumn('NDB_No')
|
cy.deleteColumn('NDB_No')
|
||||||
cy.deleteColumn('Shrt_Desc')
|
cy.deleteColumn('Shrt_Desc')
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensure the Undo button is visible after deleting a column', function () {
|
it('Ensure the Undo button is visible after deleting a column', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
cy.deleteColumn('NDB_No')
|
cy.deleteColumn('NDB_No')
|
||||||
|
|
||||||
cy.get('#notification-container')
|
cy.get('#notification-container')
|
||||||
@ -12,7 +12,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Ensure the Undo button is effectively working', function () {
|
it('Ensure the Undo button is effectively working', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
|
|
||||||
cy.deleteColumn('NDB_No')
|
cy.deleteColumn('NDB_No')
|
||||||
// ensure that the column is back in the grid
|
// ensure that the column is back in the grid
|
||||||
@ -24,7 +24,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Delete 3 columns, then successively undo and redo the modifications using the Undo/Redo panel', function () {
|
it('Delete 3 columns, then successively undo and redo the modifications using the Undo/Redo panel', function () {
|
||||||
cy.loadAndVisitProject('food.mini.csv')
|
cy.loadAndVisitProject('food.mini')
|
||||||
|
|
||||||
// delete NDB_No
|
// delete NDB_No
|
||||||
cy.deleteColumn('NDB_No')
|
cy.deleteColumn('NDB_No')
|
||||||
@ -106,7 +106,7 @@ describe(__filename, function () {
|
|||||||
// Very long test to run
|
// Very long test to run
|
||||||
// it('Ensure the Undo button dissapear after timeout after deleting a column', function () {
|
// it('Ensure the Undo button dissapear after timeout after deleting a column', function () {
|
||||||
// const ORNotificationTimeout = 15000;
|
// const ORNotificationTimeout = 15000;
|
||||||
// cy.loadAndVisitProject('food.mini.csv');
|
// cy.loadAndVisitProject('food.mini');
|
||||||
// cy.columnActionClick('NDB_No', ['Edit column', 'Remove this column']);
|
// cy.columnActionClick('NDB_No', ['Edit column', 'Remove this column']);
|
||||||
// cy.get('#notification-container', { timeout: ORNotificationTimeout }).should('not.be.visible');
|
// cy.get('#notification-container', { timeout: ORNotificationTimeout }).should('not.be.visible');
|
||||||
// });
|
// });
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensures project-metadata dialogue loads', function () {
|
it('Ensures project-metadata dialogue loads', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now()
|
||||||
cy.loadProject('food.mini.csv', projectName)
|
cy.loadProject('food.mini', projectName)
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine()
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project')
|
||||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
||||||
@ -13,7 +13,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
it('Ensures project-metadata has correct details', function () {
|
it('Ensures project-metadata has correct details', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now()
|
||||||
cy.loadProject('food.mini.csv', projectName)
|
cy.loadProject('food.mini', projectName)
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine()
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project')
|
||||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
||||||
@ -22,7 +22,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
it('Ensures project-metadata can be edit project name', function () {
|
it('Ensures project-metadata can be edit project name', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now()
|
||||||
cy.loadProject('food.mini.csv', projectName)
|
cy.loadProject('food.mini', projectName)
|
||||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||||
onBeforeLoad(win) {
|
onBeforeLoad(win) {
|
||||||
cy.stub(win, 'prompt').returns('testProject')
|
cy.stub(win, 'prompt').returns('testProject')
|
||||||
@ -39,7 +39,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
it('Ensures project-metadata can be edit tags', function () {
|
it('Ensures project-metadata can be edit tags', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now()
|
||||||
cy.loadProject('food.mini.csv', projectName)
|
cy.loadProject('food.mini', projectName)
|
||||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||||
onBeforeLoad(win) {
|
onBeforeLoad(win) {
|
||||||
cy.stub(win, 'prompt').returns('tagTest')
|
cy.stub(win, 'prompt').returns('tagTest')
|
||||||
@ -53,7 +53,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
it('Ensures project-metadata can be edit creator', function () {
|
it('Ensures project-metadata can be edit creator', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now()
|
||||||
cy.loadProject('food.mini.csv', projectName)
|
cy.loadProject('food.mini', projectName)
|
||||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||||
onBeforeLoad(win) {
|
onBeforeLoad(win) {
|
||||||
cy.stub(win, 'prompt').returns('testCreator')
|
cy.stub(win, 'prompt').returns('testCreator')
|
||||||
@ -70,7 +70,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
it('Ensures project-metadata can be edit contributors', function () {
|
it('Ensures project-metadata can be edit contributors', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now()
|
||||||
cy.loadProject('food.mini.csv', projectName)
|
cy.loadProject('food.mini', projectName)
|
||||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||||
onBeforeLoad(win) {
|
onBeforeLoad(win) {
|
||||||
cy.stub(win, 'prompt').returns('testcontributor')
|
cy.stub(win, 'prompt').returns('testcontributor')
|
||||||
@ -87,7 +87,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
it('Ensures project-metadata can be edit subject', function () {
|
it('Ensures project-metadata can be edit subject', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now()
|
||||||
cy.loadProject('food.mini.csv', projectName)
|
cy.loadProject('food.mini', projectName)
|
||||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||||
onBeforeLoad(win) {
|
onBeforeLoad(win) {
|
||||||
cy.stub(win, 'prompt').returns('testSubject')
|
cy.stub(win, 'prompt').returns('testSubject')
|
||||||
@ -104,7 +104,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
it('Ensures project-metadata can be edit license', function () {
|
it('Ensures project-metadata can be edit license', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now()
|
||||||
cy.loadProject('food.mini.csv', projectName)
|
cy.loadProject('food.mini', projectName)
|
||||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||||
onBeforeLoad(win) {
|
onBeforeLoad(win) {
|
||||||
cy.stub(win, 'prompt').returns('GPL-3')
|
cy.stub(win, 'prompt').returns('GPL-3')
|
||||||
@ -121,7 +121,7 @@ describe(__filename, function () {
|
|||||||
})
|
})
|
||||||
it('Ensures project-metadata can be edit homepage', function () {
|
it('Ensures project-metadata can be edit homepage', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now()
|
||||||
cy.loadProject('food.mini.csv', projectName)
|
cy.loadProject('food.mini', projectName)
|
||||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||||
onBeforeLoad(win) {
|
onBeforeLoad(win) {
|
||||||
cy.stub(win, 'prompt').returns('openrefine.org')
|
cy.stub(win, 'prompt').returns('openrefine.org')
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
const fixtures = require('../fixtures/fixtures.js')
|
||||||
|
|
||||||
Cypress.Commands.add('setPreference', (preferenceName, preferenceValue) => {
|
Cypress.Commands.add('setPreference', (preferenceName, preferenceValue) => {
|
||||||
const openRefineUrl = Cypress.env('OPENREFINE_URL')
|
const openRefineUrl = Cypress.env('OPENREFINE_URL')
|
||||||
cy.request(openRefineUrl + '/command/core/get-csrf-token').then(
|
cy.request(openRefineUrl + '/command/core/get-csrf-token').then(
|
||||||
@ -45,53 +47,67 @@ Cypress.Commands.add('cleanupProjects', () => {
|
|||||||
|
|
||||||
Cypress.Commands.add('loadProject', (fixture, projectName) => {
|
Cypress.Commands.add('loadProject', (fixture, projectName) => {
|
||||||
const openRefineUrl = Cypress.env('OPENREFINE_URL')
|
const openRefineUrl = Cypress.env('OPENREFINE_URL')
|
||||||
const openRefineProjectName = projectName ? projectName : fixture
|
const openRefineProjectName = projectName ? projectName : 'cypress-test'
|
||||||
cy.fixture(fixture).then((content) => {
|
|
||||||
cy.get('@token', { log: false }).then((token) => {
|
|
||||||
// cy.request(Cypress.env('OPENREFINE_URL')+'/command/core/get-csrf-token').then((response) => {
|
|
||||||
const openRefineFormat = 'text/line-based/*sv'
|
|
||||||
// const options = { projectTags: ['OpenRefineTesting'] };
|
|
||||||
// '\r\n------BOUNDARY\r\nContent-Disposition: form-data; name="options"\r\n\r\n' +
|
|
||||||
// JSON.stringify(options) +
|
|
||||||
|
|
||||||
var postData =
|
let jsonFixture
|
||||||
'------BOUNDARY\r\nContent-Disposition: form-data; name="project-file"; filename="' +
|
if (typeof fixture == 'string') {
|
||||||
fixture +
|
jsonFixture = fixtures[fixture]
|
||||||
'"\r\nContent-Type: "text/csv"\r\n\r\n' +
|
} else {
|
||||||
content +
|
jsonFixture = fixture
|
||||||
'\r\n------BOUNDARY\r\nContent-Disposition: form-data; name="project-name"\r\n\r\n' +
|
}
|
||||||
openRefineProjectName +
|
|
||||||
'\r\n------BOUNDARY\r\nContent-Disposition: form-data; name="format"\r\n\r\n' +
|
|
||||||
openRefineFormat +
|
|
||||||
'\r\n------BOUNDARY--'
|
|
||||||
|
|
||||||
cy.request({
|
const csv = []
|
||||||
method: 'POST',
|
jsonFixture.forEach((item) => {
|
||||||
url:
|
csv.push('"' + item.join('","') + '"')
|
||||||
`${openRefineUrl}/command/core/create-project-from-upload?csrf_token=` +
|
})
|
||||||
token,
|
const content = csv.join('\n')
|
||||||
body: postData,
|
|
||||||
headers: {
|
|
||||||
'content-type':
|
|
||||||
'multipart/form-data; boundary=----BOUNDARY',
|
|
||||||
},
|
|
||||||
}).then((resp) => {
|
|
||||||
const location =
|
|
||||||
resp.allRequestResponses[0]['Response Headers'].location
|
|
||||||
const projectId = location.split('=').slice(-1)[0]
|
|
||||||
cy.log('Created OR project', projectId)
|
|
||||||
|
|
||||||
cy.get('@loadedProjectIds', { log: false }).then(
|
cy.get('@token', { log: false }).then((token) => {
|
||||||
(loadedProjectIds) => {
|
// cy.request(Cypress.env('OPENREFINE_URL')+'/command/core/get-csrf-token').then((response) => {
|
||||||
loadedProjectIds.push(projectId)
|
const openRefineFormat = 'text/line-based/*sv'
|
||||||
cy.wrap(loadedProjectIds, { log: false })
|
|
||||||
.as('loadedProjectIds')
|
// the following code can be used to inject tags in created projects
|
||||||
.then(() => {
|
// It's conflicting though, breaking up the CSV files
|
||||||
return projectId
|
// const options = { projectTags: ['OpenRefineTesting'] };
|
||||||
})
|
// '\r\n------BOUNDARY\r\nContent-Disposition: form-data; name="options"\r\n\r\n' +
|
||||||
}
|
// JSON.stringify(options) +
|
||||||
)
|
|
||||||
})
|
var postData =
|
||||||
|
'------BOUNDARY\r\nContent-Disposition: form-data; name="project-file"; filename="' +
|
||||||
|
fixture +
|
||||||
|
'"\r\nContent-Type: "text/csv"\r\n\r\n' +
|
||||||
|
content +
|
||||||
|
'\r\n------BOUNDARY\r\nContent-Disposition: form-data; name="project-name"\r\n\r\n' +
|
||||||
|
openRefineProjectName +
|
||||||
|
'\r\n------BOUNDARY\r\nContent-Disposition: form-data; name="format"\r\n\r\n' +
|
||||||
|
openRefineFormat +
|
||||||
|
'\r\n------BOUNDARY--'
|
||||||
|
|
||||||
|
cy.request({
|
||||||
|
method: 'POST',
|
||||||
|
url:
|
||||||
|
`${openRefineUrl}/command/core/create-project-from-upload?csrf_token=` +
|
||||||
|
token,
|
||||||
|
body: postData,
|
||||||
|
headers: {
|
||||||
|
'content-type': 'multipart/form-data; boundary=----BOUNDARY',
|
||||||
|
},
|
||||||
|
}).then((resp) => {
|
||||||
|
const location =
|
||||||
|
resp.allRequestResponses[0]['Response Headers'].location
|
||||||
|
const projectId = location.split('=').slice(-1)[0]
|
||||||
|
cy.log('Created OR project', projectId)
|
||||||
|
|
||||||
|
cy.get('@loadedProjectIds', { log: false }).then(
|
||||||
|
(loadedProjectIds) => {
|
||||||
|
loadedProjectIds.push(projectId)
|
||||||
|
cy.wrap(loadedProjectIds, { log: false })
|
||||||
|
.as('loadedProjectIds')
|
||||||
|
.then(() => {
|
||||||
|
return projectId
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user