Skip to content

Commit ab16cfd

Browse files
authored
Merge pull request #101 from UoA-eResearch/master
CSS & Test Optimisations, new pages Funding and Case Study
2 parents 6de0221 + 26c201d commit ab16cfd

File tree

129 files changed

+26106
-2114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+26106
-2114
lines changed

Jenkinsfile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ pipeline {
1515
label("uoa-buildtools-ionic")
1616
}
1717

18+
options {
19+
buildDiscarder(
20+
logRotator(
21+
daysToKeepStr: "30"
22+
)
23+
)
24+
}
25+
1826
stages {
1927

2028
stage('Checkout') {
@@ -191,7 +199,7 @@ pipeline {
191199
}
192200

193201
stage('Run tests') {
194-
parallel {
202+
stages {
195203
stage('Run research-hub-web tests') {
196204
when {
197205
anyOf {
@@ -203,12 +211,11 @@ pipeline {
203211
echo 'Testing research-hub-web project'
204212

205213
dir("research-hub-web") {
206-
// TODO Disable tests for now, make them work in Jenkins!
207-
// echo 'Running research-hub-web unit tests'
208-
// sh 'npm run test-ci'
214+
echo 'Running research-hub-web unit tests'
215+
sh 'npm run test-ci'
209216

210-
// echo 'Running research-hub-web e2e tests'
211-
// sh "npm run e2e-ci"
217+
echo 'Running research-hub-web e2e tests'
218+
sh "npm run e2e-ci"
212219
}
213220
}
214221
}

hub-search-proxy/handler.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module.exports.search = async (event, context) => {
5454
let size = 10;
5555
let from = 0;
5656
let queryFilters = {};
57-
let contentTypes = ["article","casestudy","equipment","event","service","software","subhub"];
57+
let contentTypes = ["article","casestudy","equipment","event", "funding", "service","software","subhub"];
5858
let sort = [];
5959

6060
if (requestBody.hasOwnProperty('query')) {
@@ -70,11 +70,11 @@ module.exports.search = async (event, context) => {
7070
queryFilters = requestBody.filters;
7171
}
7272
if (requestBody.hasOwnProperty('includeContentTypes') && requestBody.includeContentTypes.length > 0) {
73-
const validContentTypes = ["article","casestudy","equipment","event","service","software","subhub"];
73+
const validContentTypes = ["article","casestudy","equipment","event", "funding", "service","software","subhub"];
7474
contentTypes = requestBody.includeContentTypes.map(contentType => contentType.toLowerCase());
7575
for(const type of contentTypes) {
7676
if (!validContentTypes.includes(type)) {
77-
throw new Error(`Received invalid content type: ${type}. Valid types are: article, casestudy, equipment, event, service, software, subhub`);
77+
throw new Error(`Received invalid content type: ${type}. Valid types are: article, casestudy, equipment, event, funding, service, software, subhub`);
7878
}
7979
}
8080
}
@@ -373,7 +373,7 @@ module.exports.delete = async (event, context) => {
373373
*/
374374
module.exports.bulk = async () => {
375375
let validEntries;
376-
const validContentTypes = ['article','caseStudy','equipment','event','service','software','subHub'];
376+
const validContentTypes = ['article','caseStudy','equipment','event', 'funding', 'service','software','subHub'];
377377

378378
try {
379379
// contentful export and filter entries

research-hub-web/angular.json

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"outputPath": "www",
1616
"index": "src/index.html",
1717
"main": "src/main.ts",
18-
"tsConfig": "tsconfig.json",
18+
"tsConfig": "tsconfig.build.json",
1919
"polyfills": "src/polyfills.ts",
2020
"assets": [
2121
"./src/assets"
@@ -28,8 +28,14 @@
2828
"allowedCommonJsDependencies": [
2929
"graphql-tag",
3030
"crypto-js",
31-
"zen-observable"
32-
]
31+
"zen-observable",
32+
"markdown-to-html-pipe"
33+
],
34+
"stylePreprocessorOptions": {
35+
"includePaths": [
36+
"src/partial-styles/"
37+
]
38+
}
3339
},
3440
"configurations": {
3541
"local": {
@@ -318,7 +324,12 @@
318324
],
319325
"assets": [
320326
"src/assets"
321-
]
327+
],
328+
"stylePreprocessorOptions": {
329+
"includePaths": [
330+
"src/partial-styles/"
331+
]
332+
}
322333
}
323334
},
324335
"lint": {
@@ -347,4 +358,4 @@
347358
"cli": {
348359
"analytics": false
349360
}
350-
}
361+
}

research-hub-web/cypress.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"chromeWebSecurity": false,
33
"baseUrl": "http://localhost:4200/",
4-
"defaultCommandTimeout": 20000
4+
"defaultCommandTimeout": 20000,
5+
"retries": {
6+
"runMode": 2,
7+
"openMode": 0
8+
},
9+
"ignoreTestFiles": ["**/caseStudy.e2e.js", "**/fundings.e2e.js"]
510
}

research-hub-web/cypress/integration/articles.e2e.js

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,32 @@ describe('ResearchHubs Article Pages', () => {
55
});
66

77
it('can visit an article and display its title', () => {
8-
cy.contains('Open Access');
8+
cy.expect('h1.content-title').not.to.be.empty;
99
});
1010

1111
it('can visit an article and display its subtitle', () => {
12-
cy.contains('Open Access brings increased visibility, usage and impact to researchers and institutions. It benefits researchers, institutions, nations and society as a whole.');
12+
cy.expect('#article-container .content-summary').not.to.be.empty;
1313
});
1414

1515
it('article displays body text', () => {
16-
cy.contains('Open access is making published research');
16+
cy.expect('#article-container ng-component.ng-star-inserted').not.to.be.empty;
1717
});
1818

1919
it('displays a list of related items', () => {
2020
cy.get('#you-might-be-interested-in').should('exist');
2121
});
2222

2323
it('clicking a related item takes you to its page', () => {
24-
cy.get('#you-might-be-interested-in').contains('Creative Commons').click();
25-
cy.contains('Open Content');
24+
cy.get('#you-might-be-interested-in mat-nav-list:first-child').click();
25+
cy.expect('h2.featured-title').not.to.be.empty;
2626
});
2727

28-
// it('displays a list of contacts', () => {
29-
// cy.get('#contacts').contains('Dharani Sontam').should('exist');
30-
// });
31-
3228
it('displays a list of documents', () => {
3329
cy.get('#documents').contains('Open Access Guidelines').should('exist');
3430
});
3531

36-
// Cypress doesn't support multi-tabs
37-
//
38-
// it('clicking on a documents takes you to the documents', () => {
39-
// cy.get('#documents').contains('IT Acceptable Use Guidelines').click();
40-
// cy.contains('The Impact of Research');
41-
// });
42-
4332
it('displays a list of organisations', () => {
44-
cy.get('#organisations').contains('Libraries and Learning Services').should('exist');
33+
cy.get('#organisations').should('exist');
4534
});
4635

47-
// Cypress doesn't dupport multi-tab testing
48-
//
49-
// it('clicking on an organisation takes you to the organisation', () => {
50-
// cy.get('#organisations').contains('Centre for eResearch').click();
51-
// cy.contains("The Office of Research Strategy and Integrity (ORSI) was established in 2018 to support the work of the Deputy Vice Chancellor Research and the University's Research Committee in: ");
52-
// });
5336
});

research-hub-web/cypress/integration/basic-functionality.e2e.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,17 @@ describe('ResearchHubs Basic Functionality', () => {
88
cy.visit('/');
99
});
1010

11-
it('has title', () => {
12-
cy.contains('ResearchHub');
11+
it('page loads and has title', () => {
12+
cy.expect('title').not.to.be.empty;
13+
});
14+
15+
it('an image asset is displayed', () => {
16+
cy.get('[alt="hub-logo"]')
17+
.should('be.visible')
18+
.and(($img) => {
19+
// "naturalWidth" and "naturalHeight" are set when the image loads
20+
expect($img[0].naturalWidth).to.be.greaterThan(0);
21+
});
1322
});
14-
});
1523

24+
});
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
describe('ResearchHubs Case Study Pages', () => {
2+
3+
beforeEach(() => {
4+
cy.visit('/casestudy/test-case-study');
5+
});
6+
7+
it('can visit a case study and display its title', () => {
8+
cy.expect('h1.content-title').not.to.be.empty;
9+
});
10+
11+
it('can visit a case study and display its subtitle', () => {
12+
cy.expect('#case-study-container .content-summary').not.to.be.empty;
13+
});
14+
15+
it('case study displays body text', () => {
16+
cy.expect('#case-study-container ng-component.ng-star-inserted').not.to.be.empty;
17+
});
18+
19+
it('displays a list of related items', () => {
20+
cy.get('#you-might-be-interested-in').should('exist');
21+
});
22+
23+
it('displays a list of contacts', () => {
24+
cy.expect('#contacts .card-title').not.to.be.empty;
25+
});
26+
27+
it('displays a list of documents', () => {
28+
cy.expect('#documents .card-title').not.to.be.empty;
29+
});
30+
31+
});

research-hub-web/cypress/integration/equipment.e2e.js

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ describe('ResearchHubs Equipment Pages', () => {
55
});
66

77
it('can visit an equipment and display its title', () => {
8-
cy.contains('Operetta High-Content Imaging System');
8+
cy.expect('h1.content-title').not.to.be.empty;
99
});
1010

11-
it('can visit an equipment and display its subtitle', () => {
12-
cy.contains('The Operetta is an automated microscope which enables you to study many features simultaneously in complex biological systems. This is known as High Content Screening as extensive data can be generated from the images the Operetta captures.');
11+
it('can visit an equipment page and display its subtitle', () => {
12+
cy.expect('.content-summary').not.to.be.empty;
1313
});
1414

1515
it('equipment displays body text', () => {
16-
cy.contains('The School of Biological Sciences (SBS) hosts an Operetta high-content screening (HCS) system that can be used for imaging cells and samples in great detail from slides and multi-well plates. This is useful for assay development, genome-wide siRNA, compound screens and many other image-based applications. The Operetta system has associated analysis tools to generate statistically valid numerical data from the microscope images it captures.');
16+
cy.expect('#equipment-container p .ng-star-inserted').not.to.be.empty;
1717
});
1818

1919
it('equipment displays specifications table', () => {
@@ -31,27 +31,12 @@ describe('ResearchHubs Equipment Pages', () => {
3131
});
3232

3333
it('clicking a related item takes you to its page', () => {
34-
cy.get('#you-might-be-interested-in').contains('FoS Shared Research Equipment (ShaRE)').click();
35-
cy.contains('ShaRE houses core research facilities within the Faculty of Science to help people access the key analytical equipment and expertise necessary to support quality research and teaching.');
34+
cy.get('#you-might-be-interested-in .mat-nav-list:first-child a.card-title').click();
35+
cy.expect('.banner-content h1').not.to.be.empty;
3636
});
3737

38-
// No document in equipment
39-
//
40-
// it('displays a list of documents', () => {
41-
// cy.get('#documents').contains('IT Acceptable Use Policy').should('exist');
42-
// });
43-
44-
// it('clicking on a documents takes you to the documents', () => {
45-
// cy.get('#documents').contains('Health Research Council – Research Impact Guidance').invoke('removeAttr', 'target').click();
46-
// cy.contains('The Impact of Research');
47-
// });
48-
4938
it('displays a list of organisations', () => {
50-
cy.get('#organisations').contains('School of Biological Sciences').should('exist');
39+
cy.expect('#organisations mat-card:first-child h4').not.to.be.empty;
5140
});
5241

53-
// it('clicking on an organisation takes you to the organisation', () => {
54-
// cy.get('#organisations').children().invoke('removeAttr', 'target').contains('School of Biological Sciences').click();
55-
// cy.contains("Our school offers state-of-the-art research and teaching across a range of subject areas within the field of biological sciences. Find out more below.");
56-
// });
5742
});

research-hub-web/cypress/integration/events.e2e.js

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,28 @@ describe('ResearchHubs Events Pages', () => {
55
});
66

77
it('can visit an event and display its title', () => {
8-
cy.contains('Orientation and Welcome Events');
8+
cy.expect('h1.content-title').not.to.be.empty;
99
});
1010

1111
it('can visit an event and display its subtitle', () => {
12-
cy.contains('The Orientation and Welcome Events curriculum is a package of events that are designed to help welcome new staff to the University');
12+
cy.expect('.content-summary').not.to.be.empty;
1313
});
1414

1515
it('event displays body text', () => {
16-
cy.contains('The Orientation and Welcome Events curriculum is a package of events that are designed to help welcome new staff to the University.');
16+
cy.expect('#event-container p .ng-star-inserted').not.to.be.empty;
1717
});
1818

1919
it('event displays specifications table', () => {
2020
cy.get('#specifications-table').contains('Details').should('exist');
2121
cy.get('#specifications-table').contains('Description').should('exist');
2222
});
2323

24-
// it('displays a list of related items', () => {
25-
// cy.get('#you-might-be-interested-in').should('exist');
26-
// });
27-
28-
// it('clicking a related item takes you to its page', () => {
29-
// cy.get('#you-might-be-interested-in').contains('Data Carpentry').click();
30-
// cy.contains('Data Carpentry workshops teach core skills for working with data effectively and reproducibly');
31-
// });
32-
3324
it('displays a list of contacts', () => {
34-
cy.get('#contacts').contains('Organisational Development (OD)').should('exist');
25+
cy.expect('#contacts .card-title').not.to.be.empty;
3526
});
3627

37-
// it('displays a list of documents', () => {
38-
// cy.get('#documents').contains('Code of Conduct').should('exist');
39-
// });
40-
41-
// Cypress doesn't dupport multi-tab testing
42-
//
43-
// it('clicking on a documents takes you to the documents', () => {
44-
// cy.get('#documents').contains('Health Research Council – Research Impact Guidance').click();
45-
// cy.contains('The Impact of Research');
46-
// });
47-
4828
it('displays a list of organisations', () => {
49-
cy.get('#organisations').contains('Organisational Development (OD)').should('exist');
29+
cy.expect('#organisations mat-card:first-child h4').not.to.be.empty;
5030
});
5131

52-
// Cypress doesn't dupport multi-tab testing
53-
//
54-
// it('clicking on an organisation takes you to the organisation', () => {
55-
// cy.get('#organisations').contains('Office of Research Strategy and Integrity').click();
56-
// cy.contains("The Office of Research Strategy and Integrity (ORSI) was established in 2018 to support the work of the Deputy Vice Chancellor Research and the University's Research Committee in: ");
57-
// });
5832
});
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
describe('ResearchHubs Funding Pages', () => {
2+
3+
beforeEach(() => {
4+
cy.visit('/funding/FRDF');
5+
});
6+
7+
it('can visit a funding page and display its title', () => {
8+
cy.expect('h1.content-title').not.to.be.empty;
9+
});
10+
11+
it('can visit a funding page and display its subtitle', () => {
12+
cy.expect('#funding-container .content-summary').not.to.be.empty;
13+
});
14+
15+
it('funding page displays body text', () => {
16+
cy.expect('#funding-container ng-component.ng-star-inserted').not.to.be.empty;
17+
});
18+
19+
it('displays specifications table', () => {
20+
cy.get('#specifications-table').contains('Details').should('exist');
21+
cy.get('#specifications-table').contains('Description').should('exist');
22+
});
23+
24+
it('displays a list of contacts', () => {
25+
cy.get('#contacts').should('exist');
26+
});
27+
28+
it('displays a list of organisations', () => {
29+
cy.get('#organisations').should('exist');
30+
});
31+
});

0 commit comments

Comments
 (0)