Fixed the issue where TV shows sometimes were not appearing as available on the Discover and Search pages, added more automation tests to cover this

pull/4121/head
tidusjar 4 years ago
parent c464b23bdc
commit 57e986a118

@ -198,6 +198,7 @@ export class DiscoverCardComponent implements OnInit {
this.result.url = updated.imdbId;
this.result.overview = updated.overview;
this.result.approved = updated.approved;
this.result.available = updated.fullyAvailable;
this.fullyLoaded = true;
}

File diff suppressed because it is too large Load Diff

@ -6,7 +6,7 @@ describe("TV Search V1 API tests", () => {
});
it("Get Extra TV Info", () => {
cy.api({url: '/api/v1/search/tv/info/121361', headers: { 'Authorization': 'Bearer ' + window.localStorage.getItem('id_token')} })
cy.api({url: '/api/v1/search/tv/info/287247', headers: { 'Authorization': 'Bearer ' + window.localStorage.getItem('id_token')} })
.then((res) => {
expect(res.status).equal(200);
cy.fixture('api/v1/tv-search-extra-info').then(x => {
@ -15,17 +15,37 @@ describe("TV Search V1 API tests", () => {
});
});
it("Popular TV", () => {
cy.api({url: '/api/v1/search/tv/popular', headers: { 'Authorization': 'Bearer ' + window.localStorage.getItem('id_token')} })
it("TV Basic Search", () => {
cy.api({url: '/api/v1/search/tv/Shitts Creek', headers: { 'Authorization': 'Bearer ' + window.localStorage.getItem('id_token')} })
.then((res) => {
expect(res.status).equal(200);
expect(res.status).equal(200);
const body = res.body;
expect(body.length).is.greaterThan(0);
expect(body[0].title).is.not.null;
expect(body[0].title).is.equal("Schitt's Creek")
expect(body[0].status).is.equal("Ended");
expect(body[0].id).is.not.null;
expect(body[0].id).to.be.an('number');
});
});
const types = [
'popular',
'trending',
'anticipated',
'mostwatched'
];
types.forEach((type) => {
// derive test name from data
it(`${type} TV List`, () => {
cy.api({url: '/api/v1/search/tv/'+type, headers: { 'Authorization': 'Bearer ' + window.localStorage.getItem('id_token')} })
.then((res) => {
expect(res.status).equal(200);
const body = res.body;
expect(body.length).is.greaterThan(0);
expect(body[0].title).is.not.null;
expect(body[0].id).is.not.null;
expect(body[0].id).to.be.an('number');
});
});
});
});

@ -227,6 +227,37 @@ describe("Discover Cards Requests Tests", () => {
});
});
it.only("Available TV (From Details Call) does not allow us to request", () => {
cy.intercept("GET", "**/search/Tv/popular/**").as("cardsResponse");
window.localStorage.setItem("DiscoverOptions2", "3");
Page.visit();
cy.wait("@cardsResponse").then((res) => {
const body = res.response.body;
var expectedId = body[1].id;
cy.intercept("GET", "**/search/Tv/moviedb/"+expectedId, (req) => {
req.reply((res2) => {
const body = res2.body;
body.fullyAvailable = true;
res2.send(body);
});
}).as("movieDbResponse");
var title = body[1].title;
cy.wait("@movieDbResponse")
const card = Page.popularCarousel.getCard(expectedId, true, DiscoverType.Popular);
card.title.realHover();
card.verifyTitle(title);
card.requestButton.should("not.exist");
card.availabilityText.should("have.text", "Available");
card.statusClass.should("have.class", "available");
});
});
it("Not available TV allow admin to request", () => {
cy.intercept("GET", "**/search/Tv/popular/**", (req) => {
req.reply((res) => {

Loading…
Cancel
Save