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');
});
});
});

View file

@ -1,5 +1,6 @@
{
"devDependencies": {
"@bahmutov/cy-api": "^1.5.0",
"cypress": "6.8.0",
"cypress-wait-until": "^1.7.1",
"typescript": "^4.2.3"

View file

@ -2,7 +2,7 @@
"compilerOptions": {
"target": "es5",
"lib": ["es2018", "dom"],
"types": ["cypress", "cypress-wait-until", "cypress-image-snapshot", "cypress-real-events"],
"types": ["cypress", "cypress-wait-until", "cypress-image-snapshot", "cypress-real-events", "@bahmutov/cy-api"],
"baseUrl": "./cypress",
"paths": {
"@/*": ["./*"]

View file

@ -2,6 +2,13 @@
# yarn lockfile v1
"@bahmutov/cy-api@^1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@bahmutov/cy-api/-/cy-api-1.5.0.tgz#e6569f1d0f3040e55f97cf151a16932bfb10dcc6"
integrity sha512-N1pBawxcwXyDpJx0qwd78k/6yFEyHWVC71N7n78Rnaegs3LR1Z0odZJrKurpb56JFaP4abNm6EONXEEi5boMmQ==
dependencies:
common-tags "1.8.0"
"@cypress/listr-verbose-renderer@^0.4.1":
version "0.4.1"
resolved "https://registry.yarnpkg.com/@cypress/listr-verbose-renderer/-/listr-verbose-renderer-0.4.1.tgz#a77492f4b11dcc7c446a34b3e28721afd33c642a"
@ -330,7 +337,7 @@ commander@^5.1.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae"
integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==
common-tags@^1.8.0:
common-tags@1.8.0, common-tags@^1.8.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.0.tgz#8e3153e542d4a39e9b10554434afaaf98956a937"
integrity sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw==