Skip to content

Commit

Permalink
Merge pull request #498 from IATI/develop
Browse files Browse the repository at this point in the history
Develop to main for v1.9.1
  • Loading branch information
akmiller01 authored Mar 23, 2023
2 parents 9a22110 + b17b7a2 commit 83c7ff1
Show file tree
Hide file tree
Showing 12 changed files with 633 additions and 606 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/develop_CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version-file: '.nvmrc'
cache: 'npm'
Expand Down Expand Up @@ -66,6 +66,12 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/[email protected]
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Cypress CI Run
uses: cypress-io/github-action@v5
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/develop_CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version-file: ".nvmrc"

Expand All @@ -41,6 +41,6 @@ jobs:
pull-requests: write
contents: write
steps:
- uses: fastify/github-action-merge-dependabot@v3.5
- uses: fastify/github-action-merge-dependabot@v3.6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
8 changes: 7 additions & 1 deletion .github/workflows/main_CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version-file: ".nvmrc"
cache: "npm"
Expand Down Expand Up @@ -54,6 +54,12 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/[email protected]
with:
node-version-file: ".nvmrc"
cache: "npm"

- name: Cypress CI Run
uses: cypress-io/github-action@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main_CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version-file: ".nvmrc"

Expand Down
72 changes: 35 additions & 37 deletions cypress/integration/activity.spec.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
/// <reference types="Cypress"/>

