pull/4104/head
tidusjar 4 years ago
parent c6c45b3342
commit 2710d7349f

@ -14,31 +14,7 @@ namespace Ombi.Mapping.Profiles
{
public TvProfileV2()
{
CreateMap<FullSearch, SearchFullInfoTvShowViewModel>()
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.externals.thetvdb))
.ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.premiered))
.ForMember(dest => dest.ImdbId, opts => opts.MapFrom(src => src.externals.imdb))
.ForMember(dest => dest.Network, opts => opts.MapFrom(src => src.network.name))
.ForMember(dest => dest.NetworkId, opts => opts.MapFrom(src => src.network.id.ToString()))
.ForMember(dest => dest.Overview, opts => opts.MapFrom(src => src.summary.RemoveHtml()))
.ForMember(dest => dest.Rating,
opts => opts.MapFrom(src => src.rating.average.ToString(CultureInfo.CurrentUICulture)))
.ForMember(dest => dest.Runtime, opts => opts.MapFrom(src => src.runtime.ToString()))
.ForMember(dest => dest.SeriesId, opts => opts.MapFrom(src => src.id))
.ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.name))
.ForMember(dest => dest.Network, opts => opts.MapFrom(src => src.network))
//.ForMember(dest => dest.Images, opts => opts.MapFrom(src => src.image))
.ForMember(dest => dest.Cast, opts => opts.MapFrom(src => src._embedded.cast))
.ForMember(dest => dest.Crew, opts => opts.MapFrom(src => src._embedded.crew))
.ForMember(dest => dest.Banner,
opts => opts.MapFrom(src =>
!string.IsNullOrEmpty(src.image.medium)
? src.image.medium.ToHttpsUrl()
: string.Empty))
.ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.status));
CreateMap<TvInfo, SearchFullInfoTvShowViewModel>()
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.id))
.ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.first_air_date))
@ -78,11 +54,6 @@ namespace Ombi.Mapping.Profiles
.ForMember(dest => dest.id, opts => opts.MapFrom(src => src.id))
.ForMember(dest => dest.name, opts => opts.MapFrom(src => src.name));
CreateMap<Api.TvMaze.Models.V2.Network, NetworkViewModel>()
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.id))
.ForMember(dest => dest.Country, opts => opts.MapFrom(src => src.country))
.ForMember(dest => dest.Name, opts => opts.MapFrom(src => src.name));
CreateMap<Api.TheMovieDb.Models.Network, NetworkViewModel>()
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.id))
.ForMember(dest => dest.Country, opts => opts.MapFrom(src => src.origin_country))
@ -93,49 +64,17 @@ namespace Ombi.Mapping.Profiles
.ForMember(dest => dest.Code, opts => opts.MapFrom(src => src.code))
.ForMember(dest => dest.Timezone, opts => opts.MapFrom(src => src.timezone));
//CreateMap<Api.TvMaze.Models.V2.Image, Images>()
// .ForMember(dest => dest.Medium, opts => opts.MapFrom(src => src.medium.ToHttpsUrl()))
// .ForMember(dest => dest.Original, opts => opts.MapFrom(src => src.original.ToHttpsUrl()));
//CreateMap<Api.TvMaze.Models.V2.Cast, CastViewModel>()
// .ForMember(dest => dest.Character, opts => opts.MapFrom(src => src.character))
// .ForMember(dest => dest.Person, opts => opts.MapFrom(src => src.person))
// .ForMember(dest => dest.Voice, opts => opts.MapFrom(src => src.voice))
// .ForMember(dest => dest.Self, opts => opts.MapFrom(src => src.self));
CreateMap<FullMovieCast, CastViewModel>()
.ForMember(dest => dest.Character, opts => opts.MapFrom(src => src.character))
.ForMember(dest => dest.Person, opts => opts.MapFrom(src => src.name))
.ForMember(dest => dest.Image, opts => opts.MapFrom(src => src.profile_path))
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.id));
CreateMap<Api.TvMaze.Models.V2.Person, PersonViewModel>()
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.id))
.ForMember(dest => dest.Name, opts => opts.MapFrom(src => src.name))
.ForMember(dest => dest.Image, opts => opts.MapFrom(src => src.image))
.ForMember(dest => dest.Url, opts => opts.MapFrom(src => src.url.ToHttpsUrl()));
//CreateMap<Api.TvMaze.Models.V2.Crew, CrewViewModel>()
// .ForMember(dest => dest.Person, opts => opts.MapFrom(src => src.person))
// .ForMember(dest => dest.Type, opts => opts.MapFrom(src => src.type));
CreateMap<FullMovieCrew, PersonViewModel>()
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.id))
.ForMember(dest => dest.Image, opts => opts.MapFrom(src => src.profile_path))
.ForMember(dest => dest.Name, opts => opts.MapFrom(src => src.name));
CreateMap<Api.TvMaze.Models.V2.Cast, CastViewModel>()
.ForMember(dest => dest.Person, opts => opts.MapFrom(src => src.person))
.ForMember(dest => dest.Self, opts => opts.MapFrom(src => src.self))
.ForMember(dest => dest.Voice, opts => opts.MapFrom(src => src.voice))
.ForMember(dest => dest.Character, opts => opts.MapFrom(src => src.character));
CreateMap<Api.TvMaze.Models.V2.Character, CharacterViewModel>()
.ForMember(dest => dest.Name, opts => opts.MapFrom(src => src.name))
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.id))
.ForMember(dest => dest.Url, opts => opts.MapFrom(src => src.url.ToHttpsUrl()))
.ForMember(dest => dest.Image, opts => opts.MapFrom(src => src.image));
CreateMap<SearchTvShowViewModel, SearchFullInfoTvShowViewModel>().ReverseMap();
}

