Fixed the v1 API, added tests around that API to ensure we keep backwards compatability

This commit is contained in:
tidusjar 2021-03-28 15:36:18 +01:00
commit c464b23bdc
11 changed files with 1316 additions and 137 deletions

File diff suppressed because it is too large Load diff

View file

@ -17,6 +17,7 @@
import './commands'
import './request.commands';
import "cypress-real-events/support";
import '@bahmutov/cy-api/support';
// Alternatively you can use CommonJS syntax:
// require('./commands')

View file

@ -0,0 +1,31 @@
import { movieDetailsPage as Page } from "@/integration/page-objects";
describe("TV Search V1 API tests", () => {
beforeEach(() => {
cy.login();
});
it("Get Extra TV Info", () => {
cy.api({url: '/api/v1/search/tv/info/121361', 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 => {
expect(res.body).deep.equal(x);
})
});
});
it("Popular TV", () => {
cy.api({url: '/api/v1/search/tv/popular', 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');
});
});
});