Skip to content

Commit

Permalink
Merge pull request #1580 from ral-facilities/fix-datapublications-test
Browse files Browse the repository at this point in the history
Fix Data Publications e2e Test
  • Loading branch information
MRichards99 authored Sep 7, 2023
2 parents 03afc7e + a8a6c92 commit bbbec98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
with:
repository: ral-facilities/datagateway-api
path: datagateway-api
ref: v7.1.0
ref: v9.0.1

# DataGateway API file setup
- name: Create search_api_mapping.json
Expand Down Expand Up @@ -288,7 +288,7 @@ jobs:
with:
repository: ral-facilities/datagateway-api
path: datagateway-api
ref: v7.1.0
ref: v9.0.1

# DataGateway API file setup
- name: Create search_api_mapping.json
Expand Down Expand Up @@ -418,7 +418,7 @@ jobs:
with:
repository: ral-facilities/datagateway-api
path: datagateway-api
ref: v7.1.0
ref: v9.0.1

# DataGateway API file setup
- name: Create search_api_mapping.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,41 +110,15 @@ describe('ISIS - Data Publication Table', () => {
'Church child time Congress'
);

let toDate = '2016-01-01';
let fromDate = '2014-01-01';
// TODO: make this less scuffed when https://github.com/ral-facilities/datagateway-api/issues/444 is fixed
if (Cypress.env('CI')) {
// can get the below date by looking at the createTime of any datafiles on SG preprod
const sgPreprodGenerationDate = new Date('2023-03-28');
// get rid of any timezone offset
sgPreprodGenerationDate.setHours(0);
const today = new Date();
today.setHours(0);
today.setMinutes(0);
today.setSeconds(0);
today.setMilliseconds(0);
const diff = today.getTime() - sgPreprodGenerationDate.getTime();

const toDateDate = new Date(toDate);
toDateDate.setHours(0);
toDateDate.setTime(toDateDate.getTime() + diff);
toDate = toDateDate.toLocaleDateString('sv').split(' ')[0];

const fromDateDate = new Date(fromDate);
fromDateDate.setHours(0);
fromDateDate.setTime(fromDateDate.getTime() + diff);
fromDate = fromDateDate.toLocaleDateString('sv').split(' ')[0];
}

// test date filter
cy.get('input[id="Publication Date filter to"]').type(toDate);
cy.get('input[id="Publication Date filter to"]').type('2016-01-01');

cy.get('[aria-rowcount="2"]').should('exist');
cy.get('[aria-rowindex="1"] [aria-colindex="1"]').contains(
'Consider author watch'
);

cy.get('input[id="Publication Date filter from"]').type(fromDate);
cy.get('input[id="Publication Date filter from"]').type('2014-01-01');

cy.get('[aria-rowcount="1"]').should('exist');
});
Expand Down

0 comments on commit bbbec98

Please sign in to comment.