From b440d4e6e588a55c848ba91108fae89110071487 Mon Sep 17 00:00:00 2001 From: Janette Day Date: Tue, 26 Apr 2022 10:53:19 -0500 Subject: [PATCH 01/17] Update cypress test user --- .circleci/config.yml | 2 +- cypress.json | 4 ++-- cypress/integration/07_admin_dataset_json_form.spec.js | 2 +- cypress/integration/08_admin_views.spec.js | 2 +- cypress/integration/09_admin_links.spec.js | 2 +- cypress/integration/10_workflow_transitions.spec.js | 8 ++++---- cypress/integration/11_admin_dataset_file_upload.spec.js | 8 ++++---- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f1e15e495b..5086fae09c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -88,7 +88,7 @@ jobs: type: boolean environment: TEST_RESULTS: /tmp/test-results - DKTL_VERSION: "4.2.9" + DKTL_VERSION: "dev-adding_testing_accounts_module_to_testing_command" steps: - prepare_build: upgrade: << parameters.upgrade >> diff --git a/cypress.json b/cypress.json index 1bb0914fef..94de8ba9df 100644 --- a/cypress.json +++ b/cypress.json @@ -2,8 +2,8 @@ "apiUri": "api/1", "env": { "TEST_USER_CREDENTIALS": { - "user": "testuser", - "pass": "2jqzOAnXS9mmcLasy" + "user": "testapiuser", + "pass": "testapiuser" }, "UUID_REGEX": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" } diff --git a/cypress/integration/07_admin_dataset_json_form.spec.js b/cypress/integration/07_admin_dataset_json_form.spec.js index 4786e17c9b..b2f742bba9 100644 --- a/cypress/integration/07_admin_dataset_json_form.spec.js +++ b/cypress/integration/07_admin_dataset_json_form.spec.js @@ -1,7 +1,7 @@ context('Admin dataset json form', () => { let baseurl = Cypress.config().baseUrl; beforeEach(() => { - cy.drupalLogin('testeditor', 'testeditor') + cy.drupalLogin('testadmin', 'testadmin') }) it('The dataset form has the correct required fields.', () => { diff --git a/cypress/integration/08_admin_views.spec.js b/cypress/integration/08_admin_views.spec.js index 2d6560ea2e..cbd6810a78 100644 --- a/cypress/integration/08_admin_views.spec.js +++ b/cypress/integration/08_admin_views.spec.js @@ -3,7 +3,7 @@ import * as dkan from '../support/helpers/dkan' context('Admin content and dataset views', () => { let baseurl = Cypress.config().baseUrl; beforeEach(() => { - cy.drupalLogin('testeditor', 'testeditor') + cy.drupalLogin('testadmin', 'testadmin') }) it('The admin content screen has an exposed data type filter that contains the values I expect.', () => { diff --git a/cypress/integration/09_admin_links.spec.js b/cypress/integration/09_admin_links.spec.js index 290ade8cd5..0ad2c52363 100755 --- a/cypress/integration/09_admin_links.spec.js +++ b/cypress/integration/09_admin_links.spec.js @@ -1,7 +1,7 @@ context('Administration pages', () => { let baseurl = Cypress.config().baseUrl; beforeEach(() => { - cy.drupalLogin('testeditor', 'testeditor') + cy.drupalLogin('testadmin', 'testadmin') }) it('I should see a link for the dataset properties configuration', () => { diff --git a/cypress/integration/10_workflow_transitions.spec.js b/cypress/integration/10_workflow_transitions.spec.js index aefcffb0a7..84943e31f2 100644 --- a/cypress/integration/10_workflow_transitions.spec.js +++ b/cypress/integration/10_workflow_transitions.spec.js @@ -1,7 +1,7 @@ import * as dkan from '../support/helpers/dkan' context('Draft datasets', () => { - beforeEach(() => cy.drupalLogin('testeditor', 'testeditor')) + beforeEach(() => cy.drupalLogin('testadmin', 'testadmin')) it('Draft datasets are hidden from the catalog until published.', () => { // Create draft dataset @@ -33,7 +33,7 @@ context('Draft datasets', () => { cy.get('#edit-submit').click() cy.get('.button').contains('Yes').click({ force:true }) cy.get('.messages--status').should('contain', 'has been updated') - + // Ensure dataset is visible via public API with correct title cy.request('/api/1/metastore/schemas/dataset/items/' + datasetId).should((response) => { expect(response.status).to.eq(200) @@ -50,7 +50,7 @@ context('Draft datasets', () => { }) context('Archived datasets', () => { - beforeEach(() => cy.drupalLogin('testeditor', 'testeditor')) + beforeEach(() => cy.drupalLogin('testadmin', 'testadmin')) it('Existing datasets which are archived cannot be visited, and are hidden from the catalog.', () => { // Create published dataset @@ -98,7 +98,7 @@ context('Archived datasets', () => { }) context('Hidden datasets', () => { - beforeEach(() => cy.drupalLogin('testeditor', 'testeditor')) + beforeEach(() => cy.drupalLogin('testadmin', 'testadmin')) it('Newly created hidden datasets are visible when visited directly, but hidden from the catalog.', () => { // create hidden dataset diff --git a/cypress/integration/11_admin_dataset_file_upload.spec.js b/cypress/integration/11_admin_dataset_file_upload.spec.js index 036465b044..199092d19c 100644 --- a/cypress/integration/11_admin_dataset_file_upload.spec.js +++ b/cypress/integration/11_admin_dataset_file_upload.spec.js @@ -6,7 +6,7 @@ context('Admin dataset file upload', () => { const title = dkan.generateRandomString() before(() => { - cy.drupalLogin('testeditor', 'testeditor') + cy.drupalLogin('testadmin', 'testadmin') cy.visit('/node/add/data') cy.wait(2000) cy.get('#edit-field-json-metadata-0-value-title').type(title, { force:true } ) @@ -46,7 +46,7 @@ context('Admin dataset file upload', () => { }) beforeEach(() => { - cy.drupalLogin('testeditor', 'testeditor') + cy.drupalLogin('testadmin', 'testadmin') }) it('can fill up the form with distribution and submit', () => { @@ -83,7 +83,7 @@ context('Admin dataset file upload', () => { before(() => { const selectorDist = '#edit-field-json-metadata-0-value-distribution-distribution-0-distribution-downloadurl-upload' - cy.drupalLogin('testeditor', 'testeditor') + cy.drupalLogin('testadmin', 'testadmin') cy.visit('/node/add/data') cy.wait(2000) cy.get('#edit-field-json-metadata-0-value-title').type(title, { force:true } ) @@ -126,7 +126,7 @@ context('Admin dataset file upload', () => { }) beforeEach(() => { - cy.drupalLogin('testeditor', 'testeditor') + cy.drupalLogin('testadmin', 'testadmin') }) it('can create and import dataset with uploaded file', () => { From 0b0ebfc5f617ec26c361083fbbad877ec5af0193 Mon Sep 17 00:00:00 2001 From: Janette Day Date: Wed, 27 Apr 2022 17:29:37 -0500 Subject: [PATCH 02/17] wip --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5086fae09c..85d61097a1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -88,7 +88,7 @@ jobs: type: boolean environment: TEST_RESULTS: /tmp/test-results - DKTL_VERSION: "dev-adding_testing_accounts_module_to_testing_command" + DKTL_VERSION: "adding_testing_accounts_module_to_testing_command" steps: - prepare_build: upgrade: << parameters.upgrade >> From f62f9244e64e999c5d0053096a603fdb2a961b22 Mon Sep 17 00:00:00 2001 From: Janette Day Date: Thu, 28 Apr 2022 12:11:52 -0500 Subject: [PATCH 03/17] fix users --- cypress.json | 4 ++-- modules/common/tests/src/Functional/Api1TestBase.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cypress.json b/cypress.json index 94de8ba9df..2d3e8e4688 100644 --- a/cypress.json +++ b/cypress.json @@ -2,8 +2,8 @@ "apiUri": "api/1", "env": { "TEST_USER_CREDENTIALS": { - "user": "testapiuser", - "pass": "testapiuser" + "user": "testadmin", + "pass": "testadmin" }, "UUID_REGEX": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" } diff --git a/modules/common/tests/src/Functional/Api1TestBase.php b/modules/common/tests/src/Functional/Api1TestBase.php index 4c5e2cdae0..1817bc997f 100644 --- a/modules/common/tests/src/Functional/Api1TestBase.php +++ b/modules/common/tests/src/Functional/Api1TestBase.php @@ -30,7 +30,7 @@ public function setUp(): void { $this->setDefaultModerationState($state = 'published'); $this->baseUrl = getenv('SIMPLETEST_BASE_URL'); $this->http = new Client(['base_uri' => $this->baseUrl]); - $this->auth = ['testuser', '2jqzOAnXS9mmcLasy']; + $this->auth = ['testapiuser', 'testapiuser']; $this->endpoint = $this->getEndpoint(); // Load the API spec for use by tests. From f0f20780947b668e6cdbf3be4a8187779a298f7a Mon Sep 17 00:00:00 2001 From: Janette Day Date: Thu, 28 Apr 2022 14:44:56 -0500 Subject: [PATCH 04/17] small test adjustments --- cypress/integration/08_admin_views.spec.js | 3 ++- cypress/integration/11_admin_dataset_file_upload.spec.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cypress/integration/08_admin_views.spec.js b/cypress/integration/08_admin_views.spec.js index cbd6810a78..36f5809bff 100644 --- a/cypress/integration/08_admin_views.spec.js +++ b/cypress/integration/08_admin_views.spec.js @@ -45,7 +45,7 @@ context('Admin content and dataset views', () => { cy.get('h1').should('have.text', 'Create Data') }) - it('User can archive, publish, edit, and delete a dataset. The edit link on the admin view should go to the json form.', () => { + it.only('User can archive, publish, edit, and delete a dataset. The edit link on the admin view should go to the json form.', () => { // Create a dataset. cy.visit(baseurl + "/node/add/data") cy.wait(2000) @@ -88,6 +88,7 @@ context('Admin content and dataset views', () => { cy.get('h1').should('contain.text', 'Edit Data') cy.get('#edit-delete').click({ force:true }) cy.get('#edit-submit').click({ force:true }) + cy.visit(baseurl + "/admin/dkan/datasets") cy.get('.messages--status').should('contain','has been deleted') }) diff --git a/cypress/integration/11_admin_dataset_file_upload.spec.js b/cypress/integration/11_admin_dataset_file_upload.spec.js index 199092d19c..9c6dcc0ecc 100644 --- a/cypress/integration/11_admin_dataset_file_upload.spec.js +++ b/cypress/integration/11_admin_dataset_file_upload.spec.js @@ -54,6 +54,7 @@ context('Admin dataset file upload', () => { cy.visit('/admin/config/system/cron') cy.get('#edit-run') .click({force: true}) + cy.contains('h1', 'Cron'); cy.get('.messages--status', {timeout: 120000}) .should('be.visible') From ec191c925a2eff00c21c64074ba1b8dea2af825a Mon Sep 17 00:00:00 2001 From: Janette Day Date: Thu, 28 Apr 2022 15:38:49 -0500 Subject: [PATCH 05/17] try rc branch --- .circleci/config.yml | 2 +- cypress/integration/07_admin_dataset_json_form.spec.js | 3 ++- cypress/integration/08_admin_views.spec.js | 6 ++++-- cypress/integration/09_admin_links.spec.js | 3 ++- cypress/integration/10_workflow_transitions.spec.js | 5 ++++- .../integration/11_admin_dataset_file_upload.spec.js | 10 ++++++---- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 85d61097a1..5fa54a5794 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -88,7 +88,7 @@ jobs: type: boolean environment: TEST_RESULTS: /tmp/test-results - DKTL_VERSION: "adding_testing_accounts_module_to_testing_command" + DKTL_VERSION: "4.2.10-RC" steps: - prepare_build: upgrade: << parameters.upgrade >> diff --git a/cypress/integration/07_admin_dataset_json_form.spec.js b/cypress/integration/07_admin_dataset_json_form.spec.js index b2f742bba9..742b1aba62 100644 --- a/cypress/integration/07_admin_dataset_json_form.spec.js +++ b/cypress/integration/07_admin_dataset_json_form.spec.js @@ -1,7 +1,8 @@ context('Admin dataset json form', () => { let baseurl = Cypress.config().baseUrl; beforeEach(() => { - cy.drupalLogin('testadmin', 'testadmin') + const user_credentials = Cypress.env('TEST_USER_CREDENTIALS') + cy.drupalLogin(user_credentials.user, user_credentials.pass) }) it('The dataset form has the correct required fields.', () => { diff --git a/cypress/integration/08_admin_views.spec.js b/cypress/integration/08_admin_views.spec.js index 36f5809bff..f422e5e478 100644 --- a/cypress/integration/08_admin_views.spec.js +++ b/cypress/integration/08_admin_views.spec.js @@ -2,8 +2,10 @@ import * as dkan from '../support/helpers/dkan' context('Admin content and dataset views', () => { let baseurl = Cypress.config().baseUrl; + beforeEach(() => { - cy.drupalLogin('testadmin', 'testadmin') + const user_credentials = Cypress.env('TEST_USER_CREDENTIALS') + cy.drupalLogin(user_credentials.user, user_credentials.pass) }) it('The admin content screen has an exposed data type filter that contains the values I expect.', () => { @@ -45,7 +47,7 @@ context('Admin content and dataset views', () => { cy.get('h1').should('have.text', 'Create Data') }) - it.only('User can archive, publish, edit, and delete a dataset. The edit link on the admin view should go to the json form.', () => { + it('User can archive, publish, edit, and delete a dataset. The edit link on the admin view should go to the json form.', () => { // Create a dataset. cy.visit(baseurl + "/node/add/data") cy.wait(2000) diff --git a/cypress/integration/09_admin_links.spec.js b/cypress/integration/09_admin_links.spec.js index 0ad2c52363..bf223ca8c7 100755 --- a/cypress/integration/09_admin_links.spec.js +++ b/cypress/integration/09_admin_links.spec.js @@ -1,7 +1,8 @@ context('Administration pages', () => { let baseurl = Cypress.config().baseUrl; beforeEach(() => { - cy.drupalLogin('testadmin', 'testadmin') + const user_credentials = Cypress.env('TEST_USER_CREDENTIALS') + cy.drupalLogin(user_credentials.user, user_credentials.pass) }) it('I should see a link for the dataset properties configuration', () => { diff --git a/cypress/integration/10_workflow_transitions.spec.js b/cypress/integration/10_workflow_transitions.spec.js index 84943e31f2..21ba768c6e 100644 --- a/cypress/integration/10_workflow_transitions.spec.js +++ b/cypress/integration/10_workflow_transitions.spec.js @@ -1,7 +1,10 @@ import * as dkan from '../support/helpers/dkan' context('Draft datasets', () => { - beforeEach(() => cy.drupalLogin('testadmin', 'testadmin')) + beforeEach(() => { + const user_credentials = Cypress.env('TEST_USER_CREDENTIALS') + cy.drupalLogin(user_credentials.user, user_credentials.pass) + }) it('Draft datasets are hidden from the catalog until published.', () => { // Create draft dataset diff --git a/cypress/integration/11_admin_dataset_file_upload.spec.js b/cypress/integration/11_admin_dataset_file_upload.spec.js index 9c6dcc0ecc..088e76fac3 100644 --- a/cypress/integration/11_admin_dataset_file_upload.spec.js +++ b/cypress/integration/11_admin_dataset_file_upload.spec.js @@ -2,11 +2,12 @@ import * as dkan from '../support/helpers/dkan' context('Admin dataset file upload', () => { context('Create dataset with remote file', () => { + const user_credentials = Cypress.env('TEST_USER_CREDENTIALS') const fileUrl = 'https://dkan-default-content-files.s3.amazonaws.com/phpunit/district_centerpoints_small.csv' const title = dkan.generateRandomString() before(() => { - cy.drupalLogin('testadmin', 'testadmin') + cy.drupalLogin(user_credentials.user, user_credentials.pass) cy.visit('/node/add/data') cy.wait(2000) cy.get('#edit-field-json-metadata-0-value-title').type(title, { force:true } ) @@ -46,7 +47,7 @@ context('Admin dataset file upload', () => { }) beforeEach(() => { - cy.drupalLogin('testadmin', 'testadmin') + cy.drupalLogin(user_credentials.user, user_credentials.pass) }) it('can fill up the form with distribution and submit', () => { @@ -83,8 +84,8 @@ context('Admin dataset file upload', () => { before(() => { const selectorDist = '#edit-field-json-metadata-0-value-distribution-distribution-0-distribution-downloadurl-upload' - - cy.drupalLogin('testadmin', 'testadmin') + const user_credentials = Cypress.env('TEST_USER_CREDENTIALS') + cy.drupalLogin(user_credentials.user, user_credentials.pass) cy.visit('/node/add/data') cy.wait(2000) cy.get('#edit-field-json-metadata-0-value-title').type(title, { force:true } ) @@ -127,6 +128,7 @@ context('Admin dataset file upload', () => { }) beforeEach(() => { + const user_credentials = Cypress.env('TEST_USER_CREDENTIALS') cy.drupalLogin('testadmin', 'testadmin') }) From a9e83573e132f0ab50fa85d78c51a3f24e02430b Mon Sep 17 00:00:00 2001 From: Janette Day Date: Thu, 28 Apr 2022 15:58:44 -0500 Subject: [PATCH 06/17] update .circleci --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5fa54a5794..232aa82a96 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -123,7 +123,7 @@ jobs: parallelism: 4 environment: TEST_RESULTS: /tmp/test-results - DKTL_VERSION: "4.2.9" + DKTL_VERSION: "4.2.10-RC" steps: - prepare_build: upgrade: << parameters.upgrade >> From 4b3b62240f036ff63214d698f9689befdc6564d0 Mon Sep 17 00:00:00 2001 From: Janette Day Date: Fri, 29 Apr 2022 09:48:59 -0500 Subject: [PATCH 07/17] more test updates --- cypress/integration/10_workflow_transitions.spec.js | 10 +--------- .../integration/11_admin_dataset_file_upload.spec.js | 3 ++- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/cypress/integration/10_workflow_transitions.spec.js b/cypress/integration/10_workflow_transitions.spec.js index 21ba768c6e..660c725d35 100644 --- a/cypress/integration/10_workflow_transitions.spec.js +++ b/cypress/integration/10_workflow_transitions.spec.js @@ -1,6 +1,6 @@ import * as dkan from '../support/helpers/dkan' -context('Draft datasets', () => { +context('DKAN Workflow', () => { beforeEach(() => { const user_credentials = Cypress.env('TEST_USER_CREDENTIALS') cy.drupalLogin(user_credentials.user, user_credentials.pass) @@ -50,10 +50,6 @@ context('Draft datasets', () => { }) }) }) -}) - -context('Archived datasets', () => { - beforeEach(() => cy.drupalLogin('testadmin', 'testadmin')) it('Existing datasets which are archived cannot be visited, and are hidden from the catalog.', () => { // Create published dataset @@ -98,10 +94,6 @@ context('Archived datasets', () => { }) }) }) -}) - -context('Hidden datasets', () => { - beforeEach(() => cy.drupalLogin('testadmin', 'testadmin')) it('Newly created hidden datasets are visible when visited directly, but hidden from the catalog.', () => { // create hidden dataset diff --git a/cypress/integration/11_admin_dataset_file_upload.spec.js b/cypress/integration/11_admin_dataset_file_upload.spec.js index 088e76fac3..e7aeddd559 100644 --- a/cypress/integration/11_admin_dataset_file_upload.spec.js +++ b/cypress/integration/11_admin_dataset_file_upload.spec.js @@ -68,6 +68,7 @@ context('Admin dataset file upload', () => { cy.get('#edit-title').type(title) cy.get('#edit-submit-dkan-dataset-content').click() cy.get('.views-field-nothing > a').click() + cy.contains('h1', 'Edit Data'); cy.get('#edit-field-json-metadata-0-value-distribution-distribution-0-distribution-downloadurl a') .invoke('attr', 'href') .should('eq', fileUrl) @@ -129,7 +130,7 @@ context('Admin dataset file upload', () => { beforeEach(() => { const user_credentials = Cypress.env('TEST_USER_CREDENTIALS') - cy.drupalLogin('testadmin', 'testadmin') + cy.drupalLogin(user_credentials.user, user_credentials.pass) }) it('can create and import dataset with uploaded file', () => { From d4566de90ba82ab09713ecbf314b42600fdc12cb Mon Sep 17 00:00:00 2001 From: Janette Day Date: Tue, 3 May 2022 10:34:36 -0500 Subject: [PATCH 08/17] Additional documentation --- docs_assets/pages/dkan_testusers.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 docs_assets/pages/dkan_testusers.md diff --git a/docs_assets/pages/dkan_testusers.md b/docs_assets/pages/dkan_testusers.md new file mode 100644 index 0000000000..23948dcdfa --- /dev/null +++ b/docs_assets/pages/dkan_testusers.md @@ -0,0 +1,17 @@ +@page dkantestusers dkan:qa-users-create + +DKAN ships with two test users: testapiuser and testadmin. + +You can define your own custom test users by adding a testuser.json file to the root of your project. These commands will generate and remove the users specified, if no file is found, the DKAN default user accounts will be used. + +#### Add users + +`dkan:qa-users-create` + +@alias `qauc` + +#### Remove users + +`dkan:qa-users-delete` + +@alias `qaud` From 0deb008e9d806d56544bfdf8a2018b52adf25d23 Mon Sep 17 00:00:00 2001 From: Janette Day Date: Tue, 3 May 2022 10:37:46 -0500 Subject: [PATCH 09/17] docs update --- docs_assets/pages/4.0_commands.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs_assets/pages/4.0_commands.md b/docs_assets/pages/4.0_commands.md index ce8d00c42c..2de016a647 100644 --- a/docs_assets/pages/4.0_commands.md +++ b/docs_assets/pages/4.0_commands.md @@ -39,3 +39,5 @@ @subpage dkansamplecontentcreate @subpage dkansamplecontentremove + +@subpage dkantestusers From bd3c1ffab9229615a1f32ddb1dac107b1adf24d6 Mon Sep 17 00:00:00 2001 From: Janette Day Date: Tue, 3 May 2022 12:18:43 -0500 Subject: [PATCH 10/17] Change the phpcodesniffer channel --- .codeclimate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index 982772090b..15857246af 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -2,7 +2,7 @@ version: 2 plugins: phpcodesniffer: enabled: true - channel: beta + channel: master config: standard: "Drupal,DrupalPractice" exclude_patterns: From af9edf397aaf4bdd9681bc00da9c227103c7097f Mon Sep 17 00:00:00 2001 From: Janette Day Date: Tue, 3 May 2022 12:28:11 -0500 Subject: [PATCH 11/17] Remove the phpcodesniffer channel --- .codeclimate.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index 15857246af..82bc4d4073 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -2,7 +2,6 @@ version: 2 plugins: phpcodesniffer: enabled: true - channel: master config: standard: "Drupal,DrupalPractice" exclude_patterns: From 076f2b7092a675ecc1a4e10770635e1d7cac2ef6 Mon Sep 17 00:00:00 2001 From: Janette Day Date: Tue, 3 May 2022 12:54:52 -0500 Subject: [PATCH 12/17] trying something else --- .codeclimate.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.codeclimate.yml b/.codeclimate.yml index 82bc4d4073..a92f7f6764 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -2,6 +2,7 @@ version: 2 plugins: phpcodesniffer: enabled: true + channel: stable config: standard: "Drupal,DrupalPractice" exclude_patterns: From 3bd51a9c4f41d0c9b693708e551f282fdace168a Mon Sep 17 00:00:00 2001 From: Janette Day Date: Tue, 3 May 2022 13:02:53 -0500 Subject: [PATCH 13/17] wip --- .codeclimate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index a92f7f6764..c999f09885 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,7 +1,7 @@ version: 2 plugins: phpcodesniffer: - enabled: true + enabled: false channel: stable config: standard: "Drupal,DrupalPractice" From aaeec9745deeae816bff4980ed6c0dc5cfdd4f5d Mon Sep 17 00:00:00 2001 From: Janette Day Date: Thu, 5 May 2022 15:27:56 -0500 Subject: [PATCH 14/17] Restore codeclimate config --- .codeclimate.yml | 4 +-- cypress.json | 3 +- .../11_admin_dataset_file_upload.spec.js | 28 +++++++++---------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index c999f09885..982772090b 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,8 +1,8 @@ version: 2 plugins: phpcodesniffer: - enabled: false - channel: stable + enabled: true + channel: beta config: standard: "Drupal,DrupalPractice" exclude_patterns: diff --git a/cypress.json b/cypress.json index 2d3e8e4688..227386c49c 100644 --- a/cypress.json +++ b/cypress.json @@ -6,5 +6,6 @@ "pass": "testadmin" }, "UUID_REGEX": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - } + }, + "baseUrl": "http://dkan.localtest.me" } diff --git a/cypress/integration/11_admin_dataset_file_upload.spec.js b/cypress/integration/11_admin_dataset_file_upload.spec.js index e7aeddd559..7e2e88bf11 100644 --- a/cypress/integration/11_admin_dataset_file_upload.spec.js +++ b/cypress/integration/11_admin_dataset_file_upload.spec.js @@ -2,12 +2,15 @@ import * as dkan from '../support/helpers/dkan' context('Admin dataset file upload', () => { context('Create dataset with remote file', () => { - const user_credentials = Cypress.env('TEST_USER_CREDENTIALS') const fileUrl = 'https://dkan-default-content-files.s3.amazonaws.com/phpunit/district_centerpoints_small.csv' const title = dkan.generateRandomString() - before(() => { + beforeEach(() => { + const user_credentials = Cypress.env('TEST_USER_CREDENTIALS') cy.drupalLogin(user_credentials.user, user_credentials.pass) + }) + + it('create the dataset', () => { cy.visit('/node/add/data') cy.wait(2000) cy.get('#edit-field-json-metadata-0-value-title').type(title, { force:true } ) @@ -46,10 +49,6 @@ context('Admin dataset file upload', () => { .should('contain','has been created') }) - beforeEach(() => { - cy.drupalLogin(user_credentials.user, user_credentials.pass) - }) - it('can fill up the form with distribution and submit', () => { // run cron to import new dataset cy.visit('/admin/config/system/cron') @@ -71,7 +70,7 @@ context('Admin dataset file upload', () => { cy.contains('h1', 'Edit Data'); cy.get('#edit-field-json-metadata-0-value-distribution-distribution-0-distribution-downloadurl a') .invoke('attr', 'href') - .should('eq', fileUrl) + .should('contain', fileUrl.split('_').pop()) }) }) @@ -83,10 +82,13 @@ context('Admin dataset file upload', () => { // tests const uploadedFileName = dkan.generateCSVFileName() - before(() => { - const selectorDist = '#edit-field-json-metadata-0-value-distribution-distribution-0-distribution-downloadurl-upload' + beforeEach(() => { const user_credentials = Cypress.env('TEST_USER_CREDENTIALS') cy.drupalLogin(user_credentials.user, user_credentials.pass) + }) + + it('create the dataset', () => { + const selectorDist = '#edit-field-json-metadata-0-value-distribution-distribution-0-distribution-downloadurl-upload' cy.visit('/node/add/data') cy.wait(2000) cy.get('#edit-field-json-metadata-0-value-title').type(title, { force:true } ) @@ -128,10 +130,6 @@ context('Admin dataset file upload', () => { .should('contain','has been created') }) - beforeEach(() => { - const user_credentials = Cypress.env('TEST_USER_CREDENTIALS') - cy.drupalLogin(user_credentials.user, user_credentials.pass) - }) it('can create and import dataset with uploaded file', () => { // run cron to import new dataset @@ -146,11 +144,13 @@ context('Admin dataset file upload', () => { }) it('uploaded dataset files show local link on edit', () => { + //let filename = `${uploadedFileName}`.substring(0,20) // validate URL of uploaded CSV file cy.visit('/admin/dkan/datasets') cy.get('#edit-title').type(title) cy.get('#edit-submit-dkan-dataset-content').click() - cy.get('.views-field-nothing > a').click() + cy.get('tbody > :nth-child(1) > .views-field-nothing > a').click({force: true}) + cy.get('h1').should('contain', 'Edit Data') cy.get('#edit-field-json-metadata-0-value-distribution-distribution-0-distribution-downloadurl a') .invoke('attr', 'href') .should('contain', `uploaded_resources/${uploadedFileName}`) From 658055a6b7e1a785c23fecc9de1c6b6f8f3a60e0 Mon Sep 17 00:00:00 2001 From: Janette Day Date: Thu, 5 May 2022 15:32:40 -0500 Subject: [PATCH 15/17] clean up --- cypress/integration/11_admin_dataset_file_upload.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress/integration/11_admin_dataset_file_upload.spec.js b/cypress/integration/11_admin_dataset_file_upload.spec.js index 7e2e88bf11..d8528e1a22 100644 --- a/cypress/integration/11_admin_dataset_file_upload.spec.js +++ b/cypress/integration/11_admin_dataset_file_upload.spec.js @@ -144,7 +144,6 @@ context('Admin dataset file upload', () => { }) it('uploaded dataset files show local link on edit', () => { - //let filename = `${uploadedFileName}`.substring(0,20) // validate URL of uploaded CSV file cy.visit('/admin/dkan/datasets') cy.get('#edit-title').type(title) From a6182a438efd661c9702d41147bf0c920932f138 Mon Sep 17 00:00:00 2001 From: Janette Day Date: Thu, 5 May 2022 15:57:18 -0500 Subject: [PATCH 16/17] clean up even more --- cypress/integration/11_admin_dataset_file_upload.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/integration/11_admin_dataset_file_upload.spec.js b/cypress/integration/11_admin_dataset_file_upload.spec.js index d8528e1a22..0f4c28b73a 100644 --- a/cypress/integration/11_admin_dataset_file_upload.spec.js +++ b/cypress/integration/11_admin_dataset_file_upload.spec.js @@ -70,7 +70,7 @@ context('Admin dataset file upload', () => { cy.contains('h1', 'Edit Data'); cy.get('#edit-field-json-metadata-0-value-distribution-distribution-0-distribution-downloadurl a') .invoke('attr', 'href') - .should('contain', fileUrl.split('_').pop()) + .should('eq', fileUrl) }) }) From 4ab17a8dd924ee2c3a6522fcb72e7352fe52e189 Mon Sep 17 00:00:00 2001 From: Janette Day Date: Tue, 10 May 2022 09:18:00 -0500 Subject: [PATCH 17/17] Update config.yml --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 232aa82a96..2f56ba2ff6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -88,7 +88,7 @@ jobs: type: boolean environment: TEST_RESULTS: /tmp/test-results - DKTL_VERSION: "4.2.10-RC" + DKTL_VERSION: "4.2.10" steps: - prepare_build: upgrade: << parameters.upgrade >> @@ -123,7 +123,7 @@ jobs: parallelism: 4 environment: TEST_RESULTS: /tmp/test-results - DKTL_VERSION: "4.2.10-RC" + DKTL_VERSION: "4.2.10" steps: - prepare_build: upgrade: << parameters.upgrade >>