Skip to content

Commit 59b417d

Browse files
committed
Merge remote-tracking branch 'upstream/main' into w2p-100302_Live-import-issues-7.5
2 parents 4ab9f70 + afc1475 commit 59b417d

67 files changed

Lines changed: 829 additions & 322 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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,19 @@ jobs:
1515
env:
1616
# The ci step will test the dspace-angular code against DSpace REST.
1717
# Direct that step to utilize a DSpace REST service that has been started in docker.
18+
# NOTE: These settings should be kept in sync with those in [src]/docker/docker-compose-ci.yml
1819
DSPACE_REST_HOST: 127.0.0.1
1920
DSPACE_REST_PORT: 8080
2021
DSPACE_REST_NAMESPACE: '/server'
2122
DSPACE_REST_SSL: false
2223
# Spin up UI on 127.0.0.1 to avoid host resolution issues in e2e tests with Node 18+
2324
DSPACE_UI_HOST: 127.0.0.1
25+
DSPACE_UI_PORT: 4000
26+
# Ensure all SSR caching is disabled in test environment
27+
DSPACE_CACHE_SERVERSIDE_BOTCACHE_MAX: 0
28+
DSPACE_CACHE_SERVERSIDE_ANONYMOUSCACHE_MAX: 0
29+
# Tell Cypress to run e2e tests using the same UI URL
30+
CYPRESS_BASE_URL: http://127.0.0.1:4000
2431
# When Chrome version is specified, we pin to a specific version of Chrome
2532
# Comment this out to use the latest release
2633
#CHROME_VERSION: "90.0.4430.212-1"

cypress.config.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { defineConfig } from 'cypress';
2+
3+
export default defineConfig({
4+
videosFolder: 'cypress/videos',
5+
screenshotsFolder: 'cypress/screenshots',
6+
fixturesFolder: 'cypress/fixtures',
7+
retries: {
8+
runMode: 2,
9+
openMode: 0,
10+
},
11+
env: {
12+
// Global constants used in DSpace e2e tests (see also ./cypress/support/e2e.ts)
13+
// May be overridden in our cypress.json config file using specified environment variables.
14+
// Default values listed here are all valid for the Demo Entities Data set available at
15+
// https://github.com/DSpace-Labs/AIP-Files/releases/tag/demo-entities-data
16+
// (This is the data set used in our CI environment)
17+
18+
// Admin account used for administrative tests
19+
DSPACE_TEST_ADMIN_USER: 'dspacedemo+admin@gmail.com',
20+
DSPACE_TEST_ADMIN_PASSWORD: 'dspace',
21+
// Community/collection/publication used for view/edit tests
22+
DSPACE_TEST_COMMUNITY: '0958c910-2037-42a9-81c7-dca80e3892b4',
23+
DSPACE_TEST_COLLECTION: '282164f5-d325-4740-8dd1-fa4d6d3e7200',
24+
DSPACE_TEST_ENTITY_PUBLICATION: 'e98b0f27-5c19-49a0-960d-eb6ad5287067',
25+
// Search term (should return results) used in search tests
26+
DSPACE_TEST_SEARCH_TERM: 'test',
27+
// Collection used for submission tests
28+
DSPACE_TEST_SUBMIT_COLLECTION_NAME: 'Sample Collection',
29+
DSPACE_TEST_SUBMIT_COLLECTION_UUID: '9d8334e9-25d3-4a67-9cea-3dffdef80144',
30+
// Account used to test basic submission process
31+
DSPACE_TEST_SUBMIT_USER: 'dspacedemo+submit@gmail.com',
32+
DSPACE_TEST_SUBMIT_USER_PASSWORD: 'dspace',
33+
},
34+
e2e: {
35+
// Setup our plugins for e2e tests
36+
setupNodeEvents(on, config) {
37+
return require('./cypress/plugins/index.ts')(on, config);
38+
},
39+
// This is the base URL that Cypress will run all tests against
40+
// It can be overridden via the CYPRESS_BASE_URL environment variable
41+
// (By default we set this to a value which should work in most development environments)
42+
baseUrl: 'http://localhost:4000',
43+
},
44+
});

cypress.json

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { TEST_ENTITY_PUBLICATION } from 'cypress/support';
1+
import { TEST_ENTITY_PUBLICATION } from 'cypress/support/e2e';
22
import { testA11y } from 'cypress/support/utils';
33

44
describe('Breadcrumbs', () => {
55
it('should pass accessibility tests', () => {
66
// Visit an Item, as those have more breadcrumbs
7-
cy.visit('/entities/publication/' + TEST_ENTITY_PUBLICATION);
7+
cy.visit('/entities/publication/'.concat(TEST_ENTITY_PUBLICATION));
88

99
// Wait for breadcrumbs to be visible
1010
cy.get('ds-breadcrumbs').should('be.visible');
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

cypress/integration/collection-page.spec.ts renamed to cypress/e2e/collection-page.cy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { TEST_COLLECTION } from 'cypress/support';
1+
import { TEST_COLLECTION } from 'cypress/support/e2e';
22
import { testA11y } from 'cypress/support/utils';
33

44
describe('Collection Page', () => {
55

66
it('should pass accessibility tests', () => {
7-
cy.visit('/collections/' + TEST_COLLECTION);
7+
cy.visit('/collections/'.concat(TEST_COLLECTION));
88

99
// <ds-collection-page> tag must be loaded
10-
cy.get('ds-collection-page').should('exist');
10+
cy.get('ds-collection-page').should('be.visible');
1111

1212
// Analyze <ds-collection-page> for accessibility issues
1313
testA11y('ds-collection-page');
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { REGEX_MATCH_NON_EMPTY_TEXT, TEST_COLLECTION } from 'cypress/support/e2e';
2+
import { testA11y } from 'cypress/support/utils';
3+
4+
describe('Collection Statistics Page', () => {
5+
const COLLECTIONSTATISTICSPAGE = '/statistics/collections/'.concat(TEST_COLLECTION);
6+
7+
it('should load if you click on "Statistics" from a Collection page', () => {
8+
cy.visit('/collections/'.concat(TEST_COLLECTION));
9+
cy.get('ds-navbar ds-link-menu-item a[title="Statistics"]').click();
10+
cy.location('pathname').should('eq', COLLECTIONSTATISTICSPAGE);
11+
});
12+
13+
it('should contain a "Total visits" section', () => {
14+
cy.visit(COLLECTIONSTATISTICSPAGE);
15+
cy.get('table[data-test="TotalVisits"]').should('be.visible');
16+
});
17+
18+
it('should contain a "Total visits per month" section', () => {
19+
cy.visit(COLLECTIONSTATISTICSPAGE);
20+
// Check just for existence because this table is empty in CI environment as it's historical data
21+
cy.get('.'.concat(TEST_COLLECTION).concat('_TotalVisitsPerMonth')).should('exist');
22+
});
23+
24+
it('should pass accessibility tests', () => {
25+
cy.visit(COLLECTIONSTATISTICSPAGE);
26+
27+
// <ds-collection-statistics-page> tag must be loaded
28+
cy.get('ds-collection-statistics-page').should('be.visible');
29+
30+
// Verify / wait until "Total Visits" table's label is non-empty
31+
// (This table loads these labels asynchronously, so we want to wait for them before analyzing page)
32+
cy.get('table[data-test="TotalVisits"] th[data-test="statistics-label"]').contains(REGEX_MATCH_NON_EMPTY_TEXT);
33+
34+
// Analyze <ds-collection-statistics-page> for accessibility issues
35+
testA11y('ds-collection-statistics-page');
36+
});
37+
});

0 commit comments

Comments
 (0)