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