From 1cf8c79d635216aa2314df6c4e350ec622437379 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 12 Aug 2024 13:22:43 +0300 Subject: [PATCH 01/69] chore: removes sample spec --- cypress/e2e/sample_spec.js | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 cypress/e2e/sample_spec.js diff --git a/cypress/e2e/sample_spec.js b/cypress/e2e/sample_spec.js deleted file mode 100644 index 96d52d507..000000000 --- a/cypress/e2e/sample_spec.js +++ /dev/null @@ -1,16 +0,0 @@ -describe('Home page', function() { - it('Visits the home page', function() { - cy.visit('/') - }) -}) - -describe('Log in as admin', function() { - it('Goes to login page, logs in with default creds, and should redirect to index', function() { - cy.visit('/auth/?next=/index.htm') - - cy.get('.input-group > .floating-label-group > input[name="username"].form-control').type(`admin{enter}`) - cy.get('.input-group > .floating-label-group > input[name="password"].form-control').type(`admin{enter}`) - - cy.url().should("include", "/index.htm") // redirected back to home page - }) -}) From c26d739ef9ab7eadd1430be4a35a56c3441ce220 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 12 Aug 2024 13:24:17 +0300 Subject: [PATCH 02/69] fix: retuns false on uncaught exepction Also changes the url to the full localhost url. This is done so the tests can actually get to the point where they run as uncaught issues were otherwise blocking them before they even got started. We can debug this later --- cypress/support/commands.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 8733629d8..617fa3006 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -16,11 +16,14 @@ // -- This is a child command -- // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) - Cypress.Commands.add("login", () => { - cy.visit('/auth/?next=/index.htm'); + cy.visit('localhost:8000/auth/?next=/index.htm'); cy.get('.input-group > .floating-label-group > input[name="username"].form-control').type(`admin{enter}`); cy.get('.input-group > .floating-label-group > input[name="password"].form-control').type(`admin{enter}`); - }); + +Cypress.on('uncaught:exception', (err, runnable) => { + // returning false here prevents Cypress from failing the test temporary solution but we could log here and debug the uncaught issues + return false +}) From bf265a729ab3609cc337c17455f1eb69df051706 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 12 Aug 2024 13:26:17 +0300 Subject: [PATCH 03/69] wip: feat: adds flag for enforcement workflow test --- .../e2e/flag_for_enforcement_workflow.cy.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 cypress/e2e/flag_for_enforcement_workflow.cy.js diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js new file mode 100644 index 000000000..ff1fc80d3 --- /dev/null +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -0,0 +1,26 @@ +describe('Going through the Flag For Enforcement Workflow', function () { + + beforeEach(() => { + cy.login() + cy.visit("http://localhost:8000/plugins/init-workflow") + }) + + it('Go through the workflow', function () { + cy.contains("Workflows"); + cy.contains("Flag for Enforcement").click(); + // Starting the workflow + cy.contains("Save and Continue").click(); + cy.wait(5000); + cy.get('[aria-label="Case Reference"]').should('be.visible').click().type('Case Ref'); + // cy.get('#cke_2_contents > .cke_wysiwyg_frame').click().type('test'); + // cy.wait(5000); + // cy.get('[aria-label="Subtitle"]').should('be.visible').click().type('Subtitle'); + // cy.get('[aria-label="File ID (key)"]').should('be.visible').click().type('File ID (key)'); + // cy.get('#cke_2_contents').click().type('test type ref'); + cy.contains("Save and Continue").click(); + // cy.get('[aria-label="Flagged by"]').should('be.visible').click().type('Case Ref'); + // cy.get('.card_component.full_name > .row > .form-group > [style="max-width: 600px; position: relative"] > .col-xs-12 > .form-control').type('Test'); + // cy.get(':nth-child(2) > .card-component > .new-provisional-edit-card-container > .card > .install-buttons > .fa-plus > span').click(); + // cy.get('.close-new-step > .btn > span').click(); + }) +}) From b8a6e3acfd78987e8273a43c32b6ddd355d2dd95 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 12 Aug 2024 14:43:44 +0300 Subject: [PATCH 04/69] wip: feat: selects first option in dropdown --- cypress/e2e/flag_for_enforcement_workflow.cy.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index ff1fc80d3..d370f37cb 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -10,17 +10,10 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains("Flag for Enforcement").click(); // Starting the workflow cy.contains("Save and Continue").click(); - cy.wait(5000); - cy.get('[aria-label="Case Reference"]').should('be.visible').click().type('Case Ref'); - // cy.get('#cke_2_contents > .cke_wysiwyg_frame').click().type('test'); - // cy.wait(5000); - // cy.get('[aria-label="Subtitle"]').should('be.visible').click().type('Subtitle'); - // cy.get('[aria-label="File ID (key)"]').should('be.visible').click().type('File ID (key)'); - // cy.get('#cke_2_contents').click().type('test type ref'); - cy.contains("Save and Continue").click(); - // cy.get('[aria-label="Flagged by"]').should('be.visible').click().type('Case Ref'); - // cy.get('.card_component.full_name > .row > .form-group > [style="max-width: 600px; position: relative"] > .col-xs-12 > .form-control').type('Test'); - // cy.get(':nth-child(2) > .card-component > .new-provisional-edit-card-container > .card > .install-buttons > .fa-plus > span').click(); - // cy.get('.close-new-step > .btn > span').click(); + cy.wait(2000); + cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); + cy.contains("Flagged by").siblings('.row').click(); + // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a test person and we can find them by name + cy.get('.select2-results__options li').first().click(); }) }) From d33cbcacbd0907c7b85706d8aff541dc38d96dea Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 14 Aug 2024 14:20:07 +0300 Subject: [PATCH 05/69] refactor: changes double quotes to single quotes --- cypress/e2e/flag_for_enforcement_workflow.cy.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index d370f37cb..1473c6043 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -2,18 +2,22 @@ describe('Going through the Flag For Enforcement Workflow', function () { beforeEach(() => { cy.login() - cy.visit("http://localhost:8000/plugins/init-workflow") + cy.visit('http://localhost:8000/plugins/init-workflow') }) it('Go through the workflow', function () { - cy.contains("Workflows"); - cy.contains("Flag for Enforcement").click(); + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); // Starting the workflow - cy.contains("Save and Continue").click(); + cy.contains('Save and Continue').click(); cy.wait(2000); cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); - cy.contains("Flagged by").siblings('.row').click(); + cy.contains('Flagged by').siblings('.row').click(); // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a test person and we can find them by name cy.get('.select2-results__options li').first().click(); + cy.get('[aria-label="Flagged Date"]').should('be.visible').click(); }) }) From 057485fb668c7ee49256e385ed36b3507944697f Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 14 Aug 2024 17:28:29 +0300 Subject: [PATCH 06/69] feat: adds a cypress command that allows editing rich textboxes --- cypress/support/commands.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 617fa3006..fe709c047 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -26,4 +26,13 @@ Cypress.Commands.add("login", () => { Cypress.on('uncaught:exception', (err, runnable) => { // returning false here prevents Cypress from failing the test temporary solution but we could log here and debug the uncaught issues return false -}) +}); + +Cypress.Commands.add("type_ckeditor", (element, content) => { + cy.window().then(win => { + // uncomment this to find the actual instance name you need + // console.log(win.CKEDITOR.instances); + win.CKEDITOR.instances[element].setData(content); + }); +}); + \ No newline at end of file From 22eca490f80b2e787833beaafc31e84f75effb6c Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 14 Aug 2024 17:32:37 +0300 Subject: [PATCH 07/69] test: adds to the ffe workflow --- cypress/e2e/flag_for_enforcement_workflow.cy.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index 1473c6043..5d1b55c24 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -15,9 +15,19 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Continue').click(); cy.wait(2000); cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); + cy.type_ckeditor('editor2', 'test reason for enforcement'); cy.contains('Flagged by').siblings('.row').click(); // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a test person and we can find them by name + // TODO test with organisation as well cy.get('.select2-results__options li').first().click(); cy.get('[aria-label="Flagged Date"]').should('be.visible').click(); + cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.contains('Select resources').siblings('.row').click(); + // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name + cy.get('.select2-results__options li').first().click(); + cy.contains('Save and Continue').click(); + cy.wait(2000); + // TODO check that information that was entered corresponds + cy.contains('Save and Complete Workflow').click(); }) }) From 13299f9887f718bfe53ca041de67b688e8bbf036 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 14 Aug 2024 17:33:19 +0300 Subject: [PATCH 08/69] chore: adds cypress gitignore Ignores videos and screenshots generated from cypress studio --- cypress/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 cypress/.gitignore diff --git a/cypress/.gitignore b/cypress/.gitignore new file mode 100644 index 000000000..968e508e3 --- /dev/null +++ b/cypress/.gitignore @@ -0,0 +1,2 @@ +/videos +/screenshots \ No newline at end of file From b17da75cef7b98ab9a8619494380383cf00bb6a5 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 15 Aug 2024 11:23:40 +0300 Subject: [PATCH 09/69] test: check all populated fields and go through workflow with just id --- .../e2e/flag_for_enforcement_workflow.cy.js | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index 5d1b55c24..3d99a2d7e 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -3,9 +3,9 @@ describe('Going through the Flag For Enforcement Workflow', function () { beforeEach(() => { cy.login() cy.visit('http://localhost:8000/plugins/init-workflow') - }) + }); - it('Go through the workflow', function () { + it('Go through the workflow and populate all fields', function () { cy.contains('Workflows'); cy.contains('Flag for Enforcement').click(); // Makes sure the autogenerated id is not undefined @@ -26,8 +26,30 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name cy.get('.select2-results__options li').first().click(); cy.contains('Save and Continue').click(); + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().should('not.have.text', ''); + cy.contains('Case Reference Number:').siblings().should('have.text', 'Case Ref'); + cy.contains('Description:').siblings().should('have.text', 'test reason for enforcement'); + // Only checks if the date we selected is present as the year and month could change + cy.contains('Flagged Date Value:').siblings().should('contain', '17'); + // TODO actually create the person and use the name in the check here + cy.contains('Actor:').siblings().should('have.text', 'test'); cy.wait(2000); - // TODO check that information that was entered corresponds cy.contains('Save and Complete Workflow').click(); - }) + }); + + it('Go through the workflow and only with Enforcement ID', function () { + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + // Starting the workflow + cy.contains('Save and Continue').click(); + cy.wait(2000); + cy.contains('Next Step').click(); + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('Save and Complete Workflow').click(); + }); + }) From 28561620677d02794bcf1ef63f8556d04baa28b3 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 15 Aug 2024 11:27:22 +0300 Subject: [PATCH 10/69] test: adds test with only case reference Also adds comments and sections off different tabs in the code --- .../e2e/flag_for_enforcement_workflow.cy.js | 37 +++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index 3d99a2d7e..df4bcb8aa 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -8,11 +8,14 @@ describe('Going through the Flag For Enforcement Workflow', function () { it('Go through the workflow and populate all fields', function () { cy.contains('Workflows'); cy.contains('Flag for Enforcement').click(); + + // Initial step tab // Makes sure the autogenerated id is not undefined cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); - // Starting the workflow cy.contains('Save and Continue').click(); + + // Enforcement Details Tab cy.wait(2000); cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); cy.type_ckeditor('editor2', 'test reason for enforcement'); @@ -26,6 +29,8 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name cy.get('.select2-results__options li').first().click(); cy.contains('Save and Continue').click(); + + // Enforcement Summary tab cy.contains('ResourceID:').siblings().should('not.have.text'); cy.contains('ResourceID:').siblings().should('not.have.text', ''); cy.contains('Case Reference Number:').siblings().should('have.text', 'Case Ref'); @@ -38,18 +43,44 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Complete Workflow').click(); }); - it('Go through the workflow and only with Enforcement ID', function () { + it('Go through the workflow only with Enforcement ID', function () { cy.contains('Workflows'); cy.contains('Flag for Enforcement').click(); + + // Initial step tab // Makes sure the autogenerated id is not undefined cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); - // Starting the workflow cy.contains('Save and Continue').click(); + + // Enforcement Details Tab cy.wait(2000); cy.contains('Next Step').click(); + + // Enforcement Summary tab cy.contains('ResourceID:').siblings().should('not.have.text'); cy.contains('Save and Complete Workflow').click(); }); + it('Go through the workflow and populate only Case Reference', function () { + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.contains('Save and Continue').click(); + + // Enforcement Details Tab + cy.wait(2000); + cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); + cy.contains('Save and Continue').click(); + + // Enforcement Summary tab + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().should('not.have.text', ''); + cy.contains('Case Reference Number:').siblings().should('have.text', 'Case Ref'); + cy.contains('Save and Complete Workflow').click(); + }); }) From e87df40bb93ad487a5a5c6b0ccf7660545d629e9 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 15 Aug 2024 11:59:10 +0300 Subject: [PATCH 11/69] test: adds tests for each field --- .../e2e/flag_for_enforcement_workflow.cy.js | 105 +++++++++++++++++- 1 file changed, 102 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index df4bcb8aa..9d597098c 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -39,11 +39,12 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Flagged Date Value:').siblings().should('contain', '17'); // TODO actually create the person and use the name in the check here cy.contains('Actor:').siblings().should('have.text', 'test'); + cy.contains('Associated Resources:').siblings().should('have.text', 'Undefined'); cy.wait(2000); cy.contains('Save and Complete Workflow').click(); }); - it('Go through the workflow only with Enforcement ID', function () { + it('Workflow with only Enforcement ID', function () { cy.contains('Workflows'); cy.contains('Flag for Enforcement').click(); @@ -62,7 +63,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Complete Workflow').click(); }); - it('Go through the workflow and populate only Case Reference', function () { + it('Workflow with only Case Reference', function () { cy.contains('Workflows'); cy.contains('Flag for Enforcement').click(); @@ -83,4 +84,102 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Case Reference Number:').siblings().should('have.text', 'Case Ref'); cy.contains('Save and Complete Workflow').click(); }); -}) + + it('Workflow with only Reason For Enforcement', function () { + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.contains('Save and Continue').click(); + + // Enforcement Details Tab + cy.wait(2000); + cy.type_ckeditor('editor2', 'test reason for enforcement'); + cy.contains('Save and Continue').click(); + + // Enforcement Summary tab + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().should('not.have.text', ''); + cy.contains('Description:').siblings().should('have.text', 'test reason for enforcement'); + cy.contains('Save and Complete Workflow').click(); + }); + + it('Workflow with only Flagged By', function () { + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.contains('Save and Continue').click(); + + // Enforcement Details Tab + cy.wait(2000); + cy.contains('Flagged by').siblings('.row').click(); + // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a test person and we can find them by name + // TODO test with organisation as well + cy.get('.select2-results__options li').first().click(); + cy.contains('Save and Continue').click(); + + // Enforcement Summary tab + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().should('not.have.text', ''); + // TODO actually create the person and use the name in the check here + cy.contains('Actor:').siblings().should('have.text', 'test'); + cy.contains('Save and Complete Workflow').click(); + }); + + + it('Workflow with only Flagged Date', function () { + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.contains('Save and Continue').click(); + + // Enforcement Details Tab + cy.wait(2000); + cy.get('[aria-label="Flagged Date"]').should('be.visible').click(); + cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.contains('Save and Continue').click(); + + // Enforcement Summary tab + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().should('not.have.text', ''); + // Only checks if the date we selected is present as the year and month could change + cy.contains('Flagged Date Value:').siblings().should('contain', '17'); + cy.contains('Save and Complete Workflow').click(); + }); + + + it('Workflow with only Associated Resource', function () { + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.contains('Save and Continue').click(); + + // Enforcement Details Tab + cy.wait(2000); + cy.contains('Select resources').siblings('.row').click(); + // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name + cy.get('.select2-results__options li').first().click(); + cy.contains('Save and Continue').click(); + + // Enforcement Summary tab + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().should('not.have.text', ''); + cy.contains('Associated Resources:').siblings().should('have.text', 'Undefined'); + cy.contains('Save and Complete Workflow').click(); + }); +}); From 4ebb3627319b4af1fc56be20cab26c78cf8e430e Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 15 Aug 2024 12:16:38 +0300 Subject: [PATCH 12/69] test: fix flagged date selection --- cypress/e2e/flag_for_enforcement_workflow.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index 9d597098c..fbf511b73 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -146,7 +146,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Enforcement Details Tab cy.wait(2000); - cy.get('[aria-label="Flagged Date"]').should('be.visible').click(); + cy.get('[aria-label="Flagged Date"]').click(); cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); cy.contains('Save and Continue').click(); From 2f17e4b4576497a93ebb55683b69ec99d693bf9d Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 15 Aug 2024 12:16:58 +0300 Subject: [PATCH 13/69] test: removes unnecessary next redirect --- cypress/support/commands.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index fe709c047..3214d2f20 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -17,7 +17,7 @@ // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) Cypress.Commands.add("login", () => { - cy.visit('localhost:8000/auth/?next=/index.htm'); + cy.visit('localhost:8000/auth/'); cy.get('.input-group > .floating-label-group > input[name="username"].form-control').type(`admin{enter}`); cy.get('.input-group > .floating-label-group > input[name="password"].form-control').type(`admin{enter}`); From 00620aabf89e1109091b19ce4367de710a0d134d Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 12 Aug 2024 13:22:43 +0300 Subject: [PATCH 14/69] chore: removes sample spec --- cypress/e2e/sample_spec.js | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 cypress/e2e/sample_spec.js diff --git a/cypress/e2e/sample_spec.js b/cypress/e2e/sample_spec.js deleted file mode 100644 index 96d52d507..000000000 --- a/cypress/e2e/sample_spec.js +++ /dev/null @@ -1,16 +0,0 @@ -describe('Home page', function() { - it('Visits the home page', function() { - cy.visit('/') - }) -}) - -describe('Log in as admin', function() { - it('Goes to login page, logs in with default creds, and should redirect to index', function() { - cy.visit('/auth/?next=/index.htm') - - cy.get('.input-group > .floating-label-group > input[name="username"].form-control').type(`admin{enter}`) - cy.get('.input-group > .floating-label-group > input[name="password"].form-control').type(`admin{enter}`) - - cy.url().should("include", "/index.htm") // redirected back to home page - }) -}) From 4a1a7f5c52b21c5a139b44a6f0373d716b296fc0 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 12 Aug 2024 13:24:17 +0300 Subject: [PATCH 15/69] fix: retuns false on uncaught exepction Also changes the url to the full localhost url. This is done so the tests can actually get to the point where they run as uncaught issues were otherwise blocking them before they even got started. We can debug this later --- cypress/support/commands.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 8733629d8..617fa3006 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -16,11 +16,14 @@ // -- This is a child command -- // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) - Cypress.Commands.add("login", () => { - cy.visit('/auth/?next=/index.htm'); + cy.visit('localhost:8000/auth/?next=/index.htm'); cy.get('.input-group > .floating-label-group > input[name="username"].form-control').type(`admin{enter}`); cy.get('.input-group > .floating-label-group > input[name="password"].form-control').type(`admin{enter}`); - }); + +Cypress.on('uncaught:exception', (err, runnable) => { + // returning false here prevents Cypress from failing the test temporary solution but we could log here and debug the uncaught issues + return false +}) From c168802d4a89f730262c9e49c2a5bfc72d580708 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 12 Aug 2024 13:26:17 +0300 Subject: [PATCH 16/69] wip: feat: adds flag for enforcement workflow test --- .../e2e/flag_for_enforcement_workflow.cy.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 cypress/e2e/flag_for_enforcement_workflow.cy.js diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js new file mode 100644 index 000000000..ff1fc80d3 --- /dev/null +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -0,0 +1,26 @@ +describe('Going through the Flag For Enforcement Workflow', function () { + + beforeEach(() => { + cy.login() + cy.visit("http://localhost:8000/plugins/init-workflow") + }) + + it('Go through the workflow', function () { + cy.contains("Workflows"); + cy.contains("Flag for Enforcement").click(); + // Starting the workflow + cy.contains("Save and Continue").click(); + cy.wait(5000); + cy.get('[aria-label="Case Reference"]').should('be.visible').click().type('Case Ref'); + // cy.get('#cke_2_contents > .cke_wysiwyg_frame').click().type('test'); + // cy.wait(5000); + // cy.get('[aria-label="Subtitle"]').should('be.visible').click().type('Subtitle'); + // cy.get('[aria-label="File ID (key)"]').should('be.visible').click().type('File ID (key)'); + // cy.get('#cke_2_contents').click().type('test type ref'); + cy.contains("Save and Continue").click(); + // cy.get('[aria-label="Flagged by"]').should('be.visible').click().type('Case Ref'); + // cy.get('.card_component.full_name > .row > .form-group > [style="max-width: 600px; position: relative"] > .col-xs-12 > .form-control').type('Test'); + // cy.get(':nth-child(2) > .card-component > .new-provisional-edit-card-container > .card > .install-buttons > .fa-plus > span').click(); + // cy.get('.close-new-step > .btn > span').click(); + }) +}) From 839def5a399ead955a3a640f8b8e06c6e7a68ef1 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 12 Aug 2024 14:43:44 +0300 Subject: [PATCH 17/69] wip: feat: selects first option in dropdown --- cypress/e2e/flag_for_enforcement_workflow.cy.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index ff1fc80d3..d370f37cb 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -10,17 +10,10 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains("Flag for Enforcement").click(); // Starting the workflow cy.contains("Save and Continue").click(); - cy.wait(5000); - cy.get('[aria-label="Case Reference"]').should('be.visible').click().type('Case Ref'); - // cy.get('#cke_2_contents > .cke_wysiwyg_frame').click().type('test'); - // cy.wait(5000); - // cy.get('[aria-label="Subtitle"]').should('be.visible').click().type('Subtitle'); - // cy.get('[aria-label="File ID (key)"]').should('be.visible').click().type('File ID (key)'); - // cy.get('#cke_2_contents').click().type('test type ref'); - cy.contains("Save and Continue").click(); - // cy.get('[aria-label="Flagged by"]').should('be.visible').click().type('Case Ref'); - // cy.get('.card_component.full_name > .row > .form-group > [style="max-width: 600px; position: relative"] > .col-xs-12 > .form-control').type('Test'); - // cy.get(':nth-child(2) > .card-component > .new-provisional-edit-card-container > .card > .install-buttons > .fa-plus > span').click(); - // cy.get('.close-new-step > .btn > span').click(); + cy.wait(2000); + cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); + cy.contains("Flagged by").siblings('.row').click(); + // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a test person and we can find them by name + cy.get('.select2-results__options li').first().click(); }) }) From e4387c336ef7a4293c6bcbabbbd54d82b8ab356b Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 14 Aug 2024 14:20:07 +0300 Subject: [PATCH 18/69] refactor: changes double quotes to single quotes --- cypress/e2e/flag_for_enforcement_workflow.cy.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index d370f37cb..1473c6043 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -2,18 +2,22 @@ describe('Going through the Flag For Enforcement Workflow', function () { beforeEach(() => { cy.login() - cy.visit("http://localhost:8000/plugins/init-workflow") + cy.visit('http://localhost:8000/plugins/init-workflow') }) it('Go through the workflow', function () { - cy.contains("Workflows"); - cy.contains("Flag for Enforcement").click(); + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); // Starting the workflow - cy.contains("Save and Continue").click(); + cy.contains('Save and Continue').click(); cy.wait(2000); cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); - cy.contains("Flagged by").siblings('.row').click(); + cy.contains('Flagged by').siblings('.row').click(); // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a test person and we can find them by name cy.get('.select2-results__options li').first().click(); + cy.get('[aria-label="Flagged Date"]').should('be.visible').click(); }) }) From 0b1391100b4a9d3127ed2e9676813623a13f0e21 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 14 Aug 2024 17:28:29 +0300 Subject: [PATCH 19/69] feat: adds a cypress command that allows editing rich textboxes --- cypress/support/commands.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 617fa3006..fe709c047 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -26,4 +26,13 @@ Cypress.Commands.add("login", () => { Cypress.on('uncaught:exception', (err, runnable) => { // returning false here prevents Cypress from failing the test temporary solution but we could log here and debug the uncaught issues return false -}) +}); + +Cypress.Commands.add("type_ckeditor", (element, content) => { + cy.window().then(win => { + // uncomment this to find the actual instance name you need + // console.log(win.CKEDITOR.instances); + win.CKEDITOR.instances[element].setData(content); + }); +}); + \ No newline at end of file From 7040fb61918f070e285cd426addfae73539cb141 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 14 Aug 2024 17:32:37 +0300 Subject: [PATCH 20/69] test: adds to the ffe workflow --- cypress/e2e/flag_for_enforcement_workflow.cy.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index 1473c6043..5d1b55c24 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -15,9 +15,19 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Continue').click(); cy.wait(2000); cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); + cy.type_ckeditor('editor2', 'test reason for enforcement'); cy.contains('Flagged by').siblings('.row').click(); // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a test person and we can find them by name + // TODO test with organisation as well cy.get('.select2-results__options li').first().click(); cy.get('[aria-label="Flagged Date"]').should('be.visible').click(); + cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.contains('Select resources').siblings('.row').click(); + // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name + cy.get('.select2-results__options li').first().click(); + cy.contains('Save and Continue').click(); + cy.wait(2000); + // TODO check that information that was entered corresponds + cy.contains('Save and Complete Workflow').click(); }) }) From dfad8f7cd4063f48e97b5199c450f8d71cebfa6b Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 14 Aug 2024 17:33:19 +0300 Subject: [PATCH 21/69] chore: adds cypress gitignore Ignores videos and screenshots generated from cypress studio --- cypress/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 cypress/.gitignore diff --git a/cypress/.gitignore b/cypress/.gitignore new file mode 100644 index 000000000..968e508e3 --- /dev/null +++ b/cypress/.gitignore @@ -0,0 +1,2 @@ +/videos +/screenshots \ No newline at end of file From 89be1977f1ae9b0ae7ecc5bf8d0e45d18356751d Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 15 Aug 2024 11:23:40 +0300 Subject: [PATCH 22/69] test: check all populated fields and go through workflow with just id --- .../e2e/flag_for_enforcement_workflow.cy.js | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index 5d1b55c24..3d99a2d7e 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -3,9 +3,9 @@ describe('Going through the Flag For Enforcement Workflow', function () { beforeEach(() => { cy.login() cy.visit('http://localhost:8000/plugins/init-workflow') - }) + }); - it('Go through the workflow', function () { + it('Go through the workflow and populate all fields', function () { cy.contains('Workflows'); cy.contains('Flag for Enforcement').click(); // Makes sure the autogenerated id is not undefined @@ -26,8 +26,30 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name cy.get('.select2-results__options li').first().click(); cy.contains('Save and Continue').click(); + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().should('not.have.text', ''); + cy.contains('Case Reference Number:').siblings().should('have.text', 'Case Ref'); + cy.contains('Description:').siblings().should('have.text', 'test reason for enforcement'); + // Only checks if the date we selected is present as the year and month could change + cy.contains('Flagged Date Value:').siblings().should('contain', '17'); + // TODO actually create the person and use the name in the check here + cy.contains('Actor:').siblings().should('have.text', 'test'); cy.wait(2000); - // TODO check that information that was entered corresponds cy.contains('Save and Complete Workflow').click(); - }) + }); + + it('Go through the workflow and only with Enforcement ID', function () { + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + // Starting the workflow + cy.contains('Save and Continue').click(); + cy.wait(2000); + cy.contains('Next Step').click(); + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('Save and Complete Workflow').click(); + }); + }) From a057b03a1e9c449bcf85e3653bf1b581d18ae025 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 15 Aug 2024 11:27:22 +0300 Subject: [PATCH 23/69] test: adds test with only case reference Also adds comments and sections off different tabs in the code --- .../e2e/flag_for_enforcement_workflow.cy.js | 37 +++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index 3d99a2d7e..df4bcb8aa 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -8,11 +8,14 @@ describe('Going through the Flag For Enforcement Workflow', function () { it('Go through the workflow and populate all fields', function () { cy.contains('Workflows'); cy.contains('Flag for Enforcement').click(); + + // Initial step tab // Makes sure the autogenerated id is not undefined cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); - // Starting the workflow cy.contains('Save and Continue').click(); + + // Enforcement Details Tab cy.wait(2000); cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); cy.type_ckeditor('editor2', 'test reason for enforcement'); @@ -26,6 +29,8 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name cy.get('.select2-results__options li').first().click(); cy.contains('Save and Continue').click(); + + // Enforcement Summary tab cy.contains('ResourceID:').siblings().should('not.have.text'); cy.contains('ResourceID:').siblings().should('not.have.text', ''); cy.contains('Case Reference Number:').siblings().should('have.text', 'Case Ref'); @@ -38,18 +43,44 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Complete Workflow').click(); }); - it('Go through the workflow and only with Enforcement ID', function () { + it('Go through the workflow only with Enforcement ID', function () { cy.contains('Workflows'); cy.contains('Flag for Enforcement').click(); + + // Initial step tab // Makes sure the autogenerated id is not undefined cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); - // Starting the workflow cy.contains('Save and Continue').click(); + + // Enforcement Details Tab cy.wait(2000); cy.contains('Next Step').click(); + + // Enforcement Summary tab cy.contains('ResourceID:').siblings().should('not.have.text'); cy.contains('Save and Complete Workflow').click(); }); + it('Go through the workflow and populate only Case Reference', function () { + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.contains('Save and Continue').click(); + + // Enforcement Details Tab + cy.wait(2000); + cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); + cy.contains('Save and Continue').click(); + + // Enforcement Summary tab + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().should('not.have.text', ''); + cy.contains('Case Reference Number:').siblings().should('have.text', 'Case Ref'); + cy.contains('Save and Complete Workflow').click(); + }); }) From 88afd82d4846bf3c42ca09ed1aa1078e2ffab9aa Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 15 Aug 2024 11:59:10 +0300 Subject: [PATCH 24/69] test: adds tests for each field --- .../e2e/flag_for_enforcement_workflow.cy.js | 105 +++++++++++++++++- 1 file changed, 102 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index df4bcb8aa..9d597098c 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -39,11 +39,12 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Flagged Date Value:').siblings().should('contain', '17'); // TODO actually create the person and use the name in the check here cy.contains('Actor:').siblings().should('have.text', 'test'); + cy.contains('Associated Resources:').siblings().should('have.text', 'Undefined'); cy.wait(2000); cy.contains('Save and Complete Workflow').click(); }); - it('Go through the workflow only with Enforcement ID', function () { + it('Workflow with only Enforcement ID', function () { cy.contains('Workflows'); cy.contains('Flag for Enforcement').click(); @@ -62,7 +63,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Complete Workflow').click(); }); - it('Go through the workflow and populate only Case Reference', function () { + it('Workflow with only Case Reference', function () { cy.contains('Workflows'); cy.contains('Flag for Enforcement').click(); @@ -83,4 +84,102 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Case Reference Number:').siblings().should('have.text', 'Case Ref'); cy.contains('Save and Complete Workflow').click(); }); -}) + + it('Workflow with only Reason For Enforcement', function () { + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.contains('Save and Continue').click(); + + // Enforcement Details Tab + cy.wait(2000); + cy.type_ckeditor('editor2', 'test reason for enforcement'); + cy.contains('Save and Continue').click(); + + // Enforcement Summary tab + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().should('not.have.text', ''); + cy.contains('Description:').siblings().should('have.text', 'test reason for enforcement'); + cy.contains('Save and Complete Workflow').click(); + }); + + it('Workflow with only Flagged By', function () { + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.contains('Save and Continue').click(); + + // Enforcement Details Tab + cy.wait(2000); + cy.contains('Flagged by').siblings('.row').click(); + // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a test person and we can find them by name + // TODO test with organisation as well + cy.get('.select2-results__options li').first().click(); + cy.contains('Save and Continue').click(); + + // Enforcement Summary tab + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().should('not.have.text', ''); + // TODO actually create the person and use the name in the check here + cy.contains('Actor:').siblings().should('have.text', 'test'); + cy.contains('Save and Complete Workflow').click(); + }); + + + it('Workflow with only Flagged Date', function () { + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.contains('Save and Continue').click(); + + // Enforcement Details Tab + cy.wait(2000); + cy.get('[aria-label="Flagged Date"]').should('be.visible').click(); + cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.contains('Save and Continue').click(); + + // Enforcement Summary tab + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().should('not.have.text', ''); + // Only checks if the date we selected is present as the year and month could change + cy.contains('Flagged Date Value:').siblings().should('contain', '17'); + cy.contains('Save and Complete Workflow').click(); + }); + + + it('Workflow with only Associated Resource', function () { + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.contains('Save and Continue').click(); + + // Enforcement Details Tab + cy.wait(2000); + cy.contains('Select resources').siblings('.row').click(); + // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name + cy.get('.select2-results__options li').first().click(); + cy.contains('Save and Continue').click(); + + // Enforcement Summary tab + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().should('not.have.text', ''); + cy.contains('Associated Resources:').siblings().should('have.text', 'Undefined'); + cy.contains('Save and Complete Workflow').click(); + }); +}); From 9e969a1146d0b77ee0a0cbcba539bd27be9819a6 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 15 Aug 2024 12:16:38 +0300 Subject: [PATCH 25/69] test: fix flagged date selection --- cypress/e2e/flag_for_enforcement_workflow.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index 9d597098c..fbf511b73 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -146,7 +146,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Enforcement Details Tab cy.wait(2000); - cy.get('[aria-label="Flagged Date"]').should('be.visible').click(); + cy.get('[aria-label="Flagged Date"]').click(); cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); cy.contains('Save and Continue').click(); From 77f8667a3f4c3c38d3f1459144660b6608ab4701 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 15 Aug 2024 12:16:58 +0300 Subject: [PATCH 26/69] test: removes unnecessary next redirect --- cypress/support/commands.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index fe709c047..3214d2f20 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -17,7 +17,7 @@ // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) Cypress.Commands.add("login", () => { - cy.visit('localhost:8000/auth/?next=/index.htm'); + cy.visit('localhost:8000/auth/'); cy.get('.input-group > .floating-label-group > input[name="username"].form-control').type(`admin{enter}`); cy.get('.input-group > .floating-label-group > input[name="password"].form-control').type(`admin{enter}`); From fdbfcb757cab23a7bb67828919b6c3a52d0e591d Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 15 Aug 2024 15:18:07 +0300 Subject: [PATCH 27/69] chore: removes spaces --- cypress/e2e/flag_for_enforcement_workflow.cy.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js index fbf511b73..236a59412 100644 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/flag_for_enforcement_workflow.cy.js @@ -133,7 +133,6 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Complete Workflow').click(); }); - it('Workflow with only Flagged Date', function () { cy.contains('Workflows'); cy.contains('Flag for Enforcement').click(); @@ -158,7 +157,6 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Complete Workflow').click(); }); - it('Workflow with only Associated Resource', function () { cy.contains('Workflows'); cy.contains('Flag for Enforcement').click(); From cc24d1b999dbf6e4ed4f6c42235946af1745ed6f Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 19 Aug 2024 12:55:51 +0300 Subject: [PATCH 28/69] test: creates person to be used in tests also renames tests to run in order --- cypress/e2e/01_create_a_person_test.cy.js | 29 +++++++++++++++++++ ...=> 02_flag_for_enforcement_workflow.cy.js} | 0 2 files changed, 29 insertions(+) create mode 100644 cypress/e2e/01_create_a_person_test.cy.js rename cypress/e2e/{flag_for_enforcement_workflow.cy.js => 02_flag_for_enforcement_workflow.cy.js} (100%) diff --git a/cypress/e2e/01_create_a_person_test.cy.js b/cypress/e2e/01_create_a_person_test.cy.js new file mode 100644 index 000000000..ab6702cb9 --- /dev/null +++ b/cypress/e2e/01_create_a_person_test.cy.js @@ -0,0 +1,29 @@ +describe('Going through the Flag For Enforcement Workflow', function () { + + beforeEach(() => { + cy.login(); + cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&resource-type-filter=%5B%7B%22graphid%22%3A%2222477f01-1a44-11e9-b0a9-000d3ab1e588%22%2C%22name%22%3A%22Person%22%2C%22inverted%22%3Afalse%7D%5D'); + // cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&resource-type-filter=%5B%7B%22graphid%22%3A%22b9e0701e-5463-11e9-b5f5-000d3ab1e588%22%2C%22name%22%3A%22Activity%22%2C%22inverted%22%3Afalse%7D%5D'); + }); + + it('Create a person', function () { + cy.wait(5000).then(() => { + cy.get('#search-results-list').then(($el) => { + if ($el.find('.search-listing').length > 0) { + // A caveat to this is that it will only look at the first page (which shouldn't be a problem with a fresh instance) since the search was failing locally to find Test Person (probably a permissions issue as all objects were created as Provisional) + if (!$el.text().includes('Test Person')) { + cy.visit('http://localhost:8000/add-resource/22477f01-1a44-11e9-b0a9-000d3ab1e588') + cy.contains('Names').click(); + cy.get('[aria-label="Full Name"]').should('be.visible').type('Test Person'); + cy.get('button').contains('Add').click(); + } + } else { + cy.visit('http://localhost:8000/add-resource/22477f01-1a44-11e9-b0a9-000d3ab1e588') + cy.contains('Names').click(); + cy.get('[aria-label="Full Name"]').should('be.visible').type('Test Person'); + cy.get('button').contains('Add').click(); + } + }) + }); + }); +}); diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/02_flag_for_enforcement_workflow.cy.js similarity index 100% rename from cypress/e2e/flag_for_enforcement_workflow.cy.js rename to cypress/e2e/02_flag_for_enforcement_workflow.cy.js From a15b657dd3510c82bb1268223635f1ea5c4cfcc1 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 19 Aug 2024 13:20:24 +0300 Subject: [PATCH 29/69] test: delete test since its been renamed --- .../e2e/flag_for_enforcement_workflow.cy.js | 185 ------------------ 1 file changed, 185 deletions(-) delete mode 100644 cypress/e2e/flag_for_enforcement_workflow.cy.js diff --git a/cypress/e2e/flag_for_enforcement_workflow.cy.js b/cypress/e2e/flag_for_enforcement_workflow.cy.js deleted file mode 100644 index fbf511b73..000000000 --- a/cypress/e2e/flag_for_enforcement_workflow.cy.js +++ /dev/null @@ -1,185 +0,0 @@ -describe('Going through the Flag For Enforcement Workflow', function () { - - beforeEach(() => { - cy.login() - cy.visit('http://localhost:8000/plugins/init-workflow') - }); - - it('Go through the workflow and populate all fields', function () { - cy.contains('Workflows'); - cy.contains('Flag for Enforcement').click(); - - // Initial step tab - // Makes sure the autogenerated id is not undefined - cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); - cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); - cy.contains('Save and Continue').click(); - - // Enforcement Details Tab - cy.wait(2000); - cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); - cy.type_ckeditor('editor2', 'test reason for enforcement'); - cy.contains('Flagged by').siblings('.row').click(); - // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a test person and we can find them by name - // TODO test with organisation as well - cy.get('.select2-results__options li').first().click(); - cy.get('[aria-label="Flagged Date"]').should('be.visible').click(); - cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); - cy.contains('Select resources').siblings('.row').click(); - // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name - cy.get('.select2-results__options li').first().click(); - cy.contains('Save and Continue').click(); - - // Enforcement Summary tab - cy.contains('ResourceID:').siblings().should('not.have.text'); - cy.contains('ResourceID:').siblings().should('not.have.text', ''); - cy.contains('Case Reference Number:').siblings().should('have.text', 'Case Ref'); - cy.contains('Description:').siblings().should('have.text', 'test reason for enforcement'); - // Only checks if the date we selected is present as the year and month could change - cy.contains('Flagged Date Value:').siblings().should('contain', '17'); - // TODO actually create the person and use the name in the check here - cy.contains('Actor:').siblings().should('have.text', 'test'); - cy.contains('Associated Resources:').siblings().should('have.text', 'Undefined'); - cy.wait(2000); - cy.contains('Save and Complete Workflow').click(); - }); - - it('Workflow with only Enforcement ID', function () { - cy.contains('Workflows'); - cy.contains('Flag for Enforcement').click(); - - // Initial step tab - // Makes sure the autogenerated id is not undefined - cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); - cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); - cy.contains('Save and Continue').click(); - - // Enforcement Details Tab - cy.wait(2000); - cy.contains('Next Step').click(); - - // Enforcement Summary tab - cy.contains('ResourceID:').siblings().should('not.have.text'); - cy.contains('Save and Complete Workflow').click(); - }); - - it('Workflow with only Case Reference', function () { - cy.contains('Workflows'); - cy.contains('Flag for Enforcement').click(); - - // Initial step tab - // Makes sure the autogenerated id is not undefined - cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); - cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); - cy.contains('Save and Continue').click(); - - // Enforcement Details Tab - cy.wait(2000); - cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); - cy.contains('Save and Continue').click(); - - // Enforcement Summary tab - cy.contains('ResourceID:').siblings().should('not.have.text'); - cy.contains('ResourceID:').siblings().should('not.have.text', ''); - cy.contains('Case Reference Number:').siblings().should('have.text', 'Case Ref'); - cy.contains('Save and Complete Workflow').click(); - }); - - it('Workflow with only Reason For Enforcement', function () { - cy.contains('Workflows'); - cy.contains('Flag for Enforcement').click(); - - // Initial step tab - // Makes sure the autogenerated id is not undefined - cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); - cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); - cy.contains('Save and Continue').click(); - - // Enforcement Details Tab - cy.wait(2000); - cy.type_ckeditor('editor2', 'test reason for enforcement'); - cy.contains('Save and Continue').click(); - - // Enforcement Summary tab - cy.contains('ResourceID:').siblings().should('not.have.text'); - cy.contains('ResourceID:').siblings().should('not.have.text', ''); - cy.contains('Description:').siblings().should('have.text', 'test reason for enforcement'); - cy.contains('Save and Complete Workflow').click(); - }); - - it('Workflow with only Flagged By', function () { - cy.contains('Workflows'); - cy.contains('Flag for Enforcement').click(); - - // Initial step tab - // Makes sure the autogenerated id is not undefined - cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); - cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); - cy.contains('Save and Continue').click(); - - // Enforcement Details Tab - cy.wait(2000); - cy.contains('Flagged by').siblings('.row').click(); - // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a test person and we can find them by name - // TODO test with organisation as well - cy.get('.select2-results__options li').first().click(); - cy.contains('Save and Continue').click(); - - // Enforcement Summary tab - cy.contains('ResourceID:').siblings().should('not.have.text'); - cy.contains('ResourceID:').siblings().should('not.have.text', ''); - // TODO actually create the person and use the name in the check here - cy.contains('Actor:').siblings().should('have.text', 'test'); - cy.contains('Save and Complete Workflow').click(); - }); - - - it('Workflow with only Flagged Date', function () { - cy.contains('Workflows'); - cy.contains('Flag for Enforcement').click(); - - // Initial step tab - // Makes sure the autogenerated id is not undefined - cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); - cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); - cy.contains('Save and Continue').click(); - - // Enforcement Details Tab - cy.wait(2000); - cy.get('[aria-label="Flagged Date"]').click(); - cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); - cy.contains('Save and Continue').click(); - - // Enforcement Summary tab - cy.contains('ResourceID:').siblings().should('not.have.text'); - cy.contains('ResourceID:').siblings().should('not.have.text', ''); - // Only checks if the date we selected is present as the year and month could change - cy.contains('Flagged Date Value:').siblings().should('contain', '17'); - cy.contains('Save and Complete Workflow').click(); - }); - - - it('Workflow with only Associated Resource', function () { - cy.contains('Workflows'); - cy.contains('Flag for Enforcement').click(); - - // Initial step tab - // Makes sure the autogenerated id is not undefined - cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); - cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); - cy.contains('Save and Continue').click(); - - // Enforcement Details Tab - cy.wait(2000); - cy.contains('Select resources').siblings('.row').click(); - // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name - cy.get('.select2-results__options li').first().click(); - cy.contains('Save and Continue').click(); - - // Enforcement Summary tab - cy.contains('ResourceID:').siblings().should('not.have.text'); - cy.contains('ResourceID:').siblings().should('not.have.text', ''); - cy.contains('Associated Resources:').siblings().should('have.text', 'Undefined'); - cy.contains('Save and Complete Workflow').click(); - }); -}); From 5d594f2e8c267baecea240c81355fdd4e4d5bca8 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 19 Aug 2024 13:38:52 +0300 Subject: [PATCH 30/69] test: adds create heritage asset test also renames tests --- ...son_test.cy.js => 01_create_a_person.cy.js} | 3 +-- cypress/e2e/02_create_a_heritage_asset.cy.js | 18 ++++++++++++++++++ ... => 03_flag_for_enforcement_workflow.cy.js} | 6 ++---- 3 files changed, 21 insertions(+), 6 deletions(-) rename cypress/e2e/{01_create_a_person_test.cy.js => 01_create_a_person.cy.js} (95%) create mode 100644 cypress/e2e/02_create_a_heritage_asset.cy.js rename cypress/e2e/{02_flag_for_enforcement_workflow.cy.js => 03_flag_for_enforcement_workflow.cy.js} (96%) diff --git a/cypress/e2e/01_create_a_person_test.cy.js b/cypress/e2e/01_create_a_person.cy.js similarity index 95% rename from cypress/e2e/01_create_a_person_test.cy.js rename to cypress/e2e/01_create_a_person.cy.js index ab6702cb9..9e539ada4 100644 --- a/cypress/e2e/01_create_a_person_test.cy.js +++ b/cypress/e2e/01_create_a_person.cy.js @@ -1,5 +1,4 @@ -describe('Going through the Flag For Enforcement Workflow', function () { - +describe('Creating a person named Test Person if one doesnt exist', function () { beforeEach(() => { cy.login(); cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&resource-type-filter=%5B%7B%22graphid%22%3A%2222477f01-1a44-11e9-b0a9-000d3ab1e588%22%2C%22name%22%3A%22Person%22%2C%22inverted%22%3Afalse%7D%5D'); diff --git a/cypress/e2e/02_create_a_heritage_asset.cy.js b/cypress/e2e/02_create_a_heritage_asset.cy.js new file mode 100644 index 000000000..424bcd8c5 --- /dev/null +++ b/cypress/e2e/02_create_a_heritage_asset.cy.js @@ -0,0 +1,18 @@ +describe('Creating a Heritage Asset if none exist', function () { + beforeEach(() => { + cy.login(); + cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&resource-type-filter=%5B%7B%22graphid%22%3A%22076f9381-7b00-11e9-8d6b-80000b44d1d9%22%2C%22name%22%3A%22Heritage%20Asset%22%2C%22inverted%22%3Afalse%7D%5D'); + }); + + it('Create a heritage asset', function () { + cy.wait(5000).then(() => { + cy.get('#search-results-list').then(($el) => { + if (!$el.find('.search-listing').length > 0) { + // If no Heritage Assets exist create an empty heritage asset + cy.visit('http://localhost:8000/add-resource/076f9381-7b00-11e9-8d6b-80000b44d1d9') + cy.get('button').contains('Add').click(); + }; + }) + }); + }); +}); diff --git a/cypress/e2e/02_flag_for_enforcement_workflow.cy.js b/cypress/e2e/03_flag_for_enforcement_workflow.cy.js similarity index 96% rename from cypress/e2e/02_flag_for_enforcement_workflow.cy.js rename to cypress/e2e/03_flag_for_enforcement_workflow.cy.js index 236a59412..c1005862d 100644 --- a/cypress/e2e/02_flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/03_flag_for_enforcement_workflow.cy.js @@ -37,8 +37,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Description:').siblings().should('have.text', 'test reason for enforcement'); // Only checks if the date we selected is present as the year and month could change cy.contains('Flagged Date Value:').siblings().should('contain', '17'); - // TODO actually create the person and use the name in the check here - cy.contains('Actor:').siblings().should('have.text', 'test'); + cy.contains('Actor:').siblings().should('have.text', 'Test Person'); cy.contains('Associated Resources:').siblings().should('have.text', 'Undefined'); cy.wait(2000); cy.contains('Save and Complete Workflow').click(); @@ -128,8 +127,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Enforcement Summary tab cy.contains('ResourceID:').siblings().should('not.have.text'); cy.contains('ResourceID:').siblings().should('not.have.text', ''); - // TODO actually create the person and use the name in the check here - cy.contains('Actor:').siblings().should('have.text', 'test'); + cy.contains('Actor:').siblings().should('have.text', 'Test Person'); cy.contains('Save and Complete Workflow').click(); }); From 0e9a9a53bae7e542efa39f7983ca052ce1a4b8fe Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 19 Aug 2024 13:45:44 +0300 Subject: [PATCH 31/69] test: adds commented search for the created person --- cypress/e2e/03_flag_for_enforcement_workflow.cy.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cypress/e2e/03_flag_for_enforcement_workflow.cy.js b/cypress/e2e/03_flag_for_enforcement_workflow.cy.js index c1005862d..5f000a424 100644 --- a/cypress/e2e/03_flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/03_flag_for_enforcement_workflow.cy.js @@ -22,6 +22,8 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Flagged by').siblings('.row').click(); // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a test person and we can find them by name // TODO test with organisation as well + // Commented out for now as search seems to be broken on local + // cy.get('.select2-search__field').type('Test Person'); cy.get('.select2-results__options li').first().click(); cy.get('[aria-label="Flagged Date"]').should('be.visible').click(); cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); @@ -121,12 +123,16 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Flagged by').siblings('.row').click(); // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a test person and we can find them by name // TODO test with organisation as well + // Commented out for now as search seems to be broken on local + // cy.get('.select2-search__field').type('Test Person'); + cy.wait(5000); cy.get('.select2-results__options li').first().click(); cy.contains('Save and Continue').click(); // Enforcement Summary tab cy.contains('ResourceID:').siblings().should('not.have.text'); cy.contains('ResourceID:').siblings().should('not.have.text', ''); + // TODO test with multiple people cy.contains('Actor:').siblings().should('have.text', 'Test Person'); cy.contains('Save and Complete Workflow').click(); }); From 39f0788e238ae1632fe7c733ef86662450414bb9 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 19 Aug 2024 13:46:40 +0300 Subject: [PATCH 32/69] ops: uncomment the test step --- .github/workflows/project.yml | 208 +++++++++++++++++----------------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index 125357184..7dbb05e65 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -268,109 +268,109 @@ jobs: run: | name=${{ fromJSON(steps.buildx.outputs.metadata)['image.name'] }} echo "image_name=$name" | sed 's/,.*//g' >> $GITHUB_OUTPUT - # Test-Arches: - # runs-on: [self-hosted] - # needs: [Build-Arches-Final] - # container: - # image: cypress/included:12.3.0 - # env: - # HOME: "" - # DEBUG: "cypress:*" - # CYPRESS_BASE_URL: http://arches:8000 - # steps: - # - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - # - name: Check out repository code - # uses: actions/checkout@v3 - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - # submodules: 'true' - # - name: Cypress run - # uses: cypress-io/github-action@v4 - # with: - # browser: firefox - # install: false - # wait-on: 'http://arches:8000' - # wait-on-timeout: 6000 - # - uses: actions/upload-artifact@v3 - # if: failure() - # with: - # name: cypress-screenshots - # path: cypress/screenshots - # - uses: actions/upload-artifact@v3 - # if: always() - # with: - # name: cypress-videos - # path: cypress/videos - # services: - # elasticsearch: - # image: elasticsearch:8.4.0 - # ports: - # - "9200:9200" - # - "9300:9300" - # env: - # TZ: "PST" - # discovery.type: "single-node" - # discovery.seed_hosts: "[]" - # xpack.security.enabled: "false" - # ES_JAVA_OPTS: "-Xms400m -Xmx400m" - # options: >- - # --health-cmd "curl -s --fail http://localhost:9200/_cat/health || exit 1" - # --health-interval 10s - # --health-timeout 5s - # --health-retries 10 + Test-Arches: + runs-on: [self-hosted] + needs: [Build-Arches-Final] + container: + image: cypress/included:12.3.0 + env: + HOME: "" + DEBUG: "cypress:*" + CYPRESS_BASE_URL: http://arches:8000 + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - name: Check out repository code + uses: actions/checkout@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + submodules: 'true' + - name: Cypress run + uses: cypress-io/github-action@v4 + with: + browser: firefox + install: false + wait-on: 'http://arches:8000' + wait-on-timeout: 6000 + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: cypress-screenshots + path: cypress/screenshots + - uses: actions/upload-artifact@v3 + if: always() + with: + name: cypress-videos + path: cypress/videos + services: + elasticsearch: + image: elasticsearch:8.4.0 + ports: + - "9200:9200" + - "9300:9300" + env: + TZ: "PST" + discovery.type: "single-node" + discovery.seed_hosts: "[]" + xpack.security.enabled: "false" + ES_JAVA_OPTS: "-Xms400m -Xmx400m" + options: >- + --health-cmd "curl -s --fail http://localhost:9200/_cat/health || exit 1" + --health-interval 10s + --health-timeout 5s + --health-retries 10 - # db: - # image: flaxandteal/arches_coral_postgres - # #volumes: - # # - ${{ github.workspace }}/scripts/init-unix.sql:/docker-entrypoint-initdb.d/init.sql # to set up the DB template - # ports: - # - '5432:5432' - # env: - # POSTGRES_USER: postgres - # POSTGRES_PASS: postgres - # POSTGRES_DB: postgres - # POSTGRES_MULTIPLE_EXTENSIONS: postgis,postgis_topology - # TZ: PST - # options: >- - # --health-cmd "pg_isready -h 127.0.0.1 -U postgres -d postgres" - # --health-interval 10s - # --health-timeout 5s - # --health-retries 20 + db: + image: flaxandteal/arches_coral_postgres + #volumes: + # - ${{ github.workspace }}/scripts/init-unix.sql:/docker-entrypoint-initdb.d/init.sql # to set up the DB template + ports: + - '5432:5432' + env: + POSTGRES_USER: postgres + POSTGRES_PASS: postgres + POSTGRES_DB: postgres + POSTGRES_MULTIPLE_EXTENSIONS: postgis,postgis_topology + TZ: PST + options: >- + --health-cmd "pg_isready -h 127.0.0.1 -U postgres -d postgres" + --health-interval 10s + --health-timeout 5s + --health-retries 20 - # arches: - # image: "${{ needs['Build-Arches-Final'].outputs.image }}" - # env: - # ALLOW_BOOTSTRAP: "True" - # ARCHES_PROJECT: "${{ env.ARCHES_PROJECT }}" - # COMPRESS_OFFLINE: "False" - # INSTALL_CORAL_PACKAGE: "True" - # INSTALL_DEFAULT_GRAPHS: "False" - # INSTALL_DEFAULT_CONCEPTS: "False" - # PGUSERNAME: "postgres" - # PGPASSWORD: "postgres" - # PGDBNAME: "arches" - # PGHOST: "db" - # PGPORT: "5432" - # RABBITMQ_USER: "rabbitmq" - # RABBITMQ_PASS: "rabbitmq" - # CANTALOUPE_HOST: "cantaloupe" - # CANTALOUPE_PORT: "8182" - # COUCHDB_HOST: "couchdb" - # COUCHDB_PORT: "5984" - # COUCHDB_USER: "admin" - # COUCHDB_PASS: "password" - # ESHOST: "elasticsearch" - # ESPORT: "9200" - # CELERY_BROKER_URL: "amqp://rabbitmq" - # DJANGO_MODE: "PROD" - # DJANGO_DEBUG: "False" - # DOMAIN_NAMES: "arches" - # PYTHONUNBUFFERED: "0" - # TZ: "PST" - # ports: - # - '8000:8000' - # options: >- - # --health-cmd "curl --fail http://localhost:8000/templates/views/components/language-switcher.htm || exit 1" - # --health-interval 10s - # --health-timeout 5s - # --health-retries 1000 + arches: + image: "${{ needs['Build-Arches-Final'].outputs.image }}" + env: + ALLOW_BOOTSTRAP: "True" + ARCHES_PROJECT: "${{ env.ARCHES_PROJECT }}" + COMPRESS_OFFLINE: "False" + INSTALL_CORAL_PACKAGE: "True" + INSTALL_DEFAULT_GRAPHS: "False" + INSTALL_DEFAULT_CONCEPTS: "False" + PGUSERNAME: "postgres" + PGPASSWORD: "postgres" + PGDBNAME: "arches" + PGHOST: "db" + PGPORT: "5432" + RABBITMQ_USER: "rabbitmq" + RABBITMQ_PASS: "rabbitmq" + CANTALOUPE_HOST: "cantaloupe" + CANTALOUPE_PORT: "8182" + COUCHDB_HOST: "couchdb" + COUCHDB_PORT: "5984" + COUCHDB_USER: "admin" + COUCHDB_PASS: "password" + ESHOST: "elasticsearch" + ESPORT: "9200" + CELERY_BROKER_URL: "amqp://rabbitmq" + DJANGO_MODE: "PROD" + DJANGO_DEBUG: "False" + DOMAIN_NAMES: "arches" + PYTHONUNBUFFERED: "0" + TZ: "PST" + ports: + - '8000:8000' + options: >- + --health-cmd "curl --fail http://localhost:8000/templates/views/components/language-switcher.htm || exit 1" + --health-interval 10s + --health-timeout 5s + --health-retries 1000 From 191a39cde23680e85201a9fd913a0cdb53aef110 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 19 Aug 2024 15:24:26 +0300 Subject: [PATCH 33/69] test: add temporary solution that selects Test Person --- cypress/e2e/03_flag_for_enforcement_workflow.cy.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/03_flag_for_enforcement_workflow.cy.js b/cypress/e2e/03_flag_for_enforcement_workflow.cy.js index 5f000a424..17ed71ff5 100644 --- a/cypress/e2e/03_flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/03_flag_for_enforcement_workflow.cy.js @@ -24,7 +24,8 @@ describe('Going through the Flag For Enforcement Workflow', function () { // TODO test with organisation as well // Commented out for now as search seems to be broken on local // cy.get('.select2-search__field').type('Test Person'); - cy.get('.select2-results__options li').first().click(); + cy.contains('Test Person').click(); + // cy.get('.select2-results__options li').first().click(); cy.get('[aria-label="Flagged Date"]').should('be.visible').click(); cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); cy.contains('Select resources').siblings('.row').click(); @@ -125,8 +126,8 @@ describe('Going through the Flag For Enforcement Workflow', function () { // TODO test with organisation as well // Commented out for now as search seems to be broken on local // cy.get('.select2-search__field').type('Test Person'); - cy.wait(5000); - cy.get('.select2-results__options li').first().click(); + cy.contains('Test Person').click(); + // cy.get('.select2-results__options li').first().click(); cy.contains('Save and Continue').click(); // Enforcement Summary tab From ad045a8e5f4479bae5defb99599bfa6c5f3ebb32 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 19 Aug 2024 17:12:41 +0300 Subject: [PATCH 34/69] test: adds create organisation test --- cypress/e2e/01_create_a_person.cy.js | 3 +-- cypress/e2e/03_create_an_organisation.cy.js | 27 +++++++++++++++++++ ...=> 04_flag_for_enforcement_workflow.cy.js} | 0 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 cypress/e2e/03_create_an_organisation.cy.js rename cypress/e2e/{03_flag_for_enforcement_workflow.cy.js => 04_flag_for_enforcement_workflow.cy.js} (100%) diff --git a/cypress/e2e/01_create_a_person.cy.js b/cypress/e2e/01_create_a_person.cy.js index 9e539ada4..8116990b5 100644 --- a/cypress/e2e/01_create_a_person.cy.js +++ b/cypress/e2e/01_create_a_person.cy.js @@ -1,8 +1,7 @@ describe('Creating a person named Test Person if one doesnt exist', function () { beforeEach(() => { cy.login(); - cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&resource-type-filter=%5B%7B%22graphid%22%3A%2222477f01-1a44-11e9-b0a9-000d3ab1e588%22%2C%22name%22%3A%22Person%22%2C%22inverted%22%3Afalse%7D%5D'); - // cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&resource-type-filter=%5B%7B%22graphid%22%3A%22b9e0701e-5463-11e9-b5f5-000d3ab1e588%22%2C%22name%22%3A%22Activity%22%2C%22inverted%22%3Afalse%7D%5D'); + cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=125&language=*&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Person%20-%20Name%22%2C%22id%22%3A%22termTest%20PersonPerson%20-%20Name%22%2C%22text%22%3A%22Test%20Person%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22Test%20Person%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D'); }); it('Create a person', function () { diff --git a/cypress/e2e/03_create_an_organisation.cy.js b/cypress/e2e/03_create_an_organisation.cy.js new file mode 100644 index 000000000..bcc11fe37 --- /dev/null +++ b/cypress/e2e/03_create_an_organisation.cy.js @@ -0,0 +1,27 @@ +describe('Creating a organisation named Test Organisation if one doesnt exist', function () { + beforeEach(() => { + cy.login(); + cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=125&language=*&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Organization%20-%20Names%22%2C%22id%22%3A%22termTest%20OrganisationOrganization%20-%20Names%22%2C%22text%22%3A%22Test%20Organisation%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22Test%20Organisation%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D'); + }); + + it('Create an organisation', function () { + cy.wait(5000).then(() => { + cy.get('#search-results-list').then(($el) => { + if ($el.find('.search-listing').length > 0) { + // A caveat to this is that it will only look at the first page (which shouldn't be a problem with a fresh instance) since the search was failing locally to find Test Organisation (probably a permissions issue as all objects were created as Provisional) + if (!$el.text().includes('Test Organisation')) { + cy.visit('http://localhost:8000/add-resource/d4a88461-5463-11e9-90d9-000d3ab1e588') + cy.contains('Names').click(); + cy.get('[aria-label="Organization Name"]').should('be.visible').type('Test Organisation'); + cy.get('button').contains('Add').click(); + } + } else { + cy.visit('http://localhost:8000/add-resource/d4a88461-5463-11e9-90d9-000d3ab1e588') + cy.contains('Names').click(); + cy.get('[aria-label="Organization Name"]').should('be.visible').type('Test Organisation'); + cy.get('button').contains('Add').click(); + } + }) + }); + }); +}); diff --git a/cypress/e2e/03_flag_for_enforcement_workflow.cy.js b/cypress/e2e/04_flag_for_enforcement_workflow.cy.js similarity index 100% rename from cypress/e2e/03_flag_for_enforcement_workflow.cy.js rename to cypress/e2e/04_flag_for_enforcement_workflow.cy.js From 96e625dd5d9b0cc08fb6134d54b90346e5d1102f Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 19 Aug 2024 17:15:07 +0300 Subject: [PATCH 35/69] test: search properly for test person --- .../e2e/04_flag_for_enforcement_workflow.cy.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/cypress/e2e/04_flag_for_enforcement_workflow.cy.js b/cypress/e2e/04_flag_for_enforcement_workflow.cy.js index 17ed71ff5..39e8e9377 100644 --- a/cypress/e2e/04_flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/04_flag_for_enforcement_workflow.cy.js @@ -20,12 +20,9 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); cy.type_ckeditor('editor2', 'test reason for enforcement'); cy.contains('Flagged by').siblings('.row').click(); - // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a test person and we can find them by name - // TODO test with organisation as well - // Commented out for now as search seems to be broken on local - // cy.get('.select2-search__field').type('Test Person'); - cy.contains('Test Person').click(); - // cy.get('.select2-results__options li').first().click(); + // TODO test with organisation as well as with multiple people/orgs + cy.get('.select2-search__field').type('Test Person'); + cy.get('.select2-results__options li').first().click(); cy.get('[aria-label="Flagged Date"]').should('be.visible').click(); cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); cy.contains('Select resources').siblings('.row').click(); @@ -122,12 +119,9 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Enforcement Details Tab cy.wait(2000); cy.contains('Flagged by').siblings('.row').click(); - // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a test person and we can find them by name // TODO test with organisation as well - // Commented out for now as search seems to be broken on local - // cy.get('.select2-search__field').type('Test Person'); - cy.contains('Test Person').click(); - // cy.get('.select2-results__options li').first().click(); + cy.get('.select2-search__field').type('Test Person'); + cy.get('.select2-results__options li').first().click(); cy.contains('Save and Continue').click(); // Enforcement Summary tab From 2852e161b9aeddecf395c307ecfc9f85e1820ea2 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 19 Aug 2024 18:07:14 +0300 Subject: [PATCH 36/69] test: lower waits --- .../04_flag_for_enforcement_workflow.cy.js | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/cypress/e2e/04_flag_for_enforcement_workflow.cy.js b/cypress/e2e/04_flag_for_enforcement_workflow.cy.js index 39e8e9377..5969ef344 100644 --- a/cypress/e2e/04_flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/04_flag_for_enforcement_workflow.cy.js @@ -1,8 +1,8 @@ describe('Going through the Flag For Enforcement Workflow', function () { beforeEach(() => { - cy.login() - cy.visit('http://localhost:8000/plugins/init-workflow') + cy.login(); + cy.visit('http://localhost:8000/plugins/init-workflow'); }); it('Go through the workflow and populate all fields', function () { @@ -16,12 +16,13 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Continue').click(); // Enforcement Details Tab - cy.wait(2000); + cy.wait(900); cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); cy.type_ckeditor('editor2', 'test reason for enforcement'); cy.contains('Flagged by').siblings('.row').click(); // TODO test with organisation as well as with multiple people/orgs cy.get('.select2-search__field').type('Test Person'); + cy.wait(400); cy.get('.select2-results__options li').first().click(); cy.get('[aria-label="Flagged Date"]').should('be.visible').click(); cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); @@ -39,7 +40,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Flagged Date Value:').siblings().should('contain', '17'); cy.contains('Actor:').siblings().should('have.text', 'Test Person'); cy.contains('Associated Resources:').siblings().should('have.text', 'Undefined'); - cy.wait(2000); + cy.wait(900); cy.contains('Save and Complete Workflow').click(); }); @@ -53,13 +54,18 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); cy.contains('Save and Continue').click(); + // Enforcement Details Tab - cy.wait(2000); + cy.wait(900); cy.contains('Next Step').click(); - + // Enforcement Summary tab cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().invoke('text').as('enforcementId') cy.contains('Save and Complete Workflow').click(); + + console.log(this.enforcementId); + cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true'); }); it('Workflow with only Case Reference', function () { @@ -73,7 +79,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Continue').click(); // Enforcement Details Tab - cy.wait(2000); + cy.wait(900); cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); cy.contains('Save and Continue').click(); @@ -95,7 +101,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Continue').click(); // Enforcement Details Tab - cy.wait(2000); + cy.wait(900); cy.type_ckeditor('editor2', 'test reason for enforcement'); cy.contains('Save and Continue').click(); @@ -117,10 +123,11 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Continue').click(); // Enforcement Details Tab - cy.wait(2000); + cy.wait(900); cy.contains('Flagged by').siblings('.row').click(); // TODO test with organisation as well cy.get('.select2-search__field').type('Test Person'); + cy.wait(400); cy.get('.select2-results__options li').first().click(); cy.contains('Save and Continue').click(); @@ -143,7 +150,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Continue').click(); // Enforcement Details Tab - cy.wait(2000); + cy.wait(900); cy.get('[aria-label="Flagged Date"]').click(); cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); cy.contains('Save and Continue').click(); @@ -162,12 +169,14 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Initial step tab // Makes sure the autogenerated id is not undefined + cy.wait(900); cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); cy.contains('Save and Continue').click(); // Enforcement Details Tab - cy.wait(2000); + cy.contains('Select resources').scrollIntoView(); + cy.wait(1000); cy.contains('Select resources').siblings('.row').click(); // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name cy.get('.select2-results__options li').first().click(); From 0d217dd82450556b9284a24a9894701bf1023720 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Tue, 20 Aug 2024 13:23:47 +0300 Subject: [PATCH 37/69] ops: comment out test step since it doesnt work --- .github/workflows/project.yml | 208 +++++++++++++++++----------------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index 7dbb05e65..125357184 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -268,109 +268,109 @@ jobs: run: | name=${{ fromJSON(steps.buildx.outputs.metadata)['image.name'] }} echo "image_name=$name" | sed 's/,.*//g' >> $GITHUB_OUTPUT - Test-Arches: - runs-on: [self-hosted] - needs: [Build-Arches-Final] - container: - image: cypress/included:12.3.0 - env: - HOME: "" - DEBUG: "cypress:*" - CYPRESS_BASE_URL: http://arches:8000 - steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - name: Check out repository code - uses: actions/checkout@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - submodules: 'true' - - name: Cypress run - uses: cypress-io/github-action@v4 - with: - browser: firefox - install: false - wait-on: 'http://arches:8000' - wait-on-timeout: 6000 - - uses: actions/upload-artifact@v3 - if: failure() - with: - name: cypress-screenshots - path: cypress/screenshots - - uses: actions/upload-artifact@v3 - if: always() - with: - name: cypress-videos - path: cypress/videos - services: - elasticsearch: - image: elasticsearch:8.4.0 - ports: - - "9200:9200" - - "9300:9300" - env: - TZ: "PST" - discovery.type: "single-node" - discovery.seed_hosts: "[]" - xpack.security.enabled: "false" - ES_JAVA_OPTS: "-Xms400m -Xmx400m" - options: >- - --health-cmd "curl -s --fail http://localhost:9200/_cat/health || exit 1" - --health-interval 10s - --health-timeout 5s - --health-retries 10 + # Test-Arches: + # runs-on: [self-hosted] + # needs: [Build-Arches-Final] + # container: + # image: cypress/included:12.3.0 + # env: + # HOME: "" + # DEBUG: "cypress:*" + # CYPRESS_BASE_URL: http://arches:8000 + # steps: + # - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + # - name: Check out repository code + # uses: actions/checkout@v3 + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # submodules: 'true' + # - name: Cypress run + # uses: cypress-io/github-action@v4 + # with: + # browser: firefox + # install: false + # wait-on: 'http://arches:8000' + # wait-on-timeout: 6000 + # - uses: actions/upload-artifact@v3 + # if: failure() + # with: + # name: cypress-screenshots + # path: cypress/screenshots + # - uses: actions/upload-artifact@v3 + # if: always() + # with: + # name: cypress-videos + # path: cypress/videos + # services: + # elasticsearch: + # image: elasticsearch:8.4.0 + # ports: + # - "9200:9200" + # - "9300:9300" + # env: + # TZ: "PST" + # discovery.type: "single-node" + # discovery.seed_hosts: "[]" + # xpack.security.enabled: "false" + # ES_JAVA_OPTS: "-Xms400m -Xmx400m" + # options: >- + # --health-cmd "curl -s --fail http://localhost:9200/_cat/health || exit 1" + # --health-interval 10s + # --health-timeout 5s + # --health-retries 10 - db: - image: flaxandteal/arches_coral_postgres - #volumes: - # - ${{ github.workspace }}/scripts/init-unix.sql:/docker-entrypoint-initdb.d/init.sql # to set up the DB template - ports: - - '5432:5432' - env: - POSTGRES_USER: postgres - POSTGRES_PASS: postgres - POSTGRES_DB: postgres - POSTGRES_MULTIPLE_EXTENSIONS: postgis,postgis_topology - TZ: PST - options: >- - --health-cmd "pg_isready -h 127.0.0.1 -U postgres -d postgres" - --health-interval 10s - --health-timeout 5s - --health-retries 20 + # db: + # image: flaxandteal/arches_coral_postgres + # #volumes: + # # - ${{ github.workspace }}/scripts/init-unix.sql:/docker-entrypoint-initdb.d/init.sql # to set up the DB template + # ports: + # - '5432:5432' + # env: + # POSTGRES_USER: postgres + # POSTGRES_PASS: postgres + # POSTGRES_DB: postgres + # POSTGRES_MULTIPLE_EXTENSIONS: postgis,postgis_topology + # TZ: PST + # options: >- + # --health-cmd "pg_isready -h 127.0.0.1 -U postgres -d postgres" + # --health-interval 10s + # --health-timeout 5s + # --health-retries 20 - arches: - image: "${{ needs['Build-Arches-Final'].outputs.image }}" - env: - ALLOW_BOOTSTRAP: "True" - ARCHES_PROJECT: "${{ env.ARCHES_PROJECT }}" - COMPRESS_OFFLINE: "False" - INSTALL_CORAL_PACKAGE: "True" - INSTALL_DEFAULT_GRAPHS: "False" - INSTALL_DEFAULT_CONCEPTS: "False" - PGUSERNAME: "postgres" - PGPASSWORD: "postgres" - PGDBNAME: "arches" - PGHOST: "db" - PGPORT: "5432" - RABBITMQ_USER: "rabbitmq" - RABBITMQ_PASS: "rabbitmq" - CANTALOUPE_HOST: "cantaloupe" - CANTALOUPE_PORT: "8182" - COUCHDB_HOST: "couchdb" - COUCHDB_PORT: "5984" - COUCHDB_USER: "admin" - COUCHDB_PASS: "password" - ESHOST: "elasticsearch" - ESPORT: "9200" - CELERY_BROKER_URL: "amqp://rabbitmq" - DJANGO_MODE: "PROD" - DJANGO_DEBUG: "False" - DOMAIN_NAMES: "arches" - PYTHONUNBUFFERED: "0" - TZ: "PST" - ports: - - '8000:8000' - options: >- - --health-cmd "curl --fail http://localhost:8000/templates/views/components/language-switcher.htm || exit 1" - --health-interval 10s - --health-timeout 5s - --health-retries 1000 + # arches: + # image: "${{ needs['Build-Arches-Final'].outputs.image }}" + # env: + # ALLOW_BOOTSTRAP: "True" + # ARCHES_PROJECT: "${{ env.ARCHES_PROJECT }}" + # COMPRESS_OFFLINE: "False" + # INSTALL_CORAL_PACKAGE: "True" + # INSTALL_DEFAULT_GRAPHS: "False" + # INSTALL_DEFAULT_CONCEPTS: "False" + # PGUSERNAME: "postgres" + # PGPASSWORD: "postgres" + # PGDBNAME: "arches" + # PGHOST: "db" + # PGPORT: "5432" + # RABBITMQ_USER: "rabbitmq" + # RABBITMQ_PASS: "rabbitmq" + # CANTALOUPE_HOST: "cantaloupe" + # CANTALOUPE_PORT: "8182" + # COUCHDB_HOST: "couchdb" + # COUCHDB_PORT: "5984" + # COUCHDB_USER: "admin" + # COUCHDB_PASS: "password" + # ESHOST: "elasticsearch" + # ESPORT: "9200" + # CELERY_BROKER_URL: "amqp://rabbitmq" + # DJANGO_MODE: "PROD" + # DJANGO_DEBUG: "False" + # DOMAIN_NAMES: "arches" + # PYTHONUNBUFFERED: "0" + # TZ: "PST" + # ports: + # - '8000:8000' + # options: >- + # --health-cmd "curl --fail http://localhost:8000/templates/views/components/language-switcher.htm || exit 1" + # --health-interval 10s + # --health-timeout 5s + # --health-retries 1000 From c23ba1d8b55892252ddf9cd1935e54d1ddd99248 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Tue, 20 Aug 2024 13:50:24 +0300 Subject: [PATCH 38/69] test: select the created heritage asset --- cypress/e2e/01_create_a_person.cy.js | 26 +++++++++++++++++-- .../flag_for_enforcement_workflow.cy.js} | 17 +++++++----- cypress/e2e/02_create_a_heritage_asset.cy.js | 6 +++-- 3 files changed, 38 insertions(+), 11 deletions(-) rename cypress/e2e/{04_flag_for_enforcement_workflow.cy.js => 01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js} (94%) diff --git a/cypress/e2e/01_create_a_person.cy.js b/cypress/e2e/01_create_a_person.cy.js index 8116990b5..df7e01bca 100644 --- a/cypress/e2e/01_create_a_person.cy.js +++ b/cypress/e2e/01_create_a_person.cy.js @@ -1,10 +1,10 @@ -describe('Creating a person named Test Person if one doesnt exist', function () { +describe('Creating a person named Test Person and a person named John Doe if they dont exist', function () { beforeEach(() => { cy.login(); - cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=125&language=*&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Person%20-%20Name%22%2C%22id%22%3A%22termTest%20PersonPerson%20-%20Name%22%2C%22text%22%3A%22Test%20Person%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22Test%20Person%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D'); }); it('Create a person', function () { + cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=125&language=*&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Person%20-%20Name%22%2C%22id%22%3A%22termTest%20PersonPerson%20-%20Name%22%2C%22text%22%3A%22Test%20Person%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22Test%20Person%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D'); cy.wait(5000).then(() => { cy.get('#search-results-list').then(($el) => { if ($el.find('.search-listing').length > 0) { @@ -24,4 +24,26 @@ describe('Creating a person named Test Person if one doesnt exist', function () }) }); }); + + it('Create a second person', function () { + cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=329&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Person%20-%20Name%22%2C%22id%22%3A%22termJohn%20DoePerson%20-%20Name%22%2C%22text%22%3A%22John%20Doe%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22John%20Doe%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D&language=*'); + cy.wait(5000).then(() => { + cy.get('#search-results-list').then(($el) => { + if ($el.find('.search-listing').length > 0) { + // A caveat to this is that it will only look at the first page (which shouldn't be a problem with a fresh instance) since the search was failing locally to find John Doe (probably a permissions issue as all objects were created as Provisional) + if (!$el.text().includes('John Doe')) { + cy.visit('http://localhost:8000/add-resource/22477f01-1a44-11e9-b0a9-000d3ab1e588') + cy.contains('Names').click(); + cy.get('[aria-label="Full Name"]').should('be.visible').type('John Doe'); + cy.get('button').contains('Add').click(); + } + } else { + cy.visit('http://localhost:8000/add-resource/22477f01-1a44-11e9-b0a9-000d3ab1e588') + cy.contains('Names').click(); + cy.get('[aria-label="Full Name"]').should('be.visible').type('John Doe'); + cy.get('button').contains('Add').click(); + } + }) + }); + }); }); diff --git a/cypress/e2e/04_flag_for_enforcement_workflow.cy.js b/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js similarity index 94% rename from cypress/e2e/04_flag_for_enforcement_workflow.cy.js rename to cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js index 5969ef344..24cfa03e5 100644 --- a/cypress/e2e/04_flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js @@ -24,11 +24,14 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.get('.select2-search__field').type('Test Person'); cy.wait(400); cy.get('.select2-results__options li').first().click(); - cy.get('[aria-label="Flagged Date"]').should('be.visible').click(); + cy.contains('Flagged by').siblings('.row').click(); + cy.get('.select2-search__field').type('John Doe'); + cy.wait(600); + cy.get('.select2-results__options li').first().click(); + cy.get('[aria-label="Flagged Date"]').scrollIntoView().should('be.visible').click(); cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); cy.contains('Select resources').siblings('.row').click(); - // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name - cy.get('.select2-results__options li').first().click(); + cy.get('.select2-results__options li').contains('TestAsset').click(); cy.contains('Save and Continue').click(); // Enforcement Summary tab @@ -38,8 +41,8 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Description:').siblings().should('have.text', 'test reason for enforcement'); // Only checks if the date we selected is present as the year and month could change cy.contains('Flagged Date Value:').siblings().should('contain', '17'); - cy.contains('Actor:').siblings().should('have.text', 'Test Person'); - cy.contains('Associated Resources:').siblings().should('have.text', 'Undefined'); + cy.contains('Actor:').siblings().should('have.text', 'John Doe, Test Person'); + cy.contains('Associated Resources:').siblings().should('have.text', 'None TestAsset'); cy.wait(900); cy.contains('Save and Complete Workflow').click(); }); @@ -178,14 +181,14 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Select resources').scrollIntoView(); cy.wait(1000); cy.contains('Select resources').siblings('.row').click(); + cy.get('.select2-results__options li').contains('TestAsset').click(); // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name - cy.get('.select2-results__options li').first().click(); cy.contains('Save and Continue').click(); // Enforcement Summary tab cy.contains('ResourceID:').siblings().should('not.have.text'); cy.contains('ResourceID:').siblings().should('not.have.text', ''); - cy.contains('Associated Resources:').siblings().should('have.text', 'Undefined'); + cy.contains('Associated Resources:').siblings().should('have.text', 'None TestAsset'); cy.contains('Save and Complete Workflow').click(); }); }); diff --git a/cypress/e2e/02_create_a_heritage_asset.cy.js b/cypress/e2e/02_create_a_heritage_asset.cy.js index 424bcd8c5..144a02471 100644 --- a/cypress/e2e/02_create_a_heritage_asset.cy.js +++ b/cypress/e2e/02_create_a_heritage_asset.cy.js @@ -1,7 +1,7 @@ -describe('Creating a Heritage Asset if none exist', function () { +describe('Creating a Heritage Asset named TestAsset if it doesnt exist', function () { beforeEach(() => { cy.login(); - cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&resource-type-filter=%5B%7B%22graphid%22%3A%22076f9381-7b00-11e9-8d6b-80000b44d1d9%22%2C%22name%22%3A%22Heritage%20Asset%22%2C%22inverted%22%3Afalse%7D%5D'); + cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=336&term-filter=%5B%7B%22inverted%22%3Afalse%2C%22type%22%3A%22string%22%2C%22context%22%3A%22%22%2C%22context_label%22%3A%22%22%2C%22id%22%3A%22TestAsset%22%2C%22text%22%3A%22TestAsset%22%2C%22value%22%3A%22TestAsset%22%2C%22selected%22%3Atrue%7D%5D&language=*'); }); it('Create a heritage asset', function () { @@ -10,6 +10,8 @@ describe('Creating a Heritage Asset if none exist', function () { if (!$el.find('.search-listing').length > 0) { // If no Heritage Assets exist create an empty heritage asset cy.visit('http://localhost:8000/add-resource/076f9381-7b00-11e9-8d6b-80000b44d1d9') + cy.contains('Heritage Asset Names').click(); + cy.get('[aria-label="Name"]').should('be.visible').type('TestAsset'); cy.get('button').contains('Add').click(); }; }) From d1f58608dca62ca502e1a13d678eea0d1e775307 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Tue, 20 Aug 2024 14:03:54 +0300 Subject: [PATCH 39/69] test: tests with multiple people as well as organisation --- .../flag_for_enforcement_workflow.cy.js | 63 +++++++++++++++++-- 1 file changed, 58 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js b/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js index 24cfa03e5..b914626cb 100644 --- a/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js @@ -20,9 +20,8 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); cy.type_ckeditor('editor2', 'test reason for enforcement'); cy.contains('Flagged by').siblings('.row').click(); - // TODO test with organisation as well as with multiple people/orgs cy.get('.select2-search__field').type('Test Person'); - cy.wait(400); + cy.wait(500); cy.get('.select2-results__options li').first().click(); cy.contains('Flagged by').siblings('.row').click(); cy.get('.select2-search__field').type('John Doe'); @@ -128,20 +127,74 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Enforcement Details Tab cy.wait(900); cy.contains('Flagged by').siblings('.row').click(); - // TODO test with organisation as well cy.get('.select2-search__field').type('Test Person'); - cy.wait(400); + cy.wait(500); cy.get('.select2-results__options li').first().click(); cy.contains('Save and Continue').click(); // Enforcement Summary tab cy.contains('ResourceID:').siblings().should('not.have.text'); cy.contains('ResourceID:').siblings().should('not.have.text', ''); - // TODO test with multiple people cy.contains('Actor:').siblings().should('have.text', 'Test Person'); cy.contains('Save and Complete Workflow').click(); }); + it('Workflow with only Flagged By using Organisation', function () { + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.contains('Save and Continue').click(); + + // Enforcement Details Tab + cy.wait(900); + cy.contains('Flagged by').siblings('.row').click(); + cy.get('.select2-search__field').type('Test Organisation'); + cy.wait(500); + cy.get('.select2-results__options li').first().click(); + cy.contains('Save and Continue').click(); + + // Enforcement Summary tab + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().should('not.have.text', ''); + cy.contains('Actor:').siblings().should('have.text', 'Test Organisation'); + cy.contains('Save and Complete Workflow').click(); + }); + + it('Workflow with only Flagged By using both an Organisation and a Person', function () { + cy.contains('Workflows'); + cy.contains('Flag for Enforcement').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.contains('Save and Continue').click(); + + // Enforcement Details Tab + cy.wait(900); + cy.contains('Flagged by').siblings('.row').click(); + cy.get('.select2-search__field').type('Test Organisation'); + cy.wait(500); + cy.get('.select2-results__options li').first().click(); + cy.wait(500); + cy.contains('Flagged by').siblings('.row').click(); + cy.get('.select2-search__field').type('Test Person'); + cy.wait(500); + cy.get('.select2-results__options li').first().click(); + cy.contains('Save and Continue').click(); + + // Enforcement Summary tab + cy.contains('ResourceID:').siblings().should('not.have.text'); + cy.contains('ResourceID:').siblings().should('not.have.text', ''); + cy.contains('Actor:').siblings().should('have.text', 'Test Person, Test Organisation'); + cy.contains('Save and Complete Workflow').click(); + }); + + it('Workflow with only Flagged Date', function () { cy.contains('Workflows'); cy.contains('Flag for Enforcement').click(); From c2ed701ceae4e5d200c9b0e08c2e43d944d67a9a Mon Sep 17 00:00:00 2001 From: Andrea K Date: Tue, 20 Aug 2024 17:53:26 +0300 Subject: [PATCH 40/69] test: enables cypress studio --- cypress.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress.config.js b/cypress.config.js index d0dedb14b..9b7d1cbf3 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -4,5 +4,6 @@ module.exports = { e2e: { setupNodeEvents(on, config) {}, specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}', + experimentalStudio: true, }, } From 9d6c2e3ec09f811d386a79389fc83802c3cfab82 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Tue, 20 Aug 2024 17:54:06 +0300 Subject: [PATCH 41/69] test: complete the first tab of the archiving workflow --- .../archive_cataloguing_workflow.cy.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js diff --git a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js new file mode 100644 index 000000000..aa0b7a3f2 --- /dev/null +++ b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js @@ -0,0 +1,35 @@ +describe('Going through the Archive Cataloguing Workflow', function () { + + beforeEach(() => { + cy.login(); + cy.visit('http://localhost:8000/plugins/init-workflow'); + }); + + it('Go through the workflow and populate all fields', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(900); + cy.get('input[aria-label="Archive Source Name"]').should('be.visible').type('Test Source Name'); + cy.get('[aria-label="Subtitle"]').should('be.visible').type('Test Subtitle'); + cy.get('[aria-label="File ID (key)"]').should('be.visible').type('TestId'); + cy.get('span').contains('Archive Source Type').should('be.visible').siblings('.archive_source_type').click(); + cy.wait(500); + cy.get('.select2-results__options li').first().click(); + cy.get('span').contains('File Status').siblings('.col-xs-12').click(); + cy.wait(500); + cy.get('.select2-results__options li').first().click(); + cy.type_ckeditor('editor1', 'test description'); + cy.wait(500); + cy.contains('Save and Continue').click(); + }); + +}); From fd6a980699b0119d7c31d6af79286a8003bca79f Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 21 Aug 2024 15:01:35 +0300 Subject: [PATCH 42/69] test: full workflow test --- .../archive_cataloguing_workflow.cy.js | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js index aa0b7a3f2..781ce2a0b 100644 --- a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js +++ b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js @@ -5,7 +5,7 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.visit('http://localhost:8000/plugins/init-workflow'); }); - it('Go through the workflow and populate all fields', function () { + it('Start new and go through the workflow and populate all fields', function () { cy.contains('Workflows'); cy.contains('Archive Cataloguing').click(); cy.contains('Start New').click(); @@ -30,6 +30,42 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.type_ckeditor('editor1', 'test description'); cy.wait(500); cy.contains('Save and Continue').click(); + + // Archive Source Creation + cy.wait(500); + cy.get('input[aria-label="Author Name"]').should('be.visible').type('Test Author Name'); + cy.get('input[aria-label="Editor Name"]').should('be.visible').type('Test Editor Name'); + cy.get('input[aria-label="Start Date"]').should('be.visible').type('2021-04-12'); + cy.get('input[aria-label="End Date"]').should('be.visible').type('2021-05-12'); + cy.type_ckeditor('editor3', 'test statement of responsibility'); + cy.wait(500); + cy.contains('Save and Continue').click(); + + // Repository Storage Location + cy.wait(1000); + cy.get('span').contains('Responsible Team').should('be.visible').siblings('.row').click(); + cy.get('.select2-search__field').type('Test Person'); + cy.wait(500); + cy.get('.select2-results__options li').first().click(); + cy.get('span').contains('Storage Building Name').should('be.visible').siblings('.col-xs-12').click(); + cy.get('.select2-results__options li').first().click(); + cy.get('input[aria-label="Storage Room Name"]').should('be.visible').type('Test Storage Room Name'); + cy.get('input[aria-label="Storage Shelf Name"]').should('be.visible').type('Test Storage Shelf Name'); + cy.get('input[aria-label="Storage Box Name"]').should('be.visible').type('Test Storage Box Name'); + cy.contains('Save and Continue').click(); + + // Archive Loan History + cy.wait(500); + cy.get('span').contains('Person or Organization').should('be.visible').siblings('.row').click(); + cy.get('.select2-search__field').type('Test Person'); + cy.wait(500); + cy.get('.select2-results__options li').first().click(); + cy.get('[aria-label="Start Date"]').scrollIntoView().should('be.visible').click(); + cy.get('[aria-label="Start Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); + cy.get('[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); + cy.contains('Save and Complete Workflow').click(); }); }); From 1a2b7551adeea860d662fa80fd1662d37ea81c4b Mon Sep 17 00:00:00 2001 From: Taylor North <135817240+taylorn01@users.noreply.github.com> Date: Thu, 29 Aug 2024 10:16:36 +0100 Subject: [PATCH 43/69] ci: restore tests running in the ci --- .github/workflows/project.yml | 208 +++++++++++++++++----------------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index 125357184..7dbb05e65 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -268,109 +268,109 @@ jobs: run: | name=${{ fromJSON(steps.buildx.outputs.metadata)['image.name'] }} echo "image_name=$name" | sed 's/,.*//g' >> $GITHUB_OUTPUT - # Test-Arches: - # runs-on: [self-hosted] - # needs: [Build-Arches-Final] - # container: - # image: cypress/included:12.3.0 - # env: - # HOME: "" - # DEBUG: "cypress:*" - # CYPRESS_BASE_URL: http://arches:8000 - # steps: - # - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - # - name: Check out repository code - # uses: actions/checkout@v3 - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - # submodules: 'true' - # - name: Cypress run - # uses: cypress-io/github-action@v4 - # with: - # browser: firefox - # install: false - # wait-on: 'http://arches:8000' - # wait-on-timeout: 6000 - # - uses: actions/upload-artifact@v3 - # if: failure() - # with: - # name: cypress-screenshots - # path: cypress/screenshots - # - uses: actions/upload-artifact@v3 - # if: always() - # with: - # name: cypress-videos - # path: cypress/videos - # services: - # elasticsearch: - # image: elasticsearch:8.4.0 - # ports: - # - "9200:9200" - # - "9300:9300" - # env: - # TZ: "PST" - # discovery.type: "single-node" - # discovery.seed_hosts: "[]" - # xpack.security.enabled: "false" - # ES_JAVA_OPTS: "-Xms400m -Xmx400m" - # options: >- - # --health-cmd "curl -s --fail http://localhost:9200/_cat/health || exit 1" - # --health-interval 10s - # --health-timeout 5s - # --health-retries 10 + Test-Arches: + runs-on: [self-hosted] + needs: [Build-Arches-Final] + container: + image: cypress/included:12.3.0 + env: + HOME: "" + DEBUG: "cypress:*" + CYPRESS_BASE_URL: http://arches:8000 + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - name: Check out repository code + uses: actions/checkout@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + submodules: 'true' + - name: Cypress run + uses: cypress-io/github-action@v4 + with: + browser: firefox + install: false + wait-on: 'http://arches:8000' + wait-on-timeout: 6000 + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: cypress-screenshots + path: cypress/screenshots + - uses: actions/upload-artifact@v3 + if: always() + with: + name: cypress-videos + path: cypress/videos + services: + elasticsearch: + image: elasticsearch:8.4.0 + ports: + - "9200:9200" + - "9300:9300" + env: + TZ: "PST" + discovery.type: "single-node" + discovery.seed_hosts: "[]" + xpack.security.enabled: "false" + ES_JAVA_OPTS: "-Xms400m -Xmx400m" + options: >- + --health-cmd "curl -s --fail http://localhost:9200/_cat/health || exit 1" + --health-interval 10s + --health-timeout 5s + --health-retries 10 - # db: - # image: flaxandteal/arches_coral_postgres - # #volumes: - # # - ${{ github.workspace }}/scripts/init-unix.sql:/docker-entrypoint-initdb.d/init.sql # to set up the DB template - # ports: - # - '5432:5432' - # env: - # POSTGRES_USER: postgres - # POSTGRES_PASS: postgres - # POSTGRES_DB: postgres - # POSTGRES_MULTIPLE_EXTENSIONS: postgis,postgis_topology - # TZ: PST - # options: >- - # --health-cmd "pg_isready -h 127.0.0.1 -U postgres -d postgres" - # --health-interval 10s - # --health-timeout 5s - # --health-retries 20 + db: + image: flaxandteal/arches_coral_postgres + #volumes: + # - ${{ github.workspace }}/scripts/init-unix.sql:/docker-entrypoint-initdb.d/init.sql # to set up the DB template + ports: + - '5432:5432' + env: + POSTGRES_USER: postgres + POSTGRES_PASS: postgres + POSTGRES_DB: postgres + POSTGRES_MULTIPLE_EXTENSIONS: postgis,postgis_topology + TZ: PST + options: >- + --health-cmd "pg_isready -h 127.0.0.1 -U postgres -d postgres" + --health-interval 10s + --health-timeout 5s + --health-retries 20 - # arches: - # image: "${{ needs['Build-Arches-Final'].outputs.image }}" - # env: - # ALLOW_BOOTSTRAP: "True" - # ARCHES_PROJECT: "${{ env.ARCHES_PROJECT }}" - # COMPRESS_OFFLINE: "False" - # INSTALL_CORAL_PACKAGE: "True" - # INSTALL_DEFAULT_GRAPHS: "False" - # INSTALL_DEFAULT_CONCEPTS: "False" - # PGUSERNAME: "postgres" - # PGPASSWORD: "postgres" - # PGDBNAME: "arches" - # PGHOST: "db" - # PGPORT: "5432" - # RABBITMQ_USER: "rabbitmq" - # RABBITMQ_PASS: "rabbitmq" - # CANTALOUPE_HOST: "cantaloupe" - # CANTALOUPE_PORT: "8182" - # COUCHDB_HOST: "couchdb" - # COUCHDB_PORT: "5984" - # COUCHDB_USER: "admin" - # COUCHDB_PASS: "password" - # ESHOST: "elasticsearch" - # ESPORT: "9200" - # CELERY_BROKER_URL: "amqp://rabbitmq" - # DJANGO_MODE: "PROD" - # DJANGO_DEBUG: "False" - # DOMAIN_NAMES: "arches" - # PYTHONUNBUFFERED: "0" - # TZ: "PST" - # ports: - # - '8000:8000' - # options: >- - # --health-cmd "curl --fail http://localhost:8000/templates/views/components/language-switcher.htm || exit 1" - # --health-interval 10s - # --health-timeout 5s - # --health-retries 1000 + arches: + image: "${{ needs['Build-Arches-Final'].outputs.image }}" + env: + ALLOW_BOOTSTRAP: "True" + ARCHES_PROJECT: "${{ env.ARCHES_PROJECT }}" + COMPRESS_OFFLINE: "False" + INSTALL_CORAL_PACKAGE: "True" + INSTALL_DEFAULT_GRAPHS: "False" + INSTALL_DEFAULT_CONCEPTS: "False" + PGUSERNAME: "postgres" + PGPASSWORD: "postgres" + PGDBNAME: "arches" + PGHOST: "db" + PGPORT: "5432" + RABBITMQ_USER: "rabbitmq" + RABBITMQ_PASS: "rabbitmq" + CANTALOUPE_HOST: "cantaloupe" + CANTALOUPE_PORT: "8182" + COUCHDB_HOST: "couchdb" + COUCHDB_PORT: "5984" + COUCHDB_USER: "admin" + COUCHDB_PASS: "password" + ESHOST: "elasticsearch" + ESPORT: "9200" + CELERY_BROKER_URL: "amqp://rabbitmq" + DJANGO_MODE: "PROD" + DJANGO_DEBUG: "False" + DOMAIN_NAMES: "arches" + PYTHONUNBUFFERED: "0" + TZ: "PST" + ports: + - '8000:8000' + options: >- + --health-cmd "curl --fail http://localhost:8000/templates/views/components/language-switcher.htm || exit 1" + --health-interval 10s + --health-timeout 5s + --health-retries 1000 From ee589a528d756ffd6f1eeb25da72dbf577fd18d7 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Fri, 30 Aug 2024 15:01:17 +0300 Subject: [PATCH 44/69] fix: uses baseUrl to fix the run in CI --- cypress.config.js | 3 ++- cypress/e2e/01_create_a_person.cy.js | 12 ++++++------ .../flag_for_enforcement_workflow.cy.js | 4 ++-- cypress/e2e/02_create_a_heritage_asset.cy.js | 4 ++-- cypress/e2e/03_create_an_organisation.cy.js | 6 +++--- cypress/support/commands.js | 3 +-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cypress.config.js b/cypress.config.js index d0dedb14b..56db1663b 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -2,7 +2,8 @@ module.exports = { projectId: 'arches', video: true, e2e: { + baseUrl: "http://localhost:8000", setupNodeEvents(on, config) {}, specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}', - }, + } } diff --git a/cypress/e2e/01_create_a_person.cy.js b/cypress/e2e/01_create_a_person.cy.js index df7e01bca..8d7eb2203 100644 --- a/cypress/e2e/01_create_a_person.cy.js +++ b/cypress/e2e/01_create_a_person.cy.js @@ -4,19 +4,19 @@ describe('Creating a person named Test Person and a person named John Doe if the }); it('Create a person', function () { - cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=125&language=*&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Person%20-%20Name%22%2C%22id%22%3A%22termTest%20PersonPerson%20-%20Name%22%2C%22text%22%3A%22Test%20Person%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22Test%20Person%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D'); + cy.visit('/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=125&language=*&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Person%20-%20Name%22%2C%22id%22%3A%22termTest%20PersonPerson%20-%20Name%22%2C%22text%22%3A%22Test%20Person%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22Test%20Person%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D'); cy.wait(5000).then(() => { cy.get('#search-results-list').then(($el) => { if ($el.find('.search-listing').length > 0) { // A caveat to this is that it will only look at the first page (which shouldn't be a problem with a fresh instance) since the search was failing locally to find Test Person (probably a permissions issue as all objects were created as Provisional) if (!$el.text().includes('Test Person')) { - cy.visit('http://localhost:8000/add-resource/22477f01-1a44-11e9-b0a9-000d3ab1e588') + cy.visit('/add-resource/22477f01-1a44-11e9-b0a9-000d3ab1e588') cy.contains('Names').click(); cy.get('[aria-label="Full Name"]').should('be.visible').type('Test Person'); cy.get('button').contains('Add').click(); } } else { - cy.visit('http://localhost:8000/add-resource/22477f01-1a44-11e9-b0a9-000d3ab1e588') + cy.visit('/add-resource/22477f01-1a44-11e9-b0a9-000d3ab1e588') cy.contains('Names').click(); cy.get('[aria-label="Full Name"]').should('be.visible').type('Test Person'); cy.get('button').contains('Add').click(); @@ -26,19 +26,19 @@ describe('Creating a person named Test Person and a person named John Doe if the }); it('Create a second person', function () { - cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=329&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Person%20-%20Name%22%2C%22id%22%3A%22termJohn%20DoePerson%20-%20Name%22%2C%22text%22%3A%22John%20Doe%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22John%20Doe%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D&language=*'); + cy.visit('/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=329&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Person%20-%20Name%22%2C%22id%22%3A%22termJohn%20DoePerson%20-%20Name%22%2C%22text%22%3A%22John%20Doe%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22John%20Doe%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D&language=*'); cy.wait(5000).then(() => { cy.get('#search-results-list').then(($el) => { if ($el.find('.search-listing').length > 0) { // A caveat to this is that it will only look at the first page (which shouldn't be a problem with a fresh instance) since the search was failing locally to find John Doe (probably a permissions issue as all objects were created as Provisional) if (!$el.text().includes('John Doe')) { - cy.visit('http://localhost:8000/add-resource/22477f01-1a44-11e9-b0a9-000d3ab1e588') + cy.visit('/add-resource/22477f01-1a44-11e9-b0a9-000d3ab1e588') cy.contains('Names').click(); cy.get('[aria-label="Full Name"]').should('be.visible').type('John Doe'); cy.get('button').contains('Add').click(); } } else { - cy.visit('http://localhost:8000/add-resource/22477f01-1a44-11e9-b0a9-000d3ab1e588') + cy.visit('/add-resource/22477f01-1a44-11e9-b0a9-000d3ab1e588') cy.contains('Names').click(); cy.get('[aria-label="Full Name"]').should('be.visible').type('John Doe'); cy.get('button').contains('Add').click(); diff --git a/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js b/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js index b914626cb..ad4e45f64 100644 --- a/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js @@ -2,7 +2,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { beforeEach(() => { cy.login(); - cy.visit('http://localhost:8000/plugins/init-workflow'); + cy.visit('/plugins/init-workflow'); }); it('Go through the workflow and populate all fields', function () { @@ -67,7 +67,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Complete Workflow').click(); console.log(this.enforcementId); - cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true'); + cy.visit('/search?paging-filter=1&tiles=true'); }); it('Workflow with only Case Reference', function () { diff --git a/cypress/e2e/02_create_a_heritage_asset.cy.js b/cypress/e2e/02_create_a_heritage_asset.cy.js index 144a02471..46f81beb1 100644 --- a/cypress/e2e/02_create_a_heritage_asset.cy.js +++ b/cypress/e2e/02_create_a_heritage_asset.cy.js @@ -1,7 +1,7 @@ describe('Creating a Heritage Asset named TestAsset if it doesnt exist', function () { beforeEach(() => { cy.login(); - cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=336&term-filter=%5B%7B%22inverted%22%3Afalse%2C%22type%22%3A%22string%22%2C%22context%22%3A%22%22%2C%22context_label%22%3A%22%22%2C%22id%22%3A%22TestAsset%22%2C%22text%22%3A%22TestAsset%22%2C%22value%22%3A%22TestAsset%22%2C%22selected%22%3Atrue%7D%5D&language=*'); + cy.visit('/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=336&term-filter=%5B%7B%22inverted%22%3Afalse%2C%22type%22%3A%22string%22%2C%22context%22%3A%22%22%2C%22context_label%22%3A%22%22%2C%22id%22%3A%22TestAsset%22%2C%22text%22%3A%22TestAsset%22%2C%22value%22%3A%22TestAsset%22%2C%22selected%22%3Atrue%7D%5D&language=*'); }); it('Create a heritage asset', function () { @@ -9,7 +9,7 @@ describe('Creating a Heritage Asset named TestAsset if it doesnt exist', functio cy.get('#search-results-list').then(($el) => { if (!$el.find('.search-listing').length > 0) { // If no Heritage Assets exist create an empty heritage asset - cy.visit('http://localhost:8000/add-resource/076f9381-7b00-11e9-8d6b-80000b44d1d9') + cy.visit('/add-resource/076f9381-7b00-11e9-8d6b-80000b44d1d9') cy.contains('Heritage Asset Names').click(); cy.get('[aria-label="Name"]').should('be.visible').type('TestAsset'); cy.get('button').contains('Add').click(); diff --git a/cypress/e2e/03_create_an_organisation.cy.js b/cypress/e2e/03_create_an_organisation.cy.js index bcc11fe37..c3bff4666 100644 --- a/cypress/e2e/03_create_an_organisation.cy.js +++ b/cypress/e2e/03_create_an_organisation.cy.js @@ -1,7 +1,7 @@ describe('Creating a organisation named Test Organisation if one doesnt exist', function () { beforeEach(() => { cy.login(); - cy.visit('http://localhost:8000/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=125&language=*&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Organization%20-%20Names%22%2C%22id%22%3A%22termTest%20OrganisationOrganization%20-%20Names%22%2C%22text%22%3A%22Test%20Organisation%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22Test%20Organisation%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D'); + cy.visit('/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=125&language=*&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Organization%20-%20Names%22%2C%22id%22%3A%22termTest%20OrganisationOrganization%20-%20Names%22%2C%22text%22%3A%22Test%20Organisation%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22Test%20Organisation%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D'); }); it('Create an organisation', function () { @@ -10,13 +10,13 @@ describe('Creating a organisation named Test Organisation if one doesnt exist', if ($el.find('.search-listing').length > 0) { // A caveat to this is that it will only look at the first page (which shouldn't be a problem with a fresh instance) since the search was failing locally to find Test Organisation (probably a permissions issue as all objects were created as Provisional) if (!$el.text().includes('Test Organisation')) { - cy.visit('http://localhost:8000/add-resource/d4a88461-5463-11e9-90d9-000d3ab1e588') + cy.visit('/add-resource/d4a88461-5463-11e9-90d9-000d3ab1e588') cy.contains('Names').click(); cy.get('[aria-label="Organization Name"]').should('be.visible').type('Test Organisation'); cy.get('button').contains('Add').click(); } } else { - cy.visit('http://localhost:8000/add-resource/d4a88461-5463-11e9-90d9-000d3ab1e588') + cy.visit('/add-resource/d4a88461-5463-11e9-90d9-000d3ab1e588') cy.contains('Names').click(); cy.get('[aria-label="Organization Name"]').should('be.visible').type('Test Organisation'); cy.get('button').contains('Add').click(); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 3214d2f20..47edd09c8 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -17,8 +17,7 @@ // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) Cypress.Commands.add("login", () => { - cy.visit('localhost:8000/auth/'); - + cy.visit('/auth/'); cy.get('.input-group > .floating-label-group > input[name="username"].form-control').type(`admin{enter}`); cy.get('.input-group > .floating-label-group > input[name="password"].form-control').type(`admin{enter}`); }); From 03696104eab6199e58828f4e867cee5319cd7f02 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Tue, 3 Sep 2024 14:14:55 +0300 Subject: [PATCH 45/69] fix: create heritage asset from workflow instead --- .../flag_for_enforcement_workflow.cy.js | 8 ++++---- cypress/e2e/02_create_a_heritage_asset.cy.js | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js b/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js index ad4e45f64..94ee4256d 100644 --- a/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js @@ -30,7 +30,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.get('[aria-label="Flagged Date"]').scrollIntoView().should('be.visible').click(); cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); cy.contains('Select resources').siblings('.row').click(); - cy.get('.select2-results__options li').contains('TestAsset').click(); + cy.get('.select2-results__options li').contains('HA/01').click(); cy.contains('Save and Continue').click(); // Enforcement Summary tab @@ -41,7 +41,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Only checks if the date we selected is present as the year and month could change cy.contains('Flagged Date Value:').siblings().should('contain', '17'); cy.contains('Actor:').siblings().should('have.text', 'John Doe, Test Person'); - cy.contains('Associated Resources:').siblings().should('have.text', 'None TestAsset'); + cy.contains('Associated Resources:').siblings().should('have.text', 'HA/01'); cy.wait(900); cy.contains('Save and Complete Workflow').click(); }); @@ -234,14 +234,14 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Select resources').scrollIntoView(); cy.wait(1000); cy.contains('Select resources').siblings('.row').click(); - cy.get('.select2-results__options li').contains('TestAsset').click(); + cy.get('.select2-results__options li').contains('HA/01').click(); // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name cy.contains('Save and Continue').click(); // Enforcement Summary tab cy.contains('ResourceID:').siblings().should('not.have.text'); cy.contains('ResourceID:').siblings().should('not.have.text', ''); - cy.contains('Associated Resources:').siblings().should('have.text', 'None TestAsset'); + cy.contains('Associated Resources:').siblings().should('have.text', 'HA/01'); cy.contains('Save and Complete Workflow').click(); }); }); diff --git a/cypress/e2e/02_create_a_heritage_asset.cy.js b/cypress/e2e/02_create_a_heritage_asset.cy.js index 46f81beb1..ad5f3d4cb 100644 --- a/cypress/e2e/02_create_a_heritage_asset.cy.js +++ b/cypress/e2e/02_create_a_heritage_asset.cy.js @@ -1,18 +1,19 @@ -describe('Creating a Heritage Asset named TestAsset if it doesnt exist', function () { +describe('Creating a Heritage Asset named HA/01 if it doesnt exist', function () { beforeEach(() => { cy.login(); - cy.visit('/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=336&term-filter=%5B%7B%22inverted%22%3Afalse%2C%22type%22%3A%22string%22%2C%22context%22%3A%22%22%2C%22context_label%22%3A%22%22%2C%22id%22%3A%22TestAsset%22%2C%22text%22%3A%22TestAsset%22%2C%22value%22%3A%22TestAsset%22%2C%22selected%22%3Atrue%7D%5D&language=*'); + cy.visit('/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=473&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Heritage%20Asset%20-%20Display%20Name%22%2C%22id%22%3A%22termHA%2F01Heritage%20Asset%20-%20Display%20Name%22%2C%22text%22%3A%22HA%2F01%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22HA%2F01%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D&language=*'); }); it('Create a heritage asset', function () { cy.wait(5000).then(() => { cy.get('#search-results-list').then(($el) => { if (!$el.find('.search-listing').length > 0) { - // If no Heritage Assets exist create an empty heritage asset - cy.visit('/add-resource/076f9381-7b00-11e9-8d6b-80000b44d1d9') - cy.contains('Heritage Asset Names').click(); - cy.get('[aria-label="Name"]').should('be.visible').type('TestAsset'); - cy.get('button').contains('Add').click(); + cy.contains('Workflows').click(); + cy.contains('Add Monument').click(); + cy.contains('Start New').click(); + cy.contains('Save and Continue').click(); + cy.wait(1000); + cy.contains('Save and Complete Workflow').click(); }; }) }); From fdbe73792db50e4e5134603e366a06e18342e13b Mon Sep 17 00:00:00 2001 From: Andrea K Date: Tue, 3 Sep 2024 16:14:26 +0300 Subject: [PATCH 46/69] fix: add static url and static root --- .github/workflows/project.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index 7dbb05e65..0f4398ac2 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -366,6 +366,9 @@ jobs: DJANGO_DEBUG: "False" DOMAIN_NAMES: "arches" PYTHONUNBUFFERED: "0" + STATIC_URL: "/static/" + STATIC_ROOT: "/static_root" + WEB_ROOT: "/web_root" TZ: "PST" ports: - '8000:8000' From 1a79d26b6198cece2fb061c83ef25adc4b988923 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 4 Sep 2024 11:33:18 +0300 Subject: [PATCH 47/69] fix: add arches root param --- .github/workflows/project.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index 0f4398ac2..d04a94fd5 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -369,6 +369,7 @@ jobs: STATIC_URL: "/static/" STATIC_ROOT: "/static_root" WEB_ROOT: "/web_root" + ARCHES_ROOT: "/web_root/arches" TZ: "PST" ports: - '8000:8000' From d2ee9ce36198616acc20cf84dd1cd2262bb0cb61 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 4 Sep 2024 13:34:33 +0300 Subject: [PATCH 48/69] fix: update cypress action version --- .github/workflows/project.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index d04a94fd5..3a2e6b2c7 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -285,7 +285,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} submodules: 'true' - name: Cypress run - uses: cypress-io/github-action@v4 + uses: cypress-io/github-action@v6 with: browser: firefox install: false From 59eeab718bfe29b18bdf2eba2c84a35066c6d074 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 5 Sep 2024 10:25:36 +0300 Subject: [PATCH 49/69] fix: try disabling coral package install --- .github/workflows/project.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index 3a2e6b2c7..9b1fcc4fe 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -343,7 +343,7 @@ jobs: ALLOW_BOOTSTRAP: "True" ARCHES_PROJECT: "${{ env.ARCHES_PROJECT }}" COMPRESS_OFFLINE: "False" - INSTALL_CORAL_PACKAGE: "True" + INSTALL_CORAL_PACKAGE: "False" INSTALL_DEFAULT_GRAPHS: "False" INSTALL_DEFAULT_CONCEPTS: "False" PGUSERNAME: "postgres" From 5d4b5f782b8b317f6905836608bd8d1e1562e632 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Mon, 9 Sep 2024 11:33:32 +0300 Subject: [PATCH 50/69] fix: add steps from static build --- .github/workflows/project.yml | 52 +++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index 9b1fcc4fe..88b5d192b 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -284,6 +284,49 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} submodules: 'true' + - name: Log in to Github + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Docker Context for Buildx + id: buildx-context + run: | + docker context create builders + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + version: latest + endpoint: builders + buildkitd-flags: '--allow-insecure-entitlement network.host' + driver-opts: | + network=host + - name: Build and push Docker image + run: docker run --rm --network host willwill/wait-for-it -h localhost -p 8000 -t 0 + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ghcr.io/flaxandteal/arches_${{ env.ARCHES_PROJECT }}_static + - name: Build and push Docker image + id: buildx + uses: docker/build-push-action@v2 + with: + context: . + push: true + file: docker/Dockerfile.static + network: host + allow: network.host + tags: ${{ steps.meta.outputs.tags }}-${{ github.run_id }},${{ steps.meta.outputs.tags }}-commit-${{ github.sha }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + ARCHES_DYNAMIC_IMAGE=${{ needs['Build-Arches-Final'].outputs.image }} + ARCHES_ENVIRONMENT=development + ARCHES_BASE=${{ env.ARCHES_BASE }} + ARCHES_PROJECT=${{ env.ARCHES_PROJECT }} + ARCHES_NAMESPACE_FOR_DATA_EXPORT=http://arches:8000/ + PUBLIC_SERVER_ADDRESS=http://arches:8000/ - name: Cypress run uses: cypress-io/github-action@v6 with: @@ -318,7 +361,6 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 10 - db: image: flaxandteal/arches_coral_postgres #volumes: @@ -338,12 +380,13 @@ jobs: --health-retries 20 arches: - image: "${{ needs['Build-Arches-Final'].outputs.image }}" + image: "${{ needs['Build-Arches-final'].outputs.image }}" env: ALLOW_BOOTSTRAP: "True" ARCHES_PROJECT: "${{ env.ARCHES_PROJECT }}" + ARCHES_ROOT: "/web_root/arches" COMPRESS_OFFLINE: "False" - INSTALL_CORAL_PACKAGE: "False" + COMPRESS_ENABLED: "False" INSTALL_DEFAULT_GRAPHS: "False" INSTALL_DEFAULT_CONCEPTS: "False" PGUSERNAME: "postgres" @@ -369,7 +412,6 @@ jobs: STATIC_URL: "/static/" STATIC_ROOT: "/static_root" WEB_ROOT: "/web_root" - ARCHES_ROOT: "/web_root/arches" TZ: "PST" ports: - '8000:8000' @@ -377,4 +419,4 @@ jobs: --health-cmd "curl --fail http://localhost:8000/templates/views/components/language-switcher.htm || exit 1" --health-interval 10s --health-timeout 5s - --health-retries 1000 + --health-retries 1000 \ No newline at end of file From cac114a1331cf4a95e997e5ea072811e097aefd2 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 12 Sep 2024 12:53:24 +0300 Subject: [PATCH 51/69] fix: try with only build and push --- .github/workflows/project.yml | 50 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index 88b5d192b..b8ac12cc2 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -279,31 +279,31 @@ jobs: CYPRESS_BASE_URL: http://arches:8000 steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - name: Check out repository code - uses: actions/checkout@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - submodules: 'true' - - name: Log in to Github - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Set up Docker Context for Buildx - id: buildx-context - run: | - docker context create builders - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - version: latest - endpoint: builders - buildkitd-flags: '--allow-insecure-entitlement network.host' - driver-opts: | - network=host - - name: Build and push Docker image - run: docker run --rm --network host willwill/wait-for-it -h localhost -p 8000 -t 0 + # - name: Check out repository code + # uses: actions/checkout@v3 + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # submodules: 'true' + # - name: Log in to Github + # uses: docker/login-action@v2 + # with: + # registry: ghcr.io + # username: ${{ github.actor }} + # password: ${{ secrets.GITHUB_TOKEN }} + # - name: Set up Docker Context for Buildx + # id: buildx-context + # run: | + # docker context create builders + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v2 + # with: + # version: latest + # endpoint: builders + # buildkitd-flags: '--allow-insecure-entitlement network.host' + # driver-opts: | + # network=host + # - name: Build and push Docker image + # run: docker run --rm --network host willwill/wait-for-it -h arches -p 8000 -t 0 - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 From d4f919a062f81e7bee99fb61b4c2b8c16f6a9743 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Tue, 17 Sep 2024 15:57:42 +0300 Subject: [PATCH 52/69] fix: remove build step --- .github/workflows/project.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index b8ac12cc2..d73cba653 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -309,24 +309,6 @@ jobs: uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: images: ghcr.io/flaxandteal/arches_${{ env.ARCHES_PROJECT }}_static - - name: Build and push Docker image - id: buildx - uses: docker/build-push-action@v2 - with: - context: . - push: true - file: docker/Dockerfile.static - network: host - allow: network.host - tags: ${{ steps.meta.outputs.tags }}-${{ github.run_id }},${{ steps.meta.outputs.tags }}-commit-${{ github.sha }} - labels: ${{ steps.meta.outputs.labels }} - build-args: | - ARCHES_DYNAMIC_IMAGE=${{ needs['Build-Arches-Final'].outputs.image }} - ARCHES_ENVIRONMENT=development - ARCHES_BASE=${{ env.ARCHES_BASE }} - ARCHES_PROJECT=${{ env.ARCHES_PROJECT }} - ARCHES_NAMESPACE_FOR_DATA_EXPORT=http://arches:8000/ - PUBLIC_SERVER_ADDRESS=http://arches:8000/ - name: Cypress run uses: cypress-io/github-action@v6 with: From 87cccae746ea78d912794cec23f7e8c143b4e6ee Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 18 Sep 2024 11:55:14 +0300 Subject: [PATCH 53/69] fix: comment out extract metadata step --- .github/workflows/project.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index d73cba653..90a91d61c 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -304,11 +304,11 @@ jobs: # network=host # - name: Build and push Docker image # run: docker run --rm --network host willwill/wait-for-it -h arches -p 8000 -t 0 - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ghcr.io/flaxandteal/arches_${{ env.ARCHES_PROJECT }}_static + # - name: Extract metadata (tags, labels) for Docker + # id: meta + # uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + # with: + # images: ghcr.io/flaxandteal/arches_${{ env.ARCHES_PROJECT }}_static - name: Cypress run uses: cypress-io/github-action@v6 with: From f2fa3be04ce60a158d0bf9373cc5e1305a1e8813 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 18 Sep 2024 13:18:01 +0300 Subject: [PATCH 54/69] fix: change the image name in case its case sensitive --- .github/workflows/project.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index 90a91d61c..a88cbb74b 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -362,7 +362,7 @@ jobs: --health-retries 20 arches: - image: "${{ needs['Build-Arches-final'].outputs.image }}" + image: "${{ needs['Build-Arches-Final'].outputs.image }}" env: ALLOW_BOOTSTRAP: "True" ARCHES_PROJECT: "${{ env.ARCHES_PROJECT }}" From 8d3cce1c8ad9281e4361876109b45f6d6aaedf03 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 18 Sep 2024 14:51:01 +0300 Subject: [PATCH 55/69] fix: revert back to previous commit --- .github/workflows/project.yml | 42 ++++++++--------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index a88cbb74b..9b1fcc4fe 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -279,36 +279,11 @@ jobs: CYPRESS_BASE_URL: http://arches:8000 steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - # - name: Check out repository code - # uses: actions/checkout@v3 - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - # submodules: 'true' - # - name: Log in to Github - # uses: docker/login-action@v2 - # with: - # registry: ghcr.io - # username: ${{ github.actor }} - # password: ${{ secrets.GITHUB_TOKEN }} - # - name: Set up Docker Context for Buildx - # id: buildx-context - # run: | - # docker context create builders - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v2 - # with: - # version: latest - # endpoint: builders - # buildkitd-flags: '--allow-insecure-entitlement network.host' - # driver-opts: | - # network=host - # - name: Build and push Docker image - # run: docker run --rm --network host willwill/wait-for-it -h arches -p 8000 -t 0 - # - name: Extract metadata (tags, labels) for Docker - # id: meta - # uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - # with: - # images: ghcr.io/flaxandteal/arches_${{ env.ARCHES_PROJECT }}_static + - name: Check out repository code + uses: actions/checkout@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + submodules: 'true' - name: Cypress run uses: cypress-io/github-action@v6 with: @@ -343,6 +318,7 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 10 + db: image: flaxandteal/arches_coral_postgres #volumes: @@ -366,9 +342,8 @@ jobs: env: ALLOW_BOOTSTRAP: "True" ARCHES_PROJECT: "${{ env.ARCHES_PROJECT }}" - ARCHES_ROOT: "/web_root/arches" COMPRESS_OFFLINE: "False" - COMPRESS_ENABLED: "False" + INSTALL_CORAL_PACKAGE: "False" INSTALL_DEFAULT_GRAPHS: "False" INSTALL_DEFAULT_CONCEPTS: "False" PGUSERNAME: "postgres" @@ -394,6 +369,7 @@ jobs: STATIC_URL: "/static/" STATIC_ROOT: "/static_root" WEB_ROOT: "/web_root" + ARCHES_ROOT: "/web_root/arches" TZ: "PST" ports: - '8000:8000' @@ -401,4 +377,4 @@ jobs: --health-cmd "curl --fail http://localhost:8000/templates/views/components/language-switcher.htm || exit 1" --health-interval 10s --health-timeout 5s - --health-retries 1000 \ No newline at end of file + --health-retries 1000 From 4ab881f7d989a887e9c82ea35a822e8401c62120 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 18 Sep 2024 16:36:53 +0300 Subject: [PATCH 56/69] tests: brings tests to match the latest test sheet description --- .../flag_for_enforcement_workflow.cy.js | 38 ++++++++++++++++++- cypress/e2e/02_create_a_heritage_asset.cy.js | 18 ++++++++- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js b/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js index 94ee4256d..b1590d5bd 100644 --- a/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js @@ -13,6 +13,8 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Makes sure the autogenerated id is not undefined cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value'); cy.contains('Enforcement ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + // The other 2 tabs should be disabled before we click Save and continue + cy.get('.workflow-nav-tab.disabled').should('have.length', 2); cy.contains('Save and Continue').click(); // Enforcement Details Tab @@ -23,14 +25,48 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.get('.select2-search__field').type('Test Person'); cy.wait(500); cy.get('.select2-results__options li').first().click(); + cy.get('[aria-label="Edit related resource Test Person"]').should('be.visible'); + cy.get('[aria-label="Delete relationship to Test Person"]').should('be.visible'); + cy.get('[aria-label="Expand resource report for Test Person"]').should('be.visible'); + cy.contains('Flagged by').siblings('.row').click(); cy.get('.select2-search__field').type('John Doe'); cy.wait(600); cy.get('.select2-results__options li').first().click(); + cy.get('[aria-label="Edit related resource John Doe"]').should('be.visible'); + cy.get('[aria-label="Delete relationship to John Doe"]').should('be.visible'); + cy.get('[aria-label="Expand resource report for John Doe"]').should('be.visible'); + + // Flagged date should be prepopulated + cy.get('[aria-label="Flagged Date"]').should('not.have.value'); + cy.get('[aria-label="Flagged Date"]').should('not.have.value', ''); cy.get('[aria-label="Flagged Date"]').scrollIntoView().should('be.visible').click(); cy.get('[aria-label="Flagged Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.get('[aria-label="Flagged Date"]').scrollIntoView().should('be.visible').click(); + cy.get('body').click(); + // Value should remain + cy.get('[aria-label="Flagged Date"]').should('not.have.value'); + cy.get('[aria-label="Flagged Date"]').should('not.have.value', ''); + cy.contains('Select resources').siblings('.row').click(); cy.get('.select2-results__options li').contains('HA/01').click(); + cy.get('[aria-label="Edit related resource HA/01"]').should('be.visible'); + cy.get('[aria-label="Delete relationship to HA/01"]').should('be.visible'); + cy.get('[aria-label="Expand resource report for HA/01"]').should('be.visible'); + + cy.contains('Select resources').siblings('.row').click(); + cy.get('.select2-results__options li').contains('HA/02').click(); + cy.get('[aria-label="Edit related resource HA/02"]').should('be.visible'); + cy.get('[aria-label="Delete relationship to HA/02"]').should('be.visible'); + cy.get('[aria-label="Expand resource report for HA/02"]').should('be.visible'); + + // cy.contains('Select resources').siblings('.row').click(); + // cy.get('.select2-search__field').type('XXXXXXX'); + // cy.get('.select2-results__option').should('have.length', 1).contains('Create a new Heritage Asset'); + + // Verify that the two selected resources are in their own rows + cy.get('.associated_resources').children('.rr-widget').children('.rr-table').children().first().children('.rr-table-row').should('have.length', 2); + cy.contains('Save and Continue').click(); // Enforcement Summary tab @@ -41,7 +77,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Only checks if the date we selected is present as the year and month could change cy.contains('Flagged Date Value:').siblings().should('contain', '17'); cy.contains('Actor:').siblings().should('have.text', 'John Doe, Test Person'); - cy.contains('Associated Resources:').siblings().should('have.text', 'HA/01'); + cy.contains('Associated Resources:').siblings().should('have.text', 'HA/02, HA/01'); cy.wait(900); cy.contains('Save and Complete Workflow').click(); }); diff --git a/cypress/e2e/02_create_a_heritage_asset.cy.js b/cypress/e2e/02_create_a_heritage_asset.cy.js index ad5f3d4cb..de590d5ad 100644 --- a/cypress/e2e/02_create_a_heritage_asset.cy.js +++ b/cypress/e2e/02_create_a_heritage_asset.cy.js @@ -1,10 +1,26 @@ describe('Creating a Heritage Asset named HA/01 if it doesnt exist', function () { beforeEach(() => { cy.login(); - cy.visit('/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=473&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Heritage%20Asset%20-%20Display%20Name%22%2C%22id%22%3A%22termHA%2F01Heritage%20Asset%20-%20Display%20Name%22%2C%22text%22%3A%22HA%2F01%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22HA%2F01%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D&language=*'); }); it('Create a heritage asset', function () { + cy.visit('/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=473&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Heritage%20Asset%20-%20Display%20Name%22%2C%22id%22%3A%22termHA%2F01Heritage%20Asset%20-%20Display%20Name%22%2C%22text%22%3A%22HA%2F01%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22HA%2F01%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D&language=*'); + cy.wait(5000).then(() => { + cy.get('#search-results-list').then(($el) => { + if (!$el.find('.search-listing').length > 0) { + cy.contains('Workflows').click(); + cy.contains('Add Monument').click(); + cy.contains('Start New').click(); + cy.contains('Save and Continue').click(); + cy.wait(1000); + cy.contains('Save and Complete Workflow').click(); + }; + }) + }); + }); + + it('Create a second heritage asset', function () { + cy.visit('/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=0&resource-type-filter=%5B%7B%22graphid%22%3A%22076f9381-7b00-11e9-8d6b-80000b44d1d9%22%2C%22name%22%3A%22Heritage%20Asset%22%2C%22inverted%22%3Afalse%7D%5D&term-filter=%5B%7B%22inverted%22%3Afalse%2C%22type%22%3A%22string%22%2C%22context%22%3A%22%22%2C%22context_label%22%3A%22%22%2C%22id%22%3A%22HA%2F02%22%2C%22text%22%3A%22HA%2F02%22%2C%22value%22%3A%22HA%2F02%22%2C%22selected%22%3Atrue%7D%5D&language=*'); cy.wait(5000).then(() => { cy.get('#search-results-list').then(($el) => { if (!$el.find('.search-listing').length > 0) { From 1b2aaf08c813c138d964ca2e9816eb519485e41a Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 19 Sep 2024 14:10:30 +0300 Subject: [PATCH 57/69] test: adds to the full workflow test --- .../archive_cataloguing_workflow.cy.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js index 781ce2a0b..969cc92ad 100644 --- a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js +++ b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js @@ -14,6 +14,7 @@ describe('Going through the Archive Cataloguing Workflow', function () { // Makes sure the autogenerated id is not undefined cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); cy.contains('Save and Continue').click(); // Archive Source Details @@ -26,6 +27,10 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.get('.select2-results__options li').first().click(); cy.get('span').contains('File Status').siblings('.col-xs-12').click(); cy.wait(500); + cy.get('.select2-results__options li').contains('Destroyed'); + cy.get('.select2-results__options li').contains('For Review'); + cy.get('.select2-results__options li').contains('Closed'); + cy.get('.select2-results__options li').contains('Open'); cy.get('.select2-results__options li').first().click(); cy.type_ckeditor('editor1', 'test description'); cy.wait(500); @@ -65,7 +70,34 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); cy.get('[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); + + // Verify data gets added + cy.get('.wf-step-multi-tile-container').contains('Archive Loan History').siblings().children('div').children().contains('Test Person'); + // Dates shouldn't be empty + cy.get('.archive_holder_start_date').last().should('not.have.text'); + cy.get('.archive_holder_start_date').last().should('not.have.text', ''); + cy.get('.archive_holder_end_date').last().should('not.have.text'); + cy.get('.archive_holder_end_date').last().should('not.have.text', ''); + + cy.get('.wf-multi-tile-step-card-controls').contains('Remove').click(); + cy.get('.wf-multi-tile-step-list-empty').contains('No Archive Loan History added yet. Add one or multiple Archive Loan History').should('be.visible'); + + cy.get('span').contains('Person or Organization').should('be.visible').siblings('.row').click(); + cy.get('.select2-search__field').type('John Doe'); + cy.wait(500); + cy.get('.select2-results__options li').first().click(); + cy.get('[aria-label="Start Date"]').scrollIntoView().should('be.visible').click(); + cy.get('[aria-label="Start Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); + cy.get('[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); + // Verify data gets added + cy.get('.wf-step-multi-tile-container').contains('Archive Loan History').siblings().children('div').children().contains('John Doe'); + cy.get('.ion-android-cloud-done').siblings().contains('Save').click(); + cy.wait(500); cy.contains('Save and Complete Workflow').click(); }); + // TODO test with each field saved + // Try with person and organisation }); From 7f935cdf63df0494c07ca0a740289e26e4877512 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 19 Sep 2024 14:15:38 +0300 Subject: [PATCH 58/69] test: dates values should remain after adding --- .../archive_cataloguing_workflow.cy.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js index 969cc92ad..73c526cf3 100644 --- a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js +++ b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js @@ -86,13 +86,19 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.get('.select2-search__field').type('John Doe'); cy.wait(500); cy.get('.select2-results__options li').first().click(); - cy.get('[aria-label="Start Date"]').scrollIntoView().should('be.visible').click(); - cy.get('[aria-label="Start Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); - cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); - cy.get('[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.get('[aria-label="Start Date"]').scrollIntoView().should('not.have.value'); + cy.get('[aria-label="Start Date"]').scrollIntoView().should('not.have.value', ''); + cy.get('[aria-label="End Date"]').scrollIntoView().should('not.have.value'); + cy.get('[aria-label="End Date"]').scrollIntoView().should('not.have.value', ''); cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); + // Verify data gets added cy.get('.wf-step-multi-tile-container').contains('Archive Loan History').siblings().children('div').children().contains('John Doe'); + cy.get('.archive_holder_start_date').last().should('not.have.text'); + cy.get('.archive_holder_start_date').last().should('not.have.text', ''); + cy.get('.archive_holder_end_date').last().should('not.have.text'); + cy.get('.archive_holder_end_date').last().should('not.have.text', ''); + cy.get('.ion-android-cloud-done').siblings().contains('Save').click(); cy.wait(500); cy.contains('Save and Complete Workflow').click(); From 12e59559b42d66bb6cce2834b7217549c922372c Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 19 Sep 2024 15:00:09 +0300 Subject: [PATCH 59/69] test: adjusts test for new version --- .../archive_cataloguing_workflow.cy.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js index 73c526cf3..cacb80286 100644 --- a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js +++ b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js @@ -19,7 +19,7 @@ describe('Going through the Archive Cataloguing Workflow', function () { // Archive Source Details cy.wait(900); - cy.get('input[aria-label="Archive Source Name"]').should('be.visible').type('Test Source Name'); + cy.get('input[aria-label="File Title"]').should('be.visible').type('Test Source Name'); cy.get('[aria-label="Subtitle"]').should('be.visible').type('Test Subtitle'); cy.get('[aria-label="File ID (key)"]').should('be.visible').type('TestId'); cy.get('span').contains('Archive Source Type').should('be.visible').siblings('.archive_source_type').click(); @@ -39,9 +39,11 @@ describe('Going through the Archive Cataloguing Workflow', function () { // Archive Source Creation cy.wait(500); cy.get('input[aria-label="Author Name"]').should('be.visible').type('Test Author Name'); - cy.get('input[aria-label="Editor Name"]').should('be.visible').type('Test Editor Name'); - cy.get('input[aria-label="Start Date"]').should('be.visible').type('2021-04-12'); - cy.get('input[aria-label="End Date"]').should('be.visible').type('2021-05-12'); + cy.get('input[aria-label="Editor Name(s)"]').should('be.visible').type('Test Editor Name'); + cy.get('[aria-label="Start Date"]').scrollIntoView().should('be.visible').click(); + cy.get('input[aria-label="Start Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); + cy.get('input[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); cy.type_ckeditor('editor3', 'test statement of responsibility'); cy.wait(500); cy.contains('Save and Continue').click(); From ce7b465615c1b10890d620a01768b6a96a9732ce Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 19 Sep 2024 17:32:59 +0300 Subject: [PATCH 60/69] test: update tests to work accordingly with latest version --- .../flag_for_enforcement_workflow.cy.js | 24 +++++++++---------- cypress/e2e/02_create_a_heritage_asset.cy.js | 6 +++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js b/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js index b1590d5bd..938a75fee 100644 --- a/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js @@ -49,16 +49,16 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.get('[aria-label="Flagged Date"]').should('not.have.value', ''); cy.contains('Select resources').siblings('.row').click(); - cy.get('.select2-results__options li').contains('HA/01').click(); - cy.get('[aria-label="Edit related resource HA/01"]').should('be.visible'); - cy.get('[aria-label="Delete relationship to HA/01"]').should('be.visible'); - cy.get('[aria-label="Expand resource report for HA/01"]').should('be.visible'); + cy.get('.select2-results__options li').contains('HA/01 Building1').click(); + cy.get('[aria-label="Edit related resource HA/01 Building1"]').should('be.visible'); + cy.get('[aria-label="Delete relationship to HA/01 Building1"]').should('be.visible'); + cy.get('[aria-label="Expand resource report for HA/01 Building1"]').should('be.visible'); cy.contains('Select resources').siblings('.row').click(); - cy.get('.select2-results__options li').contains('HA/02').click(); - cy.get('[aria-label="Edit related resource HA/02"]').should('be.visible'); - cy.get('[aria-label="Delete relationship to HA/02"]').should('be.visible'); - cy.get('[aria-label="Expand resource report for HA/02"]').should('be.visible'); + cy.get('.select2-results__options li').contains('HA/02 Building2').click(); + cy.get('[aria-label="Edit related resource HA/02 Building2"]').should('be.visible'); + cy.get('[aria-label="Delete relationship to HA/02 Building2"]').should('be.visible'); + cy.get('[aria-label="Expand resource report for HA/02 Building2"]').should('be.visible'); // cy.contains('Select resources').siblings('.row').click(); // cy.get('.select2-search__field').type('XXXXXXX'); @@ -77,7 +77,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Only checks if the date we selected is present as the year and month could change cy.contains('Flagged Date Value:').siblings().should('contain', '17'); cy.contains('Actor:').siblings().should('have.text', 'John Doe, Test Person'); - cy.contains('Associated Resources:').siblings().should('have.text', 'HA/02, HA/01'); + cy.contains('Associated Resources:').siblings().should('have.text', 'HA/02 Building2, HA/01 Building1'); cy.wait(900); cy.contains('Save and Complete Workflow').click(); }); @@ -95,7 +95,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Enforcement Details Tab cy.wait(900); - cy.contains('Next Step').click(); + cy.contains('Save and Continue').click(); // Enforcement Summary tab cy.contains('ResourceID:').siblings().should('not.have.text'); @@ -270,14 +270,14 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Select resources').scrollIntoView(); cy.wait(1000); cy.contains('Select resources').siblings('.row').click(); - cy.get('.select2-results__options li').contains('HA/01').click(); + cy.get('.select2-results__options li').contains('HA/01 Building1').click(); // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name cy.contains('Save and Continue').click(); // Enforcement Summary tab cy.contains('ResourceID:').siblings().should('not.have.text'); cy.contains('ResourceID:').siblings().should('not.have.text', ''); - cy.contains('Associated Resources:').siblings().should('have.text', 'HA/01'); + cy.contains('Associated Resources:').siblings().should('have.text', 'HA/01 Building1'); cy.contains('Save and Complete Workflow').click(); }); }); diff --git a/cypress/e2e/02_create_a_heritage_asset.cy.js b/cypress/e2e/02_create_a_heritage_asset.cy.js index de590d5ad..c6d8ff74f 100644 --- a/cypress/e2e/02_create_a_heritage_asset.cy.js +++ b/cypress/e2e/02_create_a_heritage_asset.cy.js @@ -4,7 +4,7 @@ describe('Creating a Heritage Asset named HA/01 if it doesnt exist', function () }); it('Create a heritage asset', function () { - cy.visit('/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=473&term-filter=%5B%7B%22context%22%3A%22%22%2C%22context_label%22%3A%22Heritage%20Asset%20-%20Display%20Name%22%2C%22id%22%3A%22termHA%2F01Heritage%20Asset%20-%20Display%20Name%22%2C%22text%22%3A%22HA%2F01%22%2C%22type%22%3A%22term%22%2C%22value%22%3A%22HA%2F01%22%2C%22inverted%22%3Afalse%2C%22selected%22%3Atrue%7D%5D&language=*'); + cy.visit('/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=1&term-filter=%5B%7B%22inverted%22%3Afalse%2C%22type%22%3A%22string%22%2C%22context%22%3A%22%22%2C%22context_label%22%3A%22%22%2C%22id%22%3A%22%20HA%2F01%20Building1%22%2C%22text%22%3A%22%20HA%2F01%20Building1%22%2C%22value%22%3A%22%20HA%2F01%20Building1%22%2C%22selected%22%3Atrue%7D%5D&language=*&resource-type-filter=%5B%7B%22graphid%22%3A%22076f9381-7b00-11e9-8d6b-80000b44d1d9%22%2C%22name%22%3A%22Heritage%20Asset%22%2C%22inverted%22%3Afalse%7D%5D'); cy.wait(5000).then(() => { cy.get('#search-results-list').then(($el) => { if (!$el.find('.search-listing').length > 0) { @@ -12,6 +12,7 @@ describe('Creating a Heritage Asset named HA/01 if it doesnt exist', function () cy.contains('Add Monument').click(); cy.contains('Start New').click(); cy.contains('Save and Continue').click(); + cy.get('[aria-label="Site Name"]').should('be.visible').type('Building1'); cy.wait(1000); cy.contains('Save and Complete Workflow').click(); }; @@ -20,7 +21,7 @@ describe('Creating a Heritage Asset named HA/01 if it doesnt exist', function () }); it('Create a second heritage asset', function () { - cy.visit('/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=0&resource-type-filter=%5B%7B%22graphid%22%3A%22076f9381-7b00-11e9-8d6b-80000b44d1d9%22%2C%22name%22%3A%22Heritage%20Asset%22%2C%22inverted%22%3Afalse%7D%5D&term-filter=%5B%7B%22inverted%22%3Afalse%2C%22type%22%3A%22string%22%2C%22context%22%3A%22%22%2C%22context_label%22%3A%22%22%2C%22id%22%3A%22HA%2F02%22%2C%22text%22%3A%22HA%2F02%22%2C%22value%22%3A%22HA%2F02%22%2C%22selected%22%3Atrue%7D%5D&language=*'); + cy.visit('/search?paging-filter=1&tiles=true&format=tilecsv&reportlink=false&precision=6&total=1&term-filter=%5B%7B%22inverted%22%3Afalse%2C%22type%22%3A%22string%22%2C%22context%22%3A%22%22%2C%22context_label%22%3A%22%22%2C%22id%22%3A%22%20HA%2F02%20Building2%22%2C%22text%22%3A%22%20HA%2F02%20Building2%22%2C%22value%22%3A%22%20HA%2F02%20Building2%22%2C%22selected%22%3Atrue%7D%5D&language=*&resource-type-filter=%5B%7B%22graphid%22%3A%22076f9381-7b00-11e9-8d6b-80000b44d1d9%22%2C%22name%22%3A%22Heritage%20Asset%22%2C%22inverted%22%3Afalse%7D%5D'); cy.wait(5000).then(() => { cy.get('#search-results-list').then(($el) => { if (!$el.find('.search-listing').length > 0) { @@ -29,6 +30,7 @@ describe('Creating a Heritage Asset named HA/01 if it doesnt exist', function () cy.contains('Start New').click(); cy.contains('Save and Continue').click(); cy.wait(1000); + cy.get('[aria-label="Site Name"]').should('be.visible').type('Building2'); cy.contains('Save and Complete Workflow').click(); }; }) From 3d0db3a79edff9232c2b74bedfb1b41dfe914bf7 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Thu, 19 Sep 2024 18:18:08 +0300 Subject: [PATCH 61/69] test: open a created archive and verify the information --- .../archive_cataloguing_workflow.cy.js | 68 ++++++++++++++++--- 1 file changed, 59 insertions(+), 9 deletions(-) diff --git a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js index cacb80286..46006ea16 100644 --- a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js +++ b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js @@ -24,14 +24,14 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.get('[aria-label="File ID (key)"]').should('be.visible').type('TestId'); cy.get('span').contains('Archive Source Type').should('be.visible').siblings('.archive_source_type').click(); cy.wait(500); - cy.get('.select2-results__options li').first().click(); + cy.get('.select2-results__options li').contains('Genre').click(); cy.get('span').contains('File Status').siblings('.col-xs-12').click(); cy.wait(500); cy.get('.select2-results__options li').contains('Destroyed'); cy.get('.select2-results__options li').contains('For Review'); cy.get('.select2-results__options li').contains('Closed'); cy.get('.select2-results__options li').contains('Open'); - cy.get('.select2-results__options li').first().click(); + cy.get('.select2-results__options li').contains('Destroyed').click(); cy.type_ckeditor('editor1', 'test description'); cy.wait(500); cy.contains('Save and Continue').click(); @@ -55,7 +55,7 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.wait(500); cy.get('.select2-results__options li').first().click(); cy.get('span').contains('Storage Building Name').should('be.visible').siblings('.col-xs-12').click(); - cy.get('.select2-results__options li').first().click(); + cy.get('.select2-results__options li').contains('PRONI').click(); cy.get('input[aria-label="Storage Room Name"]').should('be.visible').type('Test Storage Room Name'); cy.get('input[aria-label="Storage Shelf Name"]').should('be.visible').type('Test Storage Shelf Name'); cy.get('input[aria-label="Storage Box Name"]').should('be.visible').type('Test Storage Box Name'); @@ -96,16 +96,66 @@ describe('Going through the Archive Cataloguing Workflow', function () { // Verify data gets added cy.get('.wf-step-multi-tile-container').contains('Archive Loan History').siblings().children('div').children().contains('John Doe'); - cy.get('.archive_holder_start_date').last().should('not.have.text'); - cy.get('.archive_holder_start_date').last().should('not.have.text', ''); - cy.get('.archive_holder_end_date').last().should('not.have.text'); - cy.get('.archive_holder_end_date').last().should('not.have.text', ''); + cy.get('.archive_holder_start_date').last().should('not.have.text', 'None'); + cy.get('.archive_holder_end_date').last().should('not.have.text', 'None'); cy.get('.ion-android-cloud-done').siblings().contains('Save').click(); cy.wait(500); cy.contains('Save and Complete Workflow').click(); }); - // TODO test with each field saved - // Try with person and organisation + it('Open up the created archive and verify the information', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + + cy.get('[aria-label="Start new or please select from below"]').should('be.visible').click(); + cy.get('.select2-results__options li').contains('Test Source Name').click(); + cy.contains('Open Selected').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.contains('Next Step').click(); + + // Archive Source Details + cy.wait(900); + cy.get('input[aria-label="File Title"]').should('have.value', 'Test Source Name'); + cy.get('[aria-label="Subtitle"]').should('have.value', 'Test Subtitle'); + cy.get('[aria-label="File ID (key)"]').should('have.value', 'TestId'); + cy.get('[aria-label="Genre"]').scrollIntoView(); + cy.get('[aria-label="Destroyed"]'); + cy.contains('Next Step').click(); + + // Archive Source Creation + cy.wait(500); + cy.get('input[aria-label="Author Name"]').should('have.value', 'Test Author Name'); + cy.get('input[aria-label="Editor Name(s)"]').should('have.value', 'Test Editor Name'); + cy.get('input[aria-label="Start Date"]').should('not.have.value'); + cy.get('input[aria-label="Start Date"]').should('not.have.value', ''); + cy.get('input[aria-label="End Date"]').should('not.have.value'); + cy.get('input[aria-label="End Date"]').should('not.have.value', ''); + cy.contains('Next Step').click(); + + // Repository Storage Location + cy.get('.rr-table-row').contains('Test Person'); + cy.get('[aria-label="PRONI"]'); + cy.get('input[aria-label="Storage Room Name"]').should('have.value', 'Test Storage Room Name'); + cy.get('input[aria-label="Storage Shelf Name"]').should('have.value', 'Test Storage Shelf Name'); + cy.get('input[aria-label="Storage Box Name"]').should('have.value', 'Test Storage Box Name'); + cy.contains('Next Step').click(); + + // Verify data gets added + cy.get('.wf-step-multi-tile-container').contains('Archive Loan History').siblings().children('div').children().contains('Test Person'); + // Dates shouldn't be empty + cy.get('.archive_holder_start_date').last().should('not.have.text', 'None'); + cy.get('.archive_holder_end_date').last().should('not.have.text', 'None'); + + cy.contains('Save and Complete Workflow').click(); + }); + + // TODO + // - Test with each field saved + // - Try with person and organisation + // - Open up the created archive and verify information }); From 43ba632f4a374672ffca2fb7ab1adea5c8992944 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Fri, 20 Sep 2024 11:37:58 +0300 Subject: [PATCH 62/69] test: adds Archive Source Details individual field tests --- .../archive_cataloguing_workflow.cy.js | 328 ++++++++++++++++++ 1 file changed, 328 insertions(+) diff --git a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js index 46006ea16..23179667d 100644 --- a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js +++ b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js @@ -154,6 +154,334 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.contains('Save and Complete Workflow').click(); }); + // START OF Archive Reference Tab individual fields tests + it('Populate just Resource ID', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + cy.contains('Save and Complete Workflow').click(); + }); + // END OF Archive Reference Tab individual fields tests + + // START OF Archive Source Details Tab individual field tests + it('Populate just File Title', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(900); + cy.get('input[aria-label="File Title"]').should('be.visible').type('Test Source Name'); + cy.contains('Save and Continue').click(); + cy.contains('Save and Complete Workflow').click(); + }); + + it('Populate just Subtitle', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(900); + cy.get('[aria-label="Subtitle"]').should('be.visible').type('Test Subtitle'); + cy.contains('Save and Continue').click(); + cy.contains('Save and Complete Workflow').click(); + }); + + + it('Populate just File Id', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(900); + cy.get('[aria-label="File ID (key)"]').should('be.visible').type('TestId'); + cy.contains('Save and Continue').click(); + cy.contains('Save and Complete Workflow').click(); + }); + + + it('Populate just Archive Source Type', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(900); + cy.get('span').contains('Archive Source Type').should('be.visible').siblings('.archive_source_type').click(); + cy.wait(500); + cy.get('.select2-results__options li').contains('Genre').click(); + cy.wait(500); + cy.contains('Save and Continue').click(); + cy.contains('Save and Complete Workflow').click(); + }); + + it('Populate just File Title', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(900); + cy.get('input[aria-label="File Title"]').should('be.visible').type('Test Source Name'); + cy.get('[aria-label="Subtitle"]').should('be.visible').type('Test Subtitle'); + cy.get('[aria-label="File ID (key)"]').should('be.visible').type('TestId'); + cy.get('span').contains('Archive Source Type').should('be.visible').siblings('.archive_source_type').click(); + cy.wait(500); + cy.get('.select2-results__options li').contains('Genre').click(); + cy.get('span').contains('File Status').siblings('.col-xs-12').click(); + cy.wait(500); + cy.get('.select2-results__options li').contains('Destroyed'); + cy.get('.select2-results__options li').contains('For Review'); + cy.get('.select2-results__options li').contains('Closed'); + cy.get('.select2-results__options li').contains('Open'); + cy.get('.select2-results__options li').contains('Destroyed').click(); + cy.type_ckeditor('editor1', 'test description'); + cy.wait(500); + cy.contains('Save and Continue').click(); + + // Archive Source Creation + cy.wait(500); + cy.get('input[aria-label="Author Name"]').should('be.visible').type('Test Author Name'); + cy.get('input[aria-label="Editor Name(s)"]').should('be.visible').type('Test Editor Name'); + cy.get('[aria-label="Start Date"]').scrollIntoView().should('be.visible').click(); + cy.get('input[aria-label="Start Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); + cy.get('input[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.type_ckeditor('editor3', 'test statement of responsibility'); + cy.wait(500); + cy.contains('Save and Continue').click(); + + // Repository Storage Location + cy.wait(1000); + cy.get('span').contains('Responsible Team').should('be.visible').siblings('.row').click(); + cy.get('.select2-search__field').type('Test Person'); + cy.wait(500); + cy.get('.select2-results__options li').first().click(); + cy.get('span').contains('Storage Building Name').should('be.visible').siblings('.col-xs-12').click(); + cy.get('.select2-results__options li').contains('PRONI').click(); + cy.get('input[aria-label="Storage Room Name"]').should('be.visible').type('Test Storage Room Name'); + cy.get('input[aria-label="Storage Shelf Name"]').should('be.visible').type('Test Storage Shelf Name'); + cy.get('input[aria-label="Storage Box Name"]').should('be.visible').type('Test Storage Box Name'); + cy.contains('Save and Continue').click(); + + // Archive Loan History + cy.wait(500); + cy.get('span').contains('Person or Organization').should('be.visible').siblings('.row').click(); + cy.get('.select2-search__field').type('Test Person'); + cy.wait(500); + cy.get('.select2-results__options li').first().click(); + cy.get('[aria-label="Start Date"]').scrollIntoView().should('be.visible').click(); + cy.get('[aria-label="Start Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); + cy.get('[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); + + // Verify data gets added + cy.get('.wf-step-multi-tile-container').contains('Archive Loan History').siblings().children('div').children().contains('Test Person'); + // Dates shouldn't be empty + cy.get('.archive_holder_start_date').last().should('not.have.text'); + cy.get('.archive_holder_start_date').last().should('not.have.text', ''); + cy.get('.archive_holder_end_date').last().should('not.have.text'); + cy.get('.archive_holder_end_date').last().should('not.have.text', ''); + + cy.get('.wf-multi-tile-step-card-controls').contains('Remove').click(); + cy.get('.wf-multi-tile-step-list-empty').contains('No Archive Loan History added yet. Add one or multiple Archive Loan History').should('be.visible'); + + cy.get('span').contains('Person or Organization').should('be.visible').siblings('.row').click(); + cy.get('.select2-search__field').type('John Doe'); + cy.wait(500); + cy.get('.select2-results__options li').first().click(); + cy.get('[aria-label="Start Date"]').scrollIntoView().should('not.have.value'); + cy.get('[aria-label="Start Date"]').scrollIntoView().should('not.have.value', ''); + cy.get('[aria-label="End Date"]').scrollIntoView().should('not.have.value'); + cy.get('[aria-label="End Date"]').scrollIntoView().should('not.have.value', ''); + cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); + + // Verify data gets added + cy.get('.wf-step-multi-tile-container').contains('Archive Loan History').siblings().children('div').children().contains('John Doe'); + cy.get('.archive_holder_start_date').last().should('not.have.text', 'None'); + cy.get('.archive_holder_end_date').last().should('not.have.text', 'None'); + + cy.get('.ion-android-cloud-done').siblings().contains('Save').click(); + cy.wait(500); + cy.contains('Save and Complete Workflow').click(); + }); + + it('Populate just File Title', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.get('span').contains('File Status').siblings('.col-xs-12').click(); + cy.wait(500); + cy.get('.select2-results__options li').contains('Destroyed'); + cy.get('.select2-results__options li').contains('For Review'); + cy.get('.select2-results__options li').contains('Closed'); + cy.get('.select2-results__options li').contains('Open'); + cy.get('.select2-results__options li').contains('Destroyed').click(); + cy.contains('Save and Continue').click(); + + cy.contains('Save and Complete Workflow').click(); + }); + + it('Populate just Description', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.type_ckeditor('editor1', 'test description'); + cy.wait(500); + cy.contains('Save and Continue').click(); + + cy.contains('Save and Complete Workflow').click(); + }); + // END OF Archive Source Details Tab individual fields tests + + // START OF Archive Source Creation Tab individual fields tests + // it('Populate just File Title', function () { + // cy.contains('Workflows'); + // cy.contains('Archive Cataloguing').click(); + // cy.contains('Start New').click(); + + // // Initial step tab + // // Makes sure the autogenerated id is not undefined + // cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + // cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + // cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + // cy.contains('Save and Continue').click(); + + // // Archive Source Details + // cy.contains('Next Step').click(); + + // // Archive Source Creation + // cy.wait(500); + // cy.get('input[aria-label="Author Name"]').should('be.visible').type('Test Author Name'); + // cy.get('input[aria-label="Editor Name(s)"]').should('be.visible').type('Test Editor Name'); + // cy.get('[aria-label="Start Date"]').scrollIntoView().should('be.visible').click(); + // cy.get('input[aria-label="Start Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + // cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); + // cy.get('input[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + // cy.type_ckeditor('editor3', 'test statement of responsibility'); + // cy.wait(500); + // cy.contains('Save and Continue').click(); + + // // Repository Storage Location + // cy.wait(1000); + // cy.get('span').contains('Responsible Team').should('be.visible').siblings('.row').click(); + // cy.get('.select2-search__field').type('Test Person'); + // cy.wait(500); + // cy.get('.select2-results__options li').first().click(); + // cy.get('span').contains('Storage Building Name').should('be.visible').siblings('.col-xs-12').click(); + // cy.get('.select2-results__options li').contains('PRONI').click(); + // cy.get('input[aria-label="Storage Room Name"]').should('be.visible').type('Test Storage Room Name'); + // cy.get('input[aria-label="Storage Shelf Name"]').should('be.visible').type('Test Storage Shelf Name'); + // cy.get('input[aria-label="Storage Box Name"]').should('be.visible').type('Test Storage Box Name'); + // cy.contains('Save and Continue').click(); + + // // Archive Loan History + // cy.wait(500); + // cy.get('span').contains('Person or Organization').should('be.visible').siblings('.row').click(); + // cy.get('.select2-search__field').type('Test Person'); + // cy.wait(500); + // cy.get('.select2-results__options li').first().click(); + // cy.get('[aria-label="Start Date"]').scrollIntoView().should('be.visible').click(); + // cy.get('[aria-label="Start Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + // cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); + // cy.get('[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + // cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); + + // // Verify data gets added + // cy.get('.wf-step-multi-tile-container').contains('Archive Loan History').siblings().children('div').children().contains('Test Person'); + // // Dates shouldn't be empty + // cy.get('.archive_holder_start_date').last().should('not.have.text'); + // cy.get('.archive_holder_start_date').last().should('not.have.text', ''); + // cy.get('.archive_holder_end_date').last().should('not.have.text'); + // cy.get('.archive_holder_end_date').last().should('not.have.text', ''); + + // cy.get('.wf-multi-tile-step-card-controls').contains('Remove').click(); + // cy.get('.wf-multi-tile-step-list-empty').contains('No Archive Loan History added yet. Add one or multiple Archive Loan History').should('be.visible'); + + // cy.get('span').contains('Person or Organization').should('be.visible').siblings('.row').click(); + // cy.get('.select2-search__field').type('John Doe'); + // cy.wait(500); + // cy.get('.select2-results__options li').first().click(); + // cy.get('[aria-label="Start Date"]').scrollIntoView().should('not.have.value'); + // cy.get('[aria-label="Start Date"]').scrollIntoView().should('not.have.value', ''); + // cy.get('[aria-label="End Date"]').scrollIntoView().should('not.have.value'); + // cy.get('[aria-label="End Date"]').scrollIntoView().should('not.have.value', ''); + // cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); + + // // Verify data gets added + // cy.get('.wf-step-multi-tile-container').contains('Archive Loan History').siblings().children('div').children().contains('John Doe'); + // cy.get('.archive_holder_start_date').last().should('not.have.text', 'None'); + // cy.get('.archive_holder_end_date').last().should('not.have.text', 'None'); + + // cy.get('.ion-android-cloud-done').siblings().contains('Save').click(); + // cy.wait(500); + // cy.contains('Save and Complete Workflow').click(); + // }); + // TODO // - Test with each field saved // - Try with person and organisation From f7e662e6171f41ee7ea1eecf44c8a3bcf41d1e36 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Fri, 20 Sep 2024 12:07:01 +0300 Subject: [PATCH 63/69] test: remove unnecessary step --- .../archive_cataloguing_workflow.cy.js | 101 +----------------- 1 file changed, 1 insertion(+), 100 deletions(-) diff --git a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js index 23179667d..04c97cf79 100644 --- a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js +++ b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js @@ -253,106 +253,7 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.contains('Save and Complete Workflow').click(); }); - it('Populate just File Title', function () { - cy.contains('Workflows'); - cy.contains('Archive Cataloguing').click(); - cy.contains('Start New').click(); - - // Initial step tab - // Makes sure the autogenerated id is not undefined - cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); - cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); - cy.get('.workflow-nav-tab.disabled').should('have.length', 4); - cy.contains('Save and Continue').click(); - - // Archive Source Details - cy.wait(900); - cy.get('input[aria-label="File Title"]').should('be.visible').type('Test Source Name'); - cy.get('[aria-label="Subtitle"]').should('be.visible').type('Test Subtitle'); - cy.get('[aria-label="File ID (key)"]').should('be.visible').type('TestId'); - cy.get('span').contains('Archive Source Type').should('be.visible').siblings('.archive_source_type').click(); - cy.wait(500); - cy.get('.select2-results__options li').contains('Genre').click(); - cy.get('span').contains('File Status').siblings('.col-xs-12').click(); - cy.wait(500); - cy.get('.select2-results__options li').contains('Destroyed'); - cy.get('.select2-results__options li').contains('For Review'); - cy.get('.select2-results__options li').contains('Closed'); - cy.get('.select2-results__options li').contains('Open'); - cy.get('.select2-results__options li').contains('Destroyed').click(); - cy.type_ckeditor('editor1', 'test description'); - cy.wait(500); - cy.contains('Save and Continue').click(); - - // Archive Source Creation - cy.wait(500); - cy.get('input[aria-label="Author Name"]').should('be.visible').type('Test Author Name'); - cy.get('input[aria-label="Editor Name(s)"]').should('be.visible').type('Test Editor Name'); - cy.get('[aria-label="Start Date"]').scrollIntoView().should('be.visible').click(); - cy.get('input[aria-label="Start Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); - cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); - cy.get('input[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); - cy.type_ckeditor('editor3', 'test statement of responsibility'); - cy.wait(500); - cy.contains('Save and Continue').click(); - - // Repository Storage Location - cy.wait(1000); - cy.get('span').contains('Responsible Team').should('be.visible').siblings('.row').click(); - cy.get('.select2-search__field').type('Test Person'); - cy.wait(500); - cy.get('.select2-results__options li').first().click(); - cy.get('span').contains('Storage Building Name').should('be.visible').siblings('.col-xs-12').click(); - cy.get('.select2-results__options li').contains('PRONI').click(); - cy.get('input[aria-label="Storage Room Name"]').should('be.visible').type('Test Storage Room Name'); - cy.get('input[aria-label="Storage Shelf Name"]').should('be.visible').type('Test Storage Shelf Name'); - cy.get('input[aria-label="Storage Box Name"]').should('be.visible').type('Test Storage Box Name'); - cy.contains('Save and Continue').click(); - - // Archive Loan History - cy.wait(500); - cy.get('span').contains('Person or Organization').should('be.visible').siblings('.row').click(); - cy.get('.select2-search__field').type('Test Person'); - cy.wait(500); - cy.get('.select2-results__options li').first().click(); - cy.get('[aria-label="Start Date"]').scrollIntoView().should('be.visible').click(); - cy.get('[aria-label="Start Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); - cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); - cy.get('[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); - cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); - - // Verify data gets added - cy.get('.wf-step-multi-tile-container').contains('Archive Loan History').siblings().children('div').children().contains('Test Person'); - // Dates shouldn't be empty - cy.get('.archive_holder_start_date').last().should('not.have.text'); - cy.get('.archive_holder_start_date').last().should('not.have.text', ''); - cy.get('.archive_holder_end_date').last().should('not.have.text'); - cy.get('.archive_holder_end_date').last().should('not.have.text', ''); - - cy.get('.wf-multi-tile-step-card-controls').contains('Remove').click(); - cy.get('.wf-multi-tile-step-list-empty').contains('No Archive Loan History added yet. Add one or multiple Archive Loan History').should('be.visible'); - - cy.get('span').contains('Person or Organization').should('be.visible').siblings('.row').click(); - cy.get('.select2-search__field').type('John Doe'); - cy.wait(500); - cy.get('.select2-results__options li').first().click(); - cy.get('[aria-label="Start Date"]').scrollIntoView().should('not.have.value'); - cy.get('[aria-label="Start Date"]').scrollIntoView().should('not.have.value', ''); - cy.get('[aria-label="End Date"]').scrollIntoView().should('not.have.value'); - cy.get('[aria-label="End Date"]').scrollIntoView().should('not.have.value', ''); - cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); - - // Verify data gets added - cy.get('.wf-step-multi-tile-container').contains('Archive Loan History').siblings().children('div').children().contains('John Doe'); - cy.get('.archive_holder_start_date').last().should('not.have.text', 'None'); - cy.get('.archive_holder_end_date').last().should('not.have.text', 'None'); - - cy.get('.ion-android-cloud-done').siblings().contains('Save').click(); - cy.wait(500); - cy.contains('Save and Complete Workflow').click(); - }); - - it('Populate just File Title', function () { + it('Populate just File Status', function () { cy.contains('Workflows'); cy.contains('Archive Cataloguing').click(); cy.contains('Start New').click(); From 91e2893bf284ef67f1800d75b905f35f7aacc4de Mon Sep 17 00:00:00 2001 From: Andrea K Date: Fri, 20 Sep 2024 12:21:22 +0300 Subject: [PATCH 64/69] test: fix non working tests --- .../archive_cataloguing_workflow.cy.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js index 04c97cf79..f2f717e66 100644 --- a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js +++ b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js @@ -186,7 +186,7 @@ describe('Going through the Archive Cataloguing Workflow', function () { // Archive Source Details cy.wait(900); - cy.get('input[aria-label="File Title"]').should('be.visible').type('Test Source Name'); + cy.get('input[aria-label="File Title"]').should('be.visible').type('Test Just File Title'); cy.contains('Save and Continue').click(); cy.contains('Save and Complete Workflow').click(); }); @@ -230,7 +230,6 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.contains('Save and Complete Workflow').click(); }); - it('Populate just Archive Source Type', function () { cy.contains('Workflows'); cy.contains('Archive Cataloguing').click(); @@ -245,7 +244,7 @@ describe('Going through the Archive Cataloguing Workflow', function () { // Archive Source Details cy.wait(900); - cy.get('span').contains('Archive Source Type').should('be.visible').siblings('.archive_source_type').click(); + cy.get('span').contains('Archive Source Type').scrollIntoView().should('be.visible').siblings('.archive_source_type').click(); cy.wait(500); cy.get('.select2-results__options li').contains('Genre').click(); cy.wait(500); @@ -291,6 +290,8 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.contains('Save and Continue').click(); // Archive Source Details + cy.get('span').contains('File Status').scrollIntoView(); + cy.wait(300); cy.type_ckeditor('editor1', 'test description'); cy.wait(500); cy.contains('Save and Continue').click(); From 92a0f5bfa74d6399ac583146aaa4a35f05bbc78c Mon Sep 17 00:00:00 2001 From: Andrea K Date: Fri, 20 Sep 2024 13:39:46 +0300 Subject: [PATCH 65/69] test: adds Archive Source Creation tab individual tests --- .../archive_cataloguing_workflow.cy.js | 144 ++++++++++++++++-- 1 file changed, 132 insertions(+), 12 deletions(-) diff --git a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js index f2f717e66..6e66e6849 100644 --- a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js +++ b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js @@ -1,6 +1,8 @@ describe('Going through the Archive Cataloguing Workflow', function () { beforeEach(() => { + // Add this wait here to avoid rate limiting on the login + cy.wait(1000); cy.login(); cy.visit('http://localhost:8000/plugins/init-workflow'); }); @@ -291,7 +293,7 @@ describe('Going through the Archive Cataloguing Workflow', function () { // Archive Source Details cy.get('span').contains('File Status').scrollIntoView(); - cy.wait(300); + cy.wait(800); cy.type_ckeditor('editor1', 'test description'); cy.wait(500); cy.contains('Save and Continue').click(); @@ -301,7 +303,133 @@ describe('Going through the Archive Cataloguing Workflow', function () { // END OF Archive Source Details Tab individual fields tests // START OF Archive Source Creation Tab individual fields tests - // it('Populate just File Title', function () { + it('Populate just Author Name', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(500); + cy.contains('Next Step').click(); + + // Archive Source Creation + cy.wait(500); + cy.get('input[aria-label="Author Name"]').should('be.visible').type('Test Author Name'); + cy.contains('Save and Continue').click(); + cy.contains('Save and Complete Workflow').click(); + }); + + it('Populate just Editor Name(s)', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(500); + cy.contains('Next Step').click(); + + // Archive Source Creation + cy.wait(500); + cy.get('input[aria-label="Editor Name(s)"]').should('be.visible').type('Test Editor Name'); + cy.contains('Save and Continue').click(); + + cy.contains('Save and Complete Workflow').click(); + }); + + it('Populate just Start Date', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(500); + cy.contains('Next Step').click(); + + // Archive Source Creation + cy.wait(500); + cy.get('[aria-label="Start Date"]').scrollIntoView().should('be.visible').click(); + cy.get('input[aria-label="Start Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.contains('Save and Continue').click(); + + cy.contains('Save and Complete Workflow').click(); + }); + + it('Populate just End Date', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(500); + cy.contains('Next Step').click(); + + // Archive Source Creation + cy.wait(500); + cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); + cy.get('input[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.contains('Save and Continue').click(); + + cy.contains('Save and Complete Workflow').click(); + }); + + it('Populate just Statement of Responsibility', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(500); + cy.contains('Next Step').click(); + + // Archive Source Creation + cy.wait(500); + cy.get('[aria-label="End Date"]').scrollIntoView() + cy.wait(800); + cy.type_ckeditor('editor1', 'test statement of responsibility'); + cy.wait(200); + cy.contains('Save and Continue').click(); + + cy.contains('Save and Complete Workflow').click(); + }); + // END OF Archive Source Creation Tab individual fields tests + + // START OF Repository Storage Location Tab individual fields tests + // it('Populate just Statement of Responsibility', function () { // cy.contains('Workflows'); // cy.contains('Archive Cataloguing').click(); // cy.contains('Start New').click(); @@ -317,16 +445,7 @@ describe('Going through the Archive Cataloguing Workflow', function () { // cy.contains('Next Step').click(); // // Archive Source Creation - // cy.wait(500); - // cy.get('input[aria-label="Author Name"]').should('be.visible').type('Test Author Name'); - // cy.get('input[aria-label="Editor Name(s)"]').should('be.visible').type('Test Editor Name'); - // cy.get('[aria-label="Start Date"]').scrollIntoView().should('be.visible').click(); - // cy.get('input[aria-label="Start Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); - // cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); - // cy.get('input[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); - // cy.type_ckeditor('editor3', 'test statement of responsibility'); - // cy.wait(500); - // cy.contains('Save and Continue').click(); + // cy.contains('Next Step').click(); // // Repository Storage Location // cy.wait(1000); @@ -383,6 +502,7 @@ describe('Going through the Archive Cataloguing Workflow', function () { // cy.wait(500); // cy.contains('Save and Complete Workflow').click(); // }); + // END OF Repository Storage Location Tab individual fields tests // TODO // - Test with each field saved From ca2ead64d6ef9cd08499d9a033306cb2df42101c Mon Sep 17 00:00:00 2001 From: Andrea K Date: Fri, 20 Sep 2024 14:23:59 +0300 Subject: [PATCH 66/69] tests: adds Repository Storage Location individual tests --- .../archive_cataloguing_workflow.cy.js | 153 +++++++++++++++++- 1 file changed, 152 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js index 6e66e6849..86f204563 100644 --- a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js +++ b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js @@ -429,6 +429,157 @@ describe('Going through the Archive Cataloguing Workflow', function () { // END OF Archive Source Creation Tab individual fields tests // START OF Repository Storage Location Tab individual fields tests + it('Populate just Responsible Team', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(300); + cy.contains('Next Step').click(); + + // Archive Source Creation + cy.wait(300); + cy.contains('Next Step').click(); + + // Repository Storage Location + cy.wait(800); + cy.get('span').contains('Responsible Team').should('be.visible').siblings('.row').click(); + cy.wait(200); + cy.get('.select2-search__field').type('Test Organisation'); + cy.wait(500); + cy.get('.select2-results__options li').first().click(); + cy.contains('Save and Continue').click(); + + cy.contains('Save and Complete Workflow').click(); + }); + + + it('Populate just Storage Building Name', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(300); + cy.contains('Next Step').click(); + + // Archive Source Creation + cy.wait(300); + cy.contains('Next Step').click(); + + // Repository Storage Location + cy.wait(300); + cy.get('span').contains('Storage Building Name').should('be.visible').siblings('.col-xs-12').click(); + cy.get('.select2-results__options li').contains('PRONI').click(); + cy.contains('Save and Continue').click(); + + cy.contains('Save and Complete Workflow').click(); + }); + + + it('Populate just Storage Room Name', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(300); + cy.contains('Next Step').click(); + + // Archive Source Creation + cy.wait(400); + cy.contains('Next Step').click(); + + // Repository Storage Location + cy.wait(300); + cy.get('input[aria-label="Storage Room Name"]').should('be.visible').type('Test Storage Room Name'); + cy.contains('Save and Continue').click(); + + cy.contains('Save and Complete Workflow').click(); + }); + + + it('Populate just Storage Shelf Name', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(300); + cy.contains('Next Step').click(); + + // Archive Source Creation + cy.wait(400); + cy.contains('Next Step').click(); + + // Repository Storage Location + cy.wait(300); + cy.get('input[aria-label="Storage Shelf Name"]').should('be.visible').type('Test Storage Shelf Name'); + cy.contains('Save and Continue').click(); + + cy.contains('Save and Complete Workflow').click(); + }); + + + it('Populate just Storage Box Name', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(300); + cy.contains('Next Step').click(); + + // Archive Source Creation + cy.wait(300); + cy.contains('Next Step').click(); + + // Repository Storage Location + cy.wait(300); + cy.get('input[aria-label="Storage Box Name"]').scrollIntoView().should('be.visible').type('Test Storage Box Name'); + cy.contains('Save and Continue').click(); + + cy.contains('Save and Complete Workflow').click(); + }); + // END OF Repository Storage Location Tab individual fields tests + + // START OF Archive Loan History Tab individual fields tests // it('Populate just Statement of Responsibility', function () { // cy.contains('Workflows'); // cy.contains('Archive Cataloguing').click(); @@ -502,7 +653,7 @@ describe('Going through the Archive Cataloguing Workflow', function () { // cy.wait(500); // cy.contains('Save and Complete Workflow').click(); // }); - // END OF Repository Storage Location Tab individual fields tests + // END OF Archive Loan History Tab individual fields tests // TODO // - Test with each field saved From f556df6d680027df4b03b452d7ccdd8d4e1a93cc Mon Sep 17 00:00:00 2001 From: Andrea K Date: Fri, 20 Sep 2024 14:32:22 +0300 Subject: [PATCH 67/69] test: adds Archive Loan History individual field tests --- .../archive_cataloguing_workflow.cy.js | 181 +++++++++++------- 1 file changed, 108 insertions(+), 73 deletions(-) diff --git a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js index 86f204563..3515e41b6 100644 --- a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js +++ b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js @@ -580,79 +580,114 @@ describe('Going through the Archive Cataloguing Workflow', function () { // END OF Repository Storage Location Tab individual fields tests // START OF Archive Loan History Tab individual fields tests - // it('Populate just Statement of Responsibility', function () { - // cy.contains('Workflows'); - // cy.contains('Archive Cataloguing').click(); - // cy.contains('Start New').click(); - - // // Initial step tab - // // Makes sure the autogenerated id is not undefined - // cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); - // cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); - // cy.get('.workflow-nav-tab.disabled').should('have.length', 4); - // cy.contains('Save and Continue').click(); - - // // Archive Source Details - // cy.contains('Next Step').click(); - - // // Archive Source Creation - // cy.contains('Next Step').click(); - - // // Repository Storage Location - // cy.wait(1000); - // cy.get('span').contains('Responsible Team').should('be.visible').siblings('.row').click(); - // cy.get('.select2-search__field').type('Test Person'); - // cy.wait(500); - // cy.get('.select2-results__options li').first().click(); - // cy.get('span').contains('Storage Building Name').should('be.visible').siblings('.col-xs-12').click(); - // cy.get('.select2-results__options li').contains('PRONI').click(); - // cy.get('input[aria-label="Storage Room Name"]').should('be.visible').type('Test Storage Room Name'); - // cy.get('input[aria-label="Storage Shelf Name"]').should('be.visible').type('Test Storage Shelf Name'); - // cy.get('input[aria-label="Storage Box Name"]').should('be.visible').type('Test Storage Box Name'); - // cy.contains('Save and Continue').click(); - - // // Archive Loan History - // cy.wait(500); - // cy.get('span').contains('Person or Organization').should('be.visible').siblings('.row').click(); - // cy.get('.select2-search__field').type('Test Person'); - // cy.wait(500); - // cy.get('.select2-results__options li').first().click(); - // cy.get('[aria-label="Start Date"]').scrollIntoView().should('be.visible').click(); - // cy.get('[aria-label="Start Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); - // cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); - // cy.get('[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); - // cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); - - // // Verify data gets added - // cy.get('.wf-step-multi-tile-container').contains('Archive Loan History').siblings().children('div').children().contains('Test Person'); - // // Dates shouldn't be empty - // cy.get('.archive_holder_start_date').last().should('not.have.text'); - // cy.get('.archive_holder_start_date').last().should('not.have.text', ''); - // cy.get('.archive_holder_end_date').last().should('not.have.text'); - // cy.get('.archive_holder_end_date').last().should('not.have.text', ''); - - // cy.get('.wf-multi-tile-step-card-controls').contains('Remove').click(); - // cy.get('.wf-multi-tile-step-list-empty').contains('No Archive Loan History added yet. Add one or multiple Archive Loan History').should('be.visible'); - - // cy.get('span').contains('Person or Organization').should('be.visible').siblings('.row').click(); - // cy.get('.select2-search__field').type('John Doe'); - // cy.wait(500); - // cy.get('.select2-results__options li').first().click(); - // cy.get('[aria-label="Start Date"]').scrollIntoView().should('not.have.value'); - // cy.get('[aria-label="Start Date"]').scrollIntoView().should('not.have.value', ''); - // cy.get('[aria-label="End Date"]').scrollIntoView().should('not.have.value'); - // cy.get('[aria-label="End Date"]').scrollIntoView().should('not.have.value', ''); - // cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); - - // // Verify data gets added - // cy.get('.wf-step-multi-tile-container').contains('Archive Loan History').siblings().children('div').children().contains('John Doe'); - // cy.get('.archive_holder_start_date').last().should('not.have.text', 'None'); - // cy.get('.archive_holder_end_date').last().should('not.have.text', 'None'); - - // cy.get('.ion-android-cloud-done').siblings().contains('Save').click(); - // cy.wait(500); - // cy.contains('Save and Complete Workflow').click(); - // }); + it('Populate just Person or Organization', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(300); + cy.contains('Next Step').click(); + + // Archive Source Creation + cy.wait(300); + cy.contains('Next Step').click(); + + // Repository Storage Location + cy.wait(300); + cy.contains('Next Step').click(); + + // Archive Loan History + cy.wait(500); + cy.get('span').contains('Person or Organization').should('be.visible').siblings('.row').click(); + cy.get('.select2-search__field').type('Test Organisation'); + cy.wait(500); + cy.get('.select2-results__options li').first().click(); + cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); + + // Verify data gets added + cy.get('.wf-step-multi-tile-container').contains('Archive Loan History').siblings().children('div').children().contains('Test Organisation'); + cy.contains('Save and Complete Workflow').click(); + }); + + it('Populate just Start Date', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(300); + cy.contains('Next Step').click(); + + // Archive Source Creation + cy.wait(300); + cy.contains('Next Step').click(); + + // Repository Storage Location + cy.wait(300); + cy.contains('Next Step').click(); + + // Archive Loan History + cy.wait(500); + cy.get('[aria-label="Start Date"]').scrollIntoView().should('be.visible').click(); + cy.get('[aria-label="Start Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); + + // Verify data gets added + cy.get('.archive_holder_start_date').last().should('not.have.text'); + cy.get('.archive_holder_start_date').last().should('not.have.text', ''); + cy.contains('Save and Complete Workflow').click(); + }); + + it('Populate just End Date', function () { + cy.contains('Workflows'); + cy.contains('Archive Cataloguing').click(); + cy.contains('Start New').click(); + + // Initial step tab + // Makes sure the autogenerated id is not undefined + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value'); + cy.contains('Resource ID').siblings('.col-xs-12').children('input').should('not.have.value', ''); + cy.get('.workflow-nav-tab.disabled').should('have.length', 4); + cy.contains('Save and Continue').click(); + + // Archive Source Details + cy.wait(300); + cy.contains('Next Step').click(); + + // Archive Source Creation + cy.wait(300); + cy.contains('Next Step').click(); + + // Repository Storage Location + cy.wait(300); + cy.contains('Next Step').click(); + + // Archive Loan History + cy.wait(500); + cy.get('[aria-label="End Date"]').scrollIntoView().should('be.visible').click(); + cy.get('[aria-label="End Date"]').siblings('.bootstrap-datetimepicker-widget').contains('17').click(); + cy.get('.workflow-component-element').get('.btn.btn-workflow-tile.btn-success').should('be.visible').contains('Add').click(); + + // Verify data gets added + cy.get('.archive_holder_end_date').last().should('not.have.text'); + cy.get('.archive_holder_end_date').last().should('not.have.text', ''); + cy.contains('Save and Complete Workflow').click(); + }); // END OF Archive Loan History Tab individual fields tests // TODO From 70841c16d758b07affc7794779a98e148f526720 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 25 Sep 2024 17:43:14 +0300 Subject: [PATCH 68/69] test: increase waits for breaking tests --- .../flag_for_enforcement_workflow.cy.js | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js b/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js index 938a75fee..a897ea74b 100644 --- a/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js +++ b/cypress/e2e/01_flag_for_enforcement/flag_for_enforcement_workflow.cy.js @@ -18,9 +18,10 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Continue').click(); // Enforcement Details Tab - cy.wait(900); + cy.wait(2500); cy.get('[aria-label="Case Reference"]').should('be.visible').type('Case Ref'); cy.type_ckeditor('editor2', 'test reason for enforcement'); + cy.wait(1500); cy.contains('Flagged by').siblings('.row').click(); cy.get('.select2-search__field').type('Test Person'); cy.wait(500); @@ -139,8 +140,9 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Continue').click(); // Enforcement Details Tab - cy.wait(900); + cy.wait(2500); cy.type_ckeditor('editor2', 'test reason for enforcement'); + cy.wait(900); cy.contains('Save and Continue').click(); // Enforcement Summary tab @@ -161,10 +163,10 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Continue').click(); // Enforcement Details Tab - cy.wait(900); + cy.wait(1500); cy.contains('Flagged by').siblings('.row').click(); cy.get('.select2-search__field').type('Test Person'); - cy.wait(500); + cy.wait(900); cy.get('.select2-results__options li').first().click(); cy.contains('Save and Continue').click(); @@ -189,7 +191,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.wait(900); cy.contains('Flagged by').siblings('.row').click(); cy.get('.select2-search__field').type('Test Organisation'); - cy.wait(500); + cy.wait(900); cy.get('.select2-results__options li').first().click(); cy.contains('Save and Continue').click(); @@ -211,15 +213,15 @@ describe('Going through the Flag For Enforcement Workflow', function () { cy.contains('Save and Continue').click(); // Enforcement Details Tab - cy.wait(900); + cy.wait(1500); cy.contains('Flagged by').siblings('.row').click(); cy.get('.select2-search__field').type('Test Organisation'); - cy.wait(500); + cy.wait(1000); cy.get('.select2-results__options li').first().click(); - cy.wait(500); + cy.wait(1000); cy.contains('Flagged by').siblings('.row').click(); cy.get('.select2-search__field').type('Test Person'); - cy.wait(500); + cy.wait(1000); cy.get('.select2-results__options li').first().click(); cy.contains('Save and Continue').click(); @@ -268,7 +270,7 @@ describe('Going through the Flag For Enforcement Workflow', function () { // Enforcement Details Tab cy.contains('Select resources').scrollIntoView(); - cy.wait(1000); + cy.wait(2000); cy.contains('Select resources').siblings('.row').click(); cy.get('.select2-results__options li').contains('HA/01 Building1').click(); // Selects the first value in the dropdown. Would be better if we have a pervious test that initates a Heritage Asset and uses that by name From 5bc24d7d5028d897fb3dc6873ab72a29a385e2d5 Mon Sep 17 00:00:00 2001 From: Andrea K Date: Wed, 25 Sep 2024 18:19:45 +0300 Subject: [PATCH 69/69] test: increase waits --- .../archive_cataloguing_workflow.cy.js | 53 ++++++++++--------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js index 3515e41b6..0a42f6946 100644 --- a/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js +++ b/cypress/e2e/02_archive_cataloguing/archive_cataloguing_workflow.cy.js @@ -111,7 +111,8 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.contains('Archive Cataloguing').click(); cy.get('[aria-label="Start new or please select from below"]').should('be.visible').click(); - cy.get('.select2-results__options li').contains('Test Source Name').click(); + // Select the first one. Assuming the database was empty before the test was ran this would select the correct one. For some reason the file name doesnt show up properly here + cy.get('.select2-results__options li').first().click(); cy.contains('Open Selected').click(); // Initial step tab @@ -293,7 +294,7 @@ describe('Going through the Archive Cataloguing Workflow', function () { // Archive Source Details cy.get('span').contains('File Status').scrollIntoView(); - cy.wait(800); + cy.wait(1500); cy.type_ckeditor('editor1', 'test description'); cy.wait(500); cy.contains('Save and Continue').click(); @@ -419,9 +420,9 @@ describe('Going through the Archive Cataloguing Workflow', function () { // Archive Source Creation cy.wait(500); cy.get('[aria-label="End Date"]').scrollIntoView() - cy.wait(800); + cy.wait(2000); cy.type_ckeditor('editor1', 'test statement of responsibility'); - cy.wait(200); + cy.wait(500); cy.contains('Save and Continue').click(); cy.contains('Save and Complete Workflow').click(); @@ -442,11 +443,11 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.contains('Save and Continue').click(); // Archive Source Details - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Archive Source Creation - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Repository Storage Location @@ -475,15 +476,15 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.contains('Save and Continue').click(); // Archive Source Details - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Archive Source Creation - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Repository Storage Location - cy.wait(300); + cy.wait(500); cy.get('span').contains('Storage Building Name').should('be.visible').siblings('.col-xs-12').click(); cy.get('.select2-results__options li').contains('PRONI').click(); cy.contains('Save and Continue').click(); @@ -505,7 +506,7 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.contains('Save and Continue').click(); // Archive Source Details - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Archive Source Creation @@ -513,7 +514,7 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.contains('Next Step').click(); // Repository Storage Location - cy.wait(300); + cy.wait(500); cy.get('input[aria-label="Storage Room Name"]').should('be.visible').type('Test Storage Room Name'); cy.contains('Save and Continue').click(); @@ -534,15 +535,15 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.contains('Save and Continue').click(); // Archive Source Details - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Archive Source Creation - cy.wait(400); + cy.wait(500); cy.contains('Next Step').click(); // Repository Storage Location - cy.wait(300); + cy.wait(500); cy.get('input[aria-label="Storage Shelf Name"]').should('be.visible').type('Test Storage Shelf Name'); cy.contains('Save and Continue').click(); @@ -563,15 +564,15 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.contains('Save and Continue').click(); // Archive Source Details - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Archive Source Creation - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Repository Storage Location - cy.wait(300); + cy.wait(500); cy.get('input[aria-label="Storage Box Name"]').scrollIntoView().should('be.visible').type('Test Storage Box Name'); cy.contains('Save and Continue').click(); @@ -593,15 +594,15 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.contains('Save and Continue').click(); // Archive Source Details - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Archive Source Creation - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Repository Storage Location - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Archive Loan History @@ -630,15 +631,15 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.contains('Save and Continue').click(); // Archive Source Details - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Archive Source Creation - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Repository Storage Location - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Archive Loan History @@ -666,15 +667,15 @@ describe('Going through the Archive Cataloguing Workflow', function () { cy.contains('Save and Continue').click(); // Archive Source Details - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Archive Source Creation - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Repository Storage Location - cy.wait(300); + cy.wait(500); cy.contains('Next Step').click(); // Archive Loan History