mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
79327: Fix LGTM issues and add e2e tests
This commit is contained in:
31
e2e/src/item-statistics/item-statistics.e2e-spec.ts
Normal file
31
e2e/src/item-statistics/item-statistics.e2e-spec.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import { ProtractorPage } from './item-statistics.po';
|
||||||
|
import { browser } from 'protractor';
|
||||||
|
|
||||||
|
describe('protractor Item statics', () => {
|
||||||
|
let page: ProtractorPage;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
page = new ProtractorPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should contain element ds-item-page when navigating when navigating to an item page', () => {
|
||||||
|
page.navigateToItemPage();
|
||||||
|
expect<any>(page.elementTagExists('ds-item-page')).toEqual(true);
|
||||||
|
expect<any>(page.elementTagExists('ds-item-statistics-page')).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should redirect to the entity page when navigating to an item page', () => {
|
||||||
|
page.navigateToItemPage();
|
||||||
|
expect(browser.getCurrentUrl()).toEqual('http://localhost:4000' + page.ENTITYPAGE);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should contain element ds-item-statistics-page when navigating when navigating to an item statistics page', () => {
|
||||||
|
page.navigateToItemStatisticsPage();
|
||||||
|
expect<any>(page.elementTagExists('ds-item-statistics-page')).toEqual(true);
|
||||||
|
expect<any>(page.elementTagExists('ds-item-page')).toEqual(false);
|
||||||
|
});
|
||||||
|
it('should contain the item statistics page url when navigating to an item statistics page', () => {
|
||||||
|
page.navigateToItemStatisticsPage();
|
||||||
|
expect(browser.getCurrentUrl()).toEqual('http://localhost:4000' + page.ITEMSTATISTICSPAGE);
|
||||||
|
});
|
||||||
|
});
|
23
e2e/src/item-statistics/item-statistics.po.ts
Normal file
23
e2e/src/item-statistics/item-statistics.po.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { browser, element, by } from 'protractor';
|
||||||
|
|
||||||
|
export class ProtractorPage {
|
||||||
|
ITEMPAGE = '/items/e98b0f27-5c19-49a0-960d-eb6ad5287067';
|
||||||
|
ENTITYPAGE = '/entities/publication/e98b0f27-5c19-49a0-960d-eb6ad5287067';
|
||||||
|
ITEMSTATISTICSPAGE = '/statistics/items/e98b0f27-5c19-49a0-960d-eb6ad5287067';
|
||||||
|
|
||||||
|
navigateToItemPage() {
|
||||||
|
return browser.get(this.ITEMPAGE);
|
||||||
|
}
|
||||||
|
navigateToItemStatisticsPage() {
|
||||||
|
return browser.get(this.ITEMSTATISTICSPAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
elementTagExists(tag: string) {
|
||||||
|
return element(by.tagName(tag)).isPresent();
|
||||||
|
}
|
||||||
|
|
||||||
|
verifyCurrentUrl(url) {
|
||||||
|
browser.getCurrentUrl().then((currentUrl) => currentUrl === url );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -56,7 +56,8 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"minimist": "^1.2.5"
|
"minimist": "^1.2.5",
|
||||||
|
"webdriver-manager": "^12.1.8"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "~10.2.3",
|
"@angular/animations": "~10.2.3",
|
||||||
|
@@ -4,11 +4,7 @@ import { Observable } from 'rxjs';
|
|||||||
import { RemoteData } from '../core/data/remote-data';
|
import { RemoteData } from '../core/data/remote-data';
|
||||||
import { ItemDataService } from '../core/data/item-data.service';
|
import { ItemDataService } from '../core/data/item-data.service';
|
||||||
import { Item } from '../core/shared/item.model';
|
import { Item } from '../core/shared/item.model';
|
||||||
import { followLink, FollowLinkConfig } from '../shared/utils/follow-link-config.model';
|
|
||||||
import { FindListOptions } from '../core/data/request.models';
|
|
||||||
import { getFirstCompletedRemoteData } from '../core/shared/operators';
|
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { ResolvedAction } from '../core/resolving/resolver.actions';
|
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { hasValue } from '../shared/empty.util';
|
import { hasValue } from '../shared/empty.util';
|
||||||
import { getItemPageRoute } from './item-page-routing-paths';
|
import { getItemPageRoute } from './item-page-routing-paths';
|
||||||
|
@@ -9,9 +9,6 @@ import { FindListOptions } from '../core/data/request.models';
|
|||||||
import { getFirstCompletedRemoteData } from '../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../core/shared/operators';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { ResolvedAction } from '../core/resolving/resolver.actions';
|
import { ResolvedAction } from '../core/resolving/resolver.actions';
|
||||||
import { map } from 'rxjs/operators';
|
|
||||||
import { hasValue } from '../shared/empty.util';
|
|
||||||
import { getItemPageRoute } from './item-page-routing-paths';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The self links defined in this list are expected to be requested somewhere in the near future
|
* The self links defined in this list are expected to be requested somewhere in the near future
|
||||||
|
@@ -3,7 +3,6 @@ import { RouterModule } from '@angular/router';
|
|||||||
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
import { I18nBreadcrumbsService } from '../core/breadcrumbs/i18n-breadcrumbs.service';
|
import { I18nBreadcrumbsService } from '../core/breadcrumbs/i18n-breadcrumbs.service';
|
||||||
import { StatisticsPageModule } from './statistics-page.module';
|
import { StatisticsPageModule } from './statistics-page.module';
|
||||||
import { ItemPageResolver } from '../+item-page/item-page.resolver';
|
|
||||||
import { CollectionPageResolver } from '../+collection-page/collection-page.resolver';
|
import { CollectionPageResolver } from '../+collection-page/collection-page.resolver';
|
||||||
import { CommunityPageResolver } from '../+community-page/community-page.resolver';
|
import { CommunityPageResolver } from '../+community-page/community-page.resolver';
|
||||||
import { ThemedCollectionStatisticsPageComponent } from './collection-statistics-page/themed-collection-statistics-page.component';
|
import { ThemedCollectionStatisticsPageComponent } from './collection-statistics-page/themed-collection-statistics-page.component';
|
||||||
|
@@ -11933,10 +11933,10 @@ webdriver-js-extender@2.1.0:
|
|||||||
"@types/selenium-webdriver" "^3.0.0"
|
"@types/selenium-webdriver" "^3.0.0"
|
||||||
selenium-webdriver "^3.0.1"
|
selenium-webdriver "^3.0.1"
|
||||||
|
|
||||||
webdriver-manager@^12.1.7:
|
webdriver-manager@^12.1.7, webdriver-manager@^12.1.8:
|
||||||
version "12.1.7"
|
version "12.1.8"
|
||||||
resolved "https://registry.yarnpkg.com/webdriver-manager/-/webdriver-manager-12.1.7.tgz#ed4eaee8f906b33c146e869b55e850553a1b1162"
|
resolved "https://registry.yarnpkg.com/webdriver-manager/-/webdriver-manager-12.1.8.tgz#5e70e73eaaf53a0767d5745270addafbc5905fd4"
|
||||||
integrity sha512-XINj6b8CYuUYC93SG3xPkxlyUc3IJbD6Vvo75CVGuG9uzsefDzWQrhz0Lq8vbPxtb4d63CZdYophF8k8Or/YiA==
|
integrity sha512-qJR36SXG2VwKugPcdwhaqcLQOD7r8P2Xiv9sfNbfZrKBnX243iAkOueX1yAmeNgIKhJ3YAT/F2gq6IiEZzahsg==
|
||||||
dependencies:
|
dependencies:
|
||||||
adm-zip "^0.4.9"
|
adm-zip "^0.4.9"
|
||||||
chalk "^1.1.1"
|
chalk "^1.1.1"
|
||||||
|
Reference in New Issue
Block a user