Skip to content

Commit afac0dd

Browse files
KasinhouMatus Kasak
andauthored
MENDELU/Fixing e2e tests (#1162)
* Updated tests to czech * Add getEndpoint * Modified failing unit tests * Fixed comments, sorted, delete unused,... * Fixed comments, sorted, delete unused,... * Fixed comments, sorted, delete unused,... * Divided import * Fixed login name in cypress test * Modified homepage cypress test * Test entire page for accessibility issues * Removed unnecessary commits --------- Co-authored-by: Matus Kasak <matus.kasak@dataquest.sk>
1 parent d46d750 commit afac0dd

3 files changed

Lines changed: 22 additions & 9 deletions

File tree

cypress/e2e/header.cy.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ describe('Header', () => {
1616

1717
// Click the language switcher (globe) in header
1818
cy.get('button[data-test="lang-switch"]').click();
19-
// Click on the "Deusch" language in dropdown
20-
cy.get('#language-menu-list div[role="option"]').contains('Deutsch').click();
19+
// Click on the "Czech" language in dropdown
20+
cy.get('#language-menu-list div[role="option"]').contains('Čeština').click();
2121

22-
// HTML "lang" attribute should switch to "de"
23-
cy.get('html').invoke('attr', 'lang').should('eq', 'de');
22+
// HTML "lang" attribute should switch to "cs"
23+
cy.get('html').invoke('attr', 'lang').should('eq', 'cs');
2424

25-
// Login menu should now be in German
26-
cy.get('[data-test="login-menu"]').contains('Anmelden');
25+
// Login menu should now be in Czech
26+
cy.get('[data-test="login-menu"]').contains('Admin přístup');
2727

2828
// Change back to English from language switcher
2929
cy.get('button[data-test="lang-switch"]').click();
@@ -33,6 +33,6 @@ describe('Header', () => {
3333
cy.get('html').invoke('attr', 'lang').should('eq', 'en');
3434

3535
// Login menu should now be in English
36-
cy.get('[data-test="login-menu"]').contains('Log In');
36+
cy.get('[data-test="login-menu"]').contains('Admin Access');
3737
});
3838
});

cypress/e2e/homepage.cy.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { testA11y } from 'cypress/support/utils';
2+
import { Options } from 'cypress-axe';
23

34
describe('Homepage', () => {
45
beforeEach(() => {
@@ -33,6 +34,12 @@ describe('Homepage', () => {
3334
cy.get('ds-loading').should('not.exist');
3435

3536
// Analyze <ds-home-page> for accessibility issues
36-
testA11y('ds-home-page');
37+
testA11y('ds-home-page',
38+
{
39+
rules: {
40+
'link-name': { enabled: false },
41+
},
42+
} as Options,
43+
);
3744
});
3845
});

src/app/footer/footer.component.spec.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ import {
66
} from '@angular/core/testing';
77
import { By } from '@angular/platform-browser';
88
import { ActivatedRoute } from '@angular/router';
9+
import { provideMockStore } from '@ngrx/store/testing';
910
import { TranslateModule } from '@ngx-translate/core';
1011
import { of } from 'rxjs';
1112

12-
import { APP_CONFIG } from '../../config/app-config.interface';
13+
import {
14+
APP_CONFIG,
15+
APP_DATA_SERVICES_MAP,
16+
} from '../../config/app-config.interface';
1317
import { environment } from '../../environments/environment.test';
1418
import { NotifyInfoService } from '../core/coar-notify/notify-info/notify-info.service';
1519
import { ConfigurationDataService } from '../core/data/configuration-data.service';
@@ -45,6 +49,8 @@ describe('Footer component', () => {
4549
{ provide: ConfigurationDataService, useValue: mockConfigurationDataService },
4650
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
4751
{ provide: APP_CONFIG, useValue: environment },
52+
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
53+
provideMockStore(),
4854
],
4955
});
5056
}));

0 commit comments

Comments
 (0)