mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
Fixed up some more tests
This commit is contained in:
parent
0eeb163a0d
commit
f2ea1d0e13
6 changed files with 101 additions and 15 deletions
|
@ -21,7 +21,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row button-request-container" *ngIf="!result.available && !result.approved && !result.requested">
|
<div class="row button-request-container" *ngIf="!result.available && !result.approved && !result.requested">
|
||||||
<div class="button-request poster-overlay">
|
<div class="button-request poster-overlay">
|
||||||
<button id="requestButton{{result.id}}{{result.type}}{{discoverType}}" mat-raised-button class="btn-ombi full-width poster-request-btn" (click)="request($event)">
|
<button id="requestButton{{result.id}}{{result.type}}{{discoverType}}" *ngIf="requestable" mat-raised-button class="btn-ombi full-width poster-request-btn" (click)="request($event)">
|
||||||
<i *ngIf="!loading" class="fa-lg fas fa-cloud-download-alt"></i>
|
<i *ngIf="!loading" class="fa-lg fas fa-cloud-download-alt"></i>
|
||||||
<i *ngIf="loading" class="fas fa-spinner fa-pulse fa-2x fa-fw" aria-hidden="true"></i>
|
<i *ngIf="loading" class="fas fa-spinner fa-pulse fa-2x fa-fw" aria-hidden="true"></i>
|
||||||
{{'Common.Request' | translate }}
|
{{'Common.Request' | translate }}
|
||||||
|
|
|
@ -24,6 +24,8 @@ export class DiscoverCardComponent implements OnInit {
|
||||||
public fullyLoaded = false;
|
public fullyLoaded = false;
|
||||||
public loading: boolean;
|
public loading: boolean;
|
||||||
|
|
||||||
|
public requestable: boolean;
|
||||||
|
|
||||||
// This data is needed to open the dialog
|
// This data is needed to open the dialog
|
||||||
private tvSearchResult: ISearchTvResultV2;
|
private tvSearchResult: ISearchTvResultV2;
|
||||||
|
|
||||||
|
@ -44,19 +46,10 @@ export class DiscoverCardComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getExtraTvInfo() {
|
public async getExtraTvInfo() {
|
||||||
// if (this.result.tvMovieDb) {
|
this.tvSearchResult = await this.searchService.getTvInfoWithMovieDbId(+this.result.id);
|
||||||
this.tvSearchResult = await this.searchService.getTvInfoWithMovieDbId(+this.result.id);
|
this.requestable = true;
|
||||||
// } else {
|
|
||||||
// this.tvSearchResult = await this.searchService.getTvInfo(+this.result.id);
|
|
||||||
// }
|
|
||||||
// if (!this.tvSearchResult || this.tvSearchResult?.status.length > 0 && this.tvSearchResult?.status === "404") {
|
|
||||||
// this.hide = true;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
this.setTvDefaults(this.tvSearchResult);
|
this.setTvDefaults(this.tvSearchResult);
|
||||||
this.updateTvItem(this.tvSearchResult);
|
this.updateTvItem(this.tvSearchResult);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getAlbumInformation() {
|
public async getAlbumInformation() {
|
||||||
|
@ -69,12 +62,13 @@ export class DiscoverCardComponent implements OnInit {
|
||||||
if (art.image) {
|
if (art.image) {
|
||||||
this.result.posterPath = art.image;
|
this.result.posterPath = art.image;
|
||||||
|
|
||||||
this.fullyLoaded = true;
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.result.title = x.startYear ? `${x.name} (${x.startYear})` : x.name;
|
this.result.title = x.startYear ? `${x.name} (${x.startYear})` : x.name;
|
||||||
this.result.overview = x.overview;
|
this.result.overview = x.overview;
|
||||||
|
this.fullyLoaded = true;
|
||||||
|
this.requestable = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,6 +160,7 @@ export class DiscoverCardComponent implements OnInit {
|
||||||
} else {
|
} else {
|
||||||
this.fullyLoaded = true;
|
this.fullyLoaded = true;
|
||||||
}
|
}
|
||||||
|
this.requestable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateMovieItem(updated: ISearchMovieResultV2) {
|
private updateMovieItem(updated: ISearchMovieResultV2) {
|
||||||
|
|
|
@ -78,8 +78,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="profile-block">
|
<div class="profile-block">
|
||||||
<a routerLink="/user-preferences">
|
<a routerLink="/user-preferences">
|
||||||
<div class="profile-username">{{username}}</div>
|
<div class="profile-username" data-test="profile-username">{{username}}</div>
|
||||||
<div class="profile-img" data-test="profile-image"><img [matTooltip]="username" [src]="getUserImage()" /></div>
|
<div class="profile-img" data-test="profile-image"><img [src]="getUserImage()" /></div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,10 @@ class NavBar {
|
||||||
return cy.getByData('profile-image');
|
return cy.getByData('profile-image');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get username(): Cypress.Chainable<any> {
|
||||||
|
return cy.getByData('profile-username');
|
||||||
|
}
|
||||||
|
|
||||||
get logout(): Cypress.Chainable<any> {
|
get logout(): Cypress.Chainable<any> {
|
||||||
return cy.get('#nav-logout');
|
return cy.get('#nav-logout');
|
||||||
}
|
}
|
||||||
|
|
85
tests/cypress/tests/api/v1/tv-request.api.spec.ts
Normal file
85
tests/cypress/tests/api/v1/tv-request.api.spec.ts
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
describe("TV Request V1 API tests", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Request All of TV Show (Fear the Walking Dead)", () => {
|
||||||
|
const request = {
|
||||||
|
TvDbId: 290853,
|
||||||
|
RequestAll: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
cy.api({
|
||||||
|
url: "/api/v1/request/tv",
|
||||||
|
body: JSON.stringify(request),
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
Authorization: "Bearer " + window.localStorage.getItem("id_token"),
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
}).then((res) => {
|
||||||
|
expect(res.status).equal(200);
|
||||||
|
const body = res.body;
|
||||||
|
expect(body.result).to.be.true;
|
||||||
|
expect(body.requestId).not.to.be.null;
|
||||||
|
expect(body.isError).to.be.false;
|
||||||
|
expect(body.errorMessage).to.be.null;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Request First Season of TV Show (American Horror Story)", () => {
|
||||||
|
const request = {
|
||||||
|
TvDbId: 250487,
|
||||||
|
FirstSeason: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
cy.api({
|
||||||
|
url: "/api/v1/request/tv",
|
||||||
|
body: JSON.stringify(request),
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
Authorization: "Bearer " + window.localStorage.getItem("id_token"),
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
}).then((res) => {
|
||||||
|
expect(res.status).equal(200);
|
||||||
|
const body = res.body;
|
||||||
|
expect(body.result).to.be.true;
|
||||||
|
expect(body.requestId).not.to.be.null;
|
||||||
|
expect(body.isError).to.be.false;
|
||||||
|
expect(body.errorMessage).to.be.null;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Request Two Episode of First Season TV Show (The Sopranos)", () => {
|
||||||
|
const request = {
|
||||||
|
TvDbId: 75299,
|
||||||
|
Seasons: [
|
||||||
|
{
|
||||||
|
SeasonNumber: 1,
|
||||||
|
Episodes: [
|
||||||
|
{ EpisodeNumber: 1 },
|
||||||
|
{ EpisodeNumber: 2 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
cy.api({
|
||||||
|
url: "/api/v1/request/tv",
|
||||||
|
body: JSON.stringify(request),
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
Authorization: "Bearer " + window.localStorage.getItem("id_token"),
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
}).then((res) => {
|
||||||
|
expect(res.status).equal(200);
|
||||||
|
const body = res.body;
|
||||||
|
expect(body.result).to.be.true;
|
||||||
|
expect(body.requestId).not.to.be.null;
|
||||||
|
expect(body.isError).to.be.false;
|
||||||
|
expect(body.errorMessage).to.be.null;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -11,6 +11,7 @@ describe("Navigation Bar Tests", () => {
|
||||||
Page.navbar.requests.should("be.visible");
|
Page.navbar.requests.should("be.visible");
|
||||||
Page.navbar.discover.should("be.visible");
|
Page.navbar.discover.should("be.visible");
|
||||||
Page.navbar.userPreferences.should("be.visible");
|
Page.navbar.userPreferences.should("be.visible");
|
||||||
|
Page.navbar.username.contains("a");
|
||||||
Page.navbar.logout.should("be.visible");
|
Page.navbar.logout.should("be.visible");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ describe("Navigation Bar Tests", () => {
|
||||||
Page.navbar.requests.should("be.visible");
|
Page.navbar.requests.should("be.visible");
|
||||||
Page.navbar.discover.should("be.visible");
|
Page.navbar.discover.should("be.visible");
|
||||||
Page.navbar.userPreferences.should("be.visible");
|
Page.navbar.userPreferences.should("be.visible");
|
||||||
|
Page.navbar.username.contains(id);
|
||||||
Page.navbar.logout.should("be.visible");
|
Page.navbar.logout.should("be.visible");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue