From d48a6aefee2ef8e54833a2cc4eecd72c2abe70f6 Mon Sep 17 00:00:00 2001 From: Jhon Date: Mon, 19 Aug 2024 11:28:48 -0400 Subject: [PATCH 1/5] Adds basic integration tests Issue: documentacao-e-tarefas/scielo#694 Signed-off-by: Jhon --- .gitlab-ci.yml | 4 +-- cypress/tests/Test1_reportGeneration.spec.js | 31 ++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 cypress/tests/Test1_reportGeneration.spec.js diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9d1b636..39ce386 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ variables: include: - project: 'documentacao-e-tarefas/modelosparaintegracaocontinua' - ref: main + ref: stable-3_3_0 file: - 'templates/groups/pkp_plugin.yml' - - 'templates/groups/ops_plugins_unit_tests_model.yml' + - 'templates/groups/ops/unit_tests.yml' diff --git a/cypress/tests/Test1_reportGeneration.spec.js b/cypress/tests/Test1_reportGeneration.spec.js new file mode 100644 index 0000000..b3d0374 --- /dev/null +++ b/cypress/tests/Test1_reportGeneration.spec.js @@ -0,0 +1,31 @@ +describe("SciELO Submissions Report - Report generation", function() { + it("Generates report", function() { + cy.login('dbarnes', null, 'publicknowledge'); + + cy.contains('a.app__navItem', 'Reports').click(); + cy.contains('a', 'SciELO Submissions Report').click(); + + cy.contains('h2', 'Period'); + cy.contains('Select the desired filtering type:'); + cy.get('#selectFilterTypeDate').within(() => { + cy.contains('option', 'Filter by submitted date'); + cy.contains('option', 'Filter by final decision date'); + cy.contains('option', 'Filter by submitted date and final decision'); + }); + cy.get('#selectFilterTypeDate').select('Filter by submitted date'); + cy.contains('Submitted date range'); + cy.get('#selectFilterTypeDate').select('Filter by final decision date'); + cy.contains('Final decision date range'); + cy.get('#selectFilterTypeDate').select('Filter by submitted date and final decision'); + cy.contains('Submitted date range'); + cy.contains('Final decision date range'); + cy.get('#selectFilterTypeDate').select('Filter by submitted date'); + + cy.contains('h2', 'Sections'); + cy.contains('label', 'Articles'); + cy.contains('label', 'Reviews'); + + cy.contains('The report generation proccesss can take a few minutes, depending on the parameters selected and the number of submissions present in the system.'); + cy.contains('input', 'Generate Report'); + }); +}); \ No newline at end of file From 9ca2e553e3cbaa671e3b6b7c71f2415df8820f7a Mon Sep 17 00:00:00 2001 From: Jhon Date: Mon, 19 Aug 2024 12:40:06 -0400 Subject: [PATCH 2/5] Integration test - Check generation of report Issue: documentacao-e-tarefas/scielo#694 Signed-off-by: Jhon --- cypress/tests/Test1_reportGeneration.spec.js | 50 +++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/cypress/tests/Test1_reportGeneration.spec.js b/cypress/tests/Test1_reportGeneration.spec.js index b3d0374..391ec67 100644 --- a/cypress/tests/Test1_reportGeneration.spec.js +++ b/cypress/tests/Test1_reportGeneration.spec.js @@ -1,5 +1,28 @@ +function getNowDateAndHour() { + let now = new Date().toISOString(); + const charactersToRemove = ['-', ':', 'T']; + let nowFormatted = ''; + + for (let i = 0; i < now.length; i++) { + let shouldRemove = false; + + for (let j = 0; j < charactersToRemove.length; j++) { + if (now[i] === charactersToRemove[j]) { + shouldRemove = true; + break; + } + } + + if (!shouldRemove) { + nowFormatted += now[i]; + } + } + + return (nowFormatted.split('.')[0]); +} + describe("SciELO Submissions Report - Report generation", function() { - it("Generates report", function() { + it("Asserts presence of report setting fields", function() { cy.login('dbarnes', null, 'publicknowledge'); cy.contains('a.app__navItem', 'Reports').click(); @@ -28,4 +51,29 @@ describe("SciELO Submissions Report - Report generation", function() { cy.contains('The report generation proccesss can take a few minutes, depending on the parameters selected and the number of submissions present in the system.'); cy.contains('input', 'Generate Report'); }); + it('Generates CSV report', function () { + cy.login('dbarnes', null, 'publicknowledge'); + + cy.contains('a.app__navItem', 'Reports').click(); + cy.contains('a', 'SciELO Submissions Report').click(); + + cy.get('#selectFilterTypeDate').select('Filter by submitted date'); + cy.contains('label', 'Articles').parent().within(() => { + cy.get('input').check(); + }); + cy.contains('label', 'Reviews').parent().within(() => { + cy.get('input').check(); + }); + + cy.contains('Generate Report').click(); + cy.wait(2000); + + let now = getNowDateAndHour(); + const downloadsFolder = Cypress.config('downloadsFolder'); + const reportFileName = 'submissionsJPKJPK-' + now + '.csv'; + + cy.readFile(downloadsFolder + reportFileName, 'utf-8').then((text) => { + expect(text).to.contain('Articles,Reviews'); + }); + }); }); \ No newline at end of file From f28900ed8387775f1b7b0fb195566a8ced9a30b0 Mon Sep 17 00:00:00 2001 From: Jhon Date: Mon, 19 Aug 2024 14:11:05 -0400 Subject: [PATCH 3/5] Integration test - Field to select all sections Issue: documentacao-e-tarefas/scielo#694 Signed-off-by: Jhon --- cypress/tests/Test1_reportGeneration.spec.js | 35 ++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/cypress/tests/Test1_reportGeneration.spec.js b/cypress/tests/Test1_reportGeneration.spec.js index 391ec67..7c66362 100644 --- a/cypress/tests/Test1_reportGeneration.spec.js +++ b/cypress/tests/Test1_reportGeneration.spec.js @@ -72,6 +72,41 @@ describe("SciELO Submissions Report - Report generation", function() { const downloadsFolder = Cypress.config('downloadsFolder'); const reportFileName = 'submissionsJPKJPK-' + now + '.csv'; + cy.readFile(downloadsFolder + reportFileName, 'utf-8').then((text) => { + expect(text).to.contain('Articles,Reviews'); + }); + }); + it('Generates CSV using field to select all sections', function () { + cy.login('dbarnes', null, 'publicknowledge'); + + cy.contains('a.app__navItem', 'Reports').click(); + cy.contains('a', 'SciELO Submissions Report').click(); + + cy.get('#selectFilterTypeDate').select('Filter by submitted date'); + cy.get('#selectAllSections').check(); + cy.contains('label', 'Articles').parent().within(() => { + cy.get('input').should('be.checked'); + }); + cy.contains('label', 'Reviews').parent().within(() => { + cy.get('input').should('be.checked'); + }); + + cy.get('#selectAllSections').uncheck(); + cy.contains('label', 'Articles').parent().within(() => { + cy.get('input').should('not.be.checked'); + }); + cy.contains('label', 'Reviews').parent().within(() => { + cy.get('input').should('not.be.checked'); + }); + + cy.get('#selectAllSections').check(); + cy.contains('Generate Report').click(); + cy.wait(2000); + + let now = getNowDateAndHour(); + const downloadsFolder = Cypress.config('downloadsFolder'); + const reportFileName = 'submissionsJPKJPK-' + now + '.csv'; + cy.readFile(downloadsFolder + reportFileName, 'utf-8').then((text) => { expect(text).to.contain('Articles,Reviews'); }); From 70aa4e8b9517fa0d5cbd525db6652e6fc51726d4 Mon Sep 17 00:00:00 2001 From: Jhon Date: Mon, 19 Aug 2024 14:55:22 -0400 Subject: [PATCH 4/5] Adds button to select all sections Issue: documentacao-e-tarefas/scielo#694 Signed-off-by: Jhon --- locale/en_US/locale.po | 3 ++ locale/es_ES/locale.po | 3 ++ locale/pt_BR/locale.po | 3 ++ templates/scieloSubmissionsReportPlugin.tpl | 37 ++++++++++++++++++--- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/locale/en_US/locale.po b/locale/en_US/locale.po index 137e180..df4f3ae 100644 --- a/locale/en_US/locale.po +++ b/locale/en_US/locale.po @@ -47,6 +47,9 @@ msgstr "Period" msgid "plugins.reports.scieloSubmissionsReport.sections" msgstr "Sections" +msgid "plugins.reports.scieloSubmissionsReport.selectAllSections" +msgstr "Sellect all sections" + msgid "plugins.reports.scieloSubmissionsReport.checkboxIncludeViews" msgstr "Include in the report the numbers of views of submissions" diff --git a/locale/es_ES/locale.po b/locale/es_ES/locale.po index a9bf736..8c466c7 100644 --- a/locale/es_ES/locale.po +++ b/locale/es_ES/locale.po @@ -47,6 +47,9 @@ msgstr "Período" msgid "plugins.reports.scieloSubmissionsReport.sections" msgstr "Secciones" +msgid "plugins.reports.scieloSubmissionsReport.selectAllSections" +msgstr "Seleccionar todas las secciones" + msgid "plugins.reports.scieloSubmissionsReport.checkboxIncludeViews" msgstr "Incluir los números de acceso de los envíos en el informe" diff --git a/locale/pt_BR/locale.po b/locale/pt_BR/locale.po index 4e1a012..05e4435 100644 --- a/locale/pt_BR/locale.po +++ b/locale/pt_BR/locale.po @@ -47,6 +47,9 @@ msgstr "Período" msgid "plugins.reports.scieloSubmissionsReport.sections" msgstr "Seções" +msgid "plugins.reports.scieloSubmissionsReport.selectAllSections" +msgstr "Selecionar todas as seções" + msgid "plugins.reports.scieloSubmissionsReport.checkboxIncludeViews" msgstr "Incluir no relatório os números de acessos das submissões" diff --git a/templates/scieloSubmissionsReportPlugin.tpl b/templates/scieloSubmissionsReportPlugin.tpl index 02adac8..168b44f 100644 --- a/templates/scieloSubmissionsReportPlugin.tpl +++ b/templates/scieloSubmissionsReportPlugin.tpl @@ -74,7 +74,16 @@ {if $sections|@count > 0}

{translate key="plugins.reports.scieloSubmissionsReport.sections"}

-
+
+
+ + + +
+ {fbvElement type="checkBox" name="selectAllSections" id="selectAllSections" label="plugins.reports.scieloSubmissionsReport.selectAllSections"} +
+ +
{fbvElement type="checkBoxGroup" name="sections" id="sections" from=$sections selected=$sections_options translate=false} @@ -103,12 +112,14 @@ From 0e9d147ecceeb2d0460bbc8a6f90082901b732b0 Mon Sep 17 00:00:00 2001 From: Jhon Date: Mon, 19 Aug 2024 14:56:00 -0400 Subject: [PATCH 5/5] updates version.xml Issue: documentacao-e-tarefas/scielo#694 Signed-off-by: Jhon --- version.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.xml b/version.xml index 42835b8..039328c 100644 --- a/version.xml +++ b/version.xml @@ -4,8 +4,8 @@ scieloSubmissionsReport plugins.reports - 2.4.2.0 - 2024-03-25 + 2.4.3.0 + 2024-08-19 1 ScieloSubmissionsReportPlugin