feat: introduct prettier style formatting for cypress test suite (#3494)
Signed-off-by: Kush Trivedi <kushthedude@gmail.com>
This commit is contained in:
parent
1a2a5082d7
commit
2f375664f2
5
main/tests/cypress/.prettierignore
Normal file
5
main/tests/cypress/.prettierignore
Normal file
@ -0,0 +1,5 @@
|
||||
coverage
|
||||
node_modules
|
||||
yarn.lock
|
||||
package.json
|
||||
*.md
|
6
main/tests/cypress/.prettierrc.json
Normal file
6
main/tests/cypress/.prettierrc.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"trailingComma": "es5",
|
||||
"tabWidth": 4,
|
||||
"semi": false,
|
||||
"singleQuote": true
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
{
|
||||
"integrationFolder": "./cypress/integration",
|
||||
"nodeVersion": "system",
|
||||
"retries": {
|
||||
"runMode": 2,
|
||||
"openMode": 1
|
||||
},
|
||||
"env":{
|
||||
"OPENREFINE_URL":"http://localhost:3333"
|
||||
}
|
||||
"integrationFolder": "./cypress/integration",
|
||||
"nodeVersion": "system",
|
||||
"retries": {
|
||||
"runMode": 2,
|
||||
"openMode": 1
|
||||
},
|
||||
"env": {
|
||||
"OPENREFINE_URL": "http://localhost:3333"
|
||||
}
|
||||
}
|
||||
|
@ -1,78 +1,114 @@
|
||||
describe(__filename, function () {
|
||||
it('Test the create project page', function () {
|
||||
cy.visitOpenRefine();
|
||||
cy.navigateTo('Create Project');
|
||||
cy.get('#create-project-ui-source-selection-tabs > div').contains('This Computer').click();
|
||||
cy.get('.create-project-ui-source-selection-tab-body.selected').contains('Locate one or more files on your computer to upload');
|
||||
it('Test the create project page', function () {
|
||||
cy.visitOpenRefine()
|
||||
cy.navigateTo('Create Project')
|
||||
cy.get('#create-project-ui-source-selection-tabs > div')
|
||||
.contains('This Computer')
|
||||
.click()
|
||||
cy.get(
|
||||
'.create-project-ui-source-selection-tab-body.selected'
|
||||
).contains('Locate one or more files on your computer to upload')
|
||||
|
||||
// load a file
|
||||
const csvFile = { filePath: 'food.mini.csv', mimeType: 'application/csv' };
|
||||
cy.get('.create-project-ui-source-selection-tab-body.selected input[type="file"]').attachFile(csvFile);
|
||||
cy.get('.create-project-ui-source-selection-tab-body.selected button.button-primary').click();
|
||||
cy.get('.default-importing-wizard-header input[bind="projectNameInput"]').should('have.value', 'food mini csv');
|
||||
// load a file
|
||||
const csvFile = {
|
||||
filePath: 'food.mini.csv',
|
||||
mimeType: 'application/csv',
|
||||
}
|
||||
cy.get(
|
||||
'.create-project-ui-source-selection-tab-body.selected input[type="file"]'
|
||||
).attachFile(csvFile)
|
||||
cy.get(
|
||||
'.create-project-ui-source-selection-tab-body.selected button.button-primary'
|
||||
).click()
|
||||
cy.get(
|
||||
'.default-importing-wizard-header input[bind="projectNameInput"]'
|
||||
).should('have.value', 'food mini csv')
|
||||
|
||||
// then ensure we are on the preview page
|
||||
cy.get('.create-project-ui-panel').contains('Configure Parsing Options');
|
||||
});
|
||||
// then ensure we are on the preview page
|
||||
cy.get('.create-project-ui-panel').contains('Configure Parsing Options')
|
||||
})
|
||||
|
||||
it('Test project naming', function () {
|
||||
cy.visitOpenRefine();
|
||||
cy.createProjectThroughUserInterface('food.mini.csv');
|
||||
cy.get('.create-project-ui-panel').contains('Configure Parsing Options');
|
||||
cy.get('.default-importing-wizard-header input[bind="projectNameInput"]').type('this is a test');
|
||||
cy.doCreateProjectThroughUserInterface();
|
||||
it('Test project naming', function () {
|
||||
cy.visitOpenRefine()
|
||||
cy.createProjectThroughUserInterface('food.mini.csv')
|
||||
cy.get('.create-project-ui-panel').contains('Configure Parsing Options')
|
||||
cy.get(
|
||||
'.default-importing-wizard-header input[bind="projectNameInput"]'
|
||||
).type('this is a test')
|
||||
cy.doCreateProjectThroughUserInterface()
|
||||
|
||||
cy.get('#project-name-button').contains('this is a test');
|
||||
});
|
||||
cy.get('#project-name-button').contains('this is a test')
|
||||
})
|
||||
|
||||
it('Test project tagging', function () {
|
||||
cy.visitOpenRefine();
|
||||
cy.createProjectThroughUserInterface('food.mini.csv');
|
||||
cy.get('.create-project-ui-panel').contains('Configure Parsing Options');
|
||||
const uniqueProjectName = Date.now();
|
||||
const uniqueTagName1 = 'tag1_' + Date.now();
|
||||
const uniqueTagName2 = 'tag2_' + Date.now();
|
||||
it('Test project tagging', function () {
|
||||
cy.visitOpenRefine()
|
||||
cy.createProjectThroughUserInterface('food.mini.csv')
|
||||
cy.get('.create-project-ui-panel').contains('Configure Parsing Options')
|
||||
const uniqueProjectName = Date.now()
|
||||
const uniqueTagName1 = 'tag1_' + Date.now()
|
||||
const uniqueTagName2 = 'tag2_' + Date.now()
|
||||
|
||||
cy.get('.default-importing-wizard-header input[bind="projectNameInput"]').type(uniqueProjectName);
|
||||
// triger the select input
|
||||
cy.get('#project-tags-container').click();
|
||||
// Type and Validate the tag, pressing enter
|
||||
cy.get('#project-tags-container .select2-input').type(uniqueTagName1);
|
||||
cy.get('body').type('{enter}');
|
||||
cy.get('#project-tags-container .select2-input').type(uniqueTagName2);
|
||||
cy.get('body').type('{enter}');
|
||||
cy.get('#or-import-parsopt').click();
|
||||
cy.doCreateProjectThroughUserInterface();
|
||||
cy.get(
|
||||
'.default-importing-wizard-header input[bind="projectNameInput"]'
|
||||
).type(uniqueProjectName)
|
||||
// triger the select input
|
||||
cy.get('#project-tags-container').click()
|
||||
// Type and Validate the tag, pressing enter
|
||||
cy.get('#project-tags-container .select2-input').type(uniqueTagName1)
|
||||
cy.get('body').type('{enter}')
|
||||
cy.get('#project-tags-container .select2-input').type(uniqueTagName2)
|
||||
cy.get('body').type('{enter}')
|
||||
cy.get('#or-import-parsopt').click()
|
||||
cy.doCreateProjectThroughUserInterface()
|
||||
|
||||
cy.visitOpenRefine();
|
||||
cy.navigateTo('Open Project');
|
||||
cy.get('#projects-list').contains(uniqueProjectName).parent().parent().contains(uniqueTagName1);
|
||||
cy.get('#projects-list').contains(uniqueProjectName).parent().parent().contains(uniqueTagName2);
|
||||
});
|
||||
cy.visitOpenRefine()
|
||||
cy.navigateTo('Open Project')
|
||||
cy.get('#projects-list')
|
||||
.contains(uniqueProjectName)
|
||||
.parent()
|
||||
.parent()
|
||||
.contains(uniqueTagName1)
|
||||
cy.get('#projects-list')
|
||||
.contains(uniqueProjectName)
|
||||
.parent()
|
||||
.parent()
|
||||
.contains(uniqueTagName2)
|
||||
})
|
||||
|
||||
it('E2E, Creates a simple project, based on a CSV', function () {
|
||||
// navigate to the create page
|
||||
cy.visitOpenRefine();
|
||||
cy.navigateTo('Create Project');
|
||||
// add file
|
||||
const csvFile = { filePath: 'food.mini.csv', mimeType: 'application/csv' };
|
||||
cy.get('.create-project-ui-source-selection-tab-body.selected input[type="file"]').attachFile(csvFile);
|
||||
cy.get('.create-project-ui-source-selection-tab-body.selected button.button-primary').click();
|
||||
it('E2E, Creates a simple project, based on a CSV', function () {
|
||||
// navigate to the create page
|
||||
cy.visitOpenRefine()
|
||||
cy.navigateTo('Create Project')
|
||||
// add file
|
||||
const csvFile = {
|
||||
filePath: 'food.mini.csv',
|
||||
mimeType: 'application/csv',
|
||||
}
|
||||
cy.get(
|
||||
'.create-project-ui-source-selection-tab-body.selected input[type="file"]'
|
||||
).attachFile(csvFile)
|
||||
cy.get(
|
||||
'.create-project-ui-source-selection-tab-body.selected button.button-primary'
|
||||
).click()
|
||||
|
||||
// preview and click next
|
||||
cy.get('.default-importing-wizard-header button[bind="nextButton"]').click();
|
||||
cy.get('#create-project-progress-message').contains('Done.');
|
||||
// preview and click next
|
||||
cy.get(
|
||||
'.default-importing-wizard-header button[bind="nextButton"]'
|
||||
).click()
|
||||
cy.get('#create-project-progress-message').contains('Done.')
|
||||
|
||||
// workaround to ensure project is loaded
|
||||
// cypress does not support window.location = ...
|
||||
cy.get('h2').contains('HTTP ERROR 404');
|
||||
cy.location().should((location) => {
|
||||
expect(location.href).contains(Cypress.env('OPENREFINE_URL')+'/__/project?');
|
||||
});
|
||||
// workaround to ensure project is loaded
|
||||
// cypress does not support window.location = ...
|
||||
cy.get('h2').contains('HTTP ERROR 404')
|
||||
cy.location().should((location) => {
|
||||
expect(location.href).contains(
|
||||
Cypress.env('OPENREFINE_URL') + '/__/project?'
|
||||
)
|
||||
})
|
||||
|
||||
cy.location().then((location) => {
|
||||
const projectId = location.href.split('=').slice(-1)[0];
|
||||
cy.visitProject(projectId);
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.location().then((location) => {
|
||||
const projectId = location.href.split('=').slice(-1)[0]
|
||||
cy.visitProject(projectId)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -1,35 +1,47 @@
|
||||
describe(__filename, function () {
|
||||
it('Check the layout for importing a project', function () {
|
||||
cy.visitOpenRefine();
|
||||
cy.navigateTo('Import Project');
|
||||
cy.get('.grid-layout').contains('Locate an existing Refine project file');
|
||||
});
|
||||
it('Check the layout for importing a project', function () {
|
||||
cy.visitOpenRefine()
|
||||
cy.navigateTo('Import Project')
|
||||
cy.get('.grid-layout').contains(
|
||||
'Locate an existing Refine project file'
|
||||
)
|
||||
})
|
||||
|
||||
it('Import a project', function () {
|
||||
cy.visitOpenRefine();
|
||||
cy.navigateTo('Import Project');
|
||||
// make sure the dataset was loaded properly
|
||||
const projectFile = { filePath: 'food-small-csv.openrefine.tar.zip', mimeType: 'application/gzip' };
|
||||
cy.get('#project-upload-form input#project-tar-file-input').attachFile(projectFile);
|
||||
cy.get('#project-upload-form').submit();
|
||||
it('Import a project', function () {
|
||||
cy.visitOpenRefine()
|
||||
cy.navigateTo('Import Project')
|
||||
// make sure the dataset was loaded properly
|
||||
const projectFile = {
|
||||
filePath: 'food-small-csv.openrefine.tar.zip',
|
||||
mimeType: 'application/gzip',
|
||||
}
|
||||
cy.get('#project-upload-form input#project-tar-file-input').attachFile(
|
||||
projectFile
|
||||
)
|
||||
cy.get('#project-upload-form').submit()
|
||||
|
||||
// ensure is loaded
|
||||
cy.get('div[bind="summaryBarDiv"]').contains('199 rows');
|
||||
});
|
||||
// ensure is loaded
|
||||
cy.get('div[bind="summaryBarDiv"]').contains('199 rows')
|
||||
})
|
||||
|
||||
it('Import a project, test the renaming', function () {
|
||||
cy.visitOpenRefine();
|
||||
cy.navigateTo('Import Project');
|
||||
// make sure the dataset was loaded properly
|
||||
const projectFile = { filePath: 'food-small-csv.openrefine.tar.zip', mimeType: 'application/gzip' };
|
||||
cy.get('#project-upload-form input#project-tar-file-input').attachFile(projectFile);
|
||||
it('Import a project, test the renaming', function () {
|
||||
cy.visitOpenRefine()
|
||||
cy.navigateTo('Import Project')
|
||||
// make sure the dataset was loaded properly
|
||||
const projectFile = {
|
||||
filePath: 'food-small-csv.openrefine.tar.zip',
|
||||
mimeType: 'application/gzip',
|
||||
}
|
||||
cy.get('#project-upload-form input#project-tar-file-input').attachFile(
|
||||
projectFile
|
||||
)
|
||||
|
||||
// rename
|
||||
const projectName = Date.now();
|
||||
cy.get('#project-name-input').type(projectName);
|
||||
cy.get('#project-upload-form').submit();
|
||||
// rename
|
||||
const projectName = Date.now()
|
||||
cy.get('#project-name-input').type(projectName)
|
||||
cy.get('#project-upload-form').submit()
|
||||
|
||||
// ensure is loaded
|
||||
cy.get('#project-name-button').contains(projectName);
|
||||
});
|
||||
});
|
||||
// ensure is loaded
|
||||
cy.get('#project-name-button').contains(projectName)
|
||||
})
|
||||
})
|
||||
|
@ -1,19 +1,19 @@
|
||||
describe(__filename, function () {
|
||||
it('Check elements on the langage page', function () {
|
||||
cy.visitOpenRefine();
|
||||
cy.get('.main-layout-panel').contains('Select preferred language');
|
||||
cy.get('select#langDD').should('exist');
|
||||
cy.get('#set-lang-button').should('exist');
|
||||
});
|
||||
it('Check elements on the langage page', function () {
|
||||
cy.visitOpenRefine()
|
||||
cy.get('.main-layout-panel').contains('Select preferred language')
|
||||
cy.get('select#langDD').should('exist')
|
||||
cy.get('#set-lang-button').should('exist')
|
||||
})
|
||||
|
||||
// This test can't be implemented
|
||||
// It's changing the UI for all subsequent tests
|
||||
// If it fails, the interface will remains in German, making subsequent tests fails
|
||||
// it('Change the langage', function () {
|
||||
// cy.visitOpenRefine();
|
||||
// cy.navigateTo('Language Settings');
|
||||
// cy.get('#langDD').select('de');
|
||||
// cy.get('#set-lang-button').click();
|
||||
// cy.get('#slogan').contains('Ein leistungsstarkes Werkzeug für die Bearbeitung von ungeordneten Daten.');
|
||||
// });
|
||||
});
|
||||
// This test can't be implemented
|
||||
// It's changing the UI for all subsequent tests
|
||||
// If it fails, the interface will remains in German, making subsequent tests fails
|
||||
// it('Change the langage', function () {
|
||||
// cy.visitOpenRefine();
|
||||
// cy.navigateTo('Language Settings');
|
||||
// cy.get('#langDD').select('de');
|
||||
// cy.get('#set-lang-button').click();
|
||||
// cy.get('#slogan').contains('Ein leistungsstarkes Werkzeug für die Bearbeitung von ungeordneten Daten.');
|
||||
// });
|
||||
})
|
||||
|
@ -1,18 +1,18 @@
|
||||
describe(__filename, function () {
|
||||
it('List an existing project, ensure a newly created project is displayed', function () {
|
||||
const projectName = Date.now();
|
||||
cy.loadProject('food.mini.csv', projectName);
|
||||
cy.visitOpenRefine();
|
||||
cy.navigateTo('Open Project');
|
||||
cy.get('#projects-list table').contains(projectName);
|
||||
});
|
||||
it('List an existing project, ensure a newly created project is displayed', function () {
|
||||
const projectName = Date.now()
|
||||
cy.loadProject('food.mini.csv', projectName)
|
||||
cy.visitOpenRefine()
|
||||
cy.navigateTo('Open Project')
|
||||
cy.get('#projects-list table').contains(projectName)
|
||||
})
|
||||
|
||||
it('Visit a project from the Open project page, ensure link is working', function () {
|
||||
const projectName = Date.now();
|
||||
cy.loadProject('food.mini.csv', projectName);
|
||||
cy.visitOpenRefine();
|
||||
cy.navigateTo('Open Project');
|
||||
cy.get('#projects-list table').contains(projectName).click();
|
||||
cy.get('#project-name-button').contains(projectName);
|
||||
});
|
||||
});
|
||||
it('Visit a project from the Open project page, ensure link is working', function () {
|
||||
const projectName = Date.now()
|
||||
cy.loadProject('food.mini.csv', projectName)
|
||||
cy.visitOpenRefine()
|
||||
cy.navigateTo('Open Project')
|
||||
cy.get('#projects-list table').contains(projectName).click()
|
||||
cy.get('#project-name-button').contains(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.csv', 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.csv', projectName).then((projectId) => {
|
||||
cy.visitProject(projectId)
|
||||
cy.get('#project-name-button').contains(projectName)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -1,33 +1,39 @@
|
||||
describe(__filename, function () {
|
||||
it('Edit a preference', function () {
|
||||
cy.visitOpenRefine();
|
||||
const testPreferenceName = 'PreferenceName_' + Date.now();
|
||||
const testPreferenceValue = 'PreferenceValue_' + Date.now();
|
||||
it('Edit a preference', function () {
|
||||
cy.visitOpenRefine()
|
||||
const testPreferenceName = 'PreferenceName_' + Date.now()
|
||||
const testPreferenceValue = 'PreferenceValue_' + Date.now()
|
||||
|
||||
cy.setPreference(testPreferenceName, testPreferenceValue);
|
||||
cy.setPreference(testPreferenceName, testPreferenceValue)
|
||||
|
||||
cy.get('#project-links a').contains('Preferences').click();
|
||||
cy.get('table.preferences tr').contains(testPreferenceName);
|
||||
cy.get('#project-links a').contains('Preferences').click()
|
||||
cy.get('table.preferences tr').contains(testPreferenceName)
|
||||
|
||||
cy.window().then(($win) => {
|
||||
cy.stub($win, 'prompt').returns(testPreferenceValue + '_Edited');
|
||||
cy.get('table.preferences tr').contains(testPreferenceName).parentsUntil('tbody').find('td:last-child button:first-child').click();
|
||||
});
|
||||
cy.window().then(($win) => {
|
||||
cy.stub($win, 'prompt').returns(testPreferenceValue + '_Edited')
|
||||
cy.get('table.preferences tr')
|
||||
.contains(testPreferenceName)
|
||||
.parentsUntil('tbody')
|
||||
.find('td:last-child button:first-child')
|
||||
.click()
|
||||
})
|
||||
|
||||
cy.get('table.preferences tr').contains(testPreferenceValue + '_Edited');
|
||||
});
|
||||
cy.get('table.preferences tr').contains(testPreferenceValue + '_Edited')
|
||||
})
|
||||
|
||||
it('Add a new preference', function () {
|
||||
cy.visitOpenRefine();
|
||||
cy.get('#project-links a').contains('Preferences').click();
|
||||
it('Add a new preference', function () {
|
||||
cy.visitOpenRefine()
|
||||
cy.get('#project-links a').contains('Preferences').click()
|
||||
|
||||
const testPreferenceName = Date.now();
|
||||
const testPreferenceName = Date.now()
|
||||
|
||||
cy.window().then(($win) => {
|
||||
cy.stub($win, 'prompt').returns(testPreferenceName);
|
||||
cy.get('table.preferences tr:last-child button.button').click();
|
||||
});
|
||||
cy.window().then(($win) => {
|
||||
cy.stub($win, 'prompt').returns(testPreferenceName)
|
||||
cy.get('table.preferences tr:last-child button.button').click()
|
||||
})
|
||||
|
||||
cy.get('table.preferences tr:nth-last-child(2)').contains(testPreferenceName);
|
||||
});
|
||||
});
|
||||
cy.get('table.preferences tr:nth-last-child(2)').contains(
|
||||
testPreferenceName
|
||||
)
|
||||
})
|
||||
})
|
||||
|
@ -1,18 +1,24 @@
|
||||
describe(__filename, function () {
|
||||
it('A numeric facet must be casted first', function () {
|
||||
cy.loadAndVisitProject('food.small.csv');
|
||||
cy.columnActionClick('Water', ['Facet', 'Numeric facet']);
|
||||
cy.get('#refine-tabs-facets .facets-container li:first-child').contains('No numeric value present.');
|
||||
});
|
||||
it('A numeric facet must be casted first', function () {
|
||||
cy.loadAndVisitProject('food.small.csv')
|
||||
cy.columnActionClick('Water', ['Facet', 'Numeric facet'])
|
||||
cy.get('#refine-tabs-facets .facets-container li:first-child').contains(
|
||||
'No numeric value present.'
|
||||
)
|
||||
})
|
||||
|
||||
it('Changing the type of the column for numeric', function () {
|
||||
cy.loadAndVisitProject('food.small.csv');
|
||||
cy.columnActionClick('Water', ['Facet', 'Numeric facet']);
|
||||
cy.get('#refine-tabs-facets .facets-container li:first-child').contains('No numeric value present.');
|
||||
it('Changing the type of the column for numeric', function () {
|
||||
cy.loadAndVisitProject('food.small.csv')
|
||||
cy.columnActionClick('Water', ['Facet', 'Numeric facet'])
|
||||
cy.get('#refine-tabs-facets .facets-container li:first-child').contains(
|
||||
'No numeric value present.'
|
||||
)
|
||||
|
||||
cy.get('#refine-tabs-facets .facets-container li:first-child a[bind="changeButton"]').click();
|
||||
cy.get('.expression-preview-code').type('value.toNumber()');
|
||||
cy.get('.dialog-footer button').contains('OK').click();
|
||||
cy.get('.facet-container .facet-range-body').should('exist');
|
||||
});
|
||||
});
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:first-child a[bind="changeButton"]'
|
||||
).click()
|
||||
cy.get('.expression-preview-code').type('value.toNumber()')
|
||||
cy.get('.dialog-footer button').contains('OK').click()
|
||||
cy.get('.facet-container .facet-range-body').should('exist')
|
||||
})
|
||||
})
|
||||
|
@ -1,122 +1,184 @@
|
||||
describe(__filename, function () {
|
||||
it('Test the facets text (no facets yet)', function () {
|
||||
cy.loadAndVisitProject('food.small.csv');
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet']);
|
||||
cy.get('#refine-tabs-facets').should('exist').contains('Using facets and filters');
|
||||
});
|
||||
it('Test the facets text (no facets yet)', function () {
|
||||
cy.loadAndVisitProject('food.small.csv')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets')
|
||||
.should('exist')
|
||||
.contains('Using facets and filters')
|
||||
})
|
||||
|
||||
it('Create a simple text facet', function () {
|
||||
cy.loadAndVisitProject('food.small.csv');
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet']);
|
||||
cy.get('#refine-tabs-facets').should('exist');
|
||||
it('Create a simple text facet', function () {
|
||||
cy.loadAndVisitProject('food.small.csv')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets').should('exist')
|
||||
|
||||
// check the layout
|
||||
cy.get('#refine-tabs-facets .facets-container li:first-child span[bind="titleSpan"]').contains('Water');
|
||||
cy.get('#refine-tabs-facets .facets-container li:first-child ').contains('182 choices');
|
||||
cy.get('#refine-tabs-facets .facets-container li:first-child ').contains('Sort by');
|
||||
cy.get('#refine-tabs-facets .facets-container li:first-child ').contains('Cluster');
|
||||
});
|
||||
// check the layout
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:first-child span[bind="titleSpan"]'
|
||||
).contains('Water')
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:first-child '
|
||||
).contains('182 choices')
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:first-child '
|
||||
).contains('Sort by')
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:first-child '
|
||||
).contains('Cluster')
|
||||
})
|
||||
|
||||
it('Create a facet, Sort by count', function () {
|
||||
cy.loadAndVisitProject('food.small.csv');
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet']);
|
||||
cy.get('#refine-tabs-facets').should('exist');
|
||||
it('Create a facet, Sort by count', function () {
|
||||
cy.loadAndVisitProject('food.small.csv')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets').should('exist')
|
||||
|
||||
// Ensure sort should be by name by default
|
||||
cy.get('.facet-container .facet-body .facet-choice:first-child').contains('0.24');
|
||||
cy.get('#refine-tabs-facets .facets-container li:first-child a[bind="sortByCountLink"]').click();
|
||||
// Sort should now be by count
|
||||
cy.get('.facet-container .facet-body .facet-choice:first-child').contains('15.87');
|
||||
});
|
||||
// Ensure sort should be by name by default
|
||||
cy.get(
|
||||
'.facet-container .facet-body .facet-choice:first-child'
|
||||
).contains('0.24')
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:first-child a[bind="sortByCountLink"]'
|
||||
).click()
|
||||
// Sort should now be by count
|
||||
cy.get(
|
||||
'.facet-container .facet-body .facet-choice:first-child'
|
||||
).contains('15.87')
|
||||
})
|
||||
|
||||
it('Create a facet, Sort by count, then by name', function () {
|
||||
cy.loadAndVisitProject('food.small.csv');
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet']);
|
||||
cy.get('#refine-tabs-facets').should('exist');
|
||||
it('Create a facet, Sort by count, then by name', function () {
|
||||
cy.loadAndVisitProject('food.small.csv')
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
cy.get('#refine-tabs-facets').should('exist')
|
||||
|
||||
// Sort should be by name by default
|
||||
cy.get('.facet-container .facet-body .facet-choice:first-child').contains('0.24');
|
||||
cy.get('#refine-tabs-facets .facets-container li:first-child a[bind="sortByCountLink"]').click();
|
||||
// Sort should now be by count
|
||||
cy.get('.facet-container .facet-body .facet-choice:first-child').contains('15.87');
|
||||
cy.get('#refine-tabs-facets .facets-container li:first-child a[bind="sortByNameLink"]').click();
|
||||
cy.get('.facet-container .facet-body .facet-choice:first-child').contains('0.24');
|
||||
});
|
||||
// Sort should be by name by default
|
||||
cy.get(
|
||||
'.facet-container .facet-body .facet-choice:first-child'
|
||||
).contains('0.24')
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:first-child a[bind="sortByCountLink"]'
|
||||
).click()
|
||||
// Sort should now be by count
|
||||
cy.get(
|
||||
'.facet-container .facet-body .facet-choice:first-child'
|
||||
).contains('15.87')
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:first-child a[bind="sortByNameLink"]'
|
||||
).click()
|
||||
cy.get(
|
||||
'.facet-container .facet-body .facet-choice:first-child'
|
||||
).contains('0.24')
|
||||
})
|
||||
|
||||
it('Test the display of multiple facets', function () {
|
||||
cy.loadAndVisitProject('food.small.csv');
|
||||
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.csv')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
||||
|
||||
cy.get('#refine-tabs-facets .facets-container li:nth-child(1) span[bind="titleSpan"]').contains('NDB_No');
|
||||
cy.get('#refine-tabs-facets .facets-container li:nth-child(2) span[bind="titleSpan"]').contains('Shrt_Desc');
|
||||
cy.get('#refine-tabs-facets .facets-container li:nth-child(3) span[bind="titleSpan"]').contains('Water');
|
||||
});
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:nth-child(1) span[bind="titleSpan"]'
|
||||
).contains('NDB_No')
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:nth-child(2) span[bind="titleSpan"]'
|
||||
).contains('Shrt_Desc')
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:nth-child(3) span[bind="titleSpan"]'
|
||||
).contains('Water')
|
||||
})
|
||||
|
||||
// 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.csv');
|
||||
// //// # 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();
|
||||
// //// # cy.get('#refine-tabs-facets .facets-container li:nth-child(1) .facet-body-inner').should('not.be.visible');
|
||||
// });
|
||||
// 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.csv');
|
||||
// //// # 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();
|
||||
// //// # cy.get('#refine-tabs-facets .facets-container li:nth-child(1) .facet-body-inner').should('not.be.visible');
|
||||
// });
|
||||
|
||||
it('Test editing a facet', function () {
|
||||
cy.loadAndVisitProject('food.small.csv');
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||
cy.get('#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]').contains('change');
|
||||
cy.get('#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]').click();
|
||||
cy.get('.dialog-container .dialog-header').contains(`Edit Facet's Expression`);
|
||||
});
|
||||
it('Test editing a facet', function () {
|
||||
cy.loadAndVisitProject('food.small.csv')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
||||
).contains('change')
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:nth-child(1) 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.csv');
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||
cy.get('#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]').click();
|
||||
// test the tab
|
||||
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 / Preview', function () {
|
||||
cy.loadAndVisitProject('food.small.csv')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
||||
).click()
|
||||
// test the tab
|
||||
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.csv');
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||
cy.get('#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]').click();
|
||||
it('Test editing a facet / History', function () {
|
||||
cy.loadAndVisitProject('food.small.csv')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
||||
).click()
|
||||
|
||||
cy.get('.dialog-container a[bind="or_dialog_history"]').click();
|
||||
// test the tab
|
||||
cy.get('.dialog-container #expression-preview-tabs-history').should('be.visible');
|
||||
// test the content
|
||||
cy.get('.dialog-container #expression-preview-tabs-history').contains('Reuse');
|
||||
});
|
||||
cy.get('.dialog-container a[bind="or_dialog_history"]').click()
|
||||
// test the tab
|
||||
cy.get('.dialog-container #expression-preview-tabs-history').should(
|
||||
'be.visible'
|
||||
)
|
||||
// test the content
|
||||
cy.get('.dialog-container #expression-preview-tabs-history').contains(
|
||||
'Reuse'
|
||||
)
|
||||
})
|
||||
|
||||
it('Test editing a facet / Starred', function () {
|
||||
cy.loadAndVisitProject('food.small.csv');
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||
cy.get('#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]').click();
|
||||
it('Test editing a facet / Starred', function () {
|
||||
cy.loadAndVisitProject('food.small.csv')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
||||
).click()
|
||||
|
||||
cy.get('.dialog-container a[bind="or_dialog_starred"]').click();
|
||||
// test the tab
|
||||
cy.get('.dialog-container #expression-preview-tabs-starred').should('be.visible');
|
||||
// test the content
|
||||
cy.get('.dialog-container #expression-preview-tabs-starred').contains('Expression');
|
||||
});
|
||||
cy.get('.dialog-container a[bind="or_dialog_starred"]').click()
|
||||
// test the tab
|
||||
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.csv');
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||
cy.get('#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]').click();
|
||||
it('Test editing a facet / Help', function () {
|
||||
cy.loadAndVisitProject('food.small.csv')
|
||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
||||
cy.get(
|
||||
'#refine-tabs-facets .facets-container li:nth-child(1) a[bind="changeButton"]'
|
||||
).click()
|
||||
|
||||
cy.get('.dialog-container a[bind="or_dialog_help"]').click();
|
||||
// test the tab
|
||||
cy.get('.dialog-container #expression-preview-tabs-help').should('be.visible');
|
||||
// test the content
|
||||
cy.get('.dialog-container #expression-preview-tabs-help').contains('Variables');
|
||||
});
|
||||
});
|
||||
cy.get('.dialog-container a[bind="or_dialog_help"]').click()
|
||||
// test the tab
|
||||
cy.get('.dialog-container #expression-preview-tabs-help').should(
|
||||
'be.visible'
|
||||
)
|
||||
// test the content
|
||||
cy.get('.dialog-container #expression-preview-tabs-help').contains(
|
||||
'Variables'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
@ -1,54 +1,69 @@
|
||||
describe(__filename, function () {
|
||||
it('Perform a basic sort', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
it('Perform a basic sort', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
|
||||
// sort and confirm
|
||||
cy.columnActionClick('Shrt_Desc', ['Sort']);
|
||||
cy.waitForDialogPanel();
|
||||
cy.confirmDialogPanel();
|
||||
// sort and confirm
|
||||
cy.columnActionClick('Shrt_Desc', ['Sort'])
|
||||
cy.waitForDialogPanel()
|
||||
cy.confirmDialogPanel()
|
||||
|
||||
// ensure sorting is active
|
||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WHIPPED,WITH SALT')
|
||||
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT');
|
||||
});
|
||||
// ensure sorting is active
|
||||
cy.getCell(0, 'Shrt_Desc').should(
|
||||
'to.contain',
|
||||
'BUTTER,WHIPPED,WITH SALT'
|
||||
)
|
||||
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT')
|
||||
})
|
||||
|
||||
it('Perform a basic sort + Reverse', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
it('Perform a basic sort + Reverse', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
|
||||
// sort and confirm
|
||||
cy.columnActionClick('Shrt_Desc', ['Sort']);
|
||||
cy.waitForDialogPanel();
|
||||
cy.confirmDialogPanel();
|
||||
// sort and confirm
|
||||
cy.columnActionClick('Shrt_Desc', ['Sort'])
|
||||
cy.waitForDialogPanel()
|
||||
cy.confirmDialogPanel()
|
||||
|
||||
// check the sorting
|
||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WHIPPED,WITH SALT');
|
||||
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT');
|
||||
// check the sorting
|
||||
cy.getCell(0, 'Shrt_Desc').should(
|
||||
'to.contain',
|
||||
'BUTTER,WHIPPED,WITH SALT'
|
||||
)
|
||||
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT')
|
||||
|
||||
// do a reverse sort
|
||||
cy.columnActionClick('Shrt_Desc', ['Sort', 'Reverse']);
|
||||
// do a reverse sort
|
||||
cy.columnActionClick('Shrt_Desc', ['Sort', 'Reverse'])
|
||||
|
||||
// re-check the sorting
|
||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT');
|
||||
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WHIPPED,WITH SALT');
|
||||
});
|
||||
// re-check the sorting
|
||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT')
|
||||
cy.getCell(1, 'Shrt_Desc').should(
|
||||
'to.contain',
|
||||
'BUTTER,WHIPPED,WITH SALT'
|
||||
)
|
||||
})
|
||||
|
||||
it('Perform a basic sort + Remove Sort', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
it('Perform a basic sort + Remove Sort', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
|
||||
// sort and confirm
|
||||
cy.columnActionClick('Shrt_Desc', ['Sort']);
|
||||
cy.waitForDialogPanel();
|
||||
cy.confirmDialogPanel();
|
||||
// sort and confirm
|
||||
cy.columnActionClick('Shrt_Desc', ['Sort'])
|
||||
cy.waitForDialogPanel()
|
||||
cy.confirmDialogPanel()
|
||||
|
||||
// check the sorting
|
||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WHIPPED,WITH SALT');
|
||||
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT');
|
||||
// check the sorting
|
||||
cy.getCell(0, 'Shrt_Desc').should(
|
||||
'to.contain',
|
||||
'BUTTER,WHIPPED,WITH SALT'
|
||||
)
|
||||
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT')
|
||||
|
||||
// remove
|
||||
cy.columnActionClick('Shrt_Desc', ['Sort', 'Remove sort']);
|
||||
// remove
|
||||
cy.columnActionClick('Shrt_Desc', ['Sort', 'Remove sort'])
|
||||
|
||||
// re-check the sorting
|
||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT');
|
||||
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WHIPPED,WITH SALT');
|
||||
});
|
||||
});
|
||||
// re-check the sorting
|
||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT')
|
||||
cy.getCell(1, 'Shrt_Desc').should(
|
||||
'to.contain',
|
||||
'BUTTER,WHIPPED,WITH SALT'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
@ -1,86 +1,124 @@
|
||||
describe(__filename, function () {
|
||||
it('Ensure the Edit button is visible on mouse over a cell', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
it('Ensure the Edit button is visible on mouse over a cell', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
|
||||
cy.getCell(1, 'Water').trigger('mouseover');
|
||||
cy.getCell(1, 'Water').find('a.data-table-cell-edit').should('be.visible');
|
||||
});
|
||||
cy.getCell(1, 'Water').trigger('mouseover')
|
||||
cy.getCell(1, 'Water')
|
||||
.find('a.data-table-cell-edit')
|
||||
.should('be.visible')
|
||||
})
|
||||
|
||||
it('Ensure the Edit button opens a popup', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
cy.getCell(1, 'Shrt_Desc').trigger('mouseover').find('a.data-table-cell-edit').click();
|
||||
cy.get('.menu-container.data-table-cell-editor').should('exist');
|
||||
cy.get('.menu-container.data-table-cell-editor textarea').should('have.value', 'BUTTER,WHIPPED,WITH SALT');
|
||||
});
|
||||
it('Ensure the Edit button opens a popup', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
cy.getCell(1, 'Shrt_Desc')
|
||||
.trigger('mouseover')
|
||||
.find('a.data-table-cell-edit')
|
||||
.click()
|
||||
cy.get('.menu-container.data-table-cell-editor').should('exist')
|
||||
cy.get('.menu-container.data-table-cell-editor textarea').should(
|
||||
'have.value',
|
||||
'BUTTER,WHIPPED,WITH SALT'
|
||||
)
|
||||
})
|
||||
|
||||
it('Test a simple edit', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
cy.getCell(1, 'Shrt_Desc').trigger('mouseover').find('a.data-table-cell-edit').click();
|
||||
cy.get('.menu-container.data-table-cell-editor').should('exist');
|
||||
cy.get('.menu-container.data-table-cell-editor textarea').type('OpenRefine Testing');
|
||||
cy.get('.menu-container button[bind="okButton"]').click();
|
||||
// ensure value has been changed in the grid
|
||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist');
|
||||
cy.assertCellEquals(1, 'Shrt_Desc', 'OpenRefine Testing');
|
||||
});
|
||||
it('Test a simple edit', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
cy.getCell(1, 'Shrt_Desc')
|
||||
.trigger('mouseover')
|
||||
.find('a.data-table-cell-edit')
|
||||
.click()
|
||||
cy.get('.menu-container.data-table-cell-editor').should('exist')
|
||||
cy.get('.menu-container.data-table-cell-editor textarea').type(
|
||||
'OpenRefine Testing'
|
||||
)
|
||||
cy.get('.menu-container button[bind="okButton"]').click()
|
||||
// ensure value has been changed in the grid
|
||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist')
|
||||
cy.assertCellEquals(1, 'Shrt_Desc', 'OpenRefine Testing')
|
||||
})
|
||||
|
||||
it('Test a simple edit, using keyboard shortcut', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
cy.getCell(1, 'Shrt_Desc').trigger('mouseover').find('a.data-table-cell-edit').click();
|
||||
cy.get('.menu-container.data-table-cell-editor').should('exist');
|
||||
cy.get('.menu-container.data-table-cell-editor textarea').type('OpenRefine Testing');
|
||||
cy.get('body').type('{enter}');
|
||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist');
|
||||
cy.assertCellEquals(1, 'Shrt_Desc', 'OpenRefine Testing');
|
||||
});
|
||||
it('Test a simple edit, using keyboard shortcut', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
cy.getCell(1, 'Shrt_Desc')
|
||||
.trigger('mouseover')
|
||||
.find('a.data-table-cell-edit')
|
||||
.click()
|
||||
cy.get('.menu-container.data-table-cell-editor').should('exist')
|
||||
cy.get('.menu-container.data-table-cell-editor textarea').type(
|
||||
'OpenRefine Testing'
|
||||
)
|
||||
cy.get('body').type('{enter}')
|
||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist')
|
||||
cy.assertCellEquals(1, 'Shrt_Desc', 'OpenRefine Testing')
|
||||
})
|
||||
|
||||
it('Test the cancel button', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
cy.getCell(1, 'Shrt_Desc').trigger('mouseover').find('a.data-table-cell-edit').click();
|
||||
cy.get('.menu-container.data-table-cell-editor').should('exist');
|
||||
cy.get('.menu-container.data-table-cell-editor textarea').type('OpenRefine Testing');
|
||||
cy.get('.menu-container button[bind="cancelButton"]').click();
|
||||
// ensure value has been changed in the grid
|
||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist');
|
||||
cy.assertCellEquals(1, 'Shrt_Desc', 'BUTTER,WHIPPED,WITH SALT');
|
||||
});
|
||||
it('Test the cancel button', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
cy.getCell(1, 'Shrt_Desc')
|
||||
.trigger('mouseover')
|
||||
.find('a.data-table-cell-edit')
|
||||
.click()
|
||||
cy.get('.menu-container.data-table-cell-editor').should('exist')
|
||||
cy.get('.menu-container.data-table-cell-editor textarea').type(
|
||||
'OpenRefine Testing'
|
||||
)
|
||||
cy.get('.menu-container button[bind="cancelButton"]').click()
|
||||
// ensure value has been changed in the grid
|
||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist')
|
||||
cy.assertCellEquals(1, 'Shrt_Desc', 'BUTTER,WHIPPED,WITH SALT')
|
||||
})
|
||||
|
||||
it('Test the cancel button, using keyboard shortcut', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
cy.getCell(1, 'Shrt_Desc').trigger('mouseover').find('a.data-table-cell-edit').click();
|
||||
cy.get('.menu-container.data-table-cell-editor').should('exist');
|
||||
cy.get('.menu-container.data-table-cell-editor textarea').type('OpenRefine Testing');
|
||||
cy.get('body').type('{esc}');
|
||||
// ensure value has been changed in the grid
|
||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist');
|
||||
cy.assertCellEquals(1, 'Shrt_Desc', 'BUTTER,WHIPPED,WITH SALT');
|
||||
});
|
||||
it('Test the cancel button, using keyboard shortcut', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
cy.getCell(1, 'Shrt_Desc')
|
||||
.trigger('mouseover')
|
||||
.find('a.data-table-cell-edit')
|
||||
.click()
|
||||
cy.get('.menu-container.data-table-cell-editor').should('exist')
|
||||
cy.get('.menu-container.data-table-cell-editor textarea').type(
|
||||
'OpenRefine Testing'
|
||||
)
|
||||
cy.get('body').type('{esc}')
|
||||
// ensure value has been changed in the grid
|
||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist')
|
||||
cy.assertCellEquals(1, 'Shrt_Desc', 'BUTTER,WHIPPED,WITH SALT')
|
||||
})
|
||||
|
||||
it('Test edit all identical cells', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
cy.getCell(1, 'Water').trigger('mouseover').find('a.data-table-cell-edit').click();
|
||||
cy.get('.menu-container.data-table-cell-editor').should('exist');
|
||||
cy.get('.menu-container.data-table-cell-editor textarea').type(42);
|
||||
cy.get('.menu-container button[bind="okallButton"]').click();
|
||||
it('Test edit all identical cells', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
cy.getCell(1, 'Water')
|
||||
.trigger('mouseover')
|
||||
.find('a.data-table-cell-edit')
|
||||
.click()
|
||||
cy.get('.menu-container.data-table-cell-editor').should('exist')
|
||||
cy.get('.menu-container.data-table-cell-editor textarea').type(42)
|
||||
cy.get('.menu-container button[bind="okallButton"]').click()
|
||||
|
||||
// ensure all values has been changed in the grid
|
||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist');
|
||||
cy.get('#notification-container').should('be.visible').contains('Mass edit');
|
||||
cy.assertCellEquals(0, 'Water', '42');
|
||||
cy.assertCellEquals(1, 'Water', '42');
|
||||
});
|
||||
// ensure all values has been changed in the grid
|
||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist')
|
||||
cy.get('#notification-container')
|
||||
.should('be.visible')
|
||||
.contains('Mass edit')
|
||||
cy.assertCellEquals(0, 'Water', '42')
|
||||
cy.assertCellEquals(1, 'Water', '42')
|
||||
})
|
||||
|
||||
it('Test edit all identical cells, using the shortcut', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
cy.getCell(1, 'Water').trigger('mouseover').find('a.data-table-cell-edit').click();
|
||||
cy.get('.menu-container.data-table-cell-editor').should('exist');
|
||||
cy.get('.menu-container.data-table-cell-editor textarea').type(42);
|
||||
cy.get('body').type('{ctrl}{enter}');
|
||||
it('Test edit all identical cells, using the shortcut', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
cy.getCell(1, 'Water')
|
||||
.trigger('mouseover')
|
||||
.find('a.data-table-cell-edit')
|
||||
.click()
|
||||
cy.get('.menu-container.data-table-cell-editor').should('exist')
|
||||
cy.get('.menu-container.data-table-cell-editor textarea').type(42)
|
||||
cy.get('body').type('{ctrl}{enter}')
|
||||
|
||||
// ensure all values has been changed in the grid
|
||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist');
|
||||
cy.get('#notification-container').should('be.visible').contains('Mass edit');
|
||||
cy.assertCellEquals(0, 'Water', '42');
|
||||
cy.assertCellEquals(1, 'Water', '42');
|
||||
});
|
||||
});
|
||||
// ensure all values has been changed in the grid
|
||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist')
|
||||
cy.get('#notification-container')
|
||||
.should('be.visible')
|
||||
.contains('Mass edit')
|
||||
cy.assertCellEquals(0, 'Water', '42')
|
||||
cy.assertCellEquals(1, 'Water', '42')
|
||||
})
|
||||
})
|
||||
|
@ -1,8 +1,10 @@
|
||||
describe(__filename, function () {
|
||||
it('Export a project', function () {
|
||||
const testProjectName = Date.now();
|
||||
cy.loadAndVisitProject('food.mini.csv', 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.csv', testProjectName)
|
||||
cy.get('#export-button').click()
|
||||
cy.get('.menu-container a')
|
||||
.contains('OpenRefine project archive to file')
|
||||
.click()
|
||||
})
|
||||
})
|
||||
|
@ -1,35 +1,44 @@
|
||||
describe(__filename, function () {
|
||||
it('Apply a JSON', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
it('Apply a JSON', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
|
||||
cy.get('#or-proj-undoRedo').click();
|
||||
cy.get('#refine-tabs-history .history-panel-controls').contains('Apply').click();
|
||||
cy.get('#or-proj-undoRedo').click()
|
||||
cy.get('#refine-tabs-history .history-panel-controls')
|
||||
.contains('Apply')
|
||||
.click()
|
||||
|
||||
cy.get('table.data-table thead th[title="Shrt_Desc"]').should('exist');
|
||||
cy.get('table.data-table thead th[title="Water"]').should('exist');
|
||||
cy.get('table.data-table thead th[title="Shrt_Desc"]').should('exist')
|
||||
cy.get('table.data-table thead th[title="Water"]').should('exist')
|
||||
|
||||
// JSON for operations that will be applied
|
||||
const operations = [
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'Shrt_Desc',
|
||||
description: 'Remove column Shrt_Desc',
|
||||
},
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'Water',
|
||||
description: 'Remove column Water',
|
||||
},
|
||||
];
|
||||
// JSON for operations that will be applied
|
||||
const operations = [
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'Shrt_Desc',
|
||||
description: 'Remove column Shrt_Desc',
|
||||
},
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'Water',
|
||||
description: 'Remove column Water',
|
||||
},
|
||||
]
|
||||
|
||||
cy.get('.dialog-container .history-operation-json').type(JSON.stringify(operations), {
|
||||
parseSpecialCharSequences: false,
|
||||
delay: 0,
|
||||
waitForAnimations: false,
|
||||
});
|
||||
cy.get('.dialog-container button[bind="applyButton"]').click();
|
||||
cy.get('.dialog-container .history-operation-json').type(
|
||||
JSON.stringify(operations),
|
||||
{
|
||||
parseSpecialCharSequences: false,
|
||||
delay: 0,
|
||||
waitForAnimations: false,
|
||||
}
|
||||
)
|
||||
cy.get('.dialog-container button[bind="applyButton"]').click()
|
||||
|
||||
cy.get('table.data-table thead th[title="Shrt_Desc"]').should('not.to.exist');
|
||||
cy.get('table.data-table thead th[title="Water"]').should('not.to.exist');
|
||||
});
|
||||
});
|
||||
cy.get('table.data-table thead th[title="Shrt_Desc"]').should(
|
||||
'not.to.exist'
|
||||
)
|
||||
cy.get('table.data-table thead th[title="Water"]').should(
|
||||
'not.to.exist'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
@ -1,121 +1,170 @@
|
||||
describe(__filename, function () {
|
||||
it('Test select/unselect all', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
cy.deleteColumn('NDB_No');
|
||||
cy.deleteColumn('Shrt_Desc');
|
||||
it('Test select/unselect all', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
cy.deleteColumn('NDB_No')
|
||||
cy.deleteColumn('Shrt_Desc')
|
||||
|
||||
cy.get('#or-proj-undoRedo').click();
|
||||
cy.get('#refine-tabs-history .history-panel-controls').contains('Extract').click();
|
||||
cy.get('#or-proj-undoRedo').click()
|
||||
cy.get('#refine-tabs-history .history-panel-controls')
|
||||
.contains('Extract')
|
||||
.click()
|
||||
|
||||
// unselect all
|
||||
cy.get('.dialog-container button[bind="unselectAllButton"]').click();
|
||||
cy.wait(500);
|
||||
cy.get('.history-extract-dialog-entries tr:nth-child(1) td:first-child input').should('not.to.be.checked');
|
||||
cy.get('.history-extract-dialog-entries tr:nth-child(2) td:first-child input').should('not.to.be.checked');
|
||||
cy.get('.dialog-container textarea.history-operation-json').should('have.value', '[]');
|
||||
// unselect all
|
||||
cy.get('.dialog-container button[bind="unselectAllButton"]').click()
|
||||
cy.wait(500)
|
||||
cy.get(
|
||||
'.history-extract-dialog-entries tr:nth-child(1) td:first-child input'
|
||||
).should('not.to.be.checked')
|
||||
cy.get(
|
||||
'.history-extract-dialog-entries tr:nth-child(2) td:first-child input'
|
||||
).should('not.to.be.checked')
|
||||
cy.get('.dialog-container textarea.history-operation-json').should(
|
||||
'have.value',
|
||||
'[]'
|
||||
)
|
||||
|
||||
// // reselect all
|
||||
cy.get('.dialog-container button[bind="selectAllButton"]').click();
|
||||
cy.wait(500);
|
||||
cy.get('.history-extract-dialog-entries tr:nth-child(1) td:first-child input').should('be.checked');
|
||||
cy.get('.history-extract-dialog-entries tr:nth-child(2) td:first-child input').should('be.checked');
|
||||
cy.assertTextareaHaveJsonValue('.dialog-container textarea.history-operation-json', [
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'NDB_No',
|
||||
description: 'Remove column NDB_No',
|
||||
},
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'Shrt_Desc',
|
||||
description: 'Remove column Shrt_Desc',
|
||||
},
|
||||
]);
|
||||
});
|
||||
// // reselect all
|
||||
cy.get('.dialog-container button[bind="selectAllButton"]').click()
|
||||
cy.wait(500)
|
||||
cy.get(
|
||||
'.history-extract-dialog-entries tr:nth-child(1) td:first-child input'
|
||||
).should('be.checked')
|
||||
cy.get(
|
||||
'.history-extract-dialog-entries tr:nth-child(2) td:first-child input'
|
||||
).should('be.checked')
|
||||
cy.assertTextareaHaveJsonValue(
|
||||
'.dialog-container textarea.history-operation-json',
|
||||
[
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'NDB_No',
|
||||
description: 'Remove column NDB_No',
|
||||
},
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'Shrt_Desc',
|
||||
description: 'Remove column Shrt_Desc',
|
||||
},
|
||||
]
|
||||
)
|
||||
})
|
||||
|
||||
it('Test select/unselect individual entries', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
cy.deleteColumn('NDB_No');
|
||||
cy.deleteColumn('Shrt_Desc');
|
||||
cy.get('#or-proj-undoRedo').click();
|
||||
cy.get('#refine-tabs-history .history-panel-controls').contains('Extract').click();
|
||||
it('Test select/unselect individual entries', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
cy.deleteColumn('NDB_No')
|
||||
cy.deleteColumn('Shrt_Desc')
|
||||
cy.get('#or-proj-undoRedo').click()
|
||||
cy.get('#refine-tabs-history .history-panel-controls')
|
||||
.contains('Extract')
|
||||
.click()
|
||||
|
||||
// unselect "Remove Water"
|
||||
cy.get('.history-extract-dialog-entries tr:nth-child(1) td:first-child').click();
|
||||
cy.assertTextareaHaveJsonValue('.dialog-container textarea.history-operation-json', [
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'Shrt_Desc',
|
||||
description: 'Remove column Shrt_Desc',
|
||||
},
|
||||
]);
|
||||
// unselect "Remove Water"
|
||||
cy.get(
|
||||
'.history-extract-dialog-entries tr:nth-child(1) td:first-child'
|
||||
).click()
|
||||
cy.assertTextareaHaveJsonValue(
|
||||
'.dialog-container textarea.history-operation-json',
|
||||
[
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'Shrt_Desc',
|
||||
description: 'Remove column Shrt_Desc',
|
||||
},
|
||||
]
|
||||
)
|
||||
|
||||
// unselect "Remove Shrt_Desc"
|
||||
cy.get('.history-extract-dialog-entries tr:nth-child(2) td:first-child').click();
|
||||
cy.assertTextareaHaveJsonValue('.dialog-container textarea.history-operation-json', []);
|
||||
// unselect "Remove Shrt_Desc"
|
||||
cy.get(
|
||||
'.history-extract-dialog-entries tr:nth-child(2) td:first-child'
|
||||
).click()
|
||||
cy.assertTextareaHaveJsonValue(
|
||||
'.dialog-container textarea.history-operation-json',
|
||||
[]
|
||||
)
|
||||
|
||||
// reselect "Remove Shrt_Desc"
|
||||
cy.get('.history-extract-dialog-entries tr:nth-child(2) td:first-child').click();
|
||||
cy.assertTextareaHaveJsonValue('.dialog-container textarea.history-operation-json', [
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'Shrt_Desc',
|
||||
description: 'Remove column Shrt_Desc',
|
||||
},
|
||||
]);
|
||||
// reselect "Remove Shrt_Desc"
|
||||
cy.get(
|
||||
'.history-extract-dialog-entries tr:nth-child(2) td:first-child'
|
||||
).click()
|
||||
cy.assertTextareaHaveJsonValue(
|
||||
'.dialog-container textarea.history-operation-json',
|
||||
[
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'Shrt_Desc',
|
||||
description: 'Remove column Shrt_Desc',
|
||||
},
|
||||
]
|
||||
)
|
||||
|
||||
// reselect "Remove Water"
|
||||
cy.get('.history-extract-dialog-entries tr:nth-child(1) td:first-child').click();
|
||||
cy.assertTextareaHaveJsonValue('.dialog-container textarea.history-operation-json', [
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'NDB_No',
|
||||
description: 'Remove column NDB_No',
|
||||
},
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'Shrt_Desc',
|
||||
description: 'Remove column Shrt_Desc',
|
||||
},
|
||||
]);
|
||||
});
|
||||
// reselect "Remove Water"
|
||||
cy.get(
|
||||
'.history-extract-dialog-entries tr:nth-child(1) td:first-child'
|
||||
).click()
|
||||
cy.assertTextareaHaveJsonValue(
|
||||
'.dialog-container textarea.history-operation-json',
|
||||
[
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'NDB_No',
|
||||
description: 'Remove column NDB_No',
|
||||
},
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'Shrt_Desc',
|
||||
description: 'Remove column Shrt_Desc',
|
||||
},
|
||||
]
|
||||
)
|
||||
})
|
||||
|
||||
it('Test the close button', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
cy.deleteColumn('NDB_No');
|
||||
cy.get('#or-proj-undoRedo').click();
|
||||
cy.get('#refine-tabs-history .history-panel-controls').contains('Extract').click();
|
||||
it('Test the close button', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
cy.deleteColumn('NDB_No')
|
||||
cy.get('#or-proj-undoRedo').click()
|
||||
cy.get('#refine-tabs-history .history-panel-controls')
|
||||
.contains('Extract')
|
||||
.click()
|
||||
|
||||
cy.get('.dialog-container').should('exist').should('be.visible');
|
||||
cy.get('.dialog-container button[bind="closeButton"]').click();
|
||||
cy.get('.dialog-container').should('not.exist');
|
||||
});
|
||||
cy.get('.dialog-container').should('exist').should('be.visible')
|
||||
cy.get('.dialog-container button[bind="closeButton"]').click()
|
||||
cy.get('.dialog-container').should('not.exist')
|
||||
})
|
||||
|
||||
it('Ensure action are recorded in the extract panel', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
cy.deleteColumn('NDB_No');
|
||||
cy.deleteColumn('Shrt_Desc');
|
||||
it('Ensure action are recorded in the extract panel', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
cy.deleteColumn('NDB_No')
|
||||
cy.deleteColumn('Shrt_Desc')
|
||||
|
||||
cy.get('#or-proj-undoRedo').click();
|
||||
cy.get('#or-proj-undoRedo').click()
|
||||
|
||||
cy.get('#refine-tabs-history .history-panel-controls').contains('Extract').click();
|
||||
cy.get('#refine-tabs-history .history-panel-controls')
|
||||
.contains('Extract')
|
||||
.click()
|
||||
|
||||
// test the entries
|
||||
cy.get('.history-extract-dialog-entries').contains('Remove column NDB_No');
|
||||
cy.get('.history-extract-dialog-entries').contains('Remove column Shrt_Desc');
|
||||
// test the entries
|
||||
cy.get('.history-extract-dialog-entries').contains(
|
||||
'Remove column NDB_No'
|
||||
)
|
||||
cy.get('.history-extract-dialog-entries').contains(
|
||||
'Remove column Shrt_Desc'
|
||||
)
|
||||
|
||||
// test the json
|
||||
cy.assertTextareaHaveJsonValue('.dialog-container textarea.history-operation-json', [
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'NDB_No',
|
||||
description: 'Remove column NDB_No',
|
||||
},
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'Shrt_Desc',
|
||||
description: 'Remove column Shrt_Desc',
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
// test the json
|
||||
cy.assertTextareaHaveJsonValue(
|
||||
'.dialog-container textarea.history-operation-json',
|
||||
[
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'NDB_No',
|
||||
description: 'Remove column NDB_No',
|
||||
},
|
||||
{
|
||||
op: 'core/column-removal',
|
||||
columnName: 'Shrt_Desc',
|
||||
description: 'Remove column Shrt_Desc',
|
||||
},
|
||||
]
|
||||
)
|
||||
})
|
||||
})
|
||||
|
@ -1,67 +1,113 @@
|
||||
describe(__filename, function () {
|
||||
it('Ensure the Undo button is visible after deleting a column', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
cy.deleteColumn('NDB_No');
|
||||
it('Ensure the Undo button is visible after deleting a column', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
cy.deleteColumn('NDB_No')
|
||||
|
||||
cy.get('#notification-container').should('be.visible').should('to.contain', 'Remove column NDB_No');
|
||||
cy.get('#notification-container .notification-action').should('be.visible').should('to.contain', 'Undo');
|
||||
});
|
||||
cy.get('#notification-container')
|
||||
.should('be.visible')
|
||||
.should('to.contain', 'Remove column NDB_No')
|
||||
cy.get('#notification-container .notification-action')
|
||||
.should('be.visible')
|
||||
.should('to.contain', 'Undo')
|
||||
})
|
||||
|
||||
it('Ensure the Undo button is effectively working', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
it('Ensure the Undo button is effectively working', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
|
||||
cy.deleteColumn('NDB_No');
|
||||
// ensure that the column is back in the grid
|
||||
cy.get('#notification-container .notification-action').should('be.visible').should('to.contain', 'Undo');
|
||||
cy.get('#notification-container a[bind="undoLink"]').click();
|
||||
cy.get('.data-table th[title="NDB_No"]').should('exist');
|
||||
});
|
||||
cy.deleteColumn('NDB_No')
|
||||
// ensure that the column is back in the grid
|
||||
cy.get('#notification-container .notification-action')
|
||||
.should('be.visible')
|
||||
.should('to.contain', 'Undo')
|
||||
cy.get('#notification-container a[bind="undoLink"]').click()
|
||||
cy.get('.data-table th[title="NDB_No"]').should('exist')
|
||||
})
|
||||
|
||||
it('Delete 3 columns, then successively undo and redo the modifications using the Undo/Redo panel', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv');
|
||||
it('Delete 3 columns, then successively undo and redo the modifications using the Undo/Redo panel', function () {
|
||||
cy.loadAndVisitProject('food.mini.csv')
|
||||
|
||||
// delete NDB_No
|
||||
cy.deleteColumn('NDB_No');
|
||||
cy.get('#or-proj-undoRedo').should('to.contain', '1 / 1');
|
||||
cy.get('.history-panel-body .history-now').should('to.contain', 'Remove column NDB_No');
|
||||
// delete NDB_No
|
||||
cy.deleteColumn('NDB_No')
|
||||
cy.get('#or-proj-undoRedo').should('to.contain', '1 / 1')
|
||||
cy.get('.history-panel-body .history-now').should(
|
||||
'to.contain',
|
||||
'Remove column NDB_No'
|
||||
)
|
||||
|
||||
// delete Water
|
||||
cy.deleteColumn('Water');
|
||||
cy.get('#or-proj-undoRedo').should('to.contain', '2 / 2');
|
||||
cy.get('.history-panel-body .history-now').should('to.contain', 'Remove column Water');
|
||||
// delete Water
|
||||
cy.deleteColumn('Water')
|
||||
cy.get('#or-proj-undoRedo').should('to.contain', '2 / 2')
|
||||
cy.get('.history-panel-body .history-now').should(
|
||||
'to.contain',
|
||||
'Remove column Water'
|
||||
)
|
||||
|
||||
// Delete Shrt_Desc
|
||||
cy.deleteColumn('Shrt_Desc');
|
||||
cy.get('#or-proj-undoRedo').should('to.contain', '3 / 3');
|
||||
cy.get('.history-panel-body .history-now').should('to.contain', 'Remove column Shrt_Desc');
|
||||
// Delete Shrt_Desc
|
||||
cy.deleteColumn('Shrt_Desc')
|
||||
cy.get('#or-proj-undoRedo').should('to.contain', '3 / 3')
|
||||
cy.get('.history-panel-body .history-now').should(
|
||||
'to.contain',
|
||||
'Remove column Shrt_Desc'
|
||||
)
|
||||
|
||||
// Open the Undo/Redo panel
|
||||
cy.get('#or-proj-undoRedo').click();
|
||||
// Open the Undo/Redo panel
|
||||
cy.get('#or-proj-undoRedo').click()
|
||||
|
||||
// ensure all previous actions have been recorded
|
||||
cy.get('.history-panel-body .history-past').should('to.contain', 'Remove column NDB_No');
|
||||
cy.get('.history-panel-body .history-past').should('to.contain', 'Remove column Water');
|
||||
cy.get('.history-panel-body .history-now').should('to.contain', 'Remove column Shrt_Desc');
|
||||
// ensure all previous actions have been recorded
|
||||
cy.get('.history-panel-body .history-past').should(
|
||||
'to.contain',
|
||||
'Remove column NDB_No'
|
||||
)
|
||||
cy.get('.history-panel-body .history-past').should(
|
||||
'to.contain',
|
||||
'Remove column Water'
|
||||
)
|
||||
cy.get('.history-panel-body .history-now').should(
|
||||
'to.contain',
|
||||
'Remove column Shrt_Desc'
|
||||
)
|
||||
|
||||
// successively undo all modifications
|
||||
cy.get('.history-panel-body .history-past a.history-entry:last-of-type').click();
|
||||
cy.waitForOrOperation();
|
||||
cy.get('.history-panel-body .history-past').should('to.contain', 'Remove column NDB_No');
|
||||
cy.get('.history-panel-body .history-now').should('to.contain', 'Remove column Water');
|
||||
cy.get('.history-panel-body .history-future').should('to.contain', 'Remove column Shrt_Desc');
|
||||
// successively undo all modifications
|
||||
cy.get(
|
||||
'.history-panel-body .history-past a.history-entry:last-of-type'
|
||||
).click()
|
||||
cy.waitForOrOperation()
|
||||
cy.get('.history-panel-body .history-past').should(
|
||||
'to.contain',
|
||||
'Remove column NDB_No'
|
||||
)
|
||||
cy.get('.history-panel-body .history-now').should(
|
||||
'to.contain',
|
||||
'Remove column Water'
|
||||
)
|
||||
cy.get('.history-panel-body .history-future').should(
|
||||
'to.contain',
|
||||
'Remove column Shrt_Desc'
|
||||
)
|
||||
|
||||
cy.get('.history-panel-body .history-past a.history-entry:last-of-type').click();
|
||||
cy.waitForOrOperation();
|
||||
cy.get('.history-panel-body .history-now').should('to.contain', 'Remove column NDB_No');
|
||||
cy.get('.history-panel-body .history-future').should('to.contain', 'Remove column Water');
|
||||
cy.get('.history-panel-body .history-future').should('to.contain', 'Remove column Shrt_Desc');
|
||||
});
|
||||
cy.get(
|
||||
'.history-panel-body .history-past a.history-entry:last-of-type'
|
||||
).click()
|
||||
cy.waitForOrOperation()
|
||||
cy.get('.history-panel-body .history-now').should(
|
||||
'to.contain',
|
||||
'Remove column NDB_No'
|
||||
)
|
||||
cy.get('.history-panel-body .history-future').should(
|
||||
'to.contain',
|
||||
'Remove column Water'
|
||||
)
|
||||
cy.get('.history-panel-body .history-future').should(
|
||||
'to.contain',
|
||||
'Remove column Shrt_Desc'
|
||||
)
|
||||
})
|
||||
|
||||
// Very long test to run
|
||||
// it('Ensure the Undo button dissapear after timeout after deleting a column', function () {
|
||||
// const ORNotificationTimeout = 15000;
|
||||
// cy.loadAndVisitProject('food.mini.csv');
|
||||
// cy.columnActionClick('NDB_No', ['Edit column', 'Remove this column']);
|
||||
// cy.get('#notification-container', { timeout: ORNotificationTimeout }).should('not.be.visible');
|
||||
// });
|
||||
});
|
||||
// Very long test to run
|
||||
// it('Ensure the Undo button dissapear after timeout after deleting a column', function () {
|
||||
// const ORNotificationTimeout = 15000;
|
||||
// cy.loadAndVisitProject('food.mini.csv');
|
||||
// cy.columnActionClick('NDB_No', ['Edit column', 'Remove this column']);
|
||||
// cy.get('#notification-container', { timeout: ORNotificationTimeout }).should('not.be.visible');
|
||||
// });
|
||||
})
|
||||
|
@ -0,0 +1,139 @@
|
||||
describe(__filename, function () {
|
||||
it('Ensures project-metadata dialogue loads', function () {
|
||||
const projectName = Date.now()
|
||||
cy.loadProject('food.mini.csv', projectName)
|
||||
cy.visitOpenRefine()
|
||||
cy.navigateTo('Open Project')
|
||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
||||
cy.get('h1').contains('Project metadata')
|
||||
cy.get(
|
||||
'body > .dialog-container > .dialog-frame .dialog-footer button[bind="closeButton"]'
|
||||
).click()
|
||||
cy.get('body > .dialog-container > .dialog-frame').should('not.exist')
|
||||
})
|
||||
it('Ensures project-metadata has correct details', function () {
|
||||
const projectName = Date.now()
|
||||
cy.loadProject('food.mini.csv', projectName)
|
||||
cy.visitOpenRefine()
|
||||
cy.navigateTo('Open Project')
|
||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
||||
cy.get('#metadata-body tbody>tr').eq(3).contains('Project name')
|
||||
cy.get('#metadata-body tbody>tr').eq(3).contains(projectName)
|
||||
})
|
||||
it('Ensures project-metadata can be edit project name', function () {
|
||||
const projectName = Date.now()
|
||||
cy.loadProject('food.mini.csv', projectName)
|
||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||
onBeforeLoad(win) {
|
||||
cy.stub(win, 'prompt').returns('testProject')
|
||||
},
|
||||
})
|
||||
cy.navigateTo('Open Project')
|
||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
||||
cy.contains('td', 'Project name:')
|
||||
.siblings()
|
||||
.contains('button', 'Edit')
|
||||
.click()
|
||||
cy.get('#metadata-body tbody>tr').eq(3).contains('Project name')
|
||||
cy.get('#metadata-body tbody>tr').eq(3).contains('testProject')
|
||||
})
|
||||
it('Ensures project-metadata can be edit tags', function () {
|
||||
const projectName = Date.now()
|
||||
cy.loadProject('food.mini.csv', projectName)
|
||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||
onBeforeLoad(win) {
|
||||
cy.stub(win, 'prompt').returns('tagTest')
|
||||
},
|
||||
})
|
||||
cy.navigateTo('Open Project')
|
||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
||||
cy.contains('td', 'Tags:').siblings().contains('button', 'Edit').click()
|
||||
cy.get('#metadata-body tbody>tr').eq(4).contains('Tags')
|
||||
cy.get('#metadata-body tbody>tr').eq(4).contains('tagTest')
|
||||
})
|
||||
it('Ensures project-metadata can be edit creator', function () {
|
||||
const projectName = Date.now()
|
||||
cy.loadProject('food.mini.csv', projectName)
|
||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||
onBeforeLoad(win) {
|
||||
cy.stub(win, 'prompt').returns('testCreator')
|
||||
},
|
||||
})
|
||||
cy.navigateTo('Open Project')
|
||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
||||
cy.contains('td', 'Creator:')
|
||||
.siblings()
|
||||
.contains('button', 'Edit')
|
||||
.click()
|
||||
cy.get('#metadata-body tbody>tr').eq(5).contains('Creator')
|
||||
cy.get('#metadata-body tbody>tr').eq(5).contains('testCreator')
|
||||
})
|
||||
it('Ensures project-metadata can be edit contributors', function () {
|
||||
const projectName = Date.now()
|
||||
cy.loadProject('food.mini.csv', projectName)
|
||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||
onBeforeLoad(win) {
|
||||
cy.stub(win, 'prompt').returns('testcontributor')
|
||||
},
|
||||
})
|
||||
cy.navigateTo('Open Project')
|
||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
||||
cy.contains('td', 'Contributors:')
|
||||
.siblings()
|
||||
.contains('button', 'Edit')
|
||||
.click()
|
||||
cy.get('#metadata-body tbody>tr').eq(6).contains('Contributors')
|
||||
cy.get('#metadata-body tbody>tr').eq(6).contains('testcontributor')
|
||||
})
|
||||
it('Ensures project-metadata can be edit subject', function () {
|
||||
const projectName = Date.now()
|
||||
cy.loadProject('food.mini.csv', projectName)
|
||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||
onBeforeLoad(win) {
|
||||
cy.stub(win, 'prompt').returns('testSubject')
|
||||
},
|
||||
})
|
||||
cy.navigateTo('Open Project')
|
||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
||||
cy.contains('td', 'Subject:')
|
||||
.siblings()
|
||||
.contains('button', 'Edit')
|
||||
.click()
|
||||
cy.get('#metadata-body tbody>tr').eq(7).contains('Subject')
|
||||
cy.get('#metadata-body tbody>tr').eq(7).contains('testSubject')
|
||||
})
|
||||
it('Ensures project-metadata can be edit license', function () {
|
||||
const projectName = Date.now()
|
||||
cy.loadProject('food.mini.csv', projectName)
|
||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||
onBeforeLoad(win) {
|
||||
cy.stub(win, 'prompt').returns('GPL-3')
|
||||
},
|
||||
})
|
||||
cy.navigateTo('Open Project')
|
||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
||||
cy.contains('td', 'License:')
|
||||
.siblings()
|
||||
.contains('button', 'Edit')
|
||||
.click()
|
||||
cy.get('#metadata-body tbody>tr').eq(12).contains('License')
|
||||
cy.get('#metadata-body tbody>tr').eq(12).contains('GPL-3')
|
||||
})
|
||||
it('Ensures project-metadata can be edit homepage', function () {
|
||||
const projectName = Date.now()
|
||||
cy.loadProject('food.mini.csv', projectName)
|
||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||
onBeforeLoad(win) {
|
||||
cy.stub(win, 'prompt').returns('openrefine.org')
|
||||
},
|
||||
})
|
||||
cy.navigateTo('Open Project')
|
||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
||||
cy.contains('td', 'Homepage:')
|
||||
.siblings()
|
||||
.contains('button', 'Edit')
|
||||
.click()
|
||||
cy.get('#metadata-body tbody>tr').eq(13).contains('Homepage')
|
||||
cy.get('#metadata-body tbody>tr').eq(13).contains('openrefine.org')
|
||||
})
|
||||
})
|
@ -15,8 +15,8 @@
|
||||
* @type {Cypress.PluginConfig}
|
||||
*/
|
||||
module.exports = (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
|
||||
return config;
|
||||
};
|
||||
return config
|
||||
}
|
||||
|
@ -8,111 +8,130 @@
|
||||
// https://on.cypress.io/custom-commands
|
||||
// ***********************************************
|
||||
|
||||
import 'cypress-file-upload';
|
||||
import 'cypress-wait-until';
|
||||
import 'cypress-file-upload'
|
||||
import 'cypress-wait-until'
|
||||
// const fs = require('fs-extra');
|
||||
// var uniqid = require('uniqid');
|
||||
//
|
||||
//
|
||||
Cypress.Commands.add('assertTextareaHaveJsonValue', (selector, json) => {
|
||||
cy.get(selector).then((el) => {
|
||||
// expected json needs to be parsed / restringified, to avoid inconsitencies about spaces and tabs
|
||||
const present = JSON.parse(el.val());
|
||||
cy.expect(JSON.stringify(present)).to.equal(JSON.stringify(json));
|
||||
});
|
||||
});
|
||||
cy.get(selector).then((el) => {
|
||||
// expected json needs to be parsed / restringified, to avoid inconsitencies about spaces and tabs
|
||||
const present = JSON.parse(el.val())
|
||||
cy.expect(JSON.stringify(present)).to.equal(JSON.stringify(json))
|
||||
})
|
||||
})
|
||||
Cypress.Commands.add('visitOpenRefine', (options) => {
|
||||
cy.visit(Cypress.env('OPENREFINE_URL'), options);
|
||||
});
|
||||
cy.visit(Cypress.env('OPENREFINE_URL'), options)
|
||||
})
|
||||
|
||||
Cypress.Commands.add('createProjectThroughUserInterface', (fixtureFile) => {
|
||||
cy.navigateTo('Create Project');
|
||||
cy.navigateTo('Create Project')
|
||||
|
||||
const uploadFile = { filePath: fixtureFile, mimeType: 'application/csv' };
|
||||
cy.get('.create-project-ui-source-selection-tab-body.selected input[type="file"]').attachFile(uploadFile);
|
||||
cy.get('.create-project-ui-source-selection-tab-body.selected button.button-primary').click();
|
||||
});
|
||||
const uploadFile = { filePath: fixtureFile, mimeType: 'application/csv' }
|
||||
cy.get(
|
||||
'.create-project-ui-source-selection-tab-body.selected input[type="file"]'
|
||||
).attachFile(uploadFile)
|
||||
cy.get(
|
||||
'.create-project-ui-source-selection-tab-body.selected button.button-primary'
|
||||
).click()
|
||||
})
|
||||
|
||||
Cypress.Commands.add('doCreateProjectThroughUserInterface', () => {
|
||||
cy.get('.default-importing-wizard-header button[bind="nextButton"]').click();
|
||||
cy.get('#create-project-progress-message').contains('Done.');
|
||||
cy.get('.default-importing-wizard-header button[bind="nextButton"]').click()
|
||||
cy.get('#create-project-progress-message').contains('Done.')
|
||||
|
||||
// workaround to ensure project is loaded
|
||||
// cypress does not support window.location = ...
|
||||
cy.get('h2').contains('HTTP ERROR 404');
|
||||
cy.location().should((location) => {
|
||||
expect(location.href).contains(Cypress.env('OPENREFINE_URL')+'/__/project?');
|
||||
});
|
||||
// workaround to ensure project is loaded
|
||||
// cypress does not support window.location = ...
|
||||
cy.get('h2').contains('HTTP ERROR 404')
|
||||
cy.location().should((location) => {
|
||||
expect(location.href).contains(
|
||||
Cypress.env('OPENREFINE_URL') + '/__/project?'
|
||||
)
|
||||
})
|
||||
|
||||
cy.location().then((location) => {
|
||||
const projectId = location.href.split('=').slice(-1)[0];
|
||||
cy.visitProject(projectId);
|
||||
cy.wrap(projectId).as('createdProjectId');
|
||||
});
|
||||
});
|
||||
cy.location().then((location) => {
|
||||
const projectId = location.href.split('=').slice(-1)[0]
|
||||
cy.visitProject(projectId)
|
||||
cy.wrap(projectId).as('createdProjectId')
|
||||
})
|
||||
})
|
||||
|
||||
Cypress.Commands.add('getCell', (rowIndex, columnName) => {
|
||||
const cssRowIndex = rowIndex + 1;
|
||||
// first get the header, to know the cell index
|
||||
cy.get(`table.data-table thead th[title="${columnName}"]`).then(($elem) => {
|
||||
// there are 3 td at the beginning of each row
|
||||
const columnIndex = $elem.index() + 3;
|
||||
return cy.get(`table.data-table tbody tr:nth-child(${cssRowIndex}) td:nth-child(${columnIndex})`);
|
||||
});
|
||||
});
|
||||
const cssRowIndex = rowIndex + 1
|
||||
// first get the header, to know the cell index
|
||||
cy.get(`table.data-table thead th[title="${columnName}"]`).then(($elem) => {
|
||||
// there are 3 td at the beginning of each row
|
||||
const columnIndex = $elem.index() + 3
|
||||
return cy.get(
|
||||
`table.data-table tbody tr:nth-child(${cssRowIndex}) td:nth-child(${columnIndex})`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Cypress.Commands.add('assertCellEquals', (rowIndex, columnName, value) => {
|
||||
const cssRowIndex = rowIndex + 1;
|
||||
// first get the header, to know the cell index
|
||||
cy.get(`table.data-table thead th[title="${columnName}"]`).then(($elem) => {
|
||||
// there are 3 td at the beginning of each row
|
||||
const columnIndex = $elem.index() + 3;
|
||||
cy.get(`table.data-table tbody tr:nth-child(${cssRowIndex}) td:nth-child(${columnIndex}) div.data-table-cell-content > span`).should(($cellSpan)=>{
|
||||
expect($cellSpan.text()).equals(value);
|
||||
});
|
||||
});
|
||||
});
|
||||
const cssRowIndex = rowIndex + 1
|
||||
// first get the header, to know the cell index
|
||||
cy.get(`table.data-table thead th[title="${columnName}"]`).then(($elem) => {
|
||||
// there are 3 td at the beginning of each row
|
||||
const columnIndex = $elem.index() + 3
|
||||
cy.get(
|
||||
`table.data-table tbody tr:nth-child(${cssRowIndex}) td:nth-child(${columnIndex}) div.data-table-cell-content > span`
|
||||
).should(($cellSpan) => {
|
||||
expect($cellSpan.text()).equals(value)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Cypress.Commands.add('navigateTo', (target) => {
|
||||
cy.get('#action-area-tabs li').contains(target).click();
|
||||
});
|
||||
cy.get('#action-area-tabs li').contains(target).click()
|
||||
})
|
||||
|
||||
Cypress.Commands.add('waitForOrOperation', () => {
|
||||
cy.get('body[ajax_in_progress="true"]');
|
||||
cy.get('body[ajax_in_progress="false"]');
|
||||
});
|
||||
cy.get('body[ajax_in_progress="true"]')
|
||||
cy.get('body[ajax_in_progress="false"]')
|
||||
})
|
||||
|
||||
Cypress.Commands.add('deleteColumn', (columnName) => {
|
||||
cy.get('.data-table th[title="' + columnName + '"]').should('exist');
|
||||
cy.columnActionClick(columnName, ['Edit column', 'Remove this column']);
|
||||
cy.get('.data-table th[title="' + columnName + '"]').should('not.exist');
|
||||
});
|
||||
cy.get('.data-table th[title="' + columnName + '"]').should('exist')
|
||||
cy.columnActionClick(columnName, ['Edit column', 'Remove this column'])
|
||||
cy.get('.data-table th[title="' + columnName + '"]').should('not.exist')
|
||||
})
|
||||
|
||||
Cypress.Commands.add('waitForDialogPanel', () => {
|
||||
cy.get('body > .dialog-container > .dialog-frame').should('be.visible');
|
||||
});
|
||||
cy.get('body > .dialog-container > .dialog-frame').should('be.visible')
|
||||
})
|
||||
|
||||
Cypress.Commands.add('confirmDialogPanel', () => {
|
||||
cy.get('body > .dialog-container > .dialog-frame .dialog-footer button[bind="okButton"]').click();
|
||||
cy.get('body > .dialog-container > .dialog-frame').should('not.exist');
|
||||
});
|
||||
cy.get(
|
||||
'body > .dialog-container > .dialog-frame .dialog-footer button[bind="okButton"]'
|
||||
).click()
|
||||
cy.get('body > .dialog-container > .dialog-frame').should('not.exist')
|
||||
})
|
||||
|
||||
Cypress.Commands.add('columnActionClick', (columnName, actions) => {
|
||||
cy.get('.data-table th:contains("' + columnName + '") .column-header-menu').click();
|
||||
cy.get(
|
||||
'.data-table th:contains("' + columnName + '") .column-header-menu'
|
||||
).click()
|
||||
|
||||
for (var i = 0; i < actions.length; i++) {
|
||||
cy.get('body > .menu-container').eq(i).contains(actions[i]).click();
|
||||
}
|
||||
cy.get('body[ajax_in_progress="false"]');
|
||||
});
|
||||
for (var i = 0; i < actions.length; i++) {
|
||||
cy.get('body > .menu-container').eq(i).contains(actions[i]).click()
|
||||
}
|
||||
cy.get('body[ajax_in_progress="false"]')
|
||||
})
|
||||
|
||||
Cypress.Commands.add('visitProject', (projectId) => {
|
||||
cy.visit(Cypress.env('OPENREFINE_URL') + '/project?project=' + projectId);
|
||||
cy.get('#project-title').should('exist');
|
||||
});
|
||||
cy.visit(Cypress.env('OPENREFINE_URL') + '/project?project=' + projectId)
|
||||
cy.get('#project-title').should('exist')
|
||||
})
|
||||
|
||||
Cypress.Commands.add('loadAndVisitProject', (fixture, projectName = Date.now()) => {
|
||||
cy.loadProject(fixture, projectName).then((projectId) => {
|
||||
cy.visit(Cypress.env('OPENREFINE_URL') + '/project?project=' + projectId);
|
||||
});
|
||||
});
|
||||
Cypress.Commands.add(
|
||||
'loadAndVisitProject',
|
||||
(fixture, projectName = Date.now()) => {
|
||||
cy.loadProject(fixture, projectName).then((projectId) => {
|
||||
cy.visit(
|
||||
Cypress.env('OPENREFINE_URL') + '/project?project=' + projectId
|
||||
)
|
||||
})
|
||||
}
|
||||
)
|
||||
|
@ -14,31 +14,33 @@
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands';
|
||||
import './openrefine_api';
|
||||
import './commands'
|
||||
import './openrefine_api'
|
||||
|
||||
let token;
|
||||
let token
|
||||
|
||||
beforeEach(() => {
|
||||
cy.server({
|
||||
ignore: (xhr) => {
|
||||
// Hide XHR Requests from log, OpenRefine is making too many XHR requests, it's polluting the test runner
|
||||
return true;
|
||||
},
|
||||
});
|
||||
cy.server({
|
||||
ignore: (xhr) => {
|
||||
// Hide XHR Requests from log, OpenRefine is making too many XHR requests, it's polluting the test runner
|
||||
return true
|
||||
},
|
||||
})
|
||||
|
||||
cy.wrap(token, { log: false }).as('token');
|
||||
cy.wrap(token, { log: false }).as('deletetoken');
|
||||
cy.wrap([], { log: false }).as('loadedProjectIds');
|
||||
});
|
||||
cy.wrap(token, { log: false }).as('token')
|
||||
cy.wrap(token, { log: false }).as('deletetoken')
|
||||
cy.wrap([], { log: false }).as('loadedProjectIds')
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
cy.cleanupProjects();
|
||||
});
|
||||
cy.cleanupProjects()
|
||||
})
|
||||
|
||||
before(() => {
|
||||
cy.request(Cypress.env('OPENREFINE_URL')+'/command/core/get-csrf-token').then((response) => {
|
||||
// store one unique token for block of runs
|
||||
token = response.body.token;
|
||||
});
|
||||
});
|
||||
cy.request(
|
||||
Cypress.env('OPENREFINE_URL') + '/command/core/get-csrf-token'
|
||||
).then((response) => {
|
||||
// store one unique token for block of runs
|
||||
token = response.body.token
|
||||
})
|
||||
})
|
||||
|
@ -1,81 +1,97 @@
|
||||
Cypress.Commands.add('setPreference', (preferenceName, preferenceValue) => {
|
||||
const openRefineUrl = Cypress.env('OPENREFINE_URL')
|
||||
cy.request( openRefineUrl + '/command/core/get-csrf-token').then((response) => {
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: `${openRefineUrl}/command/core/set-preference`,
|
||||
body: `name=${preferenceName}&value="${preferenceValue}"&csrf_token=${response.body.token}`,
|
||||
form: false,
|
||||
headers: {
|
||||
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
},
|
||||
}).then((resp) => {
|
||||
cy.log('Set preference ' + preferenceName + ' with value ' + preferenceValue);
|
||||
});
|
||||
});
|
||||
});
|
||||
const openRefineUrl = Cypress.env('OPENREFINE_URL')
|
||||
cy.request(openRefineUrl + '/command/core/get-csrf-token').then(
|
||||
(response) => {
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: `${openRefineUrl}/command/core/set-preference`,
|
||||
body: `name=${preferenceName}&value="${preferenceValue}"&csrf_token=${response.body.token}`,
|
||||
form: false,
|
||||
headers: {
|
||||
'content-type':
|
||||
'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
},
|
||||
}).then((resp) => {
|
||||
cy.log(
|
||||
'Set preference ' +
|
||||
preferenceName +
|
||||
' with value ' +
|
||||
preferenceValue
|
||||
)
|
||||
})
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
Cypress.Commands.add('cleanupProjects', () => {
|
||||
const openRefineUrl = Cypress.env('OPENREFINE_URL')
|
||||
cy.get('@deletetoken', { log: false }).then((token) => {
|
||||
cy.get('@loadedProjectIds', { log: false }).then((loadedProjectIds) => {
|
||||
for (const projectId of loadedProjectIds) {
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: `${openRefineUrl}/command/core/delete-project?csrf_token=` + token,
|
||||
body: { project: projectId },
|
||||
form: true,
|
||||
}).then((resp) => {
|
||||
cy.log('Deleted OR project' + projectId);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
const openRefineUrl = Cypress.env('OPENREFINE_URL')
|
||||
cy.get('@deletetoken', { log: false }).then((token) => {
|
||||
cy.get('@loadedProjectIds', { log: false }).then((loadedProjectIds) => {
|
||||
for (const projectId of loadedProjectIds) {
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url:
|
||||
`${openRefineUrl}/command/core/delete-project?csrf_token=` +
|
||||
token,
|
||||
body: { project: projectId },
|
||||
form: true,
|
||||
}).then((resp) => {
|
||||
cy.log('Deleted OR project' + projectId)
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Cypress.Commands.add('loadProject', (fixture, projectName) => {
|
||||
const openRefineUrl = Cypress.env('OPENREFINE_URL');
|
||||
const openRefineProjectName = projectName ? projectName : fixture;
|
||||
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) +
|
||||
const openRefineUrl = Cypress.env('OPENREFINE_URL')
|
||||
const openRefineProjectName = projectName ? projectName : fixture
|
||||
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 =
|
||||
'------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--';
|
||||
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.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;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.get('@loadedProjectIds', { log: false }).then(
|
||||
(loadedProjectIds) => {
|
||||
loadedProjectIds.push(projectId)
|
||||
cy.wrap(loadedProjectIds, { log: false })
|
||||
.as('loadedProjectIds')
|
||||
.then(() => {
|
||||
return projectId
|
||||
})
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -12,5 +12,8 @@
|
||||
"dotenv": "^8.2.0",
|
||||
"fs-extra": "^9.1.0",
|
||||
"uniqid": "^5.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "2.2.1"
|
||||
}
|
||||
}
|
||||
|
@ -1073,6 +1073,11 @@ pify@^2.2.0:
|
||||
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
|
||||
integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw=
|
||||
|
||||
prettier@2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
|
||||
integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==
|
||||
|
||||
pretty-bytes@^5.4.1:
|
||||
version "5.4.1"
|
||||
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.4.1.tgz#cd89f79bbcef21e3d21eb0da68ffe93f803e884b"
|
||||
|
Loading…
Reference in New Issue
Block a user