mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Add Edit Community accessibility tests & minor cleanup
This commit is contained in:
98
cypress/e2e/community-edit.cy.ts
Normal file
98
cypress/e2e/community-edit.cy.ts
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
import { testA11y } from 'cypress/support/utils';
|
||||||
|
|
||||||
|
const COMMUNITY_EDIT_PAGE = '/communities/'.concat(Cypress.env('DSPACE_TEST_COMMUNITY')).concat('/edit');
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
// All tests start with visiting the Edit Community Page
|
||||||
|
cy.visit(COMMUNITY_EDIT_PAGE);
|
||||||
|
|
||||||
|
// This page is restricted, so we will be shown the login form. Fill it out & submit.
|
||||||
|
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Edit Community > Edit Metadata tab', () => {
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
// <ds-edit-community> tag must be loaded
|
||||||
|
cy.get('ds-edit-community').should('be.visible');
|
||||||
|
|
||||||
|
// Analyze <ds-edit-community> for accessibility issues
|
||||||
|
testA11y('ds-edit-community');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Edit Community > Assign Roles tab', () => {
|
||||||
|
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.get('a[data-test="roles"]').click();
|
||||||
|
|
||||||
|
// <ds-community-roles> tag must be loaded
|
||||||
|
cy.get('ds-community-roles').should('be.visible');
|
||||||
|
|
||||||
|
// Analyze for accessibility issues
|
||||||
|
testA11y('ds-community-roles');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Edit Community > Curate tab', () => {
|
||||||
|
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.get('a[data-test="curate"]').click();
|
||||||
|
|
||||||
|
// <ds-community-curate> tag must be loaded
|
||||||
|
cy.get('ds-community-curate').should('be.visible');
|
||||||
|
|
||||||
|
// Analyze for accessibility issues
|
||||||
|
testA11y('ds-community-curate');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Edit Community > Access Control tab', () => {
|
||||||
|
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.get('a[data-test="access-control"]').click();
|
||||||
|
|
||||||
|
// <ds-community-access-control> tag must be loaded
|
||||||
|
cy.get('ds-community-access-control').should('be.visible');
|
||||||
|
|
||||||
|
// Analyze for accessibility issues
|
||||||
|
testA11y('ds-community-access-control');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Edit Community > Authorizations tab', () => {
|
||||||
|
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.get('a[data-test="authorizations"]').click();
|
||||||
|
|
||||||
|
// <ds-community-authorizations> tag must be loaded
|
||||||
|
cy.get('ds-community-authorizations').should('be.visible');
|
||||||
|
|
||||||
|
// Analyze for accessibility issues
|
||||||
|
testA11y('ds-community-authorizations');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have an edit policy page which also passes accessibility tests', () => {
|
||||||
|
cy.visit(COMMUNITY_EDIT_PAGE.concat('/authorizations'));
|
||||||
|
|
||||||
|
cy.get('button[title="Edit policy"]').click();
|
||||||
|
|
||||||
|
// <ds-resource-policy-edit> tag must be loaded
|
||||||
|
cy.get('ds-resource-policy-edit').should('be.visible');
|
||||||
|
|
||||||
|
// Analyze for accessibility issues
|
||||||
|
testA11y('ds-resource-policy-edit');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Edit Community > Delete page', () => {
|
||||||
|
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.get('a[data-test="delete-button"]').click();
|
||||||
|
|
||||||
|
// <ds-delete-community> tag must be loaded
|
||||||
|
cy.get('ds-delete-community').should('be.visible');
|
||||||
|
|
||||||
|
// Analyze for accessibility issues
|
||||||
|
testA11y('ds-delete-community');
|
||||||
|
});
|
||||||
|
});
|
@@ -9,6 +9,6 @@ describe('Community Page', () => {
|
|||||||
cy.get('ds-community-page').should('be.visible');
|
cy.get('ds-community-page').should('be.visible');
|
||||||
|
|
||||||
// Analyze <ds-community-page> for accessibility issues
|
// Analyze <ds-community-page> for accessibility issues
|
||||||
testA11y('ds-community-page',);
|
testA11y('ds-community-page');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -31,12 +31,15 @@ describe('New Submission page', () => {
|
|||||||
testA11y('ds-submission-edit',
|
testA11y('ds-submission-edit',
|
||||||
{
|
{
|
||||||
rules: {
|
rules: {
|
||||||
// Author & Subject fields have invalid "aria-multiline" attrs, see #1272
|
// Author & Subject fields have invalid "aria-multiline" attrs.
|
||||||
|
// See https://github.com/DSpace/dspace-angular/issues/1272
|
||||||
'aria-allowed-attr': { enabled: false },
|
'aria-allowed-attr': { enabled: false },
|
||||||
// All panels are accordians & fail "aria-required-children" and "nested-interactive". Seem to require updating ng-bootstrap and #2216
|
// All panels are accordians & fail "aria-required-children" and "nested-interactive".
|
||||||
|
// Seem to require updating ng-bootstrap and https://github.com/DSpace/dspace-angular/issues/2216
|
||||||
'aria-required-children': { enabled: false },
|
'aria-required-children': { enabled: false },
|
||||||
'nested-interactive': { enabled: false },
|
'nested-interactive': { enabled: false },
|
||||||
// All select boxes fail to have a name / aria-label. This is a bug in ng-dynamic-forms and may require #2216
|
// All select boxes fail to have a name / aria-label.
|
||||||
|
// This is a bug in ng-dynamic-forms and may require https://github.com/DSpace/dspace-angular/issues/2216
|
||||||
'select-name': { enabled: false },
|
'select-name': { enabled: false },
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +186,8 @@ describe('New Submission page', () => {
|
|||||||
testA11y('ds-submission-edit',
|
testA11y('ds-submission-edit',
|
||||||
{
|
{
|
||||||
rules: {
|
rules: {
|
||||||
// All panels are accordians & fail "aria-required-children" and "nested-interactive". Seem to require updating ng-bootstrap and #2216
|
// All panels are accordians & fail "aria-required-children" and "nested-interactive".
|
||||||
|
// Seem to require updating ng-bootstrap and https://github.com/DSpace/dspace-angular/issues/2216
|
||||||
'aria-required-children': { enabled: false },
|
'aria-required-children': { enabled: false },
|
||||||
'nested-interactive': { enabled: false },
|
'nested-interactive': { enabled: false },
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,8 @@
|
|||||||
<h1>{{ type + '.edit.head' | translate }}</h1>
|
<h1>{{ type + '.edit.head' | translate }}</h1>
|
||||||
<div class="my-auto">
|
<div class="my-auto">
|
||||||
<a class="btn btn-danger"
|
<a class="btn btn-danger"
|
||||||
[routerLink]="((type === 'community') ? '/communities/' : '/collections/') + (dsoRD$ | async)?.payload.uuid + '/delete'">
|
[routerLink]="((type === 'community') ? '/communities/' : '/collections/') + (dsoRD$ | async)?.payload.uuid + '/delete'"
|
||||||
|
data-test="delete-button">
|
||||||
<i class="fas fa-trash"></i> {{type + '.edit.delete' | translate}}</a>
|
<i class="fas fa-trash"></i> {{type + '.edit.delete' | translate}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -14,7 +15,8 @@
|
|||||||
<li *ngFor="let page of pages" class="nav-item">
|
<li *ngFor="let page of pages" class="nav-item">
|
||||||
<a class="nav-link"
|
<a class="nav-link"
|
||||||
[ngClass]="{'active' : page === currentPage}"
|
[ngClass]="{'active' : page === currentPage}"
|
||||||
[routerLink]="['./' + page]">
|
[routerLink]="['./' + page]"
|
||||||
|
[attr.data-test]="page">
|
||||||
{{ type + '.edit.tabs.' + page + '.head' | translate}}
|
{{ type + '.edit.tabs.' + page + '.head' | translate}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
Reference in New Issue
Block a user