describe("The single activity view", () => {
it("Normal activity page renders with expected data", () => {
cy.fixture("activity_test").then((activity_test) => {
cy.intercept(
"https://dev-api.iatistandard.org/dss/activity/select?wt=json&sort=iati_identifier%20asc&fl=title_narrative,title_narrative_xml_lang,description_narrative,description_narrative_xml_lang,participating_org_narrative,participating_org_narrative_xml_lang,iati_identifier,last_updated_datetime,reporting_org_ref,reporting_org_narrative,reporting_org_narrative_xml_lang,activity_date*&rows=1&q=iati_identifier:%22XM-IATI-1%22",
activity_test
);
cy.intercept(
"https://api.iatistandard.org/dss/activity/select?wt=json&sort=iati_identifier%20asc&fl=title_narrative,title_narrative_xml_lang,description_narrative,description_narrative_xml_lang,participating_org_narrative,participating_org_narrative_xml_lang,iati_identifier,last_updated_datetime,reporting_org_ref,reporting_org_narrative,reporting_org_narrative_xml_lang,activity_date*&rows=1&q=iati_identifier:%22XM-IATI-1%22",
activity_test
);
describe('The single activity view', () => {
it('Normal activity page renders with expected data', () => {
cy.fixture('activity_test').then((activity_test) => {
cy.intercept(
'https://dev-api.iatistandard.org/dss/activity/select?wt=json&sort=iati_identifier%20asc&fl=title_narrative,title_narrative_xml_lang,description_narrative,description_narrative_xml_lang,participating_org_narrative,participating_org_narrative_xml_lang,iati_identifier,last_updated_datetime,reporting_org_ref,reporting_org_narrative,reporting_org_narrative_xml_lang,activity_date*&rows=1&q=iati_identifier:%22XM-IATI-1%22',
activity_test
);
cy.intercept(
'https://api.iatistandard.org/dss/activity/select?wt=json&sort=iati_identifier%20asc&fl=title_narrative,title_narrative_xml_lang,description_narrative,description_narrative_xml_lang,participating_org_narrative,participating_org_narrative_xml_lang,iati_identifier,last_updated_datetime,reporting_org_ref,reporting_org_narrative,reporting_org_narrative_xml_lang,activity_date*&rows=1&q=iati_identifier:%22XM-IATI-1%22',
activity_test
);
});
cy.visit('/activity/XM-IATI-1');
cy.contains('XM-IATI-1');
cy.contains('IATI Test Activity');
cy.contains('This is an example description');
cy.contains('IATI Test Org, UK');
cy.contains('IATI Test Participating Org, UK');
});
cy.visit("/activity/XM-IATI-1");
cy.contains("XM-IATI-1");
cy.contains("IATI Test Activity");
cy.contains("This is an example description");
cy.contains("IATI Test Org, UK");
cy.contains("IATI Test Participating Org, UK");
});

it("Activity page with blank fields renders with expected data", () => {
cy.fixture("activity_blank_fields_test").then(
(activity_blank_fields_test) => {
cy.intercept(
"https://dev-api.iatistandard.org/dss/activity/select?wt=json&sort=iati_identifier%20asc&fl=title_narrative,title_narrative_xml_lang,description_narrative,description_narrative_xml_lang,participating_org_narrative,participating_org_narrative_xml_lang,iati_identifier,last_updated_datetime,reporting_org_ref,reporting_org_narrative,reporting_org_narrative_xml_lang,activity_date*&rows=1&q=iati_identifier:%22XM-IATI-2%22",
activity_blank_fields_test
);
cy.intercept(
"https://api.iatistandard.org/dss/activity/select?wt=json&sort=iati_identifier%20asc&fl=title_narrative,title_narrative_xml_lang,description_narrative,description_narrative_xml_lang,participating_org_narrative,participating_org_narrative_xml_lang,iati_identifier,last_updated_datetime,reporting_org_ref,reporting_org_narrative,reporting_org_narrative_xml_lang,activity_date*&rows=1&q=iati_identifier:%22XM-IATI-2%22",
activity_blank_fields_test
);
}
);
cy.visit("/activity/XM-IATI-2");
cy.contains("Title not provided");
cy.contains("Description not provided");
cy.contains("Name not provided");
cy.contains("Participating organisations: Not provided");
});
it('Activity page with blank fields renders with expected data', () => {
cy.fixture('activity_blank_fields_test').then((activity_blank_fields_test) => {
cy.intercept(
'https://dev-api.iatistandard.org/dss/activity/select?wt=json&sort=iati_identifier%20asc&fl=title_narrative,title_narrative_xml_lang,description_narrative,description_narrative_xml_lang,participating_org_narrative,participating_org_narrative_xml_lang,iati_identifier,last_updated_datetime,reporting_org_ref,reporting_org_narrative,reporting_org_narrative_xml_lang,activity_date*&rows=1&q=iati_identifier:%22XM-IATI-2%22',
activity_blank_fields_test
);
cy.intercept(
'https://api.iatistandard.org/dss/activity/select?wt=json&sort=iati_identifier%20asc&fl=title_narrative,title_narrative_xml_lang,description_narrative,description_narrative_xml_lang,participating_org_narrative,participating_org_narrative_xml_lang,iati_identifier,last_updated_datetime,reporting_org_ref,reporting_org_narrative,reporting_org_narrative_xml_lang,activity_date*&rows=1&q=iati_identifier:%22XM-IATI-2%22',
activity_blank_fields_test
);
});
cy.visit('/activity/XM-IATI-2');
cy.contains('Title not provided');
cy.contains('Description not provided');
cy.contains('Name not provided');
cy.contains('Participating organisations: Not provided');
});
});
47 changes: 22 additions & 25 deletions cypress/integration/advanced.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference types="Cypress"/>

describe('The advanced view', () => {
it('has a button to add filters', () => {
describe('The advanced view', { testIsolation: false }, () => {
beforeEach(() => {
cy.intercept('https://dev-api.iatistandard.org/dss/resources/filters?locale=en').as(
'getFilters'
);
Expand All @@ -10,12 +10,16 @@ describe('The advanced view', () => {
);
cy.visit('/advanced');
cy.wait('@getFilters');
});
it('has a button to add filters', () => {
cy.contains('Add Filter');
});

describe('side bar', () => {
it('creates a dropdown when you click Add Filters button', () => {
beforeEach(() => {
cy.get('button[aria-label="Add an additional filter"]').click();
});
it('creates a dropdown when you click Add Filters button', () => {
cy.contains('Select field');
});

Expand All @@ -25,11 +29,14 @@ describe('The advanced view', () => {
});

it('yields an error message when the search is run empty', () => {
cy.get('select').eq(1).select('Title Narrative');
cy.get('button[aria-label="Run search query with selected filters"]').click();
cy.contains('Search term is required');
});

it('clears the error message when another field is selected', () => {
cy.get('select').eq(1).select('Title Narrative');
cy.get('button[aria-label="Run search query with selected filters"]').click();
cy.get('select').eq(1).select('Dataset Version');
cy.contains('Search term is required').should('not.exist');
});
Expand All @@ -45,8 +52,8 @@ describe('The advanced view', () => {

const urlSuffix = '&sort=score+desc';

it('can select boolean filters', () => {
cy.get('button[aria-label="Remove filter"]').click();
it('can add/run all filter types and import/export the generated config', () => {
// boolean filters
cy.get('button[aria-label="Add an additional filter"]').click();
cy.get('select').eq(1).select('Humanitarian');
cy.get('button[aria-label="Run search query with selected filters"]').click();
Expand All @@ -61,9 +68,8 @@ describe('The advanced view', () => {
cy.wrap(interception.response.statusCode).should('eq', 200);
});
});
});

it('can select date filters', () => {
// date filters
const now = new Date(2022, 0, 1).getTime();
cy.clock(now);
cy.get('button[aria-label="Add an additional filter"]').click();
Expand All @@ -84,9 +90,8 @@ describe('The advanced view', () => {
cy.wrap(interception.response.statusCode).should('eq', 200);
});
});
});

it('can select integer filters', () => {
// integer filters
cy.get('button[aria-label="Add an additional filter"]').click();
cy.get('select').eq(3).select('Hierarchy');
cy.get('button[aria-label="Run search query with selected filters"]').click();
Expand All @@ -106,9 +111,8 @@ describe('The advanced view', () => {
cy.wrap(interception.response.statusCode).should('eq', 200);
});
});
});

it('can select number filters', () => {
// number filters
cy.get('button[aria-label="Add an additional filter"]').click();
cy.get('select').eq(4).select('Sector Percentage');
cy.get('button[aria-label="Run search query with selected filters"]').click();
Expand All @@ -129,9 +133,8 @@ describe('The advanced view', () => {
cy.wrap(interception.response.statusCode).should('eq', 200);
});
});
});

it('can select select filters', () => {
// select filters
cy.get('button[aria-label="Add an additional filter"]').click();
cy.get('select').eq(5).select('Budget Type');
cy.get('button[aria-label="Run search query with selected filters"]').click();
Expand All @@ -155,9 +158,8 @@ describe('The advanced view', () => {
cy.wrap(interception.response.statusCode).should('eq', 200);
});
});
});

it('can select text filters', () => {
// text filters
cy.get('button[aria-label="Add an additional filter"]').click();
cy.get('select').eq(7).select('Title Narrative');
cy.wait(1000);
Expand All @@ -179,9 +181,8 @@ describe('The advanced view', () => {
cy.wrap(interception.response.statusCode).should('eq', 200);
});
});
});

it('can select grouping filters', () => {
// grouping filters
cy.get('button[aria-label="Add an additional filter"]').click();
cy.get('select').eq(8).select('Boolean Grouping');
cy.wait(1000);
Expand Down Expand Up @@ -216,9 +217,8 @@ describe('The advanced view', () => {
cy.wrap(interception.response.statusCode).should('eq', 200);
});
});
});

it('can use the spatial filter', () => {
// spatial filter
cy.get('button[aria-label="Add an additional filter"]').click();
cy.get('select').eq(12).select('Geospatial search');
cy.wait(1000);
Expand All @@ -244,9 +244,8 @@ describe('The advanced view', () => {
cy.wrap(interception.response.statusCode).should('eq', 200);
});
});
});

it('can select combo filters', () => {
// combo filters
cy.get('button[aria-label="Add an additional filter"]').click();
cy.get('select').eq(13).select('Sector Code');
cy.wait(1000);
Expand All @@ -271,9 +270,8 @@ describe('The advanced view', () => {
cy.wrap(interception.response.statusCode).should('eq', 200);
});
});
});

it('can export and import filters', () => {
// export and import filters
const downloadsFolder = Cypress.config('downloadsFolder');
cy.get('button[aria-label="Export filters to file"]').click();
cy.get('button.bg-iati-grey:contains("Export")').click();
Expand Down Expand Up @@ -312,9 +310,8 @@ describe('The advanced view', () => {
});
});
});
});