@ -10,8 +10,8 @@
<br>
<mat-form-field>
<mat-label [translate]="'UserPreferences.OmbiLanguage'"></mat-label>
<mat-select [(value)]="selectedLang" (selectionChange)="languageSelected();">
<mat-option *ngFor="let lang of availableLanguages" [value]="lang.value">
<mat-select id="langSelect" [(value)]="selectedLang" (selectionChange)="languageSelected();">
<mat-option id="langSelect{{lang.value}}" *ngFor="let lang of availableLanguages" [value]="lang.value">
{{lang.display}}
</mat-option>
</mat-select>
@ -24,7 +24,8 @@
<div class="col-1"></div>
<div class="col-7">
<mat-label [translate]="'UserPreferences.MobileQRCode'"></mat-label>
<qrcode *ngIf="qrCodeEnabled" [qrdata]="qrCode" [size]="256" [level]="'L'"></qrcode>
<div id="noQrCode" *ngIf="!qrCodeEnabled" [translate]="'UserPreferences.NoQrCode'"></div>
<qrcode id="qrCode" *ngIf="qrCodeEnabled" [qrdata]="qrCode" [size]="256" [level]="'L'"></qrcode>
<button mat-raised-button (click)="openMobileApp($event)" *ngIf="customizationSettings.applicationUrl"> {{
'UserPreferences.LegacyApp' | translate }}</button>
</div>
@ -35,8 +36,8 @@
<br>
<mat-form-field>
<mat-label [translate]="'UserPreferences.StreamingCountry'"></mat-label>
<mat-select [(value)]="selectedCountry" (selectionChange)="countrySelected();">
<mat-option *ngFor="let value of countries" [value]="value">
<mat-select id="streamingSelect" [(value)]="selectedCountry" (selectionChange)="countrySelected();">
<mat-option id="streamingSelect{{value}}" *ngFor="let value of countries" [value]="value">
{{value}}
</mat-option>
</mat-select>

@ -81,4 +81,8 @@
background: $accent-dark !important;
color: #303030;
}
*/
*/
table {
width: 100%;
}

@ -313,6 +313,7 @@
"StreamingCountryDescription": "This is the country code that we will display streaming information for. If you are in the US please select US and you will have US related streaming information.",
"LanguageDescription": "This is the language you would like the Ombi interface to be displayed in.",
"MobileQRCode":"Mobile QR Code",
"LegacyApp":"Launch Legacy App"
"LegacyApp":"Launch Legacy App",
"NoQrCode":"Please contact your administrator to enable QR codes"
}
}

