Skip to content

Commit 3d1c597

Browse files
committed
Merged in DSC-283-align-with-7.1 (pull request #41)
DSC-283 align with 7.1
2 parents 00ecd00 + f1b60c0 commit 3d1c597

349 files changed

Lines changed: 19662 additions & 9533 deletions

File tree

Some content is hidden

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

.github/workflows/build.yml

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
DSPACE_REST_PORT: 8080
1717
DSPACE_REST_NAMESPACE: '/server'
1818
DSPACE_REST_SSL: false
19-
# When Chrome version is specified, we pin to a specific version of Chrome & ChromeDriver
20-
# Comment this out to use the latest release of both.
21-
CHROME_VERSION: "90.0.4430.212-1"
19+
# When Chrome version is specified, we pin to a specific version of Chrome
20+
# Comment this out to use the latest release
21+
#CHROME_VERSION: "90.0.4430.212-1"
2222
strategy:
2323
# Create a matrix of Node versions to test against (in parallel)
2424
matrix:
@@ -66,12 +66,6 @@ jobs:
6666
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
6767
restore-keys: ${{ runner.os }}-yarn-
6868

69-
- name: Install latest ChromeDriver compatible with installed Chrome
70-
# needs to be npm, the --detect_chromedriver_version flag doesn't work with yarn global
71-
run: |
72-
npm install -g chromedriver --detect_chromedriver_version
73-
chromedriver -v
74-
7569
- name: Install Yarn dependencies
7670
run: yarn install --frozen-lockfile
7771

@@ -99,23 +93,40 @@ jobs:
9993
docker-compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli
10094
docker container ls
10195
102-
# Wait until the REST API returns a 200 response (or for a max of 30 seconds)
103-
# https://github.com/nev7n/wait_for_response
104-
- name: Wait for DSpace REST Backend to be ready (for e2e tests)
105-
uses: nev7n/wait_for_response@v1
106-
with:
107-
# We use the 'sites' endpoint to also ensure the database is ready
108-
url: 'http://localhost:8080/server/api/core/sites'
109-
responseCode: 200
110-
timeout: 30000
111-
112-
- name: Get DSpace REST Backend info/properties
113-
run: curl http://localhost:8080/server/api
114-
96+
# Run integration tests via Cypress.io
97+
# https://github.com/cypress-io/github-action
98+
# (NOTE: to run these e2e tests locally, just use 'ng e2e')
11599
- name: Run e2e tests (integration tests)
116-
run: |
117-
chromedriver --url-base='/wd/hub' --port=4444 &
118-
yarn run e2e:ci
100+
uses: cypress-io/github-action@v2
101+
with:
102+
# Run tests in Chrome, headless mode
103+
browser: chrome
104+
headless: true
105+
# Start app before running tests (will be stopped automatically after tests finish)
106+
start: yarn run serve:ssr
107+
# Wait for backend & frontend to be available
108+
# NOTE: We use the 'sites' REST endpoint to also ensure the database is ready
109+
wait-on: http://localhost:8080/server/api/core/sites, http://localhost:4000
110+
# Wait for 2 mins max for everything to respond
111+
wait-on-timeout: 120
112+
113+
# Cypress always creates a video of all e2e tests (whether they succeeded or failed)
114+
# Save those in an Artifact
115+
- name: Upload e2e test videos to Artifacts
116+
uses: actions/upload-artifact@v2
117+
if: always()
118+
with:
119+
name: e2e-test-videos
120+
path: cypress/videos
121+
122+
# If e2e tests fail, Cypress creates a screenshot of what happened
123+
# Save those in an Artifact
124+
- name: Upload e2e test failure screenshots to Artifacts
125+
uses: actions/upload-artifact@v2
126+
if: failure()
127+
with:
128+
name: e2e-test-screenshots
129+
path: cypress/screenshots
119130

120131
# Start up the app with SSR enabled (run in background)
121132
- name: Start app in SSR (server-side rendering) mode

README.md

Lines changed: 72 additions & 91 deletions
Large diffs are not rendered by default.

angular.json

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,19 @@
151151
"tsConfig": [
152152
"tsconfig.app.json",
153153
"tsconfig.spec.json",
154-
"e2e/tsconfig.json"
154+
"cypress/tsconfig.json"
155155
],
156156
"exclude": [
157157
"**/node_modules/**"
158158
]
159159
}
160160
},
161161
"e2e": {
162-
"builder": "@angular-devkit/build-angular:protractor",
162+
"builder": "@cypress/schematic:cypress",
163163
"options": {
164-
"protractorConfig": "e2e/protractor.conf.js",
165-
"devServerTarget": "dspace-angular:serve"
164+
"devServerTarget": "dspace-angular:serve",
165+
"watch": true,
166+
"headless": false
166167
},
167168
"configurations": {
168169
"production": {
@@ -219,6 +220,24 @@
219220
"configurations": {
220221
"production": {}
221222
}
223+
},
224+
"cypress-run": {
225+
"builder": "@cypress/schematic:cypress",
226+
"options": {
227+
"devServerTarget": "dspace-angular:serve"
228+
},
229+
"configurations": {
230+
"production": {
231+
"devServerTarget": "dspace-angular:serve:production"
232+
}
233+
}
234+
},
235+
"cypress-open": {
236+
"builder": "@cypress/schematic:cypress",
237+
"options": {
238+
"watch": true,
239+
"headless": false
240+
}
222241
}
223242
}
224243
}
@@ -227,4 +246,4 @@
227246
"cli": {
228247
"analytics": false
229248
}
230-
}
249+
}

