diff --git a/test/end-to-end/rubricsConfig/rubrics_config.page.js b/test/end-to-end/rubricsConfig/rubrics_config.page.js index bbd018fa82..61eab43ce9 100644 --- a/test/end-to-end/rubricsConfig/rubrics_config.page.js +++ b/test/end-to-end/rubricsConfig/rubrics_config.page.js @@ -16,9 +16,12 @@ class RubricConfigPage { return rows.count(); } - async create(rubric) { + async create(rubric, checklist = []) { await TU.buttons.create(); - await TU.input('ConfigModalCtrl.rubric.label', rubric.label); + await TU.input('RubricConfigModalCtrl.config.label', rubric.label); + + // loop through rubric ids in checklist and check them + await Promise.all(checklist.map(async (item) => TU.locator(by.id(item)).click())); await TU.modal.submit(); await notification.hasSuccess(); @@ -27,40 +30,18 @@ class RubricConfigPage { async errorOnCreateRubricConfig() { await TU.buttons.create(); await TU.modal.submit(); - await TU.validation.error('ConfigModalCtrl.rubric.label'); + await TU.validation.error('RubricConfigModalCtrl.config.label'); await TU.modal.cancel(); } - async update(label, updateRubricConfig) { + async update(label, updateRubricConfig, checklist = []) { const row = new GridRow(label); await row.dropdown(); await row.edit(); - await TU.input('ConfigModalCtrl.rubric.label', updateRubricConfig.label); - - await TU.modal.submit(); - await notification.hasSuccess(); - } - - async setRubricConfig(label) { - const row = new GridRow(label); - await row.dropdown(); - await row.method('configure'); - - await TU.waitForSelector(by.id('social')); - - await TU.locator(by.id('social')).click(); - await TU.locator(by.id('tax')).click(); - - await TU.modal.submit(); - await notification.hasSuccess(); - } - - async unsetRubricConfig(label) { - const row = new GridRow(label); - await row.dropdown(); - await row.method('configure'); + await TU.input('RubricConfigModalCtrl.config.label', updateRubricConfig.label); + // reset the updated checkboxes await TU.waitForSelector(by.id('all')); const checkbox = TU.locator(by.id('all')); @@ -68,6 +49,9 @@ class RubricConfigPage { await checkbox.click(); await checkbox.click(); + // now update the values + await Promise.all(checklist.map(async (item) => TU.locator(by.id(item)).click())); + await TU.modal.submit(); await notification.hasSuccess(); } diff --git a/test/end-to-end/rubricsConfig/rubrics_config.spec.js b/test/end-to-end/rubricsConfig/rubrics_config.spec.js index 0105d293f5..c6194bbd4b 100644 --- a/test/end-to-end/rubricsConfig/rubrics_config.spec.js +++ b/test/end-to-end/rubricsConfig/rubrics_config.spec.js @@ -20,29 +20,21 @@ test.describe('Rubrics Configuration Management', () => { const page = new RubricConfigPage(); const rubricConfig = { - label : 'Configuration 2013', + label: 'Configuration 2013', }; const updateRubricConfig = { - label : 'Configuration 2013 Updated', + label: 'Configuration 2013 Updated', }; test('successfully creates a new rubric configuration', async () => { - await page.create(rubricConfig); + await page.create(rubricConfig, ['social', 'tax']); }); test('successfully edits a rubric configuration', async () => { await page.update(rubricConfig.label, updateRubricConfig); }); - test('successfully set rubrics in rubric configuration', async () => { - await page.setRubricConfig(updateRubricConfig.label); - }); - - test('successfully unset rubrics in rubric configuration', async () => { - await page.unsetRubricConfig(updateRubricConfig.label); - }); - test('do not create when incorrect rubric', async () => { await page.errorOnCreateRubricConfig(); });