@ -3,3 +3,4 @@ export * from './login/login.page';
export * from './wizard/wizard.page';
export * from './details/tv/tvdetails.page';
export * from './search/search.page';
export * from './user-preferences/user-preferences.page';

@ -0,0 +1,42 @@
import { BasePage } from "../base.page";
class UserPreferencesPage extends BasePage {
get languageSelectBox(): Cypress.Chainable<any> {
return cy.get('#langSelect');
}
languageSelectBoxOption(lang: string): Cypress.Chainable<any> {
return cy.get('#langSelect'+lang);
}
get streamingSelectBox(): Cypress.Chainable<any> {
return cy.get('#streamingSelect');
}
streamingSelectBoxOption(country: string): Cypress.Chainable<any> {
return cy.get('#streamingSelect'+country);
}
get qrCode(): Cypress.Chainable<any> {
return cy.get('#qrCode');
}
get noQrCode(): Cypress.Chainable<any> {
return cy.get('#noQrCode');
}
constructor() {
super();
}
visit(options: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow>;
visit(): Cypress.Chainable<Cypress.AUTWindow>;
visit(id: string): Cypress.Chainable<Cypress.AUTWindow>;
visit(id: string, options: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow>;
visit(id?: any, options?: any) {
return cy.visit(`/user-preferences`, options);
}
}
export const userPreferencesPage = new UserPreferencesPage();

@ -129,7 +129,7 @@ describe("TV Requests Grid", function () {
cy.verifyNotification('You need to select some episodes!');
});
it.only("Request single episodes", () => {
it("Request single episodes", () => {
Page.visit('1399');
Page.requestPanel.seasonTab(2).click();

@ -1,5 +1,4 @@
import { searchPage as Page } from "@/integration/page-objects";
import { verify } from "cypress/types/sinon";
describe("Search Tests", () => {
beforeEach(() => {
@ -152,4 +151,17 @@ describe("Search Tests", () => {
expect(+x).to.be.greaterThan(0);
});
});
it("Searching via the search bar", () => {
Page.navbar.searchFilter.applyFilter(true, true, false);
Page.visit(" ");
cy.wait('@searchResponse');
Page.navbar.searchBar.searchInput.type('007');
Page.searchResultsContainer.invoke('attr', 'search-count').then((x: string) => {
expect(+x).to.be.greaterThan(0);
});
});
});

@ -0,0 +1,57 @@
import { userPreferencesPage as Page } from "@/integration/page-objects";
describe("User Preferences Tests", () => {
beforeEach(() => {
cy.login();
});
const langs = [
{ code: 'fr', discover: 'Découvrir'},
{ code: 'de', discover: 'Entdecken'},
{ code: 'en', discover: 'Discover'},
];
langs.forEach((l) => {
it(`Change language to ${l.code}, UI should update`, () => {
cy.intercept('POST','/language').as('langSave');
Page.visit();
Page.languageSelectBox.click();
Page.languageSelectBoxOption(l.code).click();
Page.navbar.discover.contains(l.discover);
cy.wait('@langSave').then((intercept) => {
expect(intercept.request.body.lang).equal(l.code);
})
});
})
const streamingCountries = [
'GB',
'US',
'FR',
'HU'
];
streamingCountries.forEach((country) => {
// derive test name from data
it(`Change streaming to ${country} UI should update`, () => {
cy.intercept('GET','streamingcountry').as('countryApi');
cy.intercept('POST','streamingcountry').as('countryApiSave');
Page.visit();
cy.wait('@countryApi');
Page.streamingSelectBox.click();
Page.streamingSelectBoxOption(country).click();
Page.streamingSelectBox.should('have.attr','ng-reflect-value', country);
cy.wait('@countryApiSave').then((intercept) => {
expect(intercept.request.body.code).equal(country);
})
})
})
});
Loading…
Cancel
Save