it('can continue to function normally after import', () => {
// function normally after import
cy.get('button[aria-label="Add an additional filter"]').click();
cy.get('select').eq(14).select('Description Narrative');
cy.wait(1000);
Expand Down
48 changes: 26 additions & 22 deletions cypress/integration/landing.spec.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
/// <reference types="Cypress"/>

describe("The landing view", () => {
it("has a header", () => {
cy.visit("/");
cy.contains("Datastore Search");
});

it("has a visible search bar", () => {
cy.visit("/");
cy.get("input[title=Search]").should("be.visible");
});
describe('The landing view', () => {
it('has a header', () => {
cy.visit('/');
cy.contains('Datastore Search');
});

it("has a footer", () => {
cy.visit("/");
cy.contains("IATI Unified Platform");
});
it('has a visible search bar', () => {
cy.visit('/');
cy.get('input[title=Search]').should('be.visible');
});

describe("search bar", () => {
it("routes a search to the simple view", () => {
cy.get("input[title=Search]").type("test");
cy.get("button[aria-label=Submit]").click();
cy.url().should("includes", "/simple");
it('has a footer', () => {
cy.visit('/');
cy.contains('IATI Unified Platform');
});

it("retains the search term after routing", () => {
cy.get("input[title=Search]").should("have.value", "test");
describe('search bar', () => {
it('routes a search to the simple view', () => {
cy.visit('/');
cy.get('input[title=Search]').type('test');
cy.get('button[aria-label=Submit]').click();
cy.url().should('includes', '/simple');
});

it('retains the search term after routing', () => {
cy.visit('/');
cy.get('input[title=Search]').type('test');
cy.get('button[aria-label=Submit]').click();
cy.get('input[title=Search]').should('have.value', 'test');
});
});
});
});
Loading

0 comments on commit 83c7ff1

Please sign in to comment.