cypress.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"integrationFolder": "cypress/integration",
3+
"supportFile": "cypress/support/index.ts",
4+
"videosFolder": "cypress/videos",
5+
"screenshotsFolder": "cypress/screenshots",
6+
"pluginsFile": "cypress/plugins/index.ts",
7+
"fixturesFolder": "cypress/fixtures",
8+
"baseUrl": "http://localhost:4000"
9+
}

cypress/fixtures/example.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "hello@cypress.io",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { TEST_ENTITY_PUBLICATION } from 'cypress/support';
2+
import { testA11y } from 'cypress/support/utils';
3+
import { Options } from 'cypress-axe';
4+
5+
xdescribe('Breadcrumbs', () => {
6+
it('should pass accessibility tests', () => {
7+
// Visit an Item, as those have more breadcrumbs
8+
cy.visit('/entities/publication/' + TEST_ENTITY_PUBLICATION);
9+
10+
// Wait for breadcrumbs to be visible
11+
cy.get('ds-breadcrumbs').should('be.visible');
12+
13+
// Analyze <ds-breadcrumbs> for accessibility
14+
testA11y('ds-breadcrumbs',
15+
{
16+
rules: {
17+
'heading-order': { enabled: false }
18+
}
19+
} as Options
20+
);
21+
});
22+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { testA11y } from 'cypress/support/utils';
2+
3+
describe('Browse By Author', () => {
4+
it('should pass accessibility tests', () => {
5+
cy.visit('/browse/author');
6+
7+
// Wait for <ds-browse-by-metadata-page> to be visible
8+
cy.get('ds-browse-by-metadata-page').should('be.visible');
9+
10+
// Analyze <ds-browse-by-metadata-page> for accessibility
11+
testA11y('ds-browse-by-metadata-page');
12+
});
13+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { testA11y } from 'cypress/support/utils';
2+
3+
describe('Browse By Date Issued', () => {
4+
it('should pass accessibility tests', () => {
5+
cy.visit('/browse/dateissued');
6+
7+
// Wait for <ds-browse-by-date-page> to be visible
8+
cy.get('ds-browse-by-date-page').should('be.visible');
9+
10+
// Analyze <ds-browse-by-date-page> for accessibility
11+
testA11y('ds-browse-by-date-page');
12+
});
13+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { testA11y } from 'cypress/support/utils';
2+
3+
describe('Browse By Subject', () => {
4+
it('should pass accessibility tests', () => {
5+
cy.visit('/browse/subject');
6+
7+
// Wait for <ds-browse-by-metadata-page> to be visible
8+
cy.get('ds-browse-by-metadata-page').should('be.visible');
9+
10+
// Analyze <ds-browse-by-metadata-page> for accessibility
11+
testA11y('ds-browse-by-metadata-page');
12+
});
13+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { testA11y } from 'cypress/support/utils';
2+
3+
describe('Browse By Title', () => {
4+
it('should pass accessibility tests', () => {
5+
cy.visit('/browse/title');
6+
7+
// Wait for <ds-browse-by-title-page> to be visible
8+
cy.get('ds-browse-by-title-page').should('be.visible');
9+
10+
// Analyze <ds-browse-by-title-page> for accessibility
11+
testA11y('ds-browse-by-title-page');
12+
});
13+
});

0 commit comments

Comments
 (0)