feat: add ESLint configuration for cypress-test-suite (#3564)
* feat: Initialise ES-Lint for cypress
This commit is contained in:
parent
a0bea8f8c7
commit
859828a0f0
4
main/tests/cypress/.eslintignore
Normal file
4
main/tests/cypress/.eslintignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
out
|
||||||
|
node_modules
|
||||||
|
*.md
|
||||||
|
|
28
main/tests/cypress/.eslintrc.json
Normal file
28
main/tests/cypress/.eslintrc.json
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"node": true,
|
||||||
|
"es2021": true,
|
||||||
|
"cypress/globals": true
|
||||||
|
},
|
||||||
|
"plugins": ["cypress"],
|
||||||
|
"extends": [
|
||||||
|
"google",
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:cypress/recommended",
|
||||||
|
"prettier"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 12,
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"max-len": ["error", { "code": 150 }],
|
||||||
|
"valid-jsdoc": "off",
|
||||||
|
"cypress/no-assigning-return-values": "error",
|
||||||
|
"cypress/no-unnecessary-waiting": "error",
|
||||||
|
"cypress/assertion-before-screenshot": "warn",
|
||||||
|
"cypress/no-force": "warn",
|
||||||
|
"cypress/no-async-tests": "error"
|
||||||
|
}
|
||||||
|
}
|
3
main/tests/cypress/.gitignore
vendored
3
main/tests/cypress/.gitignore
vendored
@ -5,4 +5,5 @@ cypress/videos
|
|||||||
cypress/screenshots
|
cypress/screenshots
|
||||||
cypress/downloads
|
cypress/downloads
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
cypress.env.json
|
cypress.env.json
|
||||||
|
out
|
@ -1,5 +1,6 @@
|
|||||||
coverage
|
coverage
|
||||||
node_modules
|
node_modules
|
||||||
|
out
|
||||||
yarn.lock
|
yarn.lock
|
||||||
package.json
|
package.json
|
||||||
*.md
|
*.md
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"trailingComma": "es5",
|
"trailingComma": "es5",
|
||||||
"tabWidth": 4,
|
"tabWidth": 2,
|
||||||
"semi": false,
|
"semi": true,
|
||||||
"singleQuote": true
|
"singleQuote": true
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"integrationFolder": "./cypress/integration",
|
"integrationFolder": "./cypress/integration",
|
||||||
"nodeVersion": "system",
|
"nodeVersion": "system",
|
||||||
"retries": {
|
"retries": {
|
||||||
"runMode": 2,
|
"runMode": 2,
|
||||||
"openMode": 1
|
"openMode": 1
|
||||||
},
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"OPENREFINE_URL": "http://localhost:3333"
|
"OPENREFINE_URL": "http://localhost:3333"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
const foodMini = require('./food.mini.js')
|
const foodMini = require('./food.mini.js');
|
||||||
const foodSmall = require('./food.small.js')
|
const foodSmall = require('./food.small.js');
|
||||||
const foodSort = require('./food.sort.js')
|
const foodSort = require('./food.sort.js');
|
||||||
|
|
||||||
const fixtures = {
|
const fixtures = {
|
||||||
'food.mini': foodMini,
|
'food.mini': foodMini,
|
||||||
'food.small': foodSmall,
|
'food.small': foodSmall,
|
||||||
'food.sort': foodSort,
|
'food.sort': foodSort,
|
||||||
}
|
};
|
||||||
|
|
||||||
export default fixtures
|
export default fixtures;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const fixture = [
|
const fixture = [
|
||||||
['NDB_No', 'Shrt_Desc', 'Water', 'Energ_Kcal'],
|
['NDB_No', 'Shrt_Desc', 'Water', 'Energ_Kcal'],
|
||||||
['01001', 'BUTTER,WITH SALT', '15.87', '717'],
|
['01001', 'BUTTER,WITH SALT', '15.87', '717'],
|
||||||
['01002', 'BUTTER,WHIPPED,WITH SALT', '15.87', '717'],
|
['01002', 'BUTTER,WHIPPED,WITH SALT', '15.87', '717'],
|
||||||
]
|
];
|
||||||
|
|
||||||
export default fixture
|
export default fixture;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
const fixture = [
|
const fixture = [
|
||||||
['NDB_No', 'Shrt_Desc', 'Water', 'Energ_Kcal', 'Date', 'Fat'],
|
['NDB_No', 'Shrt_Desc', 'Water', 'Energ_Kcal', 'Date', 'Fat'],
|
||||||
['01001', 'BUTTER,WITH SALT', '15.87', '717', '17/12/2020', 'false'],
|
['01001', 'BUTTER,WITH SALT', '15.87', '717', '17/12/2020', 'false'],
|
||||||
['01002', 'BUTTER,WHIPPED,WITH SALT', '15.87', '717', '17/08/2020', 'true'],
|
['01002', 'BUTTER,WHIPPED,WITH SALT', '15.87', '717', '17/08/2020', 'true'],
|
||||||
]
|
];
|
||||||
|
|
||||||
export default fixture
|
export default fixture;
|
||||||
|
@ -1,114 +1,114 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Test the create project page', function () {
|
it('Test the create project page', function () {
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.navigateTo('Create Project')
|
cy.navigateTo('Create Project');
|
||||||
cy.get('#create-project-ui-source-selection-tabs > div')
|
cy.get('#create-project-ui-source-selection-tabs > div')
|
||||||
.contains('This Computer')
|
.contains('This Computer')
|
||||||
.click()
|
.click();
|
||||||
cy.get(
|
cy.get('.create-project-ui-source-selection-tab-body.selected').contains(
|
||||||
'.create-project-ui-source-selection-tab-body.selected'
|
'Locate one or more files on your computer to upload'
|
||||||
).contains('Locate one or more files on your computer to upload')
|
);
|
||||||
|
|
||||||
// load a file
|
// load a file
|
||||||
const csvFile = {
|
const csvFile = {
|
||||||
filePath: 'food.mini.csv',
|
filePath: 'food.mini.csv',
|
||||||
mimeType: 'application/csv',
|
mimeType: 'application/csv',
|
||||||
}
|
};
|
||||||
cy.get(
|
cy.get(
|
||||||
'.create-project-ui-source-selection-tab-body.selected input[type="file"]'
|
'.create-project-ui-source-selection-tab-body.selected input[type="file"]'
|
||||||
).attachFile(csvFile)
|
).attachFile(csvFile);
|
||||||
cy.get(
|
cy.get(
|
||||||
'.create-project-ui-source-selection-tab-body.selected button.button-primary'
|
'.create-project-ui-source-selection-tab-body.selected button.button-primary'
|
||||||
).click()
|
).click();
|
||||||
cy.get(
|
cy.get(
|
||||||
'.default-importing-wizard-header input[bind="projectNameInput"]'
|
'.default-importing-wizard-header input[bind="projectNameInput"]'
|
||||||
).should('have.value', 'food mini csv')
|
).should('have.value', 'food mini csv');
|
||||||
|
|
||||||
// then ensure we are on the preview page
|
// then ensure we are on the preview page
|
||||||
cy.get('.create-project-ui-panel').contains('Configure Parsing Options')
|
cy.get('.create-project-ui-panel').contains('Configure Parsing Options');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test project naming', function () {
|
it('Test project naming', function () {
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.createProjectThroughUserInterface('food.mini.csv')
|
cy.createProjectThroughUserInterface('food.mini.csv');
|
||||||
cy.get('.create-project-ui-panel').contains('Configure Parsing Options')
|
cy.get('.create-project-ui-panel').contains('Configure Parsing Options');
|
||||||
cy.get(
|
cy.get(
|
||||||
'.default-importing-wizard-header input[bind="projectNameInput"]'
|
'.default-importing-wizard-header input[bind="projectNameInput"]'
|
||||||
).type('this is a test')
|
).type('this is a test');
|
||||||
cy.doCreateProjectThroughUserInterface()
|
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 () {
|
it('Test project tagging', function () {
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.createProjectThroughUserInterface('food.mini.csv')
|
cy.createProjectThroughUserInterface('food.mini.csv');
|
||||||
cy.get('.create-project-ui-panel').contains('Configure Parsing Options')
|
cy.get('.create-project-ui-panel').contains('Configure Parsing Options');
|
||||||
const uniqueProjectName = Date.now()
|
const uniqueProjectName = Date.now();
|
||||||
const uniqueTagName1 = 'tag1_' + Date.now()
|
const uniqueTagName1 = 'tag1_' + Date.now();
|
||||||
const uniqueTagName2 = 'tag2_' + Date.now()
|
const uniqueTagName2 = 'tag2_' + Date.now();
|
||||||
|
|
||||||
cy.get(
|
cy.get(
|
||||||
'.default-importing-wizard-header input[bind="projectNameInput"]'
|
'.default-importing-wizard-header input[bind="projectNameInput"]'
|
||||||
).type(uniqueProjectName)
|
).type(uniqueProjectName);
|
||||||
// triger the select input
|
// triger the select input
|
||||||
cy.get('#project-tags-container').click()
|
cy.get('#project-tags-container').click();
|
||||||
// Type and Validate the tag, pressing enter
|
// Type and Validate the tag, pressing enter
|
||||||
cy.get('#project-tags-container .select2-input').type(uniqueTagName1)
|
cy.get('#project-tags-container .select2-input').type(uniqueTagName1);
|
||||||
cy.get('body').type('{enter}')
|
cy.get('body').type('{enter}');
|
||||||
cy.get('#project-tags-container .select2-input').type(uniqueTagName2)
|
cy.get('#project-tags-container .select2-input').type(uniqueTagName2);
|
||||||
cy.get('body').type('{enter}')
|
cy.get('body').type('{enter}');
|
||||||
cy.get('#or-import-parsopt').click()
|
cy.get('#or-import-parsopt').click();
|
||||||
cy.doCreateProjectThroughUserInterface()
|
cy.doCreateProjectThroughUserInterface();
|
||||||
|
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project');
|
||||||
cy.get('#projects-list')
|
cy.get('#projects-list')
|
||||||
.contains(uniqueProjectName)
|
.contains(uniqueProjectName)
|
||||||
.parent()
|
.parent()
|
||||||
.parent()
|
.parent()
|
||||||
.contains(uniqueTagName1)
|
.contains(uniqueTagName1);
|
||||||
cy.get('#projects-list')
|
cy.get('#projects-list')
|
||||||
.contains(uniqueProjectName)
|
.contains(uniqueProjectName)
|
||||||
.parent()
|
.parent()
|
||||||
.parent()
|
.parent()
|
||||||
.contains(uniqueTagName2)
|
.contains(uniqueTagName2);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('E2E, Creates a simple project, based on a CSV', function () {
|
it('E2E, Creates a simple project, based on a CSV', function () {
|
||||||
// navigate to the create page
|
// navigate to the create page
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.navigateTo('Create Project')
|
cy.navigateTo('Create Project');
|
||||||
// add file
|
// add file
|
||||||
const csvFile = {
|
const csvFile = {
|
||||||
filePath: 'food.mini.csv',
|
filePath: 'food.mini.csv',
|
||||||
mimeType: 'application/csv',
|
mimeType: 'application/csv',
|
||||||
}
|
};
|
||||||
cy.get(
|
cy.get(
|
||||||
'.create-project-ui-source-selection-tab-body.selected input[type="file"]'
|
'.create-project-ui-source-selection-tab-body.selected input[type="file"]'
|
||||||
).attachFile(csvFile)
|
).attachFile(csvFile);
|
||||||
cy.get(
|
cy.get(
|
||||||
'.create-project-ui-source-selection-tab-body.selected button.button-primary'
|
'.create-project-ui-source-selection-tab-body.selected button.button-primary'
|
||||||
).click()
|
).click();
|
||||||
|
|
||||||
// preview and click next
|
// preview and click next
|
||||||
cy.get(
|
cy.get(
|
||||||
'.default-importing-wizard-header button[bind="nextButton"]'
|
'.default-importing-wizard-header button[bind="nextButton"]'
|
||||||
).click()
|
).click();
|
||||||
cy.get('#create-project-progress-message').contains('Done.')
|
cy.get('#create-project-progress-message').contains('Done.');
|
||||||
|
|
||||||
// workaround to ensure project is loaded
|
// workaround to ensure project is loaded
|
||||||
// cypress does not support window.location = ...
|
// cypress does not support window.location = ...
|
||||||
cy.get('h2').contains('HTTP ERROR 404')
|
cy.get('h2').contains('HTTP ERROR 404');
|
||||||
cy.location().should((location) => {
|
cy.location().should((location) => {
|
||||||
expect(location.href).contains(
|
expect(location.href).contains(
|
||||||
Cypress.env('OPENREFINE_URL') + '/__/project?'
|
Cypress.env('OPENREFINE_URL') + '/__/project?'
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
cy.location().then((location) => {
|
cy.location().then((location) => {
|
||||||
const projectId = location.href.split('=').slice(-1)[0]
|
const projectId = location.href.split('=').slice(-1)[0];
|
||||||
cy.visitProject(projectId)
|
cy.visitProject(projectId);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,47 +1,45 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Check the layout for importing a project', function () {
|
it('Check the layout for importing a project', function () {
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.navigateTo('Import Project')
|
cy.navigateTo('Import Project');
|
||||||
cy.get('.grid-layout').contains(
|
cy.get('.grid-layout').contains('Locate an existing Refine project file');
|
||||||
'Locate an existing Refine project file'
|
});
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Import a project', function () {
|
it('Import a project', function () {
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.navigateTo('Import Project')
|
cy.navigateTo('Import Project');
|
||||||
// make sure the dataset was loaded properly
|
// make sure the dataset was loaded properly
|
||||||
const projectFile = {
|
const projectFile = {
|
||||||
filePath: 'food-small-csv.openrefine.tar.zip',
|
filePath: 'food-small-csv.openrefine.tar.zip',
|
||||||
mimeType: 'application/gzip',
|
mimeType: 'application/gzip',
|
||||||
}
|
};
|
||||||
cy.get('#project-upload-form input#project-tar-file-input').attachFile(
|
cy.get('#project-upload-form input#project-tar-file-input').attachFile(
|
||||||
projectFile
|
projectFile
|
||||||
)
|
);
|
||||||
cy.get('#project-upload-form').submit()
|
cy.get('#project-upload-form').submit();
|
||||||
|
|
||||||
// ensure is loaded
|
// ensure is loaded
|
||||||
cy.get('div[bind="summaryBarDiv"]').contains('199 rows')
|
cy.get('div[bind="summaryBarDiv"]').contains('199 rows');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Import a project, test the renaming', function () {
|
it('Import a project, test the renaming', function () {
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.navigateTo('Import Project')
|
cy.navigateTo('Import Project');
|
||||||
// make sure the dataset was loaded properly
|
// make sure the dataset was loaded properly
|
||||||
const projectFile = {
|
const projectFile = {
|
||||||
filePath: 'food-small-csv.openrefine.tar.zip',
|
filePath: 'food-small-csv.openrefine.tar.zip',
|
||||||
mimeType: 'application/gzip',
|
mimeType: 'application/gzip',
|
||||||
}
|
};
|
||||||
cy.get('#project-upload-form input#project-tar-file-input').attachFile(
|
cy.get('#project-upload-form input#project-tar-file-input').attachFile(
|
||||||
projectFile
|
projectFile
|
||||||
)
|
);
|
||||||
|
|
||||||
// rename
|
// rename
|
||||||
const projectName = Date.now()
|
const projectName = Date.now();
|
||||||
cy.get('#project-name-input').type(projectName)
|
cy.get('#project-name-input').type(projectName);
|
||||||
cy.get('#project-upload-form').submit()
|
cy.get('#project-upload-form').submit();
|
||||||
|
|
||||||
// ensure is loaded
|
// ensure is loaded
|
||||||
cy.get('#project-name-button').contains(projectName)
|
cy.get('#project-name-button').contains(projectName);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Check elements on the langage page', function () {
|
it('Check elements on the langage page', function () {
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.get('.main-layout-panel').contains('Select preferred language')
|
cy.get('.main-layout-panel').contains('Select preferred language');
|
||||||
cy.get('select#langDD').should('exist')
|
cy.get('select#langDD').should('exist');
|
||||||
cy.get('#set-lang-button').should('exist')
|
cy.get('#set-lang-button').should('exist');
|
||||||
})
|
});
|
||||||
|
|
||||||
// This test can't be implemented
|
// This test can't be implemented
|
||||||
// It's changing the UI for all subsequent tests
|
// It's changing the UI for all subsequent tests
|
||||||
// If it fails, the interface will remains in German, making subsequent tests fails
|
// If it fails, the interface will remains in German, making subsequent tests fails
|
||||||
// it('Change the langage', function () {
|
// it('Change the langage', function () {
|
||||||
// cy.visitOpenRefine();
|
// cy.visitOpenRefine();
|
||||||
// cy.navigateTo('Language Settings');
|
// cy.navigateTo('Language Settings');
|
||||||
// cy.get('#langDD').select('de');
|
// cy.get('#langDD').select('de');
|
||||||
// cy.get('#set-lang-button').click();
|
// cy.get('#set-lang-button').click();
|
||||||
// cy.get('#slogan').contains('Ein leistungsstarkes Werkzeug für die Bearbeitung von ungeordneten Daten.');
|
// cy.get('#slogan').contains('Ein leistungsstarkes Werkzeug für die Bearbeitung von ungeordneten Daten.');
|
||||||
// });
|
// });
|
||||||
})
|
});
|
||||||
|
@ -1,43 +1,39 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('List an existing project tag, ensure a newly created project tag is created and displayed', function () {
|
it('List an existing project tag, ensure a newly created project tag is created and displayed', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now();
|
||||||
cy.loadProject('food.mini', projectName, 'TestTag')
|
cy.loadProject('food.mini', projectName, 'TestTag');
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project');
|
||||||
cy.get('#projects-list table').contains(projectName)
|
cy.get('#projects-list table').contains(projectName);
|
||||||
cy.get('#projects-list table').contains('TestTag')
|
cy.get('#projects-list table').contains('TestTag');
|
||||||
})
|
});
|
||||||
it('Ensure all project tags are created and displayed as filter', function () {
|
it('Ensure all project tags are created and displayed as filter', function () {
|
||||||
const project1 = 'Project A'
|
const project1 = 'Project A';
|
||||||
const project2 = 'Project B'
|
const project2 = 'Project B';
|
||||||
cy.loadProject('food.mini', project1, 'TestTagOne')
|
cy.loadProject('food.mini', project1, 'TestTagOne');
|
||||||
cy.loadProject('food.mini', project2, 'TestTagTwo')
|
cy.loadProject('food.mini', project2, 'TestTagTwo');
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project');
|
||||||
cy.get('#projects-list table').contains(project1)
|
cy.get('#projects-list table').contains(project1);
|
||||||
cy.get('#projects-list table').contains('TestTagOne')
|
cy.get('#projects-list table').contains('TestTagOne');
|
||||||
cy.get('#projectTags ul').children().should('contain', 'TestTagOne')
|
cy.get('#projectTags ul').children().should('contain', 'TestTagOne');
|
||||||
cy.get('#projectTags ul').children().should('contain', 'TestTagTwo')
|
cy.get('#projectTags ul').children().should('contain', 'TestTagTwo');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Ensure projects are being filtered through tags', function () {
|
it('Ensure projects are being filtered through tags', function () {
|
||||||
const project1 = 'Project A'
|
const project1 = 'Project A';
|
||||||
const project2 = 'Project B'
|
const project2 = 'Project B';
|
||||||
cy.loadProject('food.mini', project1, 'TestTagOne')
|
cy.loadProject('food.mini', project1, 'TestTagOne');
|
||||||
cy.loadProject('food.mini', project2, 'TestTagTwo')
|
cy.loadProject('food.mini', project2, 'TestTagTwo');
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project');
|
||||||
cy.get('#projects-list table').contains(project1)
|
cy.get('#projects-list table').contains(project1);
|
||||||
cy.get('#projects-list table').contains('TestTagOne')
|
cy.get('#projects-list table').contains('TestTagOne');
|
||||||
cy.get('#projectTags ul').children().contains('TestTagOne').click()
|
cy.get('#projectTags ul').children().contains('TestTagOne').click();
|
||||||
cy.get('#projects-list table')
|
cy.get('#projects-list table').contains(project2).should('not.be.visible');
|
||||||
.contains(project2)
|
cy.get('#projects-list table').contains(project1).should('be.visible');
|
||||||
.should('not.be.visible')
|
cy.get('#projectTags ul').children().contains('TestTagTwo').click();
|
||||||
cy.get('#projects-list table').contains(project1).should('be.visible')
|
cy.get('#projects-list table').contains(project2).should('be.visible');
|
||||||
cy.get('#projectTags ul').children().contains('TestTagTwo').click()
|
cy.get('#projects-list table').contains(project1).should('not.be.visible');
|
||||||
cy.get('#projects-list table').contains(project2).should('be.visible')
|
});
|
||||||
cy.get('#projects-list table')
|
});
|
||||||
.contains(project1)
|
|
||||||
.should('not.be.visible')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
@ -1,74 +1,72 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('List an existing project, ensure a newly created project is displayed', function () {
|
it('List an existing project, ensure a newly created project is displayed', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now();
|
||||||
cy.loadProject('food.mini', projectName)
|
cy.loadProject('food.mini', projectName);
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project');
|
||||||
cy.get('#projects-list table').should('contain', projectName)
|
cy.get('#projects-list table').should('contain', projectName);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Visit a project from the Open project page, ensure link is working', function () {
|
it('Visit a project from the Open project page, ensure link is working', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now();
|
||||||
cy.loadProject('food.mini', projectName)
|
cy.loadProject('food.mini', projectName);
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project');
|
||||||
cy.get('#projects-list table').contains(projectName).click()
|
cy.get('#projects-list table').contains(projectName).click();
|
||||||
cy.get('#project-name-button').should('contain', projectName)
|
cy.get('#project-name-button').should('contain', projectName);
|
||||||
})
|
});
|
||||||
it('Ensure projects are sorted on basis of names', function () {
|
it('Ensure projects are sorted on basis of names', function () {
|
||||||
const projectName = 'projectA'
|
const projectName = 'projectA';
|
||||||
const projectName2 = 'projectZ'
|
const projectName2 = 'projectZ';
|
||||||
var positionA, positionZ
|
let positionA;
|
||||||
cy.loadProject('food.mini', projectName)
|
let positionZ;
|
||||||
cy.loadProject('food.mini', projectName2)
|
cy.loadProject('food.mini', projectName);
|
||||||
cy.visitOpenRefine()
|
cy.loadProject('food.mini', projectName2);
|
||||||
cy.navigateTo('Open Project')
|
cy.visitOpenRefine();
|
||||||
cy.get('#projects-list table').contains('Name').click()
|
cy.navigateTo('Open Project');
|
||||||
// cy.get('#projects-list tbody>tr').eq(0).should('contain','projectA');
|
cy.get('#projects-list table').contains('Name').click();
|
||||||
// cy.get('#projects-list table').contains("Name").click();
|
// cy.get('#projects-list tbody>tr').eq(0).should('contain','projectA');
|
||||||
// cy.get('#projects-list tbody>tr').eq(0).should('contain', 'projectZ');
|
// cy.get('#projects-list table').contains("Name").click();
|
||||||
// hack since all projects are not being deleted
|
// cy.get('#projects-list tbody>tr').eq(0).should('contain', 'projectZ');
|
||||||
|
// hack since all projects are not being deleted
|
||||||
|
|
||||||
|
cy.get('a.project-name')
|
||||||
|
.contains('projectA')
|
||||||
|
.then((projectALink) => {
|
||||||
cy.get('a.project-name')
|
cy.get('a.project-name')
|
||||||
.contains('projectA')
|
.contains('projectZ')
|
||||||
.then((projectALink) => {
|
.then((projectZLink) => {
|
||||||
cy.get('a.project-name')
|
positionA = projectALink.parent().parent().index();
|
||||||
.contains('projectZ')
|
positionZ = projectZLink.parent().parent().index();
|
||||||
.then((projectZLink) => {
|
expect(positionA).to.be.lessThan(positionZ);
|
||||||
positionA = projectALink.parent().parent().index()
|
});
|
||||||
positionZ = projectZLink.parent().parent().index()
|
});
|
||||||
expect(positionA).to.be.lessThan(positionZ)
|
cy.get('#projects-list table').contains('Name').click();
|
||||||
})
|
cy.get('a.project-name')
|
||||||
})
|
.contains('projectA')
|
||||||
cy.get('#projects-list table').contains('Name').click()
|
.then((projectALink) => {
|
||||||
cy.get('a.project-name')
|
cy.get('a.project-name')
|
||||||
.contains('projectA')
|
.contains('projectZ')
|
||||||
.then((projectALink) => {
|
.then((projectZLink) => {
|
||||||
cy.get('a.project-name')
|
positionA = projectALink.parent().parent().index();
|
||||||
.contains('projectZ')
|
positionZ = projectZLink.parent().parent().index();
|
||||||
.then((projectZLink) => {
|
expect(positionA).to.be.greaterThan(positionZ);
|
||||||
positionA = projectALink.parent().parent().index()
|
});
|
||||||
positionZ = projectZLink.parent().parent().index()
|
});
|
||||||
expect(positionA).to.be.greaterThan(positionZ)
|
});
|
||||||
})
|
it('Ensure project is deleted from database as well as UI', function () {
|
||||||
})
|
const projectName = Date.now();
|
||||||
})
|
cy.loadProject('food.mini', projectName);
|
||||||
it('Ensure project is deleted from database as well as UI', function () {
|
cy.visitOpenRefine();
|
||||||
const projectName = Date.now()
|
cy.navigateTo('Open Project');
|
||||||
cy.loadProject('food.mini', projectName)
|
cy.contains('td', projectName).siblings().find('.delete-project').click();
|
||||||
cy.visitOpenRefine()
|
cy.get('#projects-list').should('not.contain', projectName);
|
||||||
cy.navigateTo('Open Project')
|
cy.request(
|
||||||
cy.contains('td', projectName)
|
'GET',
|
||||||
.siblings()
|
'http://127.0.0.1:3333/command/core/get-all-project-metadata'
|
||||||
.find('.delete-project')
|
).then((response) => {
|
||||||
.click()
|
const responseText = JSON.stringify(response.body);
|
||||||
cy.get('#projects-list').should('not.contain', projectName)
|
expect(responseText).to.not.have.string(projectName);
|
||||||
cy.request(
|
});
|
||||||
'GET',
|
});
|
||||||
'http://127.0.0.1:3333/command/core/get-all-project-metadata'
|
});
|
||||||
).then((response) => {
|
|
||||||
var responseText = JSON.stringify(response.body)
|
|
||||||
expect(responseText).to.not.have.string(projectName)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Open an existing project by visiting the URL directly', function () {
|
it('Open an existing project by visiting the URL directly', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now();
|
||||||
cy.loadProject('food.mini', projectName).then((projectId) => {
|
cy.loadProject('food.mini', projectName).then((projectId) => {
|
||||||
cy.visitProject(projectId)
|
cy.visitProject(projectId);
|
||||||
cy.get('#project-name-button').contains(projectName)
|
cy.get('#project-name-button').contains(projectName);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,39 +1,39 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Edit a preference', function () {
|
it('Edit a preference', function () {
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
const testPreferenceName = 'PreferenceName_' + Date.now()
|
const testPreferenceName = 'PreferenceName_' + Date.now();
|
||||||
const testPreferenceValue = 'PreferenceValue_' + 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('#project-links a').contains('Preferences').click();
|
||||||
cy.get('table.preferences tr').contains(testPreferenceName)
|
cy.get('table.preferences tr').contains(testPreferenceName);
|
||||||
|
|
||||||
cy.window().then(($win) => {
|
cy.window().then(($win) => {
|
||||||
cy.stub($win, 'prompt').returns(testPreferenceValue + '_Edited')
|
cy.stub($win, 'prompt').returns(testPreferenceValue + '_Edited');
|
||||||
cy.get('table.preferences tr')
|
cy.get('table.preferences tr')
|
||||||
.contains(testPreferenceName)
|
.contains(testPreferenceName)
|
||||||
.parentsUntil('tbody')
|
.parentsUntil('tbody')
|
||||||
.find('td:last-child button:first-child')
|
.find('td:last-child button:first-child')
|
||||||
.click()
|
.click();
|
||||||
})
|
});
|
||||||
|
|
||||||
cy.get('table.preferences tr').contains(testPreferenceValue + '_Edited')
|
cy.get('table.preferences tr').contains(testPreferenceValue + '_Edited');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Add a new preference', function () {
|
it('Add a new preference', function () {
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.get('#project-links a').contains('Preferences').click()
|
cy.get('#project-links a').contains('Preferences').click();
|
||||||
|
|
||||||
const testPreferenceName = Date.now()
|
const testPreferenceName = Date.now();
|
||||||
|
|
||||||
cy.window().then(($win) => {
|
cy.window().then(($win) => {
|
||||||
cy.stub($win, 'prompt').returns(testPreferenceName)
|
cy.stub($win, 'prompt').returns(testPreferenceName);
|
||||||
cy.get('table.preferences tr:last-child button.button').click()
|
cy.get('table.preferences tr:last-child button.button').click();
|
||||||
})
|
});
|
||||||
|
|
||||||
cy.get('table.preferences tr:nth-last-child(2)').contains(
|
cy.get('table.preferences tr:nth-last-child(2)').contains(
|
||||||
testPreferenceName
|
testPreferenceName
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,28 +1,28 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensure cells are blanked down', function () {
|
it('Ensure cells are blanked down', function () {
|
||||||
const fixture = [
|
const fixture = [
|
||||||
['a', 'b', 'c'],
|
['a', 'b', 'c'],
|
||||||
|
|
||||||
['0a', 'identical', '0c'],
|
['0a', 'identical', '0c'],
|
||||||
['1a', 'identical', '1c'],
|
['1a', 'identical', '1c'],
|
||||||
['2a', '2b', '2c'],
|
['2a', '2b', '2c'],
|
||||||
['3a', 'also identical', '3c'],
|
['3a', 'also identical', '3c'],
|
||||||
['4a', 'also identical', '4c'],
|
['4a', 'also identical', '4c'],
|
||||||
['5a', 'also identical', '5c'],
|
['5a', 'also identical', '5c'],
|
||||||
]
|
];
|
||||||
|
|
||||||
cy.loadAndVisitProject(fixture)
|
cy.loadAndVisitProject(fixture);
|
||||||
|
|
||||||
// click
|
// click
|
||||||
cy.columnActionClick('b', ['Edit cells', 'Blank down'])
|
cy.columnActionClick('b', ['Edit cells', 'Blank down']);
|
||||||
|
|
||||||
// ensure notification and cell content
|
// ensure notification and cell content
|
||||||
cy.assertNotificationContainingText('Blank down 3 cells')
|
cy.assertNotificationContainingText('Blank down 3 cells');
|
||||||
cy.assertCellEquals(0, 'b', 'identical') // untouched
|
cy.assertCellEquals(0, 'b', 'identical'); // untouched
|
||||||
cy.assertCellEquals(1, 'b', null) // blanked
|
cy.assertCellEquals(1, 'b', null); // blanked
|
||||||
cy.assertCellEquals(2, 'b', '2b') // untouched
|
cy.assertCellEquals(2, 'b', '2b'); // untouched
|
||||||
cy.assertCellEquals(3, 'b', 'also identical') // untouched
|
cy.assertCellEquals(3, 'b', 'also identical'); // untouched
|
||||||
cy.assertCellEquals(4, 'b', null) // blanked
|
cy.assertCellEquals(4, 'b', null); // blanked
|
||||||
cy.assertCellEquals(5, 'b', null) // blanked
|
cy.assertCellEquals(5, 'b', null); // blanked
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensure multiple whitespaces are collapsed', function () {
|
it('Ensure multiple whitespaces are collapsed', function () {
|
||||||
const fixture = [
|
const fixture = [
|
||||||
['NDB_No', 'Shrt_Desc'],
|
['NDB_No', 'Shrt_Desc'],
|
||||||
['01001', 'THIS IS A TEST'],
|
['01001', 'THIS IS A TEST'],
|
||||||
['01002', 'THIS IS ANOTHER TEST'],
|
['01002', 'THIS IS ANOTHER TEST'],
|
||||||
['01003', 'THIS IS a THIRD TEST'],
|
['01003', 'THIS IS a THIRD TEST'],
|
||||||
]
|
];
|
||||||
cy.loadAndVisitProject(fixture)
|
cy.loadAndVisitProject(fixture);
|
||||||
|
|
||||||
cy.columnActionClick('Shrt_Desc', [
|
cy.columnActionClick('Shrt_Desc', [
|
||||||
'Edit cells',
|
'Edit cells',
|
||||||
'Common transforms',
|
'Common transforms',
|
||||||
'Collapse consecutive whitespace',
|
'Collapse consecutive whitespace',
|
||||||
])
|
]);
|
||||||
|
|
||||||
// Check notification and cell content
|
// Check notification and cell content
|
||||||
cy.assertNotificationContainingText('Text transform on 2 cells')
|
cy.assertNotificationContainingText('Text transform on 2 cells');
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'THIS IS A TEST')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'THIS IS A TEST');
|
||||||
cy.assertCellEquals(1, 'Shrt_Desc', 'THIS IS ANOTHER TEST')
|
cy.assertCellEquals(1, 'Shrt_Desc', 'THIS IS ANOTHER TEST');
|
||||||
cy.assertCellEquals(2, 'Shrt_Desc', 'THIS IS a THIRD TEST')
|
cy.assertCellEquals(2, 'Shrt_Desc', 'THIS IS a THIRD TEST');
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,28 +1,28 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensure only some cells are converted to dates', function () {
|
it('Ensure only some cells are converted to dates', function () {
|
||||||
const fixture = [
|
const fixture = [
|
||||||
['NDB_No', 'A Date'],
|
['NDB_No', 'A Date'],
|
||||||
['01001', '2021-01-01'],
|
['01001', '2021-01-01'],
|
||||||
['01002', '2021-01-01 05:35:15'],
|
['01002', '2021-01-01 05:35:15'],
|
||||||
['01003', 'THIS SHOULD NOT BE TOUCHED'],
|
['01003', 'THIS SHOULD NOT BE TOUCHED'],
|
||||||
]
|
];
|
||||||
cy.loadAndVisitProject(fixture)
|
cy.loadAndVisitProject(fixture);
|
||||||
|
|
||||||
// Update grid
|
// Update grid
|
||||||
cy.columnActionClick('A Date', [
|
cy.columnActionClick('A Date', [
|
||||||
'Edit cells',
|
'Edit cells',
|
||||||
'Common transforms',
|
'Common transforms',
|
||||||
'To date',
|
'To date',
|
||||||
])
|
]);
|
||||||
|
|
||||||
// Check notification and cell content
|
// Check notification and cell content
|
||||||
cy.assertNotificationContainingText('Text transform on 2 cells')
|
cy.assertNotificationContainingText('Text transform on 2 cells');
|
||||||
cy.assertCellEquals(0, 'A Date', '2021-01-01T00:00:00Z')
|
cy.assertCellEquals(0, 'A Date', '2021-01-01T00:00:00Z');
|
||||||
cy.assertCellEquals(1, 'A Date', '2021-01-01T05:35:15Z')
|
cy.assertCellEquals(1, 'A Date', '2021-01-01T05:35:15Z');
|
||||||
cy.assertCellEquals(2, 'A Date', 'THIS SHOULD NOT BE TOUCHED')
|
cy.assertCellEquals(2, 'A Date', 'THIS SHOULD NOT BE TOUCHED');
|
||||||
|
|
||||||
// ensure cells are marked as non-string
|
// ensure cells are marked as non-string
|
||||||
cy.assertCellNotString(0, 'A Date')
|
cy.assertCellNotString(0, 'A Date');
|
||||||
cy.assertCellNotString(1, 'A Date')
|
cy.assertCellNotString(1, 'A Date');
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,52 +1,52 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensure some cells are converted to numbers, and some remains untouched (int)', function () {
|
it('Ensure some cells are converted to numbers, and some remains untouched (int)', function () {
|
||||||
const fixture = [
|
const fixture = [
|
||||||
['NDB_No', 'A Number'],
|
['NDB_No', 'A Number'],
|
||||||
['01001', 'This is not a number'],
|
['01001', 'This is not a number'],
|
||||||
['01002', '42'],
|
['01002', '42'],
|
||||||
['01003', '43'],
|
['01003', '43'],
|
||||||
]
|
];
|
||||||
cy.loadAndVisitProject(fixture)
|
cy.loadAndVisitProject(fixture);
|
||||||
|
|
||||||
// click
|
// click
|
||||||
cy.columnActionClick('A Number', [
|
cy.columnActionClick('A Number', [
|
||||||
'Edit cells',
|
'Edit cells',
|
||||||
'Common transforms',
|
'Common transforms',
|
||||||
'To number',
|
'To number',
|
||||||
])
|
]);
|
||||||
|
|
||||||
// Ensure notification and cell content
|
// Ensure notification and cell content
|
||||||
cy.assertNotificationContainingText('Text transform on 2 cells')
|
cy.assertNotificationContainingText('Text transform on 2 cells');
|
||||||
cy.assertCellEquals(0, 'A Number', 'This is not a number')
|
cy.assertCellEquals(0, 'A Number', 'This is not a number');
|
||||||
cy.assertCellEquals(1, 'A Number', '42')
|
cy.assertCellEquals(1, 'A Number', '42');
|
||||||
cy.assertCellEquals(2, 'A Number', '43')
|
cy.assertCellEquals(2, 'A Number', '43');
|
||||||
|
|
||||||
// Ensure a numeric type is applied to the cell
|
// Ensure a numeric type is applied to the cell
|
||||||
cy.assertCellNotString(1, 'A Number')
|
cy.assertCellNotString(1, 'A Number');
|
||||||
cy.assertCellNotString(2, 'A Number')
|
cy.assertCellNotString(2, 'A Number');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Ensure toNumber works with floats', function () {
|
it('Ensure toNumber works with floats', function () {
|
||||||
const fixture = [
|
const fixture = [
|
||||||
['NDB_No', 'A Number'],
|
['NDB_No', 'A Number'],
|
||||||
['01001', '42.2'],
|
['01001', '42.2'],
|
||||||
['01002', '43.5'],
|
['01002', '43.5'],
|
||||||
['01002', '43.50000'],
|
['01002', '43.50000'],
|
||||||
['01002', '43.500001'],
|
['01002', '43.500001'],
|
||||||
]
|
];
|
||||||
cy.loadAndVisitProject(fixture)
|
cy.loadAndVisitProject(fixture);
|
||||||
|
|
||||||
// click
|
// click
|
||||||
cy.columnActionClick('A Number', [
|
cy.columnActionClick('A Number', [
|
||||||
'Edit cells',
|
'Edit cells',
|
||||||
'Common transforms',
|
'Common transforms',
|
||||||
'To number',
|
'To number',
|
||||||
])
|
]);
|
||||||
|
|
||||||
// Ensure cell content
|
// Ensure cell content
|
||||||
cy.assertCellEquals(0, 'A Number', '42.2')
|
cy.assertCellEquals(0, 'A Number', '42.2');
|
||||||
cy.assertCellEquals(1, 'A Number', '43.5')
|
cy.assertCellEquals(1, 'A Number', '43.5');
|
||||||
cy.assertCellEquals(2, 'A Number', '43.5')
|
cy.assertCellEquals(2, 'A Number', '43.5');
|
||||||
cy.assertCellEquals(3, 'A Number', '43.500001')
|
cy.assertCellEquals(3, 'A Number', '43.500001');
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensure multiple leading/tailing whitespaces are trimmed', function () {
|
it('Ensure multiple leading/tailing whitespaces are trimmed', function () {
|
||||||
const fixture = [
|
const fixture = [
|
||||||
['NDB_No', 'A column'],
|
['NDB_No', 'A column'],
|
||||||
['01001', 'TEST'],
|
['01001', 'TEST'],
|
||||||
]
|
];
|
||||||
|
|
||||||
cy.loadAndVisitProject(fixture)
|
cy.loadAndVisitProject(fixture);
|
||||||
cy.editCell(0, 'A column', ' TEST ')
|
cy.editCell(0, 'A column', ' TEST ');
|
||||||
|
|
||||||
cy.columnActionClick('A column', [
|
cy.columnActionClick('A column', [
|
||||||
'Edit cells',
|
'Edit cells',
|
||||||
'Common transforms',
|
'Common transforms',
|
||||||
'Trim leading and trailing whitespace',
|
'Trim leading and trailing whitespace',
|
||||||
])
|
]);
|
||||||
|
|
||||||
// ensure notification and cell content
|
// ensure notification and cell content
|
||||||
cy.assertNotificationContainingText('Text transform on 1 cells')
|
cy.assertNotificationContainingText('Text transform on 1 cells');
|
||||||
cy.assertCellEquals(0, 'A column', 'TEST')
|
cy.assertCellEquals(0, 'A column', 'TEST');
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensure escaped html entities are unescaped', function () {
|
it('Ensure escaped html entities are unescaped', function () {
|
||||||
const fixture = [
|
const fixture = [
|
||||||
['NDB_No', 'A column'],
|
['NDB_No', 'A column'],
|
||||||
['01001', '<img src="test" />'],
|
['01001', '<img src="test" />'],
|
||||||
['01001', '<img src="test" />'],
|
['01001', '<img src="test" />'],
|
||||||
]
|
];
|
||||||
|
|
||||||
cy.loadAndVisitProject(fixture, 'ok')
|
cy.loadAndVisitProject(fixture, 'ok');
|
||||||
|
|
||||||
cy.columnActionClick('A column', [
|
cy.columnActionClick('A column', [
|
||||||
'Edit cells',
|
'Edit cells',
|
||||||
'Common transforms',
|
'Common transforms',
|
||||||
'Unescape HTML entities',
|
'Unescape HTML entities',
|
||||||
])
|
]);
|
||||||
|
|
||||||
// ensure notification and cell content
|
// ensure notification and cell content
|
||||||
cy.assertNotificationContainingText('Text transform on 1 cells')
|
cy.assertNotificationContainingText('Text transform on 1 cells');
|
||||||
cy.assertCellEquals(0, 'A column', '<img src="test" />')
|
cy.assertCellEquals(0, 'A column', '<img src="test" />');
|
||||||
cy.assertCellEquals(1, 'A column', '<img src="test" />')
|
cy.assertCellEquals(1, 'A column', '<img src="test" />');
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensure cells are filled down', function () {
|
it('Ensure cells are filled down', function () {
|
||||||
const fixture = [
|
const fixture = [
|
||||||
['a', 'b', 'c'],
|
['a', 'b', 'c'],
|
||||||
|
|
||||||
['0a', '0b', '0c'],
|
['0a', '0b', '0c'],
|
||||||
['1a', null, '1c'],
|
['1a', null, '1c'],
|
||||||
['2a', '2b', '2c'],
|
['2a', '2b', '2c'],
|
||||||
['3a', null, '3c'],
|
['3a', null, '3c'],
|
||||||
['4a', null, '4c'],
|
['4a', null, '4c'],
|
||||||
['5a', '5b', '5c'],
|
['5a', '5b', '5c'],
|
||||||
]
|
];
|
||||||
|
|
||||||
cy.loadAndVisitProject(fixture)
|
cy.loadAndVisitProject(fixture);
|
||||||
// click
|
// click
|
||||||
cy.columnActionClick('b', ['Edit cells', 'Fill down'])
|
cy.columnActionClick('b', ['Edit cells', 'Fill down']);
|
||||||
|
|
||||||
// ensure notification and cell content
|
// ensure notification and cell content
|
||||||
cy.assertNotificationContainingText('Fill down 3 cells in column b')
|
cy.assertNotificationContainingText('Fill down 3 cells in column b');
|
||||||
cy.assertCellEquals(0, 'b', '0b') // untouched
|
cy.assertCellEquals(0, 'b', '0b'); // untouched
|
||||||
cy.assertCellEquals(1, 'b', '0b') // filled
|
cy.assertCellEquals(1, 'b', '0b'); // filled
|
||||||
cy.assertCellEquals(2, 'b', '2b') // untouched
|
cy.assertCellEquals(2, 'b', '2b'); // untouched
|
||||||
cy.assertCellEquals(3, 'b', '2b') // filled
|
cy.assertCellEquals(3, 'b', '2b'); // filled
|
||||||
cy.assertCellEquals(4, 'b', '2b') // filled
|
cy.assertCellEquals(4, 'b', '2b'); // filled
|
||||||
cy.assertCellEquals(5, 'b', '5b') // untouched
|
cy.assertCellEquals(5, 'b', '5b'); // untouched
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('A numeric facet must be casted first', function () {
|
it('A numeric facet must be casted first', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('Water', ['Facet', 'Numeric facet'])
|
cy.columnActionClick('Water', ['Facet', 'Numeric facet']);
|
||||||
cy.get('#refine-tabs-facets .facets-container li:first-child').contains(
|
cy.get('#refine-tabs-facets .facets-container li:first-child').contains(
|
||||||
'No numeric value present.'
|
'No numeric value present.'
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Changing the type of the column for numeric', function () {
|
it('Changing the type of the column for numeric', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('Water', ['Facet', 'Numeric facet'])
|
cy.columnActionClick('Water', ['Facet', 'Numeric facet']);
|
||||||
cy.get('#refine-tabs-facets .facets-container li:first-child').contains(
|
cy.get('#refine-tabs-facets .facets-container li:first-child').contains(
|
||||||
'No numeric value present.'
|
'No numeric value present.'
|
||||||
)
|
);
|
||||||
|
|
||||||
cy.get(
|
cy.get(
|
||||||
'#refine-tabs-facets .facets-container li:first-child a[bind="changeButton"]'
|
'#refine-tabs-facets .facets-container li:first-child a[bind="changeButton"]'
|
||||||
).click()
|
).click();
|
||||||
cy.get('.expression-preview-code').type('value.toNumber()')
|
cy.get('.expression-preview-code').type('value.toNumber()');
|
||||||
cy.get('.dialog-footer button').contains('OK').click()
|
cy.get('.dialog-footer button').contains('OK').click();
|
||||||
cy.get('.facet-container .facet-range-body').should('exist')
|
cy.get('.facet-container .facet-range-body').should('exist');
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -3,415 +3,411 @@
|
|||||||
* It's using "text facet" as it is the most simple facet
|
* It's using "text facet" as it is the most simple facet
|
||||||
*/
|
*/
|
||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Verify facets panel (left-panel) appears with no facets yet', function () {
|
it('Verify facets panel (left-panel) appears with no facets yet', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
cy.columnActionClick('Water', ['Facet', 'Text facet']);
|
||||||
cy.get('#refine-tabs-facets')
|
cy.get('#refine-tabs-facets')
|
||||||
.should('exist')
|
.should('exist')
|
||||||
.contains('Using facets and filters')
|
.contains('Using facets and filters');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test the display of multiple facets', function () {
|
it('Test the display of multiple facets', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet']);
|
||||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
cy.columnActionClick('Water', ['Facet', 'Text facet']);
|
||||||
|
|
||||||
cy.getFacetContainer('NDB_No').should('exist')
|
cy.getFacetContainer('NDB_No').should('exist');
|
||||||
cy.getFacetContainer('Shrt_Desc').should('exist')
|
cy.getFacetContainer('Shrt_Desc').should('exist');
|
||||||
cy.getFacetContainer('Water').should('exist')
|
cy.getFacetContainer('Water').should('exist');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test the Remove All button', function () {
|
it('Test the Remove All button', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet']);
|
||||||
cy.get('#refine-tabs-facets .facets-container .facet-container').should(
|
cy.get('#refine-tabs-facets .facets-container .facet-container').should(
|
||||||
'have.length',
|
'have.length',
|
||||||
2
|
2
|
||||||
)
|
);
|
||||||
|
|
||||||
cy.get('#refine-tabs-facets a').contains('Remove All').click()
|
cy.get('#refine-tabs-facets a').contains('Remove All').click();
|
||||||
cy.get('#refine-tabs-facets .facets-container .facet-container').should(
|
cy.get('#refine-tabs-facets .facets-container .facet-container').should(
|
||||||
'have.length',
|
'have.length',
|
||||||
0
|
0
|
||||||
)
|
);
|
||||||
cy.get('#refine-tabs-facets')
|
cy.get('#refine-tabs-facets')
|
||||||
.should('exist')
|
.should('exist')
|
||||||
.contains('Using facets and filters')
|
.contains('Using facets and filters');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test the Reset All button', function () {
|
it('Test the Reset All button', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
cy.columnActionClick('Water', ['Facet', 'Text facet']);
|
||||||
cy.columnActionClick('Energ_Kcal', ['Facet', 'Text facet'])
|
cy.columnActionClick('Energ_Kcal', ['Facet', 'Text facet']);
|
||||||
cy.get('#refine-tabs-facets .facets-container .facet-container').should(
|
cy.get('#refine-tabs-facets .facets-container .facet-container').should(
|
||||||
'have.length',
|
'have.length',
|
||||||
2
|
2
|
||||||
)
|
);
|
||||||
|
|
||||||
// Click to facet 1, select first value
|
// Click to facet 1, select first value
|
||||||
cy.getFacetContainer('Water')
|
cy.getFacetContainer('Water')
|
||||||
.find('.facet-choice:first-child .facet-choice-label')
|
.find('.facet-choice:first-child .facet-choice-label')
|
||||||
.click()
|
.click();
|
||||||
cy.getFacetContainer('Water')
|
cy.getFacetContainer('Water')
|
||||||
.find('.facet-choice:first-child')
|
.find('.facet-choice:first-child')
|
||||||
.should('have.class', 'facet-choice-selected')
|
.should('have.class', 'facet-choice-selected');
|
||||||
|
|
||||||
// Click to facet 2, select first value
|
// Click to facet 2, select first value
|
||||||
cy.getFacetContainer('Energ_Kcal')
|
cy.getFacetContainer('Energ_Kcal')
|
||||||
.find('.facet-choice:first-child .facet-choice-label')
|
.find('.facet-choice:first-child .facet-choice-label')
|
||||||
.click()
|
.click();
|
||||||
cy.getFacetContainer('Energ_Kcal')
|
cy.getFacetContainer('Energ_Kcal')
|
||||||
.find('.facet-choice:first-child')
|
.find('.facet-choice:first-child')
|
||||||
.should('have.class', 'facet-choice-selected')
|
.should('have.class', 'facet-choice-selected');
|
||||||
|
|
||||||
cy.get('#refine-tabs-facets a').contains('Reset All').click()
|
cy.get('#refine-tabs-facets a').contains('Reset All').click();
|
||||||
|
|
||||||
// all facets selections should be gone
|
// all facets selections should be gone
|
||||||
cy.getFacetContainer('Water')
|
cy.getFacetContainer('Water')
|
||||||
.find('.facet-choice:first-child')
|
.find('.facet-choice:first-child')
|
||||||
.should('not.have.class', 'facet-choice-selected')
|
.should('not.have.class', 'facet-choice-selected');
|
||||||
cy.getFacetContainer('Energ_Kcal')
|
cy.getFacetContainer('Energ_Kcal')
|
||||||
.find('.facet-choice:first-child')
|
.find('.facet-choice:first-child')
|
||||||
.should('not.have.class', 'facet-choice-selected')
|
.should('not.have.class', 'facet-choice-selected');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Create a simple text facet, check various elements in a Facet', function () {
|
it('Create a simple text facet, check various elements in a Facet', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
cy.columnActionClick('Water', ['Facet', 'Text facet']);
|
||||||
cy.get('#refine-tabs-facets').should('exist')
|
cy.get('#refine-tabs-facets').should('exist');
|
||||||
|
|
||||||
cy.getFacetContainer('Water').should('exist')
|
cy.getFacetContainer('Water').should('exist');
|
||||||
cy.getFacetContainer('Water').contains('182 choices')
|
cy.getFacetContainer('Water').contains('182 choices');
|
||||||
cy.getFacetContainer('Water').contains('Sort by')
|
cy.getFacetContainer('Water').contains('Sort by');
|
||||||
cy.getFacetContainer('Water').contains('Cluster')
|
cy.getFacetContainer('Water').contains('Cluster');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Delete a facet', function () {
|
it('Delete a facet', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
cy.columnActionClick('Water', ['Facet', 'Text facet']);
|
||||||
|
|
||||||
cy.getFacetContainer('Water').find('a.facet-title-remove').click()
|
cy.getFacetContainer('Water').find('a.facet-title-remove').click();
|
||||||
cy.getFacetContainer('Water').should('not.exist')
|
cy.getFacetContainer('Water').should('not.exist');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test editing a facet ("change")', function () {
|
it('Test editing a facet ("change")', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||||
cy.getFacetContainer('NDB_No')
|
cy.getFacetContainer('NDB_No')
|
||||||
.find('a[bind="changeButton"]')
|
.find('a[bind="changeButton"]')
|
||||||
.contains('change')
|
.contains('change');
|
||||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click();
|
||||||
cy.get('.dialog-container .dialog-header').contains(
|
cy.get('.dialog-container .dialog-header').contains(
|
||||||
`Edit Facet's Expression`
|
`Edit Facet's Expression`
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test editing a facet / Preview', function () {
|
it('Test editing a facet / Preview', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||||
|
|
||||||
// test the tab
|
// test the tab
|
||||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click();
|
||||||
cy.get('.dialog-container #expression-preview-tabs-preview').should(
|
cy.get('.dialog-container #expression-preview-tabs-preview').should(
|
||||||
'be.visible'
|
'be.visible'
|
||||||
)
|
);
|
||||||
// test the content
|
// test the content
|
||||||
cy.get('.dialog-container #expression-preview-tabs-preview').contains(
|
cy.get('.dialog-container #expression-preview-tabs-preview').contains(
|
||||||
'row'
|
'row'
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test editing a facet / History', function () {
|
it('Test editing a facet / History', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click();
|
||||||
|
|
||||||
// test the tab
|
// test the tab
|
||||||
cy.get('.dialog-container a[bind="or_dialog_history"]').click()
|
cy.get('.dialog-container a[bind="or_dialog_history"]').click();
|
||||||
cy.get('.dialog-container #expression-preview-tabs-history').should(
|
cy.get('.dialog-container #expression-preview-tabs-history').should(
|
||||||
'be.visible'
|
'be.visible'
|
||||||
)
|
);
|
||||||
// test the content
|
// test the content
|
||||||
cy.get('.dialog-container #expression-preview-tabs-history').contains(
|
cy.get('.dialog-container #expression-preview-tabs-history').contains(
|
||||||
'Expression'
|
'Expression'
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test editing a facet / Starred', function () {
|
it('Test editing a facet / Starred', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click();
|
||||||
|
|
||||||
// test the tab
|
// test the tab
|
||||||
cy.get('.dialog-container a[bind="or_dialog_starred"]').click()
|
cy.get('.dialog-container a[bind="or_dialog_starred"]').click();
|
||||||
cy.get('.dialog-container #expression-preview-tabs-starred').should(
|
cy.get('.dialog-container #expression-preview-tabs-starred').should(
|
||||||
'be.visible'
|
'be.visible'
|
||||||
)
|
);
|
||||||
// test the content
|
// test the content
|
||||||
cy.get('.dialog-container #expression-preview-tabs-starred').contains(
|
cy.get('.dialog-container #expression-preview-tabs-starred').contains(
|
||||||
'Expression'
|
'Expression'
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test editing a facet / Help', function () {
|
it('Test editing a facet / Help', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('NDB_No', ['Facet', 'Text facet'])
|
cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||||
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click()
|
cy.getFacetContainer('NDB_No').find('a[bind="changeButton"]').click();
|
||||||
|
|
||||||
// test the tab
|
// test the tab
|
||||||
cy.get('.dialog-container a[bind="or_dialog_help"]').click()
|
cy.get('.dialog-container a[bind="or_dialog_help"]').click();
|
||||||
cy.get('.dialog-container #expression-preview-tabs-help').should(
|
cy.get('.dialog-container #expression-preview-tabs-help').should(
|
||||||
'be.visible'
|
'be.visible'
|
||||||
)
|
);
|
||||||
// test the content
|
// test the content
|
||||||
cy.get('.dialog-container #expression-preview-tabs-help').contains(
|
cy.get('.dialog-container #expression-preview-tabs-help').contains(
|
||||||
'Variables'
|
'Variables'
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Create a facet, Sorts, by count', function () {
|
it('Create a facet, Sorts, by count', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
cy.columnActionClick('Water', ['Facet', 'Text facet']);
|
||||||
cy.get('#refine-tabs-facets').should('exist')
|
cy.get('#refine-tabs-facets').should('exist');
|
||||||
|
|
||||||
// Ensure sort should be by name by default
|
// Ensure sort should be by name by default
|
||||||
cy.getFacetContainer('Water').contains('0.24')
|
cy.getFacetContainer('Water').contains('0.24');
|
||||||
cy.getFacetContainer('Water').find('a[bind="sortByCountLink"]').click()
|
cy.getFacetContainer('Water').find('a[bind="sortByCountLink"]').click();
|
||||||
// Sort should now be by count
|
// Sort should now be by count
|
||||||
cy.getFacetContainer('Water').contains('15.87')
|
cy.getFacetContainer('Water').contains('15.87');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Create a facet, Sorts multiple', function () {
|
it('Create a facet, Sorts multiple', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
cy.columnActionClick('Water', ['Facet', 'Text facet']);
|
||||||
cy.get('#refine-tabs-facets').should('exist')
|
cy.get('#refine-tabs-facets').should('exist');
|
||||||
|
|
||||||
// Sort should be by name by default
|
// Sort should be by name by default
|
||||||
cy.getFacetContainer('Water').contains('0.24')
|
cy.getFacetContainer('Water').contains('0.24');
|
||||||
cy.getFacetContainer('Water').find('a[bind="sortByCountLink"]').click()
|
cy.getFacetContainer('Water').find('a[bind="sortByCountLink"]').click();
|
||||||
// Sort should now be by count
|
// Sort should now be by count
|
||||||
cy.getFacetContainer('Water').contains('15.87')
|
cy.getFacetContainer('Water').contains('15.87');
|
||||||
cy.getFacetContainer('Water').find('a[bind="sortByNameLink"]').click()
|
cy.getFacetContainer('Water').find('a[bind="sortByNameLink"]').click();
|
||||||
cy.getFacetContainer('Water').contains('0.24')
|
cy.getFacetContainer('Water').contains('0.24');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test include/exlude filters', function () {
|
it('Test include/exlude filters', function () {
|
||||||
// Because the toggle of include/exclude buttons is unstable
|
// Because the toggle of include/exclude buttons is unstable
|
||||||
// we force include/exclude to be visible
|
// we force include/exclude to be visible
|
||||||
// This test focus solely on ensuring that filters are effectively applied to the grid
|
// This test focus solely on ensuring that filters are effectively applied to the grid
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet']);
|
||||||
|
|
||||||
// force visibility
|
// force visibility
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('.facet-choice-toggle')
|
.find('.facet-choice-toggle')
|
||||||
.invoke('attr', 'style', 'visibility:visible')
|
.invoke('attr', 'style', 'visibility:visible');
|
||||||
|
|
||||||
// include ALLSPICE,GROUND, and check rows
|
// include ALLSPICE,GROUND, and check rows
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('.facet-choice')
|
.find('.facet-choice')
|
||||||
.contains('ALLSPICE,GROUND')
|
.contains('ALLSPICE,GROUND')
|
||||||
.parent()
|
.parent()
|
||||||
.find('.facet-choice-toggle')
|
.find('.facet-choice-toggle')
|
||||||
.click()
|
.click();
|
||||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'ALLSPICE,GROUND')
|
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'ALLSPICE,GROUND');
|
||||||
cy.get('#tool-panel').contains('1 matching rows')
|
cy.get('#tool-panel').contains('1 matching rows');
|
||||||
|
|
||||||
// OR is refreshing facets, need to show the toggle again
|
// OR is refreshing facets, need to show the toggle again
|
||||||
cy.waitForOrOperation()
|
cy.waitForOrOperation();
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('.facet-choice-toggle')
|
.find('.facet-choice-toggle')
|
||||||
.invoke('attr', 'style', 'visibility:visible')
|
.invoke('attr', 'style', 'visibility:visible');
|
||||||
|
|
||||||
// include CELERY SEED, and check rows
|
// include CELERY SEED, and check rows
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('.facet-choice')
|
.find('.facet-choice')
|
||||||
.contains('ANISE SEED')
|
.contains('ANISE SEED')
|
||||||
.parent()
|
.parent()
|
||||||
.find('.facet-choice-toggle')
|
.find('.facet-choice-toggle')
|
||||||
.click()
|
.click();
|
||||||
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'ANISE SEED')
|
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'ANISE SEED');
|
||||||
cy.get('#tool-panel').contains('2 matching rows')
|
cy.get('#tool-panel').contains('2 matching rows');
|
||||||
|
|
||||||
// OR ir refreshing facets, need to show the toggle again
|
// OR ir refreshing facets, need to show the toggle again
|
||||||
cy.waitForOrOperation()
|
cy.waitForOrOperation();
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('.facet-choice-toggle')
|
.find('.facet-choice-toggle')
|
||||||
.invoke('attr', 'style', 'visibility:visible')
|
.invoke('attr', 'style', 'visibility:visible');
|
||||||
|
|
||||||
// include a third one, CELERY SEED, and check rows
|
// include a third one, CELERY SEED, and check rows
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('.facet-choice')
|
.find('.facet-choice')
|
||||||
.contains('BUTTER OIL,ANHYDROUS')
|
.contains('BUTTER OIL,ANHYDROUS')
|
||||||
.parent()
|
.parent()
|
||||||
.find('.facet-choice-toggle')
|
.find('.facet-choice-toggle')
|
||||||
.click()
|
.click();
|
||||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER OIL,ANHYDROUS') // this row is added first
|
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER OIL,ANHYDROUS'); // this row is added first
|
||||||
cy.get('#tool-panel').contains('3 matching rows')
|
cy.get('#tool-panel').contains('3 matching rows');
|
||||||
|
|
||||||
// OR ir refreshing facets, need to show the toggle again
|
// OR ir refreshing facets, need to show the toggle again
|
||||||
cy.waitForOrOperation()
|
cy.waitForOrOperation();
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('.facet-choice-toggle')
|
.find('.facet-choice-toggle')
|
||||||
.invoke('attr', 'style', 'visibility:visible')
|
.invoke('attr', 'style', 'visibility:visible');
|
||||||
|
|
||||||
// EXCLUDE ALLSPICE,GROUND
|
// EXCLUDE ALLSPICE,GROUND
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('.facet-choice')
|
.find('.facet-choice')
|
||||||
.contains('ALLSPICE,GROUND')
|
.contains('ALLSPICE,GROUND')
|
||||||
.parent()
|
.parent()
|
||||||
.find('.facet-choice-toggle')
|
.find('.facet-choice-toggle')
|
||||||
.click()
|
.click();
|
||||||
cy.get('#tool-panel').contains('2 matching rows')
|
cy.get('#tool-panel').contains('2 matching rows');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test include/exclude, invert', function () {
|
it('Test include/exclude, invert', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet']);
|
||||||
|
|
||||||
// do a basic facetting, expect 1 row
|
// do a basic facetting, expect 1 row
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('.facet-choice-toggle')
|
.find('.facet-choice-toggle')
|
||||||
.invoke('attr', 'style', 'visibility:visible')
|
.invoke('attr', 'style', 'visibility:visible');
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('.facet-choice')
|
.find('.facet-choice')
|
||||||
.contains('ALLSPICE,GROUND')
|
.contains('ALLSPICE,GROUND')
|
||||||
.parent()
|
.parent()
|
||||||
.find('.facet-choice-toggle')
|
.find('.facet-choice-toggle')
|
||||||
.click()
|
.click();
|
||||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'ALLSPICE,GROUND')
|
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'ALLSPICE,GROUND');
|
||||||
cy.get('#tool-panel').contains('1 matching rows')
|
cy.get('#tool-panel').contains('1 matching rows');
|
||||||
|
|
||||||
// now invert, expect 198 rows
|
// now invert, expect 198 rows
|
||||||
cy.getFacetContainer('Shrt_Desc').find('a[bind="invertButton"]').click()
|
cy.getFacetContainer('Shrt_Desc').find('a[bind="invertButton"]').click();
|
||||||
cy.waitForOrOperation()
|
cy.waitForOrOperation();
|
||||||
cy.get('#tool-panel').contains('198 matching rows')
|
cy.get('#tool-panel').contains('198 matching rows');
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('a[bind="invertButton"]')
|
.find('a[bind="invertButton"]')
|
||||||
.should('have.class', 'facet-mode-inverted')
|
.should('have.class', 'facet-mode-inverted');
|
||||||
|
|
||||||
// remove invert
|
// remove invert
|
||||||
cy.getFacetContainer('Shrt_Desc').find('a[bind="invertButton"]').click()
|
cy.getFacetContainer('Shrt_Desc').find('a[bind="invertButton"]').click();
|
||||||
cy.waitForOrOperation()
|
cy.waitForOrOperation();
|
||||||
cy.get('#tool-panel').contains('1 matching rows')
|
cy.get('#tool-panel').contains('1 matching rows');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test facet reset', function () {
|
it('Test facet reset', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet']);
|
||||||
|
|
||||||
// do a basic facetting, expect 1 row
|
// do a basic facetting, expect 1 row
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('.facet-choice-toggle')
|
.find('.facet-choice-toggle')
|
||||||
.invoke('attr', 'style', 'visibility:visible')
|
.invoke('attr', 'style', 'visibility:visible');
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('.facet-choice')
|
.find('.facet-choice')
|
||||||
.contains('ALLSPICE,GROUND')
|
.contains('ALLSPICE,GROUND')
|
||||||
.parent()
|
.parent()
|
||||||
.find('.facet-choice-toggle')
|
.find('.facet-choice-toggle')
|
||||||
.click()
|
.click();
|
||||||
cy.get('#tool-panel').contains('1 matching rows')
|
cy.get('#tool-panel').contains('1 matching rows');
|
||||||
|
|
||||||
// now reset, expect 199
|
// now reset, expect 199
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('a[bind="resetButton"]')
|
.find('a[bind="resetButton"]')
|
||||||
.contains('reset')
|
.contains('reset')
|
||||||
.click()
|
.click();
|
||||||
cy.get('#tool-panel').contains('199 rows')
|
cy.get('#tool-panel').contains('199 rows');
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('a[bind="resetButton"]')
|
.find('a[bind="resetButton"]')
|
||||||
.should('not.be.visible')
|
.should('not.be.visible');
|
||||||
})
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This test ensure the refresh button behavior when editing a facet
|
* This test ensure the refresh button behavior when editing a facet
|
||||||
* The grid is updated with a duplicate on "BUTTER,WITH SALT"
|
* The grid is updated with a duplicate on "BUTTER,WITH SALT"
|
||||||
* Then we ensure the number of occurences is respected
|
* Then we ensure the number of occurences is respected
|
||||||
*/
|
*/
|
||||||
it('Test refresh reset', function () {
|
it('Test refresh reset', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet']);
|
||||||
|
|
||||||
cy.get('.facet-choice').should('have.length', 2)
|
cy.get('.facet-choice').should('have.length', 2);
|
||||||
cy.get('.facet-choice:nth-child(1)').contains(
|
cy.get('.facet-choice:nth-child(1)').contains('BUTTER,WHIPPED,WITH SALT');
|
||||||
'BUTTER,WHIPPED,WITH SALT'
|
cy.get('.facet-choice:nth-child(2)').contains('BUTTER,WITH SALT');
|
||||||
)
|
|
||||||
cy.get('.facet-choice:nth-child(2)').contains('BUTTER,WITH SALT')
|
|
||||||
|
|
||||||
cy.editCell(1, 'Shrt_Desc', 'BUTTER,WITH SALT')
|
cy.editCell(1, 'Shrt_Desc', 'BUTTER,WITH SALT');
|
||||||
cy.get('#refine-tabs-facets .browsing-panel-controls-refresh')
|
cy.get('#refine-tabs-facets .browsing-panel-controls-refresh')
|
||||||
.contains('Refresh')
|
.contains('Refresh')
|
||||||
.click()
|
.click();
|
||||||
cy.get('.facet-choice').should('have.length', 1)
|
cy.get('.facet-choice').should('have.length', 1);
|
||||||
cy.get('.facet-choice:first-child').contains('BUTTER,WITH SALT')
|
cy.get('.facet-choice:first-child').contains('BUTTER,WITH SALT');
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc').find('.facet-choice-count').contains(2);
|
||||||
.find('.facet-choice-count')
|
});
|
||||||
.contains(2)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Test facet by choice count', function () {
|
it('Test facet by choice count', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet'])
|
cy.columnActionClick('Shrt_Desc', ['Facet', 'Text facet']);
|
||||||
cy.getFacetContainer('Shrt_Desc')
|
cy.getFacetContainer('Shrt_Desc')
|
||||||
.find('.facet-body-controls')
|
.find('.facet-body-controls')
|
||||||
.contains('Facet by choice counts')
|
.contains('Facet by choice counts')
|
||||||
.click()
|
.click();
|
||||||
|
|
||||||
cy.get(`#refine-tabs-facets .facets-container .facet-container#facet-1`)
|
cy.get(`#refine-tabs-facets .facets-container .facet-container#facet-1`)
|
||||||
.should('exist')
|
.should('exist')
|
||||||
.contains('Shrt_Desc')
|
.contains('Shrt_Desc');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test the mass edit from a Facet', function () {
|
it('Test the mass edit from a Facet', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
cy.columnActionClick('Water', ['Facet', 'Text facet'])
|
cy.columnActionClick('Water', ['Facet', 'Text facet']);
|
||||||
|
|
||||||
cy.getFacetContainer('Water').within(() => {
|
cy.getFacetContainer('Water').within(() => {
|
||||||
cy.get('.facet-choice')
|
cy.get('.facet-choice')
|
||||||
.contains('15.87')
|
.contains('15.87')
|
||||||
.parent()
|
.parent()
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.facet-choice-edit')
|
.find('a.facet-choice-edit')
|
||||||
.contains('edit')
|
.contains('edit')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.click()
|
.click();
|
||||||
})
|
});
|
||||||
|
|
||||||
// mass edit all cells that have Water = 15.87
|
// mass edit all cells that have Water = 15.87
|
||||||
cy.get('.data-table-cell-editor textarea').type(50)
|
cy.get('.data-table-cell-editor textarea').type(50);
|
||||||
cy.get('.data-table-cell-editor button').contains('Apply').click()
|
cy.get('.data-table-cell-editor button').contains('Apply').click();
|
||||||
|
|
||||||
// ensure rows has been modified
|
// ensure rows has been modified
|
||||||
cy.getCell(0, 'Water').should('to.contain', 50)
|
cy.getCell(0, 'Water').should('to.contain', 50);
|
||||||
cy.getCell(1, 'Water').should('to.contain', 50)
|
cy.getCell(1, 'Water').should('to.contain', 50);
|
||||||
|
|
||||||
// ensure modification is made only to the rows that had 15.87, not the others
|
// ensure modification is made only to the rows that had 15.87, not the others
|
||||||
cy.getCell(2, 'Water').should('to.contain', 0.24)
|
cy.getCell(2, 'Water').should('to.contain', 0.24);
|
||||||
})
|
});
|
||||||
|
|
||||||
// // This test is unstable, mouseover behavior is unpredictable
|
// // This test is unstable, mouseover behavior is unpredictable
|
||||||
// // This might be because the element is detached from the DOM in the middle
|
// // This might be because the element is detached from the DOM in the middle
|
||||||
// // it('Test include/exlude toggle', function () {
|
// // it('Test include/exlude toggle', function () {
|
||||||
// // cy.loadAndVisitProject('food.small');
|
// // cy.loadAndVisitProject('food.small');
|
||||||
// // cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
// // cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"]').trigger('mouseover');
|
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"]').trigger('mouseover');
|
||||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').contains('include').should('be.visible');
|
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').contains('include').should('be.visible');
|
||||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').click();
|
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').click();
|
||||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').contains('exclude');
|
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').contains('exclude');
|
||||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').click();
|
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').click();
|
||||||
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').contains('include');
|
// // cy.getFacetContainer('NDB_No').find('.facet-choice[choiceindex="0"] a.facet-choice-toggle').contains('include');
|
||||||
// // });
|
// // });
|
||||||
|
|
||||||
// it('Test collapsing facet panels', function () {
|
// it('Test collapsing facet panels', function () {
|
||||||
// The following test does not work
|
// The following test does not work
|
||||||
// Because the facet panels uses soem weird CSS with overflow:hidden, Cypress can not detect it
|
// Because the facet panels uses soem weird CSS with overflow:hidden, Cypress can not detect it
|
||||||
// //// # cy.loadAndVisitProject('food.small');
|
// //// # cy.loadAndVisitProject('food.small');
|
||||||
// //// # cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
// //// # cy.columnActionClick('NDB_No', ['Facet', 'Text facet']);
|
||||||
// //// # ensure facet inner panel is visible
|
// //// # ensure facet inner panel is visible
|
||||||
// //// # cy.get('#refine-tabs-facets .facets-container li:nth-child(1) .facet-body-inner').should('be.visible');
|
// //// # cy.get('#refine-tabs-facets .facets-container li:nth-child(1) .facet-body-inner').should('be.visible');
|
||||||
// //// #collapse the panel
|
// //// #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) a[bind="minimizeButton"]').click();
|
||||||
// ////
|
// ////
|
||||||
})
|
});
|
||||||
|
@ -1,114 +1,105 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Perform a text sort + Reverse + Remove', function () {
|
it('Perform a text sort + Reverse + Remove', function () {
|
||||||
cy.loadAndVisitProject('food.sort')
|
cy.loadAndVisitProject('food.sort');
|
||||||
|
|
||||||
// sort and confirm
|
// sort and confirm
|
||||||
cy.columnActionClick('Shrt_Desc', ['Sort'])
|
cy.columnActionClick('Shrt_Desc', ['Sort']);
|
||||||
cy.waitForDialogPanel()
|
cy.waitForDialogPanel();
|
||||||
cy.confirmDialogPanel()
|
cy.confirmDialogPanel();
|
||||||
|
|
||||||
// ensure sorting is active
|
// ensure sorting is active
|
||||||
cy.getCell(0, 'Shrt_Desc').should(
|
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WHIPPED,WITH SALT');
|
||||||
'to.contain',
|
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT');
|
||||||
'BUTTER,WHIPPED,WITH SALT'
|
|
||||||
)
|
|
||||||
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT')
|
|
||||||
|
|
||||||
cy.columnActionClick('Shrt_Desc', ['Sort', 'Reverse'])
|
cy.columnActionClick('Shrt_Desc', ['Sort', 'Reverse']);
|
||||||
|
|
||||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT')
|
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT');
|
||||||
cy.getCell(1, 'Shrt_Desc').should(
|
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WHIPPED,WITH SALT');
|
||||||
'to.contain',
|
|
||||||
'BUTTER,WHIPPED,WITH SALT'
|
|
||||||
)
|
|
||||||
|
|
||||||
cy.columnActionClick('Shrt_Desc', ['Sort', 'Remove sort'])
|
cy.columnActionClick('Shrt_Desc', ['Sort', 'Remove sort']);
|
||||||
|
|
||||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT')
|
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT');
|
||||||
cy.getCell(1, 'Shrt_Desc').should(
|
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WHIPPED,WITH SALT');
|
||||||
'to.contain',
|
});
|
||||||
'BUTTER,WHIPPED,WITH SALT'
|
it('Perform a number sort + Reverse + Remove', function () {
|
||||||
)
|
cy.loadAndVisitProject('food.sort');
|
||||||
})
|
|
||||||
it('Perform a number sort + Reverse + Remove', function () {
|
|
||||||
cy.loadAndVisitProject('food.sort')
|
|
||||||
|
|
||||||
cy.castColumnTo('NDB_No', 'number')
|
cy.castColumnTo('NDB_No', 'number');
|
||||||
cy.columnActionClick('NDB_No', ['Sort'])
|
cy.columnActionClick('NDB_No', ['Sort']);
|
||||||
|
|
||||||
cy.waitForDialogPanel()
|
cy.waitForDialogPanel();
|
||||||
cy.get('[type="radio"]').check('number')
|
cy.get('[type="radio"]').check('number');
|
||||||
cy.get('[type="radio"]').check('reverse')
|
cy.get('[type="radio"]').check('reverse');
|
||||||
cy.confirmDialogPanel()
|
cy.confirmDialogPanel();
|
||||||
|
|
||||||
// ensure sorting is active
|
// ensure sorting is active
|
||||||
cy.getCell(0, 'NDB_No').should('to.contain', 1002)
|
cy.getCell(0, 'NDB_No').should('to.contain', 1002);
|
||||||
cy.getCell(1, 'NDB_No').should('to.contain', 1001)
|
cy.getCell(1, 'NDB_No').should('to.contain', 1001);
|
||||||
cy.columnActionClick('NDB_No', ['Sort', 'Reverse'])
|
cy.columnActionClick('NDB_No', ['Sort', 'Reverse']);
|
||||||
cy.getCell(0, 'NDB_No').should('to.contain', 1001)
|
cy.getCell(0, 'NDB_No').should('to.contain', 1001);
|
||||||
cy.getCell(1, 'NDB_No').should('to.contain', 1002)
|
cy.getCell(1, 'NDB_No').should('to.contain', 1002);
|
||||||
cy.columnActionClick('NDB_No', ['Sort', 'Remove sort'])
|
cy.columnActionClick('NDB_No', ['Sort', 'Remove sort']);
|
||||||
cy.getCell(0, 'NDB_No').should('to.contain', 1001)
|
cy.getCell(0, 'NDB_No').should('to.contain', 1001);
|
||||||
cy.getCell(1, 'NDB_No').should('to.contain', 1002)
|
cy.getCell(1, 'NDB_No').should('to.contain', 1002);
|
||||||
})
|
});
|
||||||
it('Perform a date sort + Reverse + Remove', function () {
|
it('Perform a date sort + Reverse + Remove', function () {
|
||||||
cy.loadAndVisitProject('food.sort')
|
cy.loadAndVisitProject('food.sort');
|
||||||
|
|
||||||
cy.castColumnTo('Date', 'date')
|
cy.castColumnTo('Date', 'date');
|
||||||
cy.columnActionClick('Date', ['Sort'])
|
cy.columnActionClick('Date', ['Sort']);
|
||||||
|
|
||||||
cy.waitForDialogPanel()
|
cy.waitForDialogPanel();
|
||||||
cy.get('[type="radio"]').check('date')
|
cy.get('[type="radio"]').check('date');
|
||||||
cy.get('[type="radio"]').check('reverse')
|
cy.get('[type="radio"]').check('reverse');
|
||||||
cy.confirmDialogPanel()
|
cy.confirmDialogPanel();
|
||||||
|
|
||||||
// ensure sorting is active
|
// ensure sorting is active
|
||||||
cy.getCell(0, 'Date').should('to.contain', '2020-12-17T00:00:00Z')
|
cy.getCell(0, 'Date').should('to.contain', '2020-12-17T00:00:00Z');
|
||||||
cy.getCell(1, 'Date').should('to.contain', '2020-08-17T00:00:00Z')
|
cy.getCell(1, 'Date').should('to.contain', '2020-08-17T00:00:00Z');
|
||||||
|
|
||||||
cy.columnActionClick('Date', ['Sort', 'Reverse'])
|
cy.columnActionClick('Date', ['Sort', 'Reverse']);
|
||||||
|
|
||||||
cy.getCell(0, 'Date').should('to.contain', '2020-08-17T00:00:00Z')
|
cy.getCell(0, 'Date').should('to.contain', '2020-08-17T00:00:00Z');
|
||||||
cy.getCell(1, 'Date').should('to.contain', '2020-12-17T00:00:00Z')
|
cy.getCell(1, 'Date').should('to.contain', '2020-12-17T00:00:00Z');
|
||||||
|
|
||||||
cy.columnActionClick('Date', ['Sort', 'Remove sort'])
|
cy.columnActionClick('Date', ['Sort', 'Remove sort']);
|
||||||
cy.getCell(0, 'Date').should('to.contain', '2020-12-17T00:00:00Z')
|
cy.getCell(0, 'Date').should('to.contain', '2020-12-17T00:00:00Z');
|
||||||
cy.getCell(1, 'Date').should('to.contain', '2020-08-17T00:00:00Z')
|
cy.getCell(1, 'Date').should('to.contain', '2020-08-17T00:00:00Z');
|
||||||
})
|
});
|
||||||
it('Perform a bool sort + Reverse + Remove', function () {
|
it('Perform a bool sort + Reverse + Remove', function () {
|
||||||
cy.loadAndVisitProject('food.sort')
|
cy.loadAndVisitProject('food.sort');
|
||||||
|
|
||||||
cy.getCell(0, 'Fat')
|
cy.getCell(0, 'Fat')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get('a.data-table-cell-edit').click()
|
cy.get('a.data-table-cell-edit').click();
|
||||||
})
|
});
|
||||||
cy.get('select').select('boolean')
|
cy.get('select').select('boolean');
|
||||||
cy.get('button').contains(new RegExp('Apply', 'g')).click()
|
cy.get('button').contains(new RegExp('Apply', 'g')).click();
|
||||||
|
|
||||||
cy.getCell(1, 'Fat')
|
cy.getCell(1, 'Fat')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get('a.data-table-cell-edit').click()
|
cy.get('a.data-table-cell-edit').click();
|
||||||
})
|
});
|
||||||
cy.get('select').select('boolean')
|
cy.get('select').select('boolean');
|
||||||
cy.get('button').contains(new RegExp('Apply', 'g')).click()
|
cy.get('button').contains(new RegExp('Apply', 'g')).click();
|
||||||
|
|
||||||
cy.columnActionClick('Fat', ['Sort'])
|
cy.columnActionClick('Fat', ['Sort']);
|
||||||
|
|
||||||
cy.waitForDialogPanel()
|
cy.waitForDialogPanel();
|
||||||
cy.get('[type="radio"]').check('boolean')
|
cy.get('[type="radio"]').check('boolean');
|
||||||
cy.confirmDialogPanel()
|
cy.confirmDialogPanel();
|
||||||
|
|
||||||
cy.getCell(0, 'Fat').should('to.contain', 'false')
|
cy.getCell(0, 'Fat').should('to.contain', 'false');
|
||||||
cy.getCell(1, 'Fat').should('to.contain', 'true')
|
cy.getCell(1, 'Fat').should('to.contain', 'true');
|
||||||
|
|
||||||
cy.columnActionClick('Fat', ['Sort', 'Reverse'])
|
cy.columnActionClick('Fat', ['Sort', 'Reverse']);
|
||||||
cy.getCell(0, 'Fat').should('to.contain', 'true')
|
cy.getCell(0, 'Fat').should('to.contain', 'true');
|
||||||
cy.getCell(1, 'Fat').should('to.contain', 'false')
|
cy.getCell(1, 'Fat').should('to.contain', 'false');
|
||||||
|
|
||||||
cy.columnActionClick('Fat', ['Sort', 'Remove sort'])
|
cy.columnActionClick('Fat', ['Sort', 'Remove sort']);
|
||||||
cy.getCell(0, 'Fat').should('to.contain', 'false')
|
cy.getCell(0, 'Fat').should('to.contain', 'false');
|
||||||
cy.getCell(1, 'Fat').should('to.contain', 'true')
|
cy.getCell(1, 'Fat').should('to.contain', 'true');
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Utility method to load an expression panel, used by almost all the tests
|
* Utility method to load an expression panel, used by almost all the tests
|
||||||
*/
|
*/
|
||||||
function loadExpressionPanel() {
|
function loadExpressionPanel() {
|
||||||
cy.columnActionClick('Shrt_Desc', ['Facet', 'Custom text facet'])
|
cy.columnActionClick('Shrt_Desc', ['Facet', 'Custom text facet']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -10,304 +10,278 @@ function loadExpressionPanel() {
|
|||||||
* Need to wait for OpenRefine to preview the result, hence the cy.wait
|
* Need to wait for OpenRefine to preview the result, hence the cy.wait
|
||||||
*/
|
*/
|
||||||
function typeExpression(expression) {
|
function typeExpression(expression) {
|
||||||
cy.get('textarea.expression-preview-code').type(expression)
|
cy.get('textarea.expression-preview-code').type(expression);
|
||||||
cy.wait(250)
|
cy.wait(250); // eslint-disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a unique GREL expression to be used for testing
|
* Generate a unique GREL expression to be used for testing
|
||||||
*/
|
*/
|
||||||
function generateUniqueExpression() {
|
function generateUniqueExpression() {
|
||||||
return `value+${Date.now()}`
|
return `value+${Date.now()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Test the layout of the expression panel', function () {
|
it('Test the layout of the expression panel', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
|
|
||||||
cy.get('.dialog-container').within(() => {
|
cy.get('.dialog-container').within(() => {
|
||||||
cy.get('td[bind="or_dialog_expr"]').contains('Expression')
|
cy.get('td[bind="or_dialog_expr"]').contains('Expression');
|
||||||
cy.get(
|
cy.get('select[bind="expressionPreviewLanguageSelect"] option').should(
|
||||||
'select[bind="expressionPreviewLanguageSelect"] option'
|
'have.length',
|
||||||
).should('have.length', 3)
|
3
|
||||||
cy.get('textarea.expression-preview-code').should('exist')
|
);
|
||||||
|
cy.get('textarea.expression-preview-code').should('exist');
|
||||||
|
|
||||||
cy.get('.dialog-footer button:nth-child(1)').should(
|
cy.get('.dialog-footer button:nth-child(1)').should('to.contain', 'OK');
|
||||||
'to.contain',
|
cy.get('.dialog-footer button:nth-child(2)').should(
|
||||||
'OK'
|
'to.contain',
|
||||||
)
|
'Cancel'
|
||||||
cy.get('.dialog-footer button:nth-child(2)').should(
|
);
|
||||||
'to.contain',
|
});
|
||||||
'Cancel'
|
});
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Test a valid Grel expression', function () {
|
it('Test a valid Grel expression', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
typeExpression('value.toLowercase()')
|
typeExpression('value.toLowercase()');
|
||||||
cy.get('.expression-preview-parsing-status').contains(
|
cy.get('.expression-preview-parsing-status').contains('No syntax error.');
|
||||||
'No syntax error.'
|
cy.get(
|
||||||
)
|
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||||
cy.get(
|
).should('to.contain', 'butter,with salt');
|
||||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
});
|
||||||
).should('to.contain', 'butter,with salt')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Test a valid Python expression', function () {
|
it('Test a valid Python expression', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
cy.get('select[bind="expressionPreviewLanguageSelect"]').select('jython');
|
||||||
'jython'
|
typeExpression('return value.lower()');
|
||||||
)
|
cy.get('.expression-preview-parsing-status').contains('No syntax error.');
|
||||||
typeExpression('return value.lower()')
|
cy.get(
|
||||||
cy.get('.expression-preview-parsing-status').contains(
|
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||||
'No syntax error.'
|
).should('to.contain', 'butter,with salt');
|
||||||
)
|
});
|
||||||
cy.get(
|
|
||||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
|
||||||
).should('to.contain', 'butter,with salt')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Test a valid Clojure expression', function () {
|
it('Test a valid Clojure expression', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
cy.get('select[bind="expressionPreviewLanguageSelect"]').select('clojure');
|
||||||
'clojure'
|
typeExpression('(.. value (toLowerCase) )');
|
||||||
)
|
cy.get('.expression-preview-parsing-status').contains('No syntax error.');
|
||||||
typeExpression('(.. value (toLowerCase) )')
|
cy.get(
|
||||||
cy.get('.expression-preview-parsing-status').contains(
|
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||||
'No syntax error.'
|
).should('to.contain', 'butter,with salt');
|
||||||
)
|
});
|
||||||
cy.get(
|
|
||||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
|
||||||
).should('to.contain', 'butter,with salt')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Test a Grel syntax error', function () {
|
it('Test a Grel syntax error', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
typeExpression('()')
|
typeExpression('()');
|
||||||
cy.get('.expression-preview-parsing-status').contains('Parsing error')
|
cy.get('.expression-preview-parsing-status').contains('Parsing error');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test a Python syntax error', function () {
|
it('Test a Python syntax error', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
cy.get('select[bind="expressionPreviewLanguageSelect"]').select('jython');
|
||||||
'jython'
|
typeExpression('(;)');
|
||||||
)
|
cy.get('.expression-preview-parsing-status').contains('Internal error');
|
||||||
typeExpression('(;)')
|
});
|
||||||
cy.get('.expression-preview-parsing-status').contains('Internal error')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Test a Clojure syntax error', function () {
|
it('Test a Clojure syntax error', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
cy.get('select[bind="expressionPreviewLanguageSelect"]').select('clojure');
|
||||||
'clojure'
|
typeExpression('(;)');
|
||||||
)
|
cy.get('.expression-preview-parsing-status').contains(
|
||||||
typeExpression('(;)')
|
'Syntax error reading source'
|
||||||
cy.get('.expression-preview-parsing-status').contains(
|
);
|
||||||
'Syntax error reading source'
|
});
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Test a Grel language error', function () {
|
it('Test a Grel language error', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
typeExpression('value.thisGrelFunctionDoesNotExists()')
|
typeExpression('value.thisGrelFunctionDoesNotExists()');
|
||||||
cy.get('.expression-preview-parsing-status').contains(
|
cy.get('.expression-preview-parsing-status').contains(
|
||||||
'Unknown function thisGrelFunctionDoesNotExists'
|
'Unknown function thisGrelFunctionDoesNotExists'
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test a Python language error', function () {
|
it('Test a Python language error', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
cy.get('select[bind="expressionPreviewLanguageSelect"]').select('jython');
|
||||||
'jython'
|
typeExpression('return value.thisPythonFunctionDoesNotExists()');
|
||||||
)
|
|
||||||
typeExpression('return value.thisPythonFunctionDoesNotExists()')
|
|
||||||
|
|
||||||
cy.get(
|
cy.get(
|
||||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||||
).should('to.contain', 'Error: Traceback')
|
).should('to.contain', 'Error: Traceback');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test a Clojure language error', function () {
|
it('Test a Clojure language error', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
cy.get('select[bind="expressionPreviewLanguageSelect"]').select('clojure');
|
||||||
'clojure'
|
typeExpression('(.. value (thisClojureFunctionDoesNotExists) )');
|
||||||
)
|
cy.get(
|
||||||
typeExpression('(.. value (thisClojureFunctionDoesNotExists) )')
|
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||||
cy.get(
|
).should('to.contain', 'Error: No matching method');
|
||||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
});
|
||||||
).should('to.contain', 'Error: No matching method')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Test switching from one langage to another', function () {
|
it('Test switching from one langage to another', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
typeExpression('(.. value (toLowerCase) )')
|
typeExpression('(.. value (toLowerCase) )');
|
||||||
// error is expected, this is clojure language
|
// error is expected, this is clojure language
|
||||||
cy.get('.expression-preview-parsing-status').should(
|
cy.get('.expression-preview-parsing-status').should(
|
||||||
'to.contain',
|
'to.contain',
|
||||||
'Parsing error'
|
'Parsing error'
|
||||||
)
|
);
|
||||||
// switching to clojure
|
// switching to clojure
|
||||||
cy.get('select[bind="expressionPreviewLanguageSelect"]').select(
|
cy.get('select[bind="expressionPreviewLanguageSelect"]').select('clojure');
|
||||||
'clojure'
|
cy.get('.expression-preview-parsing-status').should(
|
||||||
)
|
'not.to.contain',
|
||||||
cy.get('.expression-preview-parsing-status').should(
|
'Parsing error'
|
||||||
'not.to.contain',
|
);
|
||||||
'Parsing error'
|
});
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Test the preview (GREL)', function () {
|
it('Test the preview (GREL)', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
typeExpression('value.toLowercase()')
|
typeExpression('value.toLowercase()');
|
||||||
|
|
||||||
cy.get(
|
cy.get(
|
||||||
'.expression-preview-table-wrapper tr:nth-child(1) td:last-child'
|
'.expression-preview-table-wrapper tr:nth-child(1) td:last-child'
|
||||||
).should('to.contain', 'value.toLowercase()')
|
).should('to.contain', 'value.toLowercase()');
|
||||||
cy.get(
|
cy.get(
|
||||||
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
'.expression-preview-table-wrapper tr:nth-child(2) td:last-child'
|
||||||
).should('to.contain', 'butter,with salt')
|
).should('to.contain', 'butter,with salt');
|
||||||
cy.get(
|
cy.get(
|
||||||
'.expression-preview-table-wrapper tr:nth-child(3) td:last-child'
|
'.expression-preview-table-wrapper tr:nth-child(3) td:last-child'
|
||||||
).should('to.contain', 'butter,whipped,with salt')
|
).should('to.contain', 'butter,whipped,with salt');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test the help tab', function () {
|
it('Test the help tab', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
cy.get('#expression-preview-tabs li').contains('Help').click()
|
cy.get('#expression-preview-tabs li').contains('Help').click();
|
||||||
cy.get('#expression-preview-tabs-help').should('be.visible')
|
cy.get('#expression-preview-tabs-help').should('be.visible');
|
||||||
cy.get('#expression-preview-tabs-help').should(
|
cy.get('#expression-preview-tabs-help').should(
|
||||||
'to.contain',
|
'to.contain',
|
||||||
`The current cell. It has a few fields: 'value', 'recon' and 'errorMessage'.`
|
`The current cell. It has a few fields: 'value', 'recon' and 'errorMessage'.`
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test the history behavior, ensure expressions are stored', function () {
|
it('Test the history behavior, ensure expressions are stored', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
// Because history is shared across projects, we need to use an expression that is unique
|
// Because history is shared across projects, we need to use an expression that is unique
|
||||||
|
|
||||||
// Use a first unique expression
|
// Use a first unique expression
|
||||||
const uniqueExpression = generateUniqueExpression()
|
const uniqueExpression = generateUniqueExpression();
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
typeExpression(uniqueExpression)
|
typeExpression(uniqueExpression);
|
||||||
cy.get('.dialog-footer button').contains('OK').click()
|
cy.get('.dialog-footer button').contains('OK').click();
|
||||||
// ensure the function has been added to the facet
|
// ensure the function has been added to the facet
|
||||||
cy.get('#refine-tabs-facets').contains(
|
cy.get('#refine-tabs-facets').contains(uniqueExpression.replace('()', ''));
|
||||||
uniqueExpression.replace('()', '')
|
|
||||||
)
|
|
||||||
|
|
||||||
// Reload and review history
|
// Reload and review history
|
||||||
// Ensure the previously used expression is listed
|
// Ensure the previously used expression is listed
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
cy.get('#expression-preview-tabs li').contains('History').click()
|
cy.get('#expression-preview-tabs li').contains('History').click();
|
||||||
cy.get('#expression-preview-tabs-history')
|
cy.get('#expression-preview-tabs-history')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.should('to.contain', uniqueExpression)
|
.should('to.contain', uniqueExpression);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test the reuse of expressions from the history', function () {
|
it('Test the reuse of expressions from the history', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
// Because history is shared across projects, we need to build and use an expression that is unique
|
// Because history is shared across projects, we need to build and use an expression that is unique
|
||||||
const uniqueExpression = generateUniqueExpression()
|
const uniqueExpression = generateUniqueExpression();
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
typeExpression(uniqueExpression)
|
typeExpression(uniqueExpression);
|
||||||
cy.get('.dialog-footer button').contains('OK').click()
|
cy.get('.dialog-footer button').contains('OK').click();
|
||||||
cy.get('#refine-tabs-facets').contains(
|
cy.get('#refine-tabs-facets').contains(uniqueExpression.replace('()', ''));
|
||||||
uniqueExpression.replace('()', '')
|
|
||||||
)
|
|
||||||
|
|
||||||
// Reload and review history
|
// Reload and review history
|
||||||
// Ensure the previously used expression is there
|
// Ensure the previously used expression is there
|
||||||
// Use it
|
// Use it
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
cy.get('#expression-preview-tabs li').contains('History').click()
|
cy.get('#expression-preview-tabs li').contains('History').click();
|
||||||
cy.get('#expression-preview-tabs-history tr td')
|
cy.get('#expression-preview-tabs-history tr td')
|
||||||
.contains(uniqueExpression)
|
.contains(uniqueExpression)
|
||||||
.parent()
|
.parent()
|
||||||
.find('a')
|
.find('a')
|
||||||
.contains('Reuse')
|
.contains('Reuse')
|
||||||
.click()
|
.click();
|
||||||
|
|
||||||
// Expression must be populated in the textarea, after clicking on 'reuse'
|
// Expression must be populated in the textarea, after clicking on 'reuse'
|
||||||
cy.get('textarea.expression-preview-code').should(
|
cy.get('textarea.expression-preview-code').should(
|
||||||
'have.value',
|
'have.value',
|
||||||
uniqueExpression
|
uniqueExpression
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test the history, star', function () {
|
it('Test the history, star', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
|
|
||||||
// Cleanup step
|
// Cleanup step
|
||||||
// Because starred expression are shared across projects, see #3499
|
// Because starred expression are shared across projects, see #3499
|
||||||
// We need to un-star all previously starred expressions
|
// We need to un-star all previously starred expressions
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
cy.get('#expression-preview-tabs li').contains('Starred').click()
|
cy.get('#expression-preview-tabs li').contains('Starred').click();
|
||||||
cy.get(
|
cy.get(
|
||||||
'#expression-preview-tabs-starred .expression-preview-table-wrapper table'
|
'#expression-preview-tabs-starred .expression-preview-table-wrapper table'
|
||||||
).then(($table) => {
|
).then(($table) => {
|
||||||
if ($table.find('tr').length > 1) {
|
if ($table.find('tr').length > 1) {
|
||||||
cy.get(
|
cy.get(
|
||||||
'#expression-preview-tabs-starred .expression-preview-table-wrapper table a'
|
'#expression-preview-tabs-starred .expression-preview-table-wrapper table a'
|
||||||
)
|
)
|
||||||
.contains('Remove')
|
.contains('Remove')
|
||||||
.each(($btn) => {
|
.each(($btn) => {
|
||||||
cy.wrap($btn).click()
|
cy.wrap($btn).click();
|
||||||
cy.get('.dialog-container:last-child button')
|
cy.get('.dialog-container:last-child button')
|
||||||
.contains('OK')
|
.contains('OK')
|
||||||
.click()
|
.click();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
cy.get('.dialog-footer button').contains('Cancel').click()
|
cy.get('.dialog-footer button').contains('Cancel').click();
|
||||||
// End cleanup
|
// End cleanup
|
||||||
|
|
||||||
// Load an expression
|
// Load an expression
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
const uniqueExpression = generateUniqueExpression()
|
const uniqueExpression = generateUniqueExpression();
|
||||||
typeExpression(uniqueExpression)
|
typeExpression(uniqueExpression);
|
||||||
cy.get('.dialog-footer button').contains('OK').click()
|
cy.get('.dialog-footer button').contains('OK').click();
|
||||||
|
|
||||||
// Star the expression
|
// Star the expression
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
cy.get('#expression-preview-tabs li').contains('History').click()
|
cy.get('#expression-preview-tabs li').contains('History').click();
|
||||||
cy.get('.expression-preview-table-wrapper tr td')
|
cy.get('.expression-preview-table-wrapper tr td')
|
||||||
.contains(uniqueExpression)
|
.contains(uniqueExpression)
|
||||||
.parent()
|
.parent()
|
||||||
.find('a.data-table-star-off')
|
.find('a.data-table-star-off')
|
||||||
.click()
|
.click();
|
||||||
|
|
||||||
// List starred expressions, en ensure the expression is listed
|
// List starred expressions, en ensure the expression is listed
|
||||||
cy.get('#expression-preview-tabs li').contains('Starred').click()
|
cy.get('#expression-preview-tabs li').contains('Starred').click();
|
||||||
cy.get(
|
cy.get(
|
||||||
'#expression-preview-tabs-starred .expression-preview-table-wrapper table'
|
'#expression-preview-tabs-starred .expression-preview-table-wrapper table'
|
||||||
).contains(uniqueExpression)
|
).contains(uniqueExpression);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Simple test to ensure the expression panel can be closed with OK', function () {
|
it('Simple test to ensure the expression panel can be closed with OK', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
cy.get('.dialog-footer button').contains('OK').click()
|
cy.get('.dialog-footer button').contains('OK').click();
|
||||||
cy.get('.dialog-container').should('not.to.exist')
|
cy.get('.dialog-container').should('not.to.exist');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Simple test to ensure the expression panel can be closed with Cancel', function () {
|
it('Simple test to ensure the expression panel can be closed with Cancel', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
loadExpressionPanel()
|
loadExpressionPanel();
|
||||||
cy.get('.dialog-footer button').contains('Cancel').click()
|
cy.get('.dialog-footer button').contains('Cancel').click();
|
||||||
cy.get('.dialog-container').should('not.to.exist')
|
cy.get('.dialog-container').should('not.to.exist');
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,124 +1,122 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensure the Edit button is visible on mouse over a cell', function () {
|
it('Ensure the Edit button is visible on mouse over a cell', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
|
|
||||||
cy.getCell(1, 'Water').trigger('mouseover')
|
cy.getCell(1, 'Water').trigger('mouseover');
|
||||||
cy.getCell(1, 'Water')
|
cy.getCell(1, 'Water').find('a.data-table-cell-edit').should('be.visible');
|
||||||
.find('a.data-table-cell-edit')
|
});
|
||||||
.should('be.visible')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Ensure the Edit button opens a popup', function () {
|
it('Ensure the Edit button opens a popup', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
cy.getCell(1, 'Shrt_Desc')
|
cy.getCell(1, 'Shrt_Desc')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
.click()
|
.click();
|
||||||
cy.get('.menu-container.data-table-cell-editor').should('exist')
|
cy.get('.menu-container.data-table-cell-editor').should('exist');
|
||||||
cy.get('.menu-container.data-table-cell-editor textarea').should(
|
cy.get('.menu-container.data-table-cell-editor textarea').should(
|
||||||
'have.value',
|
'have.value',
|
||||||
'BUTTER,WHIPPED,WITH SALT'
|
'BUTTER,WHIPPED,WITH SALT'
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test a simple edit', function () {
|
it('Test a simple edit', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
cy.getCell(1, 'Shrt_Desc')
|
cy.getCell(1, 'Shrt_Desc')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
.click()
|
.click();
|
||||||
cy.get('.menu-container.data-table-cell-editor').should('exist')
|
cy.get('.menu-container.data-table-cell-editor').should('exist');
|
||||||
cy.get('.menu-container.data-table-cell-editor textarea').type(
|
cy.get('.menu-container.data-table-cell-editor textarea').type(
|
||||||
'OpenRefine Testing'
|
'OpenRefine Testing'
|
||||||
)
|
);
|
||||||
cy.get('.menu-container button[bind="okButton"]').click()
|
cy.get('.menu-container button[bind="okButton"]').click();
|
||||||
// ensure value has been changed in the grid
|
// ensure value has been changed in the grid
|
||||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist')
|
cy.get('.menu-container.data-table-cell-editor').should('not.exist');
|
||||||
cy.assertCellEquals(1, 'Shrt_Desc', 'OpenRefine Testing')
|
cy.assertCellEquals(1, 'Shrt_Desc', 'OpenRefine Testing');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test a simple edit, using keyboard shortcut', function () {
|
it('Test a simple edit, using keyboard shortcut', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
cy.getCell(1, 'Shrt_Desc')
|
cy.getCell(1, 'Shrt_Desc')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
.click()
|
.click();
|
||||||
cy.get('.menu-container.data-table-cell-editor').should('exist')
|
cy.get('.menu-container.data-table-cell-editor').should('exist');
|
||||||
cy.get('.menu-container.data-table-cell-editor textarea').type(
|
cy.get('.menu-container.data-table-cell-editor textarea').type(
|
||||||
'OpenRefine Testing'
|
'OpenRefine Testing'
|
||||||
)
|
);
|
||||||
cy.get('body').type('{enter}')
|
cy.get('body').type('{enter}');
|
||||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist')
|
cy.get('.menu-container.data-table-cell-editor').should('not.exist');
|
||||||
cy.assertCellEquals(1, 'Shrt_Desc', 'OpenRefine Testing')
|
cy.assertCellEquals(1, 'Shrt_Desc', 'OpenRefine Testing');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test the cancel button', function () {
|
it('Test the cancel button', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
cy.getCell(1, 'Shrt_Desc')
|
cy.getCell(1, 'Shrt_Desc')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
.click()
|
.click();
|
||||||
cy.get('.menu-container.data-table-cell-editor').should('exist')
|
cy.get('.menu-container.data-table-cell-editor').should('exist');
|
||||||
cy.get('.menu-container.data-table-cell-editor textarea').type(
|
cy.get('.menu-container.data-table-cell-editor textarea').type(
|
||||||
'OpenRefine Testing'
|
'OpenRefine Testing'
|
||||||
)
|
);
|
||||||
cy.get('.menu-container button[bind="cancelButton"]').click()
|
cy.get('.menu-container button[bind="cancelButton"]').click();
|
||||||
// ensure value has been changed in the grid
|
// ensure value has been changed in the grid
|
||||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist')
|
cy.get('.menu-container.data-table-cell-editor').should('not.exist');
|
||||||
cy.assertCellEquals(1, 'Shrt_Desc', 'BUTTER,WHIPPED,WITH SALT')
|
cy.assertCellEquals(1, 'Shrt_Desc', 'BUTTER,WHIPPED,WITH SALT');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test the cancel button, using keyboard shortcut', function () {
|
it('Test the cancel button, using keyboard shortcut', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
cy.getCell(1, 'Shrt_Desc')
|
cy.getCell(1, 'Shrt_Desc')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
.click()
|
.click();
|
||||||
cy.get('.menu-container.data-table-cell-editor').should('exist')
|
cy.get('.menu-container.data-table-cell-editor').should('exist');
|
||||||
cy.get('.menu-container.data-table-cell-editor textarea').type(
|
cy.get('.menu-container.data-table-cell-editor textarea').type(
|
||||||
'OpenRefine Testing'
|
'OpenRefine Testing'
|
||||||
)
|
);
|
||||||
cy.get('body').type('{esc}')
|
cy.get('body').type('{esc}');
|
||||||
// ensure value has been changed in the grid
|
// ensure value has been changed in the grid
|
||||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist')
|
cy.get('.menu-container.data-table-cell-editor').should('not.exist');
|
||||||
cy.assertCellEquals(1, 'Shrt_Desc', 'BUTTER,WHIPPED,WITH SALT')
|
cy.assertCellEquals(1, 'Shrt_Desc', 'BUTTER,WHIPPED,WITH SALT');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test edit all identical cells', function () {
|
it('Test edit all identical cells', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
cy.getCell(1, 'Water')
|
cy.getCell(1, 'Water')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
.click()
|
.click();
|
||||||
cy.get('.menu-container.data-table-cell-editor').should('exist')
|
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.data-table-cell-editor textarea').type(42);
|
||||||
cy.get('.menu-container button[bind="okallButton"]').click()
|
cy.get('.menu-container button[bind="okallButton"]').click();
|
||||||
|
|
||||||
// ensure all values has been changed in the grid
|
// ensure all values has been changed in the grid
|
||||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist')
|
cy.get('.menu-container.data-table-cell-editor').should('not.exist');
|
||||||
cy.get('#notification-container')
|
cy.get('#notification-container')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.contains('Mass edit')
|
.contains('Mass edit');
|
||||||
cy.assertCellEquals(0, 'Water', '42')
|
cy.assertCellEquals(0, 'Water', '42');
|
||||||
cy.assertCellEquals(1, 'Water', '42')
|
cy.assertCellEquals(1, 'Water', '42');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test edit all identical cells, using the shortcut', function () {
|
it('Test edit all identical cells, using the shortcut', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
cy.getCell(1, 'Water')
|
cy.getCell(1, 'Water')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
.click()
|
.click();
|
||||||
cy.get('.menu-container.data-table-cell-editor').should('exist')
|
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.data-table-cell-editor textarea').type(42);
|
||||||
cy.get('body').type('{ctrl}{enter}')
|
cy.get('body').type('{ctrl}{enter}');
|
||||||
|
|
||||||
// ensure all values has been changed in the grid
|
// ensure all values has been changed in the grid
|
||||||
cy.get('.menu-container.data-table-cell-editor').should('not.exist')
|
cy.get('.menu-container.data-table-cell-editor').should('not.exist');
|
||||||
cy.get('#notification-container')
|
cy.get('#notification-container')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.contains('Mass edit')
|
.contains('Mass edit');
|
||||||
cy.assertCellEquals(0, 'Water', '42')
|
cy.assertCellEquals(0, 'Water', '42');
|
||||||
cy.assertCellEquals(1, 'Water', '42')
|
cy.assertCellEquals(1, 'Water', '42');
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,249 +1,249 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensure it shows correct number of rows', function () {
|
it('Ensure it shows correct number of rows', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('#summary-bar').should('to.contain', '199 rows')
|
cy.get('#summary-bar').should('to.contain', '199 rows');
|
||||||
})
|
});
|
||||||
it('Ensure it shows only 5 rows when pagesize is 5', function () {
|
it('Ensure it shows only 5 rows when pagesize is 5', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('5').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('5').click();
|
||||||
cy.get('.data-table tbody').find('tr').should('have.length', 5)
|
cy.get('.data-table tbody').find('tr').should('have.length', 5);
|
||||||
})
|
});
|
||||||
it('Ensure it shows only 10 rows when pagesize is 10', function () {
|
it('Ensure it shows only 10 rows when pagesize is 10', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('10').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('10').click();
|
||||||
cy.get('.data-table tbody').find('tr').should('have.length', 10)
|
cy.get('.data-table tbody').find('tr').should('have.length', 10);
|
||||||
})
|
});
|
||||||
it('Ensure it shows only 25 rows when pagesize is 25', function () {
|
it('Ensure it shows only 25 rows when pagesize is 25', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('25').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('25').click();
|
||||||
cy.get('.data-table tbody').find('tr').should('have.length', 25)
|
cy.get('.data-table tbody').find('tr').should('have.length', 25);
|
||||||
})
|
});
|
||||||
it('Ensure it shows only 50 rows when pagesize is 50', function () {
|
it('Ensure it shows only 50 rows when pagesize is 50', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('50').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('50').click();
|
||||||
cy.get('.data-table tbody').find('tr').should('have.length', 50)
|
cy.get('.data-table tbody').find('tr').should('have.length', 50);
|
||||||
})
|
});
|
||||||
it('Ensure it redirects to next-page when pagesize is 5', function () {
|
it('Ensure it redirects to next-page when pagesize is 5', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('5').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('5').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('next').click()
|
cy.get('.viewpanel-paging').find('a').contains('next').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 2)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 2);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'CHEESE,BRIE')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'CHEESE,BRIE');
|
||||||
cy.assertCellEquals(4, 'Shrt_Desc', 'CHEESE,CHESHIRE')
|
cy.assertCellEquals(4, 'Shrt_Desc', 'CHEESE,CHESHIRE');
|
||||||
})
|
});
|
||||||
it('Ensure it redirects to next-page when pagesize is 10', function () {
|
it('Ensure it redirects to next-page when pagesize is 10', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('10').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('10').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('next').click()
|
cy.get('.viewpanel-paging').find('a').contains('next').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 2)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 2);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'CHEESE,COLBY')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'CHEESE,COLBY');
|
||||||
cy.assertCellEquals(9, 'Shrt_Desc', 'CHEESE,FONTINA')
|
cy.assertCellEquals(9, 'Shrt_Desc', 'CHEESE,FONTINA');
|
||||||
})
|
});
|
||||||
it('Ensure it redirects to next-page when pagesize is 25', function () {
|
it('Ensure it redirects to next-page when pagesize is 25', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('25').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('25').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('next').click()
|
cy.get('.viewpanel-paging').find('a').contains('next').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 2)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 2);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'CHEESE,MOZZARELLA,WHL MILK')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'CHEESE,MOZZARELLA,WHL MILK');
|
||||||
cy.assertCellEquals(
|
cy.assertCellEquals(
|
||||||
24,
|
24,
|
||||||
'Shrt_Desc',
|
'Shrt_Desc',
|
||||||
'CREAM,FLUID,LT (COFFEE CRM OR TABLE CRM)'
|
'CREAM,FLUID,LT (COFFEE CRM OR TABLE CRM)'
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
it('Ensure it redirects to next-page when pagesize is 50', function () {
|
it('Ensure it redirects to next-page when pagesize is 50', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('50').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('50').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('next').click()
|
cy.get('.viewpanel-paging').find('a').contains('next').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 2)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 2);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'CREAM,FLUID,LT WHIPPING')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'CREAM,FLUID,LT WHIPPING');
|
||||||
cy.assertCellEquals(49, 'Shrt_Desc', 'MILK SHAKES,THICK VANILLA')
|
cy.assertCellEquals(49, 'Shrt_Desc', 'MILK SHAKES,THICK VANILLA');
|
||||||
})
|
});
|
||||||
it('Ensure it redirects to previous-page when pagesize is 5', function () {
|
it('Ensure it redirects to previous-page when pagesize is 5', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('5').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('5').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('next').click()
|
cy.get('.viewpanel-paging').find('a').contains('next').click();
|
||||||
|
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 2)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 2);
|
||||||
cy.get('.viewpanel-paging').find('a').contains('previous').click()
|
cy.get('.viewpanel-paging').find('a').contains('previous').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 1)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 1);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT');
|
||||||
cy.assertCellEquals(4, 'Shrt_Desc', 'CHEESE,BRICK')
|
cy.assertCellEquals(4, 'Shrt_Desc', 'CHEESE,BRICK');
|
||||||
})
|
});
|
||||||
it('Ensure it redirects to previous-page when pagesize is 10', function () {
|
it('Ensure it redirects to previous-page when pagesize is 10', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('10').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('10').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('next').click()
|
cy.get('.viewpanel-paging').find('a').contains('next').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 2)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 2);
|
||||||
cy.get('.viewpanel-paging').find('a').contains('previous').click()
|
cy.get('.viewpanel-paging').find('a').contains('previous').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 1)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 1);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT');
|
||||||
cy.assertCellEquals(9, 'Shrt_Desc', 'CHEESE,CHESHIRE')
|
cy.assertCellEquals(9, 'Shrt_Desc', 'CHEESE,CHESHIRE');
|
||||||
})
|
});
|
||||||
it('Ensure it redirects to previous-page when pagesize is 25', function () {
|
it('Ensure it redirects to previous-page when pagesize is 25', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('25').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('25').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('next').click()
|
cy.get('.viewpanel-paging').find('a').contains('next').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 2)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 2);
|
||||||
cy.get('.viewpanel-paging').find('a').contains('previous').click()
|
cy.get('.viewpanel-paging').find('a').contains('previous').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 1)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 1);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT');
|
||||||
cy.assertCellEquals(24, 'Shrt_Desc', 'CHEESE,MONTEREY')
|
cy.assertCellEquals(24, 'Shrt_Desc', 'CHEESE,MONTEREY');
|
||||||
})
|
});
|
||||||
it('Ensure it redirects to previous-page when pagesize is 50', function () {
|
it('Ensure it redirects to previous-page when pagesize is 50', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('50').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('50').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('next').click()
|
cy.get('.viewpanel-paging').find('a').contains('next').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 2)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 2);
|
||||||
cy.get('.viewpanel-paging').find('a').contains('previous').click()
|
cy.get('.viewpanel-paging').find('a').contains('previous').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 1)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 1);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT');
|
||||||
cy.assertCellEquals(
|
cy.assertCellEquals(
|
||||||
49,
|
49,
|
||||||
'Shrt_Desc',
|
'Shrt_Desc',
|
||||||
'CREAM,FLUID,LT (COFFEE CRM OR TABLE CRM)'
|
'CREAM,FLUID,LT (COFFEE CRM OR TABLE CRM)'
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
it('Ensure last button redirects to last-page when pagesize is 5', function () {
|
it('Ensure last button redirects to last-page when pagesize is 5', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('5').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('5').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('last').click()
|
cy.get('.viewpanel-paging').find('a').contains('last').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 40)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 40);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'CHERVIL,DRIED')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'CHERVIL,DRIED');
|
||||||
cy.assertCellEquals(3, 'Shrt_Desc', 'CLOVES,GROUND')
|
cy.assertCellEquals(3, 'Shrt_Desc', 'CLOVES,GROUND');
|
||||||
})
|
});
|
||||||
it('Ensure last button redirects to last-page when pagesize is 10', function () {
|
it('Ensure last button redirects to last-page when pagesize is 10', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('10').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('10').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('last').click()
|
cy.get('.viewpanel-paging').find('a').contains('last').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 20)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 20);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'SPICES,BASIL,DRIED')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'SPICES,BASIL,DRIED');
|
||||||
cy.assertCellEquals(8, 'Shrt_Desc', 'CLOVES,GROUND')
|
cy.assertCellEquals(8, 'Shrt_Desc', 'CLOVES,GROUND');
|
||||||
})
|
});
|
||||||
it('Ensure last button redirects to last-page when pagesize is 25', function () {
|
it('Ensure last button redirects to last-page when pagesize is 25', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('25').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('25').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('last').click()
|
cy.get('.viewpanel-paging').find('a').contains('last').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 8)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 8);
|
||||||
cy.assertCellEquals(
|
cy.assertCellEquals(
|
||||||
0,
|
0,
|
||||||
'Shrt_Desc',
|
'Shrt_Desc',
|
||||||
"KRAFT BREYERS LT N' LVLY LOWFAT STR'BERY YOGURT (1% MILKFAT)"
|
"KRAFT BREYERS LT N' LVLY LOWFAT STR'BERY YOGURT (1% MILKFAT)"
|
||||||
)
|
);
|
||||||
cy.assertCellEquals(23, 'Shrt_Desc', 'CLOVES,GROUND')
|
cy.assertCellEquals(23, 'Shrt_Desc', 'CLOVES,GROUND');
|
||||||
})
|
});
|
||||||
it('Ensure last button redirects to last-page when pagesize is 50', function () {
|
it('Ensure last button redirects to last-page when pagesize is 50', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('50').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('50').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('last').click()
|
cy.get('.viewpanel-paging').find('a').contains('last').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 4)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 4);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'CHEESE SAU,PREP FROM RECIPE')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'CHEESE SAU,PREP FROM RECIPE');
|
||||||
cy.assertCellEquals(48, 'Shrt_Desc', 'CLOVES,GROUND')
|
cy.assertCellEquals(48, 'Shrt_Desc', 'CLOVES,GROUND');
|
||||||
})
|
});
|
||||||
it('Ensure first button redirects to first-page when pagesize is 5', function () {
|
it('Ensure first button redirects to first-page when pagesize is 5', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('5').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('5').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('last').click()
|
cy.get('.viewpanel-paging').find('a').contains('last').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 40)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 40);
|
||||||
cy.get('.viewpanel-paging').find('a').contains('first').click()
|
cy.get('.viewpanel-paging').find('a').contains('first').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 1)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 1);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT');
|
||||||
cy.assertCellEquals(4, 'Shrt_Desc', 'CHEESE,BRICK')
|
cy.assertCellEquals(4, 'Shrt_Desc', 'CHEESE,BRICK');
|
||||||
})
|
});
|
||||||
it('Ensure first button redirects to first-page when pagesize is 10', function () {
|
it('Ensure first button redirects to first-page when pagesize is 10', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('10').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('10').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('last').click()
|
cy.get('.viewpanel-paging').find('a').contains('last').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 20)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 20);
|
||||||
cy.get('.viewpanel-paging').find('a').contains('first').click()
|
cy.get('.viewpanel-paging').find('a').contains('first').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 1)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 1);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT');
|
||||||
cy.assertCellEquals(9, 'Shrt_Desc', 'CHEESE,CHESHIRE')
|
cy.assertCellEquals(9, 'Shrt_Desc', 'CHEESE,CHESHIRE');
|
||||||
})
|
});
|
||||||
it('Ensure first button redirects to first-page when pagesize is 25', function () {
|
it('Ensure first button redirects to first-page when pagesize is 25', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('25').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('25').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('last').click()
|
cy.get('.viewpanel-paging').find('a').contains('last').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 8)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 8);
|
||||||
cy.get('.viewpanel-paging').find('a').contains('first').click()
|
cy.get('.viewpanel-paging').find('a').contains('first').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 1)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 1);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT');
|
||||||
cy.assertCellEquals(24, 'Shrt_Desc', 'CHEESE,MONTEREY')
|
cy.assertCellEquals(24, 'Shrt_Desc', 'CHEESE,MONTEREY');
|
||||||
})
|
});
|
||||||
it('Ensure first button redirects to first-page when pagesize is 50', function () {
|
it('Ensure first button redirects to first-page when pagesize is 50', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('50').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('50').click();
|
||||||
cy.get('.viewpanel-paging').find('a').contains('last').click()
|
cy.get('.viewpanel-paging').find('a').contains('last').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 4)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 4);
|
||||||
cy.get('.viewpanel-paging').find('a').contains('first').click()
|
cy.get('.viewpanel-paging').find('a').contains('first').click();
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 1)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 1);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT');
|
||||||
cy.assertCellEquals(
|
cy.assertCellEquals(
|
||||||
49,
|
49,
|
||||||
'Shrt_Desc',
|
'Shrt_Desc',
|
||||||
'CREAM,FLUID,LT (COFFEE CRM OR TABLE CRM)'
|
'CREAM,FLUID,LT (COFFEE CRM OR TABLE CRM)'
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
it('Ensure page-number input redirects to correct-page when pagesize is 5', function () {
|
it('Ensure page-number input redirects to correct-page when pagesize is 5', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('5').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('5').click();
|
||||||
cy.get('#viewpanel-paging-current-input').type('{backspace}2{enter}')
|
cy.get('#viewpanel-paging-current-input').type('{backspace}2{enter}');
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 2)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 2);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'CHEESE,BRIE')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'CHEESE,BRIE');
|
||||||
cy.assertCellEquals(4, 'Shrt_Desc', 'CHEESE,CHESHIRE')
|
cy.assertCellEquals(4, 'Shrt_Desc', 'CHEESE,CHESHIRE');
|
||||||
})
|
});
|
||||||
it('Ensure page-number input redirects to correct-page when pagesize is 10', function () {
|
it('Ensure page-number input redirects to correct-page when pagesize is 10', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('10').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('10').click();
|
||||||
cy.get('#viewpanel-paging-current-input').type('{backspace}2{enter}')
|
cy.get('#viewpanel-paging-current-input').type('{backspace}2{enter}');
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 2)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 2);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'CHEESE,COLBY')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'CHEESE,COLBY');
|
||||||
cy.assertCellEquals(9, 'Shrt_Desc', 'CHEESE,FONTINA')
|
cy.assertCellEquals(9, 'Shrt_Desc', 'CHEESE,FONTINA');
|
||||||
})
|
});
|
||||||
it('Ensure page-number input redirects to correct-page when pagesize is 25', function () {
|
it('Ensure page-number input redirects to correct-page when pagesize is 25', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('25').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('25').click();
|
||||||
cy.get('#viewpanel-paging-current-input').type('{backspace}2{enter}')
|
cy.get('#viewpanel-paging-current-input').type('{backspace}2{enter}');
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 2)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 2);
|
||||||
|
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'CHEESE,MOZZARELLA,WHL MILK')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'CHEESE,MOZZARELLA,WHL MILK');
|
||||||
cy.assertCellEquals(
|
cy.assertCellEquals(
|
||||||
24,
|
24,
|
||||||
'Shrt_Desc',
|
'Shrt_Desc',
|
||||||
'CREAM,FLUID,LT (COFFEE CRM OR TABLE CRM)'
|
'CREAM,FLUID,LT (COFFEE CRM OR TABLE CRM)'
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
it('Ensure page-number input redirects to correct-page when pagesize is 50', function () {
|
it('Ensure page-number input redirects to correct-page when pagesize is 50', function () {
|
||||||
cy.loadAndVisitProject('food.small')
|
cy.loadAndVisitProject('food.small');
|
||||||
|
|
||||||
cy.get('.viewpanel-pagesize').find('a').contains('50').click()
|
cy.get('.viewpanel-pagesize').find('a').contains('50').click();
|
||||||
cy.get('#viewpanel-paging-current-input').type('{backspace}2{enter}')
|
cy.get('#viewpanel-paging-current-input').type('{backspace}2{enter}');
|
||||||
cy.get('#viewpanel-paging-current-input').should('have.value', 2)
|
cy.get('#viewpanel-paging-current-input').should('have.value', 2);
|
||||||
cy.assertCellEquals(0, 'Shrt_Desc', 'CREAM,FLUID,LT WHIPPING')
|
cy.assertCellEquals(0, 'Shrt_Desc', 'CREAM,FLUID,LT WHIPPING');
|
||||||
cy.assertCellEquals(49, 'Shrt_Desc', 'MILK SHAKES,THICK VANILLA')
|
cy.assertCellEquals(49, 'Shrt_Desc', 'MILK SHAKES,THICK VANILLA');
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,120 +1,111 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensure it reverses and reorders text sort', function () {
|
it('Ensure it reverses and reorders text sort', function () {
|
||||||
cy.loadAndVisitProject('food.sort')
|
cy.loadAndVisitProject('food.sort');
|
||||||
|
|
||||||
cy.columnActionClick('Shrt_Desc', ['Sort'])
|
cy.columnActionClick('Shrt_Desc', ['Sort']);
|
||||||
cy.waitForDialogPanel()
|
cy.waitForDialogPanel();
|
||||||
cy.confirmDialogPanel()
|
cy.confirmDialogPanel();
|
||||||
|
|
||||||
cy.getCell(0, 'Shrt_Desc').should(
|
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WHIPPED,WITH SALT');
|
||||||
'to.contain',
|
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT');
|
||||||
'BUTTER,WHIPPED,WITH SALT'
|
cy.get('.viewpanel-sorting a').contains('Sort').click();
|
||||||
)
|
cy.get('.menu-container').contains('By Shrt_Desc').trigger('mouseover');
|
||||||
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT')
|
cy.get('.menu-item').contains('Reverse').click();
|
||||||
cy.get('.viewpanel-sorting a').contains('Sort').click()
|
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT');
|
||||||
cy.get('.menu-container').contains('By Shrt_Desc').trigger('mouseover')
|
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WHIPPED,WITH SALT');
|
||||||
cy.get('.menu-item').contains('Reverse').click()
|
cy.get('.viewpanel-sorting a').contains('Sort').click();
|
||||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT')
|
cy.get('.menu-container').contains('Reorder rows permanently').click();
|
||||||
cy.getCell(1, 'Shrt_Desc').should(
|
cy.reload();
|
||||||
'to.contain',
|
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT');
|
||||||
'BUTTER,WHIPPED,WITH SALT'
|
cy.getCell(1, 'Shrt_Desc').should('to.contain', 'BUTTER,WHIPPED,WITH SALT');
|
||||||
)
|
});
|
||||||
cy.get('.viewpanel-sorting a').contains('Sort').click()
|
it('Ensure it reverses and reorders number sort', function () {
|
||||||
cy.get('.menu-container').contains('Reorder rows permanently').click()
|
cy.loadAndVisitProject('food.sort');
|
||||||
cy.reload()
|
|
||||||
cy.getCell(0, 'Shrt_Desc').should('to.contain', 'BUTTER,WITH SALT')
|
|
||||||
cy.getCell(1, 'Shrt_Desc').should(
|
|
||||||
'to.contain',
|
|
||||||
'BUTTER,WHIPPED,WITH SALT'
|
|
||||||
)
|
|
||||||
})
|
|
||||||
it('Ensure it reverses and reorders number sort', function () {
|
|
||||||
cy.loadAndVisitProject('food.sort')
|
|
||||||
|
|
||||||
cy.castColumnTo('NDB_No', 'number')
|
cy.castColumnTo('NDB_No', 'number');
|
||||||
cy.columnActionClick('NDB_No', ['Sort'])
|
cy.columnActionClick('NDB_No', ['Sort']);
|
||||||
|
|
||||||
cy.waitForDialogPanel()
|
cy.waitForDialogPanel();
|
||||||
cy.get('[type="radio"]').check('number')
|
cy.get('[type="radio"]').check('number');
|
||||||
cy.get('[type="radio"]').check('reverse')
|
cy.get('[type="radio"]').check('reverse');
|
||||||
cy.confirmDialogPanel()
|
cy.confirmDialogPanel();
|
||||||
|
|
||||||
cy.getCell(0, 'NDB_No').should('to.contain', 1002)
|
cy.getCell(0, 'NDB_No').should('to.contain', 1002);
|
||||||
cy.getCell(1, 'NDB_No').should('to.contain', 1001)
|
cy.getCell(1, 'NDB_No').should('to.contain', 1001);
|
||||||
|
|
||||||
cy.get('.viewpanel-sorting a').contains('Sort').click()
|
cy.get('.viewpanel-sorting a').contains('Sort').click();
|
||||||
cy.get('.menu-container').contains('By NDB_No').trigger('mouseover')
|
cy.get('.menu-container').contains('By NDB_No').trigger('mouseover');
|
||||||
cy.get('.menu-item').contains('Reverse').click()
|
cy.get('.menu-item').contains('Reverse').click();
|
||||||
cy.getCell(0, 'NDB_No').should('to.contain', 1001)
|
cy.getCell(0, 'NDB_No').should('to.contain', 1001);
|
||||||
cy.getCell(1, 'NDB_No').should('to.contain', 1002)
|
cy.getCell(1, 'NDB_No').should('to.contain', 1002);
|
||||||
cy.get('.viewpanel-sorting a').contains('Sort').click()
|
cy.get('.viewpanel-sorting a').contains('Sort').click();
|
||||||
cy.get('.menu-container').contains('Reorder rows permanently').click()
|
cy.get('.menu-container').contains('Reorder rows permanently').click();
|
||||||
cy.reload()
|
cy.reload();
|
||||||
cy.getCell(0, 'NDB_No').should('to.contain', 1001)
|
cy.getCell(0, 'NDB_No').should('to.contain', 1001);
|
||||||
cy.getCell(1, 'NDB_No').should('to.contain', 1002)
|
cy.getCell(1, 'NDB_No').should('to.contain', 1002);
|
||||||
})
|
});
|
||||||
it('Ensure it reverses and reorders date sort', function () {
|
it('Ensure it reverses and reorders date sort', function () {
|
||||||
cy.loadAndVisitProject('food.sort')
|
cy.loadAndVisitProject('food.sort');
|
||||||
|
|
||||||
cy.castColumnTo('Date', 'date')
|
cy.castColumnTo('Date', 'date');
|
||||||
cy.columnActionClick('Date', ['Sort'])
|
cy.columnActionClick('Date', ['Sort']);
|
||||||
|
|
||||||
cy.waitForDialogPanel()
|
cy.waitForDialogPanel();
|
||||||
cy.get('[type="radio"]').check('date')
|
cy.get('[type="radio"]').check('date');
|
||||||
cy.get('[type="radio"]').check('reverse')
|
cy.get('[type="radio"]').check('reverse');
|
||||||
cy.confirmDialogPanel()
|
cy.confirmDialogPanel();
|
||||||
|
|
||||||
cy.getCell(0, 'Date').should('to.contain', '2020-12-17T00:00:00Z')
|
cy.getCell(0, 'Date').should('to.contain', '2020-12-17T00:00:00Z');
|
||||||
cy.getCell(1, 'Date').should('to.contain', '2020-08-17T00:00:00Z')
|
cy.getCell(1, 'Date').should('to.contain', '2020-08-17T00:00:00Z');
|
||||||
|
|
||||||
cy.get('.viewpanel-sorting a').contains('Sort').click()
|
cy.get('.viewpanel-sorting a').contains('Sort').click();
|
||||||
cy.get('.menu-container').contains('By Date').trigger('mouseover')
|
cy.get('.menu-container').contains('By Date').trigger('mouseover');
|
||||||
cy.get('.menu-item').contains('Reverse').click()
|
cy.get('.menu-item').contains('Reverse').click();
|
||||||
cy.getCell(0, 'Date').should('to.contain', '2020-08-17T00:00:00Z')
|
cy.getCell(0, 'Date').should('to.contain', '2020-08-17T00:00:00Z');
|
||||||
cy.getCell(1, 'Date').should('to.contain', '2020-12-17T00:00:00Z')
|
cy.getCell(1, 'Date').should('to.contain', '2020-12-17T00:00:00Z');
|
||||||
|
|
||||||
cy.get('.viewpanel-sorting a').contains('Sort').click()
|
cy.get('.viewpanel-sorting a').contains('Sort').click();
|
||||||
cy.get('.menu-container').contains('Reorder rows permanently').click()
|
cy.get('.menu-container').contains('Reorder rows permanently').click();
|
||||||
cy.reload()
|
cy.reload();
|
||||||
cy.getCell(0, 'Date').should('to.contain', '2020-08-17T00:00:00Z')
|
cy.getCell(0, 'Date').should('to.contain', '2020-08-17T00:00:00Z');
|
||||||
cy.getCell(1, 'Date').should('to.contain', '2020-12-17T00:00:00Z')
|
cy.getCell(1, 'Date').should('to.contain', '2020-12-17T00:00:00Z');
|
||||||
})
|
});
|
||||||
it('Ensure it reverses and reorders bool sort', function () {
|
it('Ensure it reverses and reorders bool sort', function () {
|
||||||
cy.loadAndVisitProject('food.sort')
|
cy.loadAndVisitProject('food.sort');
|
||||||
|
|
||||||
cy.getCell(0, 'Fat')
|
cy.getCell(0, 'Fat')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get('a.data-table-cell-edit').click()
|
cy.get('a.data-table-cell-edit').click();
|
||||||
})
|
});
|
||||||
cy.get('select').select('boolean')
|
cy.get('select').select('boolean');
|
||||||
cy.get('button').contains(new RegExp('Apply', 'g')).click()
|
cy.get('button').contains(new RegExp('Apply', 'g')).click();
|
||||||
|
|
||||||
cy.getCell(1, 'Fat')
|
cy.getCell(1, 'Fat')
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get('a.data-table-cell-edit').click()
|
cy.get('a.data-table-cell-edit').click();
|
||||||
})
|
});
|
||||||
cy.get('select').select('boolean')
|
cy.get('select').select('boolean');
|
||||||
cy.get('button').contains(new RegExp('Apply', 'g')).click()
|
cy.get('button').contains(new RegExp('Apply', 'g')).click();
|
||||||
|
|
||||||
cy.columnActionClick('Fat', ['Sort'])
|
cy.columnActionClick('Fat', ['Sort']);
|
||||||
|
|
||||||
cy.waitForDialogPanel()
|
cy.waitForDialogPanel();
|
||||||
cy.get('[type="radio"]').check('boolean')
|
cy.get('[type="radio"]').check('boolean');
|
||||||
cy.confirmDialogPanel()
|
cy.confirmDialogPanel();
|
||||||
|
|
||||||
cy.getCell(0, 'Fat').should('to.contain', 'false')
|
cy.getCell(0, 'Fat').should('to.contain', 'false');
|
||||||
cy.getCell(1, 'Fat').should('to.contain', 'true')
|
cy.getCell(1, 'Fat').should('to.contain', 'true');
|
||||||
cy.get('.viewpanel-sorting a').contains('Sort').click()
|
cy.get('.viewpanel-sorting a').contains('Sort').click();
|
||||||
cy.get('.menu-container').contains('By Fat').trigger('mouseover')
|
cy.get('.menu-container').contains('By Fat').trigger('mouseover');
|
||||||
cy.get('.menu-item').contains('Reverse').click()
|
cy.get('.menu-item').contains('Reverse').click();
|
||||||
cy.getCell(0, 'Fat').should('to.contain', 'true')
|
cy.getCell(0, 'Fat').should('to.contain', 'true');
|
||||||
cy.getCell(1, 'Fat').should('to.contain', 'false')
|
cy.getCell(1, 'Fat').should('to.contain', 'false');
|
||||||
cy.get('.viewpanel-sorting a').contains('Sort').click()
|
cy.get('.viewpanel-sorting a').contains('Sort').click();
|
||||||
cy.get('.menu-container').contains('Reorder rows permanently').click()
|
cy.get('.menu-container').contains('Reorder rows permanently').click();
|
||||||
cy.reload()
|
cy.reload();
|
||||||
cy.getCell(0, 'Fat').should('to.contain', 'true')
|
cy.getCell(0, 'Fat').should('to.contain', 'true');
|
||||||
cy.getCell(1, 'Fat').should('to.contain', 'false')
|
cy.getCell(1, 'Fat').should('to.contain', 'false');
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Export a project', function () {
|
it('Export a project', function () {
|
||||||
const testProjectName = Date.now()
|
const testProjectName = Date.now();
|
||||||
cy.loadAndVisitProject('food.mini', testProjectName)
|
cy.loadAndVisitProject('food.mini', testProjectName);
|
||||||
cy.get('#export-button').click()
|
cy.get('#export-button').click();
|
||||||
cy.get('.menu-container a')
|
cy.get('.menu-container a')
|
||||||
.contains('OpenRefine project archive to file')
|
.contains('OpenRefine project archive to file')
|
||||||
.click()
|
.click();
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,44 +1,42 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Apply a JSON', function () {
|
it('Apply a JSON', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
|
|
||||||
cy.get('#or-proj-undoRedo').click()
|
cy.get('#or-proj-undoRedo').click();
|
||||||
cy.get('#refine-tabs-history .history-panel-controls')
|
cy.get('#refine-tabs-history .history-panel-controls')
|
||||||
.contains('Apply')
|
.contains('Apply')
|
||||||
.click()
|
.click();
|
||||||
|
|
||||||
cy.get('table.data-table thead th[title="Shrt_Desc"]').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')
|
cy.get('table.data-table thead th[title="Water"]').should('exist');
|
||||||
|
|
||||||
// JSON for operations that will be applied
|
// JSON for operations that will be applied
|
||||||
const operations = [
|
const operations = [
|
||||||
{
|
{
|
||||||
op: 'core/column-removal',
|
op: 'core/column-removal',
|
||||||
columnName: 'Shrt_Desc',
|
columnName: 'Shrt_Desc',
|
||||||
description: 'Remove column Shrt_Desc',
|
description: 'Remove column Shrt_Desc',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
op: 'core/column-removal',
|
op: 'core/column-removal',
|
||||||
columnName: 'Water',
|
columnName: 'Water',
|
||||||
description: 'Remove column Water',
|
description: 'Remove column Water',
|
||||||
},
|
},
|
||||||
]
|
];
|
||||||
|
|
||||||
cy.get('.dialog-container .history-operation-json').type(
|
cy.get('.dialog-container .history-operation-json').type(
|
||||||
JSON.stringify(operations),
|
JSON.stringify(operations),
|
||||||
{
|
{
|
||||||
parseSpecialCharSequences: false,
|
parseSpecialCharSequences: false,
|
||||||
delay: 0,
|
delay: 0,
|
||||||
waitForAnimations: false,
|
waitForAnimations: false,
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
cy.get('.dialog-container button[bind="applyButton"]').click()
|
cy.get('.dialog-container button[bind="applyButton"]').click();
|
||||||
|
|
||||||
cy.get('table.data-table thead th[title="Shrt_Desc"]').should(
|
cy.get('table.data-table thead th[title="Shrt_Desc"]').should(
|
||||||
'not.to.exist'
|
'not.to.exist'
|
||||||
)
|
);
|
||||||
cy.get('table.data-table thead th[title="Water"]').should(
|
cy.get('table.data-table thead th[title="Water"]').should('not.to.exist');
|
||||||
'not.to.exist'
|
});
|
||||||
)
|
});
|
||||||
})
|
|
||||||
})
|
|
||||||
|
@ -1,170 +1,168 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Test select/unselect all', function () {
|
it('Test select/unselect all', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
cy.deleteColumn('NDB_No')
|
cy.deleteColumn('NDB_No');
|
||||||
cy.deleteColumn('Shrt_Desc')
|
cy.deleteColumn('Shrt_Desc');
|
||||||
|
|
||||||
cy.get('#or-proj-undoRedo').click()
|
cy.get('#or-proj-undoRedo').click();
|
||||||
cy.get('#refine-tabs-history .history-panel-controls')
|
cy.get('#refine-tabs-history .history-panel-controls')
|
||||||
.contains('Extract')
|
.contains('Extract')
|
||||||
.click()
|
.click();
|
||||||
|
|
||||||
// unselect all
|
// unselect all
|
||||||
cy.get('.dialog-container button[bind="unselectAllButton"]').click()
|
cy.get('.dialog-container button[bind="unselectAllButton"]').click();
|
||||||
cy.wait(500)
|
cy.wait(500); // eslint-disable-line
|
||||||
cy.get(
|
cy.get(
|
||||||
'.history-extract-dialog-entries tr:nth-child(1) td:first-child input'
|
'.history-extract-dialog-entries tr:nth-child(1) td:first-child input'
|
||||||
).should('not.to.be.checked')
|
).should('not.to.be.checked');
|
||||||
cy.get(
|
cy.get(
|
||||||
'.history-extract-dialog-entries tr:nth-child(2) td:first-child input'
|
'.history-extract-dialog-entries tr:nth-child(2) td:first-child input'
|
||||||
).should('not.to.be.checked')
|
).should('not.to.be.checked');
|
||||||
cy.get('.dialog-container textarea.history-operation-json').should(
|
cy.get('.dialog-container textarea.history-operation-json').should(
|
||||||
'have.value',
|
'have.value',
|
||||||
'[]'
|
'[]'
|
||||||
)
|
);
|
||||||
|
|
||||||
// // reselect all
|
// // reselect all
|
||||||
cy.get('.dialog-container button[bind="selectAllButton"]').click()
|
cy.get('.dialog-container button[bind="selectAllButton"]').click();
|
||||||
cy.wait(500)
|
cy.wait(500); // eslint-disable-line
|
||||||
cy.get(
|
cy.get(
|
||||||
'.history-extract-dialog-entries tr:nth-child(1) td:first-child input'
|
'.history-extract-dialog-entries tr:nth-child(1) td:first-child input'
|
||||||
).should('be.checked')
|
).should('be.checked');
|
||||||
cy.get(
|
cy.get(
|
||||||
'.history-extract-dialog-entries tr:nth-child(2) td:first-child input'
|
'.history-extract-dialog-entries tr:nth-child(2) td:first-child input'
|
||||||
).should('be.checked')
|
).should('be.checked');
|
||||||
cy.assertTextareaHaveJsonValue(
|
cy.assertTextareaHaveJsonValue(
|
||||||
'.dialog-container textarea.history-operation-json',
|
'.dialog-container textarea.history-operation-json',
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
op: 'core/column-removal',
|
op: 'core/column-removal',
|
||||||
columnName: 'NDB_No',
|
columnName: 'NDB_No',
|
||||||
description: 'Remove column NDB_No',
|
description: 'Remove column NDB_No',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
op: 'core/column-removal',
|
op: 'core/column-removal',
|
||||||
columnName: 'Shrt_Desc',
|
columnName: 'Shrt_Desc',
|
||||||
description: 'Remove column Shrt_Desc',
|
description: 'Remove column Shrt_Desc',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test select/unselect individual entries', function () {
|
it('Test select/unselect individual entries', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
cy.deleteColumn('NDB_No')
|
cy.deleteColumn('NDB_No');
|
||||||
cy.deleteColumn('Shrt_Desc')
|
cy.deleteColumn('Shrt_Desc');
|
||||||
cy.get('#or-proj-undoRedo').click()
|
cy.get('#or-proj-undoRedo').click();
|
||||||
cy.get('#refine-tabs-history .history-panel-controls')
|
cy.get('#refine-tabs-history .history-panel-controls')
|
||||||
.contains('Extract')
|
.contains('Extract')
|
||||||
.click()
|
.click();
|
||||||
|
|
||||||
// unselect "Remove Water"
|
// unselect "Remove Water"
|
||||||
cy.get(
|
cy.get(
|
||||||
'.history-extract-dialog-entries tr:nth-child(1) td:first-child'
|
'.history-extract-dialog-entries tr:nth-child(1) td:first-child'
|
||||||
).click()
|
).click();
|
||||||
cy.assertTextareaHaveJsonValue(
|
cy.assertTextareaHaveJsonValue(
|
||||||
'.dialog-container textarea.history-operation-json',
|
'.dialog-container textarea.history-operation-json',
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
op: 'core/column-removal',
|
op: 'core/column-removal',
|
||||||
columnName: 'Shrt_Desc',
|
columnName: 'Shrt_Desc',
|
||||||
description: 'Remove column Shrt_Desc',
|
description: 'Remove column Shrt_Desc',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
)
|
);
|
||||||
|
|
||||||
// unselect "Remove Shrt_Desc"
|
// unselect "Remove Shrt_Desc"
|
||||||
cy.get(
|
cy.get(
|
||||||
'.history-extract-dialog-entries tr:nth-child(2) td:first-child'
|
'.history-extract-dialog-entries tr:nth-child(2) td:first-child'
|
||||||
).click()
|
).click();
|
||||||
cy.assertTextareaHaveJsonValue(
|
cy.assertTextareaHaveJsonValue(
|
||||||
'.dialog-container textarea.history-operation-json',
|
'.dialog-container textarea.history-operation-json',
|
||||||
[]
|
[]
|
||||||
)
|
);
|
||||||
|
|
||||||
// reselect "Remove Shrt_Desc"
|
// reselect "Remove Shrt_Desc"
|
||||||
cy.get(
|
cy.get(
|
||||||
'.history-extract-dialog-entries tr:nth-child(2) td:first-child'
|
'.history-extract-dialog-entries tr:nth-child(2) td:first-child'
|
||||||
).click()
|
).click();
|
||||||
cy.assertTextareaHaveJsonValue(
|
cy.assertTextareaHaveJsonValue(
|
||||||
'.dialog-container textarea.history-operation-json',
|
'.dialog-container textarea.history-operation-json',
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
op: 'core/column-removal',
|
op: 'core/column-removal',
|
||||||
columnName: 'Shrt_Desc',
|
columnName: 'Shrt_Desc',
|
||||||
description: 'Remove column Shrt_Desc',
|
description: 'Remove column Shrt_Desc',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
)
|
);
|
||||||
|
|
||||||
// reselect "Remove Water"
|
// reselect "Remove Water"
|
||||||
cy.get(
|
cy.get(
|
||||||
'.history-extract-dialog-entries tr:nth-child(1) td:first-child'
|
'.history-extract-dialog-entries tr:nth-child(1) td:first-child'
|
||||||
).click()
|
).click();
|
||||||
cy.assertTextareaHaveJsonValue(
|
cy.assertTextareaHaveJsonValue(
|
||||||
'.dialog-container textarea.history-operation-json',
|
'.dialog-container textarea.history-operation-json',
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
op: 'core/column-removal',
|
op: 'core/column-removal',
|
||||||
columnName: 'NDB_No',
|
columnName: 'NDB_No',
|
||||||
description: 'Remove column NDB_No',
|
description: 'Remove column NDB_No',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
op: 'core/column-removal',
|
op: 'core/column-removal',
|
||||||
columnName: 'Shrt_Desc',
|
columnName: 'Shrt_Desc',
|
||||||
description: 'Remove column Shrt_Desc',
|
description: 'Remove column Shrt_Desc',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Test the close button', function () {
|
it('Test the close button', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
cy.deleteColumn('NDB_No')
|
cy.deleteColumn('NDB_No');
|
||||||
cy.get('#or-proj-undoRedo').click()
|
cy.get('#or-proj-undoRedo').click();
|
||||||
cy.get('#refine-tabs-history .history-panel-controls')
|
cy.get('#refine-tabs-history .history-panel-controls')
|
||||||
.contains('Extract')
|
.contains('Extract')
|
||||||
.click()
|
.click();
|
||||||
|
|
||||||
cy.get('.dialog-container').should('exist').should('be.visible')
|
cy.get('.dialog-container').should('exist').should('be.visible');
|
||||||
cy.get('.dialog-container button[bind="closeButton"]').click()
|
cy.get('.dialog-container button[bind="closeButton"]').click();
|
||||||
cy.get('.dialog-container').should('not.exist')
|
cy.get('.dialog-container').should('not.exist');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Ensure action are recorded in the extract panel', function () {
|
it('Ensure action are recorded in the extract panel', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
cy.deleteColumn('NDB_No')
|
cy.deleteColumn('NDB_No');
|
||||||
cy.deleteColumn('Shrt_Desc')
|
cy.deleteColumn('Shrt_Desc');
|
||||||
|
|
||||||
cy.get('#or-proj-undoRedo').click()
|
cy.get('#or-proj-undoRedo').click();
|
||||||
|
|
||||||
cy.get('#refine-tabs-history .history-panel-controls')
|
cy.get('#refine-tabs-history .history-panel-controls')
|
||||||
.contains('Extract')
|
.contains('Extract')
|
||||||
.click()
|
.click();
|
||||||
|
|
||||||
// test the entries
|
// test the entries
|
||||||
cy.get('.history-extract-dialog-entries').contains(
|
cy.get('.history-extract-dialog-entries').contains('Remove column NDB_No');
|
||||||
'Remove column NDB_No'
|
cy.get('.history-extract-dialog-entries').contains(
|
||||||
)
|
'Remove column Shrt_Desc'
|
||||||
cy.get('.history-extract-dialog-entries').contains(
|
);
|
||||||
'Remove column Shrt_Desc'
|
|
||||||
)
|
|
||||||
|
|
||||||
// test the json
|
// test the json
|
||||||
cy.assertTextareaHaveJsonValue(
|
cy.assertTextareaHaveJsonValue(
|
||||||
'.dialog-container textarea.history-operation-json',
|
'.dialog-container textarea.history-operation-json',
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
op: 'core/column-removal',
|
op: 'core/column-removal',
|
||||||
columnName: 'NDB_No',
|
columnName: 'NDB_No',
|
||||||
description: 'Remove column NDB_No',
|
description: 'Remove column NDB_No',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
op: 'core/column-removal',
|
op: 'core/column-removal',
|
||||||
columnName: 'Shrt_Desc',
|
columnName: 'Shrt_Desc',
|
||||||
description: 'Remove column Shrt_Desc',
|
description: 'Remove column Shrt_Desc',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,113 +1,113 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensure the Undo button is visible after deleting a column', function () {
|
it('Ensure the Undo button is visible after deleting a column', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
cy.deleteColumn('NDB_No')
|
cy.deleteColumn('NDB_No');
|
||||||
|
|
||||||
cy.get('#notification-container')
|
cy.get('#notification-container')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.should('to.contain', 'Remove column NDB_No')
|
.should('to.contain', 'Remove column NDB_No');
|
||||||
cy.get('#notification-container .notification-action')
|
cy.get('#notification-container .notification-action')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.should('to.contain', 'Undo')
|
.should('to.contain', 'Undo');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('Ensure the Undo button is effectively working', function () {
|
it('Ensure the Undo button is effectively working', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
|
|
||||||
cy.deleteColumn('NDB_No')
|
cy.deleteColumn('NDB_No');
|
||||||
// ensure that the column is back in the grid
|
// ensure that the column is back in the grid
|
||||||
cy.get('#notification-container .notification-action')
|
cy.get('#notification-container .notification-action')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.should('to.contain', 'Undo')
|
.should('to.contain', 'Undo');
|
||||||
cy.get('#notification-container a[bind="undoLink"]').click()
|
cy.get('#notification-container a[bind="undoLink"]').click();
|
||||||
cy.get('.data-table th[title="NDB_No"]').should('exist')
|
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 () {
|
it('Delete 3 columns, then successively undo and redo the modifications using the Undo/Redo panel', function () {
|
||||||
cy.loadAndVisitProject('food.mini')
|
cy.loadAndVisitProject('food.mini');
|
||||||
|
|
||||||
// delete NDB_No
|
// delete NDB_No
|
||||||
cy.deleteColumn('NDB_No')
|
cy.deleteColumn('NDB_No');
|
||||||
cy.get('#or-proj-undoRedo').should('to.contain', '1 / 1')
|
cy.get('#or-proj-undoRedo').should('to.contain', '1 / 1');
|
||||||
cy.get('.history-panel-body .history-now').should(
|
cy.get('.history-panel-body .history-now').should(
|
||||||
'to.contain',
|
'to.contain',
|
||||||
'Remove column NDB_No'
|
'Remove column NDB_No'
|
||||||
)
|
);
|
||||||
|
|
||||||
// delete Water
|
// delete Water
|
||||||
cy.deleteColumn('Water')
|
cy.deleteColumn('Water');
|
||||||
cy.get('#or-proj-undoRedo').should('to.contain', '2 / 2')
|
cy.get('#or-proj-undoRedo').should('to.contain', '2 / 2');
|
||||||
cy.get('.history-panel-body .history-now').should(
|
cy.get('.history-panel-body .history-now').should(
|
||||||
'to.contain',
|
'to.contain',
|
||||||
'Remove column Water'
|
'Remove column Water'
|
||||||
)
|
);
|
||||||
|
|
||||||
// Delete Shrt_Desc
|
// Delete Shrt_Desc
|
||||||
cy.deleteColumn('Shrt_Desc')
|
cy.deleteColumn('Shrt_Desc');
|
||||||
cy.get('#or-proj-undoRedo').should('to.contain', '3 / 3')
|
cy.get('#or-proj-undoRedo').should('to.contain', '3 / 3');
|
||||||
cy.get('.history-panel-body .history-now').should(
|
cy.get('.history-panel-body .history-now').should(
|
||||||
'to.contain',
|
'to.contain',
|
||||||
'Remove column Shrt_Desc'
|
'Remove column Shrt_Desc'
|
||||||
)
|
);
|
||||||
|
|
||||||
// Open the Undo/Redo panel
|
// Open the Undo/Redo panel
|
||||||
cy.get('#or-proj-undoRedo').click()
|
cy.get('#or-proj-undoRedo').click();
|
||||||
|
|
||||||
// ensure all previous actions have been recorded
|
// ensure all previous actions have been recorded
|
||||||
cy.get('.history-panel-body .history-past').should(
|
cy.get('.history-panel-body .history-past').should(
|
||||||
'to.contain',
|
'to.contain',
|
||||||
'Remove column NDB_No'
|
'Remove column NDB_No'
|
||||||
)
|
);
|
||||||
cy.get('.history-panel-body .history-past').should(
|
cy.get('.history-panel-body .history-past').should(
|
||||||
'to.contain',
|
'to.contain',
|
||||||
'Remove column Water'
|
'Remove column Water'
|
||||||
)
|
);
|
||||||
cy.get('.history-panel-body .history-now').should(
|
cy.get('.history-panel-body .history-now').should(
|
||||||
'to.contain',
|
'to.contain',
|
||||||
'Remove column Shrt_Desc'
|
'Remove column Shrt_Desc'
|
||||||
)
|
);
|
||||||
|
|
||||||
// successively undo all modifications
|
// successively undo all modifications
|
||||||
cy.get(
|
cy.get(
|
||||||
'.history-panel-body .history-past a.history-entry:last-of-type'
|
'.history-panel-body .history-past a.history-entry:last-of-type'
|
||||||
).click()
|
).click();
|
||||||
cy.waitForOrOperation()
|
cy.waitForOrOperation();
|
||||||
cy.get('.history-panel-body .history-past').should(
|
cy.get('.history-panel-body .history-past').should(
|
||||||
'to.contain',
|
'to.contain',
|
||||||
'Remove column NDB_No'
|
'Remove column NDB_No'
|
||||||
)
|
);
|
||||||
cy.get('.history-panel-body .history-now').should(
|
cy.get('.history-panel-body .history-now').should(
|
||||||
'to.contain',
|
'to.contain',
|
||||||
'Remove column Water'
|
'Remove column Water'
|
||||||
)
|
);
|
||||||
cy.get('.history-panel-body .history-future').should(
|
cy.get('.history-panel-body .history-future').should(
|
||||||
'to.contain',
|
'to.contain',
|
||||||
'Remove column Shrt_Desc'
|
'Remove column Shrt_Desc'
|
||||||
)
|
);
|
||||||
|
|
||||||
cy.get(
|
cy.get(
|
||||||
'.history-panel-body .history-past a.history-entry:last-of-type'
|
'.history-panel-body .history-past a.history-entry:last-of-type'
|
||||||
).click()
|
).click();
|
||||||
cy.waitForOrOperation()
|
cy.waitForOrOperation();
|
||||||
cy.get('.history-panel-body .history-now').should(
|
cy.get('.history-panel-body .history-now').should(
|
||||||
'to.contain',
|
'to.contain',
|
||||||
'Remove column NDB_No'
|
'Remove column NDB_No'
|
||||||
)
|
);
|
||||||
cy.get('.history-panel-body .history-future').should(
|
cy.get('.history-panel-body .history-future').should(
|
||||||
'to.contain',
|
'to.contain',
|
||||||
'Remove column Water'
|
'Remove column Water'
|
||||||
)
|
);
|
||||||
cy.get('.history-panel-body .history-future').should(
|
cy.get('.history-panel-body .history-future').should(
|
||||||
'to.contain',
|
'to.contain',
|
||||||
'Remove column Shrt_Desc'
|
'Remove column Shrt_Desc'
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
// Very long test to run
|
// Very long test to run
|
||||||
// it('Ensure the Undo button dissapear after timeout after deleting a column', function () {
|
// it('Ensure the Undo button dissapear after timeout after deleting a column', function () {
|
||||||
// const ORNotificationTimeout = 15000;
|
// const ORNotificationTimeout = 15000;
|
||||||
// cy.loadAndVisitProject('food.mini');
|
// cy.loadAndVisitProject('food.mini');
|
||||||
// cy.columnActionClick('NDB_No', ['Edit column', 'Remove this column']);
|
// cy.columnActionClick('NDB_No', ['Edit column', 'Remove this column']);
|
||||||
// cy.get('#notification-container', { timeout: ORNotificationTimeout }).should('not.be.visible');
|
// cy.get('#notification-container', { timeout: ORNotificationTimeout }).should('not.be.visible');
|
||||||
// });
|
// });
|
||||||
})
|
});
|
||||||
|
@ -1,139 +1,130 @@
|
|||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
it('Ensures project-metadata dialogue loads', function () {
|
it('Ensures project-metadata dialogue loads', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now();
|
||||||
cy.loadProject('food.mini', projectName)
|
cy.loadProject('food.mini', projectName);
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project');
|
||||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
cy.contains('td', projectName).siblings().contains('a', 'About').click();
|
||||||
cy.get('h1').contains('Project metadata')
|
cy.get('h1').contains('Project metadata');
|
||||||
cy.get(
|
cy.get(
|
||||||
'body > .dialog-container > .dialog-frame .dialog-footer button[bind="closeButton"]'
|
'body > .dialog-container > .dialog-frame .dialog-footer button[bind="closeButton"]'
|
||||||
).click()
|
).click();
|
||||||
cy.get('body > .dialog-container > .dialog-frame').should('not.exist')
|
cy.get('body > .dialog-container > .dialog-frame').should('not.exist');
|
||||||
})
|
});
|
||||||
it('Ensures project-metadata has correct details', function () {
|
it('Ensures project-metadata has correct details', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now();
|
||||||
cy.loadProject('food.mini', projectName)
|
cy.loadProject('food.mini', projectName);
|
||||||
cy.visitOpenRefine()
|
cy.visitOpenRefine();
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project');
|
||||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
cy.contains('td', projectName).siblings().contains('a', 'About').click();
|
||||||
cy.get('#metadata-body tbody>tr').eq(3).contains('Project name')
|
cy.get('#metadata-body tbody>tr').eq(3).contains('Project name');
|
||||||
cy.get('#metadata-body tbody>tr').eq(3).contains(projectName)
|
cy.get('#metadata-body tbody>tr').eq(3).contains(projectName);
|
||||||
})
|
});
|
||||||
it('Ensures project-metadata can be edit project name', function () {
|
it('Ensures project-metadata can be edit project name', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now();
|
||||||
cy.loadProject('food.mini', projectName)
|
cy.loadProject('food.mini', projectName);
|
||||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||||
onBeforeLoad(win) {
|
onBeforeLoad(win) {
|
||||||
cy.stub(win, 'prompt').returns('testProject')
|
cy.stub(win, 'prompt').returns('testProject');
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project');
|
||||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
cy.contains('td', projectName).siblings().contains('a', 'About').click();
|
||||||
cy.contains('td', 'Project name:')
|
cy.contains('td', 'Project name:')
|
||||||
.siblings()
|
.siblings()
|
||||||
.contains('button', 'Edit')
|
.contains('button', 'Edit')
|
||||||
.click()
|
.click();
|
||||||
cy.get('#metadata-body tbody>tr').eq(3).contains('Project name')
|
cy.get('#metadata-body tbody>tr').eq(3).contains('Project name');
|
||||||
cy.get('#metadata-body tbody>tr').eq(3).contains('testProject')
|
cy.get('#metadata-body tbody>tr').eq(3).contains('testProject');
|
||||||
})
|
});
|
||||||
it('Ensures project-metadata can be edit tags', function () {
|
it('Ensures project-metadata can be edit tags', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now();
|
||||||
cy.loadProject('food.mini', projectName)
|
cy.loadProject('food.mini', projectName);
|
||||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||||
onBeforeLoad(win) {
|
onBeforeLoad(win) {
|
||||||
cy.stub(win, 'prompt').returns('tagTest')
|
cy.stub(win, 'prompt').returns('tagTest');
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project');
|
||||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
cy.contains('td', projectName).siblings().contains('a', 'About').click();
|
||||||
cy.contains('td', 'Tags:').siblings().contains('button', 'Edit').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('Tags');
|
||||||
cy.get('#metadata-body tbody>tr').eq(4).contains('tagTest')
|
cy.get('#metadata-body tbody>tr').eq(4).contains('tagTest');
|
||||||
})
|
});
|
||||||
it('Ensures project-metadata can be edit creator', function () {
|
it('Ensures project-metadata can be edit creator', function () {
|
||||||
const projectName = Date.now()
|
const projectName = Date.now();
|
||||||
cy.loadProject('food.mini', projectName)
|
cy.loadProject('food.mini', projectName);
|
||||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||||
onBeforeLoad(win) {
|
onBeforeLoad(win) {
|
||||||
cy.stub(win, 'prompt').returns('testCreator')
|
cy.stub(win, 'prompt').returns('testCreator');
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
cy.navigateTo('Open Project')
|
cy.navigateTo('Open Project');
|
||||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
cy.contains('td', projectName).siblings().contains('a', 'About').click();
|
||||||
cy.contains('td', 'Creator:')
|
cy.contains('td', 'Creator:').siblings().contains('button', 'Edit').click();
|
||||||
.siblings()
|
cy.get('#metadata-body tbody>tr').eq(5).contains('Creator');
|
||||||
.contains('button', 'Edit')
|
cy.get('#metadata-body tbody>tr').eq(5).contains('testCreator');
|
||||||
.click()
|
});
|
||||||
cy.get('#metadata-body tbody>tr').eq(5).contains('Creator')
|
it('Ensures project-metadata can be edit contributors', function () {
|
||||||
cy.get('#metadata-body tbody>tr').eq(5).contains('testCreator')
|
const projectName = Date.now();
|
||||||
})
|
cy.loadProject('food.mini', projectName);
|
||||||
it('Ensures project-metadata can be edit contributors', function () {
|
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||||
const projectName = Date.now()
|
onBeforeLoad(win) {
|
||||||
cy.loadProject('food.mini', projectName)
|
cy.stub(win, 'prompt').returns('testcontributor');
|
||||||
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:')
|
||||||
cy.navigateTo('Open Project')
|
.siblings()
|
||||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
.contains('button', 'Edit')
|
||||||
cy.contains('td', 'Contributors:')
|
.click();
|
||||||
.siblings()
|
cy.get('#metadata-body tbody>tr').eq(6).contains('Contributors');
|
||||||
.contains('button', 'Edit')
|
cy.get('#metadata-body tbody>tr').eq(6).contains('testcontributor');
|
||||||
.click()
|
});
|
||||||
cy.get('#metadata-body tbody>tr').eq(6).contains('Contributors')
|
it('Ensures project-metadata can be edit subject', function () {
|
||||||
cy.get('#metadata-body tbody>tr').eq(6).contains('testcontributor')
|
const projectName = Date.now();
|
||||||
})
|
cy.loadProject('food.mini', projectName);
|
||||||
it('Ensures project-metadata can be edit subject', function () {
|
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||||
const projectName = Date.now()
|
onBeforeLoad(win) {
|
||||||
cy.loadProject('food.mini', projectName)
|
cy.stub(win, 'prompt').returns('testSubject');
|
||||||
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.navigateTo('Open Project')
|
cy.get('#metadata-body tbody>tr').eq(7).contains('Subject');
|
||||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
cy.get('#metadata-body tbody>tr').eq(7).contains('testSubject');
|
||||||
cy.contains('td', 'Subject:')
|
});
|
||||||
.siblings()
|
it('Ensures project-metadata can be edit license', function () {
|
||||||
.contains('button', 'Edit')
|
const projectName = Date.now();
|
||||||
.click()
|
cy.loadProject('food.mini', projectName);
|
||||||
cy.get('#metadata-body tbody>tr').eq(7).contains('Subject')
|
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||||
cy.get('#metadata-body tbody>tr').eq(7).contains('testSubject')
|
onBeforeLoad(win) {
|
||||||
})
|
cy.stub(win, 'prompt').returns('GPL-3');
|
||||||
it('Ensures project-metadata can be edit license', function () {
|
},
|
||||||
const projectName = Date.now()
|
});
|
||||||
cy.loadProject('food.mini', projectName)
|
cy.navigateTo('Open Project');
|
||||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
cy.contains('td', projectName).siblings().contains('a', 'About').click();
|
||||||
onBeforeLoad(win) {
|
cy.contains('td', 'License:').siblings().contains('button', 'Edit').click();
|
||||||
cy.stub(win, 'prompt').returns('GPL-3')
|
cy.get('#metadata-body tbody>tr').eq(12).contains('License');
|
||||||
},
|
cy.get('#metadata-body tbody>tr').eq(12).contains('GPL-3');
|
||||||
})
|
});
|
||||||
cy.navigateTo('Open Project')
|
it('Ensures project-metadata can be edit homepage', function () {
|
||||||
cy.contains('td', projectName).siblings().contains('a', 'About').click()
|
const projectName = Date.now();
|
||||||
cy.contains('td', 'License:')
|
cy.loadProject('food.mini', projectName);
|
||||||
.siblings()
|
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
||||||
.contains('button', 'Edit')
|
onBeforeLoad(win) {
|
||||||
.click()
|
cy.stub(win, 'prompt').returns('openrefine.org');
|
||||||
cy.get('#metadata-body tbody>tr').eq(12).contains('License')
|
},
|
||||||
cy.get('#metadata-body tbody>tr').eq(12).contains('GPL-3')
|
});
|
||||||
})
|
cy.navigateTo('Open Project');
|
||||||
it('Ensures project-metadata can be edit homepage', function () {
|
cy.contains('td', projectName).siblings().contains('a', 'About').click();
|
||||||
const projectName = Date.now()
|
cy.contains('td', 'Homepage:')
|
||||||
cy.loadProject('food.mini', projectName)
|
.siblings()
|
||||||
cy.visit(Cypress.env('OPENREFINE_URL'), {
|
.contains('button', 'Edit')
|
||||||
onBeforeLoad(win) {
|
.click();
|
||||||
cy.stub(win, 'prompt').returns('openrefine.org')
|
cy.get('#metadata-body tbody>tr').eq(13).contains('Homepage');
|
||||||
},
|
cy.get('#metadata-body tbody>tr').eq(13).contains('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')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/// <reference types="cypress" />
|
// / <reference types="cypress" />
|
||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
// This example plugins/index.js can be used to load plugins
|
// This example plugins/index.js can be used to load plugins
|
||||||
//
|
//
|
||||||
@ -15,8 +15,8 @@
|
|||||||
* @type {Cypress.PluginConfig}
|
* @type {Cypress.PluginConfig}
|
||||||
*/
|
*/
|
||||||
module.exports = (on, config) => {
|
module.exports = (on, config) => {
|
||||||
// `on` is used to hook into various events Cypress emits
|
// `on` is used to hook into various events Cypress emits
|
||||||
// `config` is the resolved Cypress config
|
// `config` is the resolved Cypress config
|
||||||
|
|
||||||
return config
|
return config;
|
||||||
}
|
};
|
||||||
|
@ -8,181 +8,179 @@
|
|||||||
// https://on.cypress.io/custom-commands
|
// https://on.cypress.io/custom-commands
|
||||||
// ***********************************************
|
// ***********************************************
|
||||||
|
|
||||||
import 'cypress-file-upload'
|
import 'cypress-file-upload';
|
||||||
import 'cypress-wait-until'
|
import 'cypress-wait-until';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the .facets-container for a given facet name
|
* Return the .facets-container for a given facet name
|
||||||
*/
|
*/
|
||||||
Cypress.Commands.add('getFacetContainer', (facetName) => {
|
Cypress.Commands.add('getFacetContainer', (facetName) => {
|
||||||
return cy
|
return cy
|
||||||
.get(
|
.get(
|
||||||
`#refine-tabs-facets .facets-container .facet-container span[bind="titleSpan"]:contains("${facetName}")`,
|
`#refine-tabs-facets .facets-container .facet-container span[bind="titleSpan"]:contains("${facetName}")`,
|
||||||
{ log: false }
|
{ log: false }
|
||||||
)
|
)
|
||||||
.parentsUntil('.facets-container', { log: false })
|
.parentsUntil('.facets-container', { log: false });
|
||||||
})
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit a cell, for a given row index, a column name and a value
|
* Edit a cell, for a given row index, a column name and a value
|
||||||
*/
|
*/
|
||||||
Cypress.Commands.add('editCell', (rowIndex, columnName, value) => {
|
Cypress.Commands.add('editCell', (rowIndex, columnName, value) => {
|
||||||
cy.getCell(rowIndex, columnName)
|
cy.getCell(rowIndex, columnName)
|
||||||
.trigger('mouseover')
|
.trigger('mouseover')
|
||||||
.find('a.data-table-cell-edit')
|
.find('a.data-table-cell-edit')
|
||||||
.click()
|
.click();
|
||||||
cy.get('.menu-container.data-table-cell-editor textarea').type(value)
|
cy.get('.menu-container.data-table-cell-editor textarea').type(value);
|
||||||
cy.get('.menu-container button[bind="okButton"]').click()
|
cy.get('.menu-container button[bind="okButton"]').click();
|
||||||
})
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('assertTextareaHaveJsonValue', (selector, json) => {
|
Cypress.Commands.add('assertTextareaHaveJsonValue', (selector, json) => {
|
||||||
cy.get(selector).then((el) => {
|
cy.get(selector).then((el) => {
|
||||||
// expected json needs to be parsed / restringified, to avoid inconsitencies about spaces and tabs
|
// expected json needs to be parsed / restringified, to avoid inconsitencies about spaces and tabs
|
||||||
const present = JSON.parse(el.val())
|
const present = JSON.parse(el.val());
|
||||||
cy.expect(JSON.stringify(present)).to.equal(JSON.stringify(json))
|
cy.expect(JSON.stringify(present)).to.equal(JSON.stringify(json));
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
Cypress.Commands.add('visitOpenRefine', (options) => {
|
Cypress.Commands.add('visitOpenRefine', (options) => {
|
||||||
cy.visit(Cypress.env('OPENREFINE_URL'), options)
|
cy.visit(Cypress.env('OPENREFINE_URL'), options);
|
||||||
})
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('createProjectThroughUserInterface', (fixtureFile) => {
|
Cypress.Commands.add('createProjectThroughUserInterface', (fixtureFile) => {
|
||||||
cy.navigateTo('Create Project')
|
cy.navigateTo('Create Project');
|
||||||
|
|
||||||
const uploadFile = { filePath: fixtureFile, mimeType: 'application/csv' }
|
const uploadFile = { filePath: fixtureFile, mimeType: 'application/csv' };
|
||||||
cy.get(
|
cy.get(
|
||||||
'.create-project-ui-source-selection-tab-body.selected input[type="file"]'
|
'.create-project-ui-source-selection-tab-body.selected input[type="file"]'
|
||||||
).attachFile(uploadFile)
|
).attachFile(uploadFile);
|
||||||
cy.get(
|
cy.get(
|
||||||
'.create-project-ui-source-selection-tab-body.selected button.button-primary'
|
'.create-project-ui-source-selection-tab-body.selected button.button-primary'
|
||||||
).click()
|
).click();
|
||||||
})
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('doCreateProjectThroughUserInterface', () => {
|
Cypress.Commands.add('doCreateProjectThroughUserInterface', () => {
|
||||||
cy.get('.default-importing-wizard-header button[bind="nextButton"]').click()
|
cy.get('.default-importing-wizard-header button[bind="nextButton"]').click();
|
||||||
cy.get('#create-project-progress-message').contains('Done.')
|
cy.get('#create-project-progress-message').contains('Done.');
|
||||||
|
|
||||||
// workaround to ensure project is loaded
|
// workaround to ensure project is loaded
|
||||||
// cypress does not support window.location = ...
|
// cypress does not support window.location = ...
|
||||||
cy.get('h2').contains('HTTP ERROR 404')
|
cy.get('h2').contains('HTTP ERROR 404');
|
||||||
cy.location().should((location) => {
|
cy.location().should((location) => {
|
||||||
expect(location.href).contains(
|
expect(location.href).contains(
|
||||||
Cypress.env('OPENREFINE_URL') + '/__/project?'
|
Cypress.env('OPENREFINE_URL') + '/__/project?'
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
cy.location().then((location) => {
|
cy.location().then((location) => {
|
||||||
const projectId = location.href.split('=').slice(-1)[0]
|
const projectId = location.href.split('=').slice(-1)[0];
|
||||||
cy.visitProject(projectId)
|
cy.visitProject(projectId);
|
||||||
cy.wrap(projectId).as('createdProjectId')
|
cy.wrap(projectId).as('createdProjectId');
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('castColumnTo', (selector, target) => {
|
Cypress.Commands.add('castColumnTo', (selector, target) => {
|
||||||
cy.get(
|
cy.get(
|
||||||
'.data-table th:contains("' + selector + '") .column-header-menu'
|
'.data-table th:contains("' + selector + '") .column-header-menu'
|
||||||
).click()
|
).click();
|
||||||
|
|
||||||
const targetAction = 'To ' + target
|
const targetAction = 'To ' + target;
|
||||||
|
|
||||||
cy.get('body > .menu-container').eq(0).contains('Edit cells').click()
|
cy.get('body > .menu-container').eq(0).contains('Edit cells').click();
|
||||||
cy.get('body > .menu-container').eq(1).contains('Common transforms').click()
|
cy.get('body > .menu-container').eq(1).contains('Common transforms').click();
|
||||||
cy.get('body > .menu-container').eq(2).contains(targetAction).click()
|
cy.get('body > .menu-container').eq(2).contains(targetAction).click();
|
||||||
})
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('getCell', (rowIndex, columnName) => {
|
Cypress.Commands.add('getCell', (rowIndex, columnName) => {
|
||||||
const cssRowIndex = rowIndex + 1
|
const cssRowIndex = rowIndex + 1;
|
||||||
// first get the header, to know the cell index
|
// first get the header, to know the cell index
|
||||||
cy.get(`table.data-table thead th[title="${columnName}"]`).then(($elem) => {
|
cy.get(`table.data-table thead th[title="${columnName}"]`).then(($elem) => {
|
||||||
// there are 3 td at the beginning of each row
|
// there are 3 td at the beginning of each row
|
||||||
const columnIndex = $elem.index() + 3
|
const columnIndex = $elem.index() + 3;
|
||||||
return cy.get(
|
return cy.get(
|
||||||
`table.data-table tbody tr:nth-child(${cssRowIndex}) td:nth-child(${columnIndex})`
|
`table.data-table tbody tr:nth-child(${cssRowIndex}) td:nth-child(${columnIndex})`
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('assertCellEquals', (rowIndex, columnName, value) => {
|
Cypress.Commands.add('assertCellEquals', (rowIndex, columnName, value) => {
|
||||||
const cssRowIndex = rowIndex + 1
|
const cssRowIndex = rowIndex + 1;
|
||||||
// first get the header, to know the cell index
|
// first get the header, to know the cell index
|
||||||
cy.get(`table.data-table thead th[title="${columnName}"]`).then(($elem) => {
|
cy.get(`table.data-table thead th[title="${columnName}"]`).then(($elem) => {
|
||||||
// there are 3 td at the beginning of each row
|
// there are 3 td at the beginning of each row
|
||||||
const columnIndex = $elem.index() + 3
|
const columnIndex = $elem.index() + 3;
|
||||||
cy.get(
|
cy.get(
|
||||||
`table.data-table tbody tr:nth-child(${cssRowIndex}) td:nth-child(${columnIndex}) div.data-table-cell-content > span`
|
`table.data-table tbody tr:nth-child(${cssRowIndex}) td:nth-child(${columnIndex}) div.data-table-cell-content > span`
|
||||||
).should(($cellSpan) => {
|
).should(($cellSpan) => {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
// weird, "null" is returned as a string in this case, bug in Chai ?
|
// weird, "null" is returned as a string in this case, bug in Chai ?
|
||||||
expect($cellSpan.text()).equals('null')
|
expect($cellSpan.text()).equals('null');
|
||||||
} else {
|
} else {
|
||||||
expect($cellSpan.text()).equals(value)
|
expect($cellSpan.text()).equals(value);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('navigateTo', (target) => {
|
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', () => {
|
Cypress.Commands.add('waitForOrOperation', () => {
|
||||||
cy.get('body[ajax_in_progress="true"]')
|
cy.get('body[ajax_in_progress="true"]');
|
||||||
cy.get('body[ajax_in_progress="false"]')
|
cy.get('body[ajax_in_progress="false"]');
|
||||||
})
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('deleteColumn', (columnName) => {
|
Cypress.Commands.add('deleteColumn', (columnName) => {
|
||||||
cy.get('.data-table th[title="' + columnName + '"]').should('exist')
|
cy.get('.data-table th[title="' + columnName + '"]').should('exist');
|
||||||
cy.columnActionClick(columnName, ['Edit column', 'Remove this column'])
|
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('not.exist');
|
||||||
})
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('waitForDialogPanel', () => {
|
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', () => {
|
Cypress.Commands.add('confirmDialogPanel', () => {
|
||||||
cy.get(
|
cy.get(
|
||||||
'body > .dialog-container > .dialog-frame .dialog-footer button[bind="okButton"]'
|
'body > .dialog-container > .dialog-frame .dialog-footer button[bind="okButton"]'
|
||||||
).click()
|
).click();
|
||||||
cy.get('body > .dialog-container > .dialog-frame').should('not.exist')
|
cy.get('body > .dialog-container > .dialog-frame').should('not.exist');
|
||||||
})
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('columnActionClick', (columnName, actions) => {
|
Cypress.Commands.add('columnActionClick', (columnName, actions) => {
|
||||||
cy.get(
|
cy.get(
|
||||||
'.data-table th:contains("' + columnName + '") .column-header-menu'
|
'.data-table th:contains("' + columnName + '") .column-header-menu'
|
||||||
).click()
|
).click();
|
||||||
|
|
||||||
for (var i = 0; i < actions.length; i++) {
|
for (let i = 0; i < actions.length; i++) {
|
||||||
cy.get('body > .menu-container').eq(i).contains(actions[i]).click()
|
cy.get('body > .menu-container').eq(i).contains(actions[i]).click();
|
||||||
}
|
}
|
||||||
cy.get('body[ajax_in_progress="false"]')
|
cy.get('body[ajax_in_progress="false"]');
|
||||||
})
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('visitProject', (projectId) => {
|
Cypress.Commands.add('visitProject', (projectId) => {
|
||||||
cy.visit(Cypress.env('OPENREFINE_URL') + '/project?project=' + projectId)
|
cy.visit(Cypress.env('OPENREFINE_URL') + '/project?project=' + projectId);
|
||||||
cy.get('#project-title').should('exist')
|
cy.get('#project-title').should('exist');
|
||||||
})
|
});
|
||||||
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
'loadAndVisitProject',
|
'loadAndVisitProject',
|
||||||
(fixture, projectName = Date.now()) => {
|
(fixture, projectName = Date.now()) => {
|
||||||
cy.loadProject(fixture, projectName).then((projectId) => {
|
cy.loadProject(fixture, projectName).then((projectId) => {
|
||||||
cy.visit(
|
cy.visit(Cypress.env('OPENREFINE_URL') + '/project?project=' + projectId);
|
||||||
Cypress.env('OPENREFINE_URL') + '/project?project=' + projectId
|
});
|
||||||
)
|
}
|
||||||
})
|
);
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
Cypress.Commands.add('assertNotificationContainingText', (text) => {
|
Cypress.Commands.add('assertNotificationContainingText', (text) => {
|
||||||
cy.get('#notification').should('to.contain', text)
|
cy.get('#notification').should('to.contain', text);
|
||||||
})
|
});
|
||||||
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
'assertCellNotString',
|
'assertCellNotString',
|
||||||
(rowIndex, columnName, expectedType) => {
|
(rowIndex, columnName, expectedType) => {
|
||||||
cy.getCell(rowIndex, columnName)
|
cy.getCell(rowIndex, columnName)
|
||||||
.find('.data-table-value-nonstring')
|
.find('.data-table-value-nonstring')
|
||||||
.should('to.exist')
|
.should('to.exist');
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
|
@ -14,33 +14,33 @@
|
|||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
|
|
||||||
// Import commands.js using ES2015 syntax:
|
// Import commands.js using ES2015 syntax:
|
||||||
import './commands'
|
import './commands';
|
||||||
import './openrefine_api'
|
import './openrefine_api';
|
||||||
|
|
||||||
let token
|
let token;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.server({
|
cy.server({
|
||||||
ignore: (xhr) => {
|
ignore: (xhr) => {
|
||||||
// Hide XHR Requests from log, OpenRefine is making too many XHR requests, it's polluting the test runner
|
// Hide XHR Requests from log, OpenRefine is making too many XHR requests, it's polluting the test runner
|
||||||
return true
|
return true;
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
cy.wrap(token, { log: false }).as('token')
|
cy.wrap(token, { log: false }).as('token');
|
||||||
cy.wrap(token, { log: false }).as('deletetoken')
|
cy.wrap(token, { log: false }).as('deletetoken');
|
||||||
cy.wrap([], { log: false }).as('loadedProjectIds')
|
cy.wrap([], { log: false }).as('loadedProjectIds');
|
||||||
})
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
cy.cleanupProjects()
|
cy.cleanupProjects();
|
||||||
})
|
});
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.request(
|
cy.request(
|
||||||
Cypress.env('OPENREFINE_URL') + '/command/core/get-csrf-token'
|
Cypress.env('OPENREFINE_URL') + '/command/core/get-csrf-token'
|
||||||
).then((response) => {
|
).then((response) => {
|
||||||
// store one unique token for block of runs
|
// store one unique token for block of runs
|
||||||
token = response.body.token
|
token = response.body.token;
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
@ -1,144 +1,136 @@
|
|||||||
const fixtures = require('../fixtures/fixtures.js')
|
const fixtures = require('../fixtures/fixtures.js');
|
||||||
|
|
||||||
Cypress.Commands.add('setPreference', (preferenceName, preferenceValue) => {
|
Cypress.Commands.add('setPreference', (preferenceName, preferenceValue) => {
|
||||||
const openRefineUrl = Cypress.env('OPENREFINE_URL')
|
const openRefineUrl = Cypress.env('OPENREFINE_URL');
|
||||||
cy.request(openRefineUrl + '/command/core/get-csrf-token').then(
|
cy.request(openRefineUrl + '/command/core/get-csrf-token').then(
|
||||||
(response) => {
|
(response) => {
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: `${openRefineUrl}/command/core/set-preference`,
|
url: `${openRefineUrl}/command/core/set-preference`,
|
||||||
body: `name=${preferenceName}&value="${preferenceValue}"&csrf_token=${response.body.token}`,
|
body: `name=${preferenceName}&value="${preferenceValue}"&csrf_token=${response.body.token}`,
|
||||||
form: false,
|
form: false,
|
||||||
headers: {
|
headers: {
|
||||||
'content-type':
|
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||||
'application/x-www-form-urlencoded; charset=UTF-8',
|
},
|
||||||
},
|
}).then((resp) => {
|
||||||
}).then((resp) => {
|
cy.log(
|
||||||
cy.log(
|
'Set preference ' + preferenceName + ' with value ' + preferenceValue
|
||||||
'Set preference ' +
|
);
|
||||||
preferenceName +
|
});
|
||||||
' with value ' +
|
}
|
||||||
preferenceValue
|
);
|
||||||
)
|
});
|
||||||
})
|
|
||||||
}
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
Cypress.Commands.add('cleanupProjects', () => {
|
Cypress.Commands.add('cleanupProjects', () => {
|
||||||
const openRefineUrl = Cypress.env('OPENREFINE_URL')
|
const openRefineUrl = Cypress.env('OPENREFINE_URL');
|
||||||
cy.get('@deletetoken', { log: false }).then((token) => {
|
cy.get('@deletetoken', { log: false }).then((token) => {
|
||||||
cy.get('@loadedProjectIds', { log: false }).then((loadedProjectIds) => {
|
cy.get('@loadedProjectIds', { log: false }).then((loadedProjectIds) => {
|
||||||
for (const projectId of loadedProjectIds) {
|
for (const projectId of loadedProjectIds) {
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url:
|
url:
|
||||||
`${openRefineUrl}/command/core/delete-project?csrf_token=` +
|
`${openRefineUrl}/command/core/delete-project?csrf_token=` + token,
|
||||||
token,
|
body: { project: projectId },
|
||||||
body: { project: projectId },
|
form: true,
|
||||||
form: true,
|
}).then((resp) => {
|
||||||
}).then((resp) => {
|
cy.log('Deleted OR project' + projectId);
|
||||||
cy.log('Deleted OR project' + projectId)
|
});
|
||||||
})
|
}
|
||||||
}
|
});
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
})
|
|
||||||
|
|
||||||
Cypress.Commands.add('loadProject', (fixture, projectName, tagName) => {
|
Cypress.Commands.add('loadProject', (fixture, projectName, tagName) => {
|
||||||
const openRefineUrl = Cypress.env('OPENREFINE_URL')
|
const openRefineUrl = Cypress.env('OPENREFINE_URL');
|
||||||
const openRefineProjectName = projectName ? projectName : 'cypress-test'
|
const openRefineProjectName = projectName ? projectName : 'cypress-test';
|
||||||
|
|
||||||
let jsonFixture
|
let jsonFixture;
|
||||||
if (typeof fixture == 'string') {
|
if (typeof fixture == 'string') {
|
||||||
jsonFixture = fixtures[fixture]
|
jsonFixture = fixtures[fixture];
|
||||||
|
} else {
|
||||||
|
jsonFixture = fixture;
|
||||||
|
}
|
||||||
|
|
||||||
|
const csv = [];
|
||||||
|
jsonFixture.forEach((item) => {
|
||||||
|
csv.push('"' + item.join('","') + '"');
|
||||||
|
});
|
||||||
|
const content = csv.join('\n');
|
||||||
|
|
||||||
|
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';
|
||||||
|
|
||||||
|
// the following code can be used to inject tags in created projects
|
||||||
|
// It's conflicting though, breaking up the CSV files
|
||||||
|
// It is a hack to parse out CSV files in the openrefine while creating a project with tags
|
||||||
|
const options = {
|
||||||
|
encoding: 'US-ASCII',
|
||||||
|
separator: ',',
|
||||||
|
ignoreLines: -1,
|
||||||
|
headerLines: 1,
|
||||||
|
skipDataLines: 0,
|
||||||
|
limit: -1,
|
||||||
|
storeBlankRows: true,
|
||||||
|
guessCellValueTypes: false,
|
||||||
|
processQuotes: true,
|
||||||
|
quoteCharacter: '"',
|
||||||
|
storeBlankCellsAsNulls: true,
|
||||||
|
includeFileSources: false,
|
||||||
|
includeArchiveFileName: false,
|
||||||
|
trimStrings: false,
|
||||||
|
projectName: openRefineProjectName,
|
||||||
|
projectTags: [tagName],
|
||||||
|
};
|
||||||
|
let postData;
|
||||||
|
if (tagName == undefined) {
|
||||||
|
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--';
|
||||||
} else {
|
} else {
|
||||||
jsonFixture = fixture
|
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="options"\r\n\r\n' +
|
||||||
|
JSON.stringify(options) +
|
||||||
|
'\r\n------BOUNDARY\r\nContent-Disposition: form-data; name="format"\r\n\r\n' +
|
||||||
|
openRefineFormat +
|
||||||
|
'\r\n------BOUNDARY--';
|
||||||
}
|
}
|
||||||
|
|
||||||
const csv = []
|
cy.request({
|
||||||
jsonFixture.forEach((item) => {
|
method: 'POST',
|
||||||
csv.push('"' + item.join('","') + '"')
|
url:
|
||||||
})
|
`${openRefineUrl}/command/core/create-project-from-upload?csrf_token=` +
|
||||||
const content = csv.join('\n')
|
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('@token', { log: false }).then((token) => {
|
cy.get('@loadedProjectIds', { log: false }).then((loadedProjectIds) => {
|
||||||
// cy.request(Cypress.env('OPENREFINE_URL')+'/command/core/get-csrf-token').then((response) => {
|
loadedProjectIds.push(projectId);
|
||||||
const openRefineFormat = 'text/line-based/*sv'
|
cy.wrap(loadedProjectIds, { log: false })
|
||||||
|
.as('loadedProjectIds')
|
||||||
// the following code can be used to inject tags in created projects
|
.then(() => {
|
||||||
// It's conflicting though, breaking up the CSV files
|
return projectId;
|
||||||
// It is a hack to parse out CSV files in the openrefine while creating a project with tags
|
});
|
||||||
const options = {
|
});
|
||||||
encoding: 'US-ASCII',
|
});
|
||||||
separator: ',',
|
});
|
||||||
ignoreLines: -1,
|
});
|
||||||
headerLines: 1,
|
|
||||||
skipDataLines: 0,
|
|
||||||
limit: -1,
|
|
||||||
storeBlankRows: true,
|
|
||||||
guessCellValueTypes: false,
|
|
||||||
processQuotes: true,
|
|
||||||
quoteCharacter: '"',
|
|
||||||
storeBlankCellsAsNulls: true,
|
|
||||||
includeFileSources: false,
|
|
||||||
includeArchiveFileName: false,
|
|
||||||
trimStrings: false,
|
|
||||||
projectName: openRefineProjectName,
|
|
||||||
projectTags: [tagName],
|
|
||||||
}
|
|
||||||
var postData
|
|
||||||
if (tagName == undefined) {
|
|
||||||
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--'
|
|
||||||
} else {
|
|
||||||
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="options"\r\n\r\n' +
|
|
||||||
JSON.stringify(options) +
|
|
||||||
'\r\n------BOUNDARY\r\nContent-Disposition: form-data; name="format"\r\n\r\n' +
|
|
||||||
openRefineFormat +
|
|
||||||
'\r\n------BOUNDARY--'
|
|
||||||
}
|
|
||||||
|
|
||||||
cy.request({
|
|
||||||
method: 'POST',
|
|
||||||
url:
|
|
||||||
`${openRefineUrl}/command/core/create-project-from-upload?csrf_token=` +
|
|
||||||
token,
|
|
||||||
body: postData,
|
|
||||||
headers: {
|
|
||||||
'content-type': 'multipart/form-data; boundary=----BOUNDARY',
|
|
||||||
},
|
|
||||||
}).then((resp) => {
|
|
||||||
const location =
|
|
||||||
resp.allRequestResponses[0]['Response Headers'].location
|
|
||||||
const projectId = location.split('=').slice(-1)[0]
|
|
||||||
cy.log('Created OR project', projectId)
|
|
||||||
|
|
||||||
cy.get('@loadedProjectIds', { log: false }).then(
|
|
||||||
(loadedProjectIds) => {
|
|
||||||
loadedProjectIds.push(projectId)
|
|
||||||
cy.wrap(loadedProjectIds, { log: false })
|
|
||||||
.as('loadedProjectIds')
|
|
||||||
.then(() => {
|
|
||||||
return projectId
|
|
||||||
})
|
|
||||||
}
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
@ -19,6 +19,11 @@
|
|||||||
"uniqid": "^5.2.0"
|
"uniqid": "^5.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"eslint": "^7.19.0",
|
||||||
|
"eslint-config-google": "^0.14.0",
|
||||||
|
"eslint-config-prettier": "^7.2.0",
|
||||||
|
"eslint-plugin-cypress": "^2.11.2",
|
||||||
|
"jsdoc": "^3.6.6",
|
||||||
"prettier": "2.2.1"
|
"prettier": "2.2.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user