Skip to content

Commit 6c76d8c

Browse files
committed
Add Edit Community accessibility tests & minor cleanup
1 parent e47593b commit 6c76d8c

4 files changed

Lines changed: 111 additions & 7 deletions

File tree

cypress/e2e/community-edit.cy.ts

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import { testA11y } from 'cypress/support/utils';
2+
3+
const COMMUNITY_EDIT_PAGE = '/communities/'.concat(Cypress.env('DSPACE_TEST_COMMUNITY')).concat('/edit');
4+
5+
beforeEach(() => {
6+
// All tests start with visiting the Edit Community Page
7+
cy.visit(COMMUNITY_EDIT_PAGE);
8+
9+
// This page is restricted, so we will be shown the login form. Fill it out & submit.
10+
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
11+
});
12+
13+
describe('Edit Community > Edit Metadata tab', () => {
14+
it('should pass accessibility tests', () => {
15+
// <ds-edit-community> tag must be loaded
16+
cy.get('ds-edit-community').should('be.visible');
17+
18+
// Analyze <ds-edit-community> for accessibility issues
19+
testA11y('ds-edit-community');
20+
});
21+
});
22+
23+
describe('Edit Community > Assign Roles tab', () => {
24+
25+
it('should pass accessibility tests', () => {
26+
cy.get('a[data-test="roles"]').click();
27+
28+
// <ds-community-roles> tag must be loaded
29+
cy.get('ds-community-roles').should('be.visible');
30+
31+
// Analyze for accessibility issues
32+
testA11y('ds-community-roles');
33+
});
34+
});
35+
36+
describe('Edit Community > Curate tab', () => {
37+
38+
it('should pass accessibility tests', () => {
39+
cy.get('a[data-test="curate"]').click();
40+
41+
// <ds-community-curate> tag must be loaded
42+
cy.get('ds-community-curate').should('be.visible');
43+
44+
// Analyze for accessibility issues
45+
testA11y('ds-community-curate');
46+
});
47+
});
48+
49+
describe('Edit Community > Access Control tab', () => {
50+
51+
it('should pass accessibility tests', () => {
52+
cy.get('a[data-test="access-control"]').click();
53+
54+
// <ds-community-access-control> tag must be loaded
55+
cy.get('ds-community-access-control').should('be.visible');
56+
57+
// Analyze for accessibility issues
58+
testA11y('ds-community-access-control');
59+
});
60+
});
61+
62+
describe('Edit Community > Authorizations tab', () => {
63+
64+
it('should pass accessibility tests', () => {
65+
cy.get('a[data-test="authorizations"]').click();
66+
67+
// <ds-community-authorizations> tag must be loaded
68+
cy.get('ds-community-authorizations').should('be.visible');
69+
70+
// Analyze for accessibility issues
71+
testA11y('ds-community-authorizations');
72+
});
73+
74+
it('should have an edit policy page which also passes accessibility tests', () => {
75+
cy.visit(COMMUNITY_EDIT_PAGE.concat('/authorizations'));
76+
77+
cy.get('button[title="Edit policy"]').click();
78+
79+
// <ds-resource-policy-edit> tag must be loaded
80+
cy.get('ds-resource-policy-edit').should('be.visible');
81+
82+
// Analyze for accessibility issues
83+
testA11y('ds-resource-policy-edit');
84+
});
85+
});
86+
87+
describe('Edit Community > Delete page', () => {
88+
89+
it('should pass accessibility tests', () => {
90+
cy.get('a[data-test="delete-button"]').click();
91+
92+
// <ds-delete-community> tag must be loaded
93+
cy.get('ds-delete-community').should('be.visible');
94+
95+
// Analyze for accessibility issues
96+
testA11y('ds-delete-community');
97+
});
98+
});

cypress/e2e/community-page.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ describe('Community Page', () => {
99
cy.get('ds-community-page').should('be.visible');
1010

1111
// Analyze <ds-community-page> for accessibility issues
12-
testA11y('ds-community-page',);
12+
testA11y('ds-community-page');
1313
});
1414
});

cypress/e2e/submission.cy.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ describe('New Submission page', () => {
3131
testA11y('ds-submission-edit',
3232
{
3333
rules: {
34-
// Author & Subject fields have invalid "aria-multiline" attrs, see #1272
34+
// Author & Subject fields have invalid "aria-multiline" attrs.
35+
// See https://github.com/DSpace/dspace-angular/issues/1272
3536
'aria-allowed-attr': { enabled: false },
36-
// All panels are accordians & fail "aria-required-children" and "nested-interactive". Seem to require updating ng-bootstrap and #2216
37+
// All panels are accordians & fail "aria-required-children" and "nested-interactive".
38+
// Seem to require updating ng-bootstrap and https://github.com/DSpace/dspace-angular/issues/2216
3739
'aria-required-children': { enabled: false },
3840
'nested-interactive': { enabled: false },
39-
// All select boxes fail to have a name / aria-label. This is a bug in ng-dynamic-forms and may require #2216
41+
// All select boxes fail to have a name / aria-label.
42+
// This is a bug in ng-dynamic-forms and may require https://github.com/DSpace/dspace-angular/issues/2216
4043
'select-name': { enabled: false },
4144
}
4245

@@ -183,7 +186,8 @@ describe('New Submission page', () => {
183186
testA11y('ds-submission-edit',
184187
{
185188
rules: {
186-
// All panels are accordians & fail "aria-required-children" and "nested-interactive". Seem to require updating ng-bootstrap and #2216
189+
// All panels are accordians & fail "aria-required-children" and "nested-interactive".
190+
// Seem to require updating ng-bootstrap and https://github.com/DSpace/dspace-angular/issues/2216
187191
'aria-required-children': { enabled: false },
188192
'nested-interactive': { enabled: false },
189193
}

src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<h1>{{ type + '.edit.head' | translate }}</h1>
66
<div class="my-auto">
77
<a class="btn btn-danger"
8-
[routerLink]="((type === 'community') ? '/communities/' : '/collections/') + (dsoRD$ | async)?.payload.uuid + '/delete'">
8+
[routerLink]="((type === 'community') ? '/communities/' : '/collections/') + (dsoRD$ | async)?.payload.uuid + '/delete'"
9+
data-test="delete-button">
910
<i class="fas fa-trash"></i> {{type + '.edit.delete' | translate}}</a>
1011
</div>
1112
</div>
@@ -14,7 +15,8 @@ <h1>{{ type + '.edit.head' | translate }}</h1>
1415
<li *ngFor="let page of pages" class="nav-item">
1516
<a class="nav-link"
1617
[ngClass]="{'active' : page === currentPage}"
17-
[routerLink]="['./' + page]">
18+
[routerLink]="['./' + page]"
19+
[attr.data-test]="page">
1820
{{ type + '.edit.tabs.' + page + '.head' | translate}}
1921
</a>
2022
</li>

0 commit comments

Comments
 (0)