Fixing request calls to include base url

This commit is contained in:
Jason House
2021-04-28 10:43:11 -04:00
parent 8bdacae940
commit c671d6cf56
12 changed files with 50 additions and 48 deletions
@@ -34,7 +34,7 @@ describe('Schedule Configuration Tests', () => {
cy.get('#scheduleSaveError')
.should('not.be.visible');
cy.request('/schedule')
cy.request(`${BASE_URL}/schedule`)
.then((resp) => {
const result = resp.body;
expect(result).to.have.property('message', 'Monthly');
@@ -54,7 +54,7 @@ describe('Schedule Configuration Tests', () => {
cy.get('#scheduleSaveError')
.should('not.be.visible');
cy.request('/schedule')
cy.request(`${BASE_URL}/schedule`)
.then((resp) => {
const result = resp.body;
expect(result).to.have.property('message', 'Hourly');
@@ -91,7 +91,7 @@ function searchMovieWithNewMetadataLibrary(cy) {
}
function waitUtilSearchingIsDone() {
cy.request('/searchStatus')
cy.request(`${BASE_URL}//searchStatus`)
.then((resp) => {
if (resp.status === 200 && resp.body.isSearching === false) {
return;
@@ -111,11 +111,11 @@ describe('Search for Duplicates', () => {
waitUtilSearchingIsDone();
let ownedMovies;
cy.request('/plex/movies/c51c432ae94e316d52570550f915ecbcd71bede8/1')
cy.request(`${BASE_URL}/plex/movies/c51c432ae94e316d52570550f915ecbcd71bede8/1`)
.then((resp) => {
ownedMovies = resp.body;
cy.log(`ownedMovies.length: ${ownedMovies.length}`);
}).request('/recommended/c51c432ae94e316d52570550f915ecbcd71bede8/1')
}).request(`${BASE_URL}/recommended/c51c432ae94e316d52570550f915ecbcd71bede8/1`)
.then((resp) => {
const recommendedMovies = resp.body.extras;
checkForDuplicates(ownedMovies, recommendedMovies);
@@ -128,10 +128,10 @@ describe('Search for Duplicates', () => {
waitUtilSearchingIsDone();
let ownedMovies;
cy.request('/plex/movies/c51c432ae94e316d52570550f915ecbcd71bede8/4')
cy.request(`${BASE_URL}/plex/movies/c51c432ae94e316d52570550f915ecbcd71bede8/4`)
.then((resp) => {
ownedMovies = resp.body;
}).request('/recommended/c51c432ae94e316d52570550f915ecbcd71bede8/4')
}).request(`${BASE_URL}/recommended/c51c432ae94e316d52570550f915ecbcd71bede8/4`)
.then((resp) => {
const recommendedMovies = resp.body.extras;
checkForDuplicates(ownedMovies, recommendedMovies);
+3 -1
View File
@@ -11,9 +11,11 @@
/* global cy, it, expect, describe */
/* eslint no-undef: "error" */
import {BASE_URL} from "../common.spec";
describe('Check Error Page', () => {
it('Does error page load', () => {
cy.request({ url: '/bad', method: 'GET', failOnStatusCode: false })
cy.request({ url: `${BASE_URL}/bad`, method: 'GET', failOnStatusCode: false })
.should((response) => {
expect(response.status).to.eq(404);
});
+3 -3
View File
@@ -35,7 +35,7 @@ function searchSawLibrary(cy) {
describe('Library API', () => {
it('Get bad library', () => {
cy.request('/libraries/abc/123')
cy.request(`${BASE_URL}/libraries/abc/123`)
.then((resp) => {
cy.log(resp.body);
const result = resp.body;
@@ -48,7 +48,7 @@ describe('Library API', () => {
it('Get library Joker - Saw', () => {
searchSawLibrary(cy);
cy.request('/libraries/c51c432ae94e316d52570550f915ecbcd71bede8/5')
cy.request(`${BASE_URL}/libraries/c51c432ae94e316d52570550f915ecbcd71bede8/5`)
.then((resp) => {
cy.log(resp.body);
const result = resp.body;
@@ -62,7 +62,7 @@ describe('Plex Movie List API', () => {
beforeEach(redLibraryBefore);
it('Get library Joker - Saw', () => {
cy.request('/plex/movies/c51c432ae94e316d52570550f915ecbcd71bede8/5')
cy.request(`${BASE_URL}/plex/movies/c51c432ae94e316d52570550f915ecbcd71bede8/5`)
.then((resp) => {
cy.log(resp.body);
const result = resp.body;
@@ -41,7 +41,7 @@ describe('Check Discord Notification Agent', () => {
beforeEach(nuke);
it('Check for Empty Discord Notification Agent Settings', () => {
cy.request('/notifications/discord')
cy.request(`${BASE_URL}/notifications/discord`)
.then((resp) => {
const { body } = resp;
cy.fixture('discord.empty.json')
@@ -94,13 +94,13 @@ describe('Check Discord Notification Agent', () => {
webHookUrl: faker.internet.url(),
};
cy.request('PUT', '/notifications/discord', dummyAll)
cy.request('PUT', `${BASE_URL}/notifications/discord`, dummyAll)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(140);
expect(body.extras).to.eq(null);
})
.request('/notifications/discord')
.request(`${BASE_URL}/notifications/discord`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(142);
@@ -142,13 +142,13 @@ describe('Check Discord Notification Agent', () => {
],
webHookUrl: faker.internet.url(),
};
cy.request('PUT', '/notifications/discord', tmdbOnly)
cy.request('PUT', `${BASE_URL}/notifications/discord`, tmdbOnly)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(140);
expect(body.extras).to.eq(null);
})
.request('/notifications/discord')
.request(`${BASE_URL}/notifications/discord`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(142);
@@ -65,7 +65,7 @@ describe('Check Email Notification Agent', () => {
beforeEach(nuke);
it('Check for Email Gotify Notification Agent Settings', () => {
cy.request('/notifications/email')
cy.request(`${BASE_URL}/notifications/email`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(122);
@@ -148,13 +148,13 @@ describe('Check Email Notification Agent', () => {
mailSmtpTlsEnabled: faker.random.boolean(),
};
cy.request('PUT', '/notifications/email', email)
cy.request('PUT', `${BASE_URL}/notifications/email`, email)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(120);
expect(body.extras).to.eq(null);
})
.request('/notifications/email')
.request(`${BASE_URL}/notifications/email`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(122);
@@ -230,13 +230,13 @@ describe('Check Email Notification Agent', () => {
mailSmtpTlsEnabled: faker.random.boolean(),
};
cy.request('PUT', '/notifications/email', email)
cy.request('PUT', `${BASE_URL}/notifications/email`, email)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(120);
expect(body.extras).to.eq(null);
})
.request('/notifications/email')
.request(`${BASE_URL}/notifications/email`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(122);
@@ -44,7 +44,7 @@ describe('Check Gotify Notification Agent', () => {
beforeEach(nuke);
it('Check for Empty Gotify Notification Agent Settings', () => {
cy.request('/notifications/gotify')
cy.request(`${BASE_URL}/notifications/gotify`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(112);
@@ -92,13 +92,13 @@ describe('Check Gotify Notification Agent', () => {
token: faker.random.alphaNumeric(),
};
cy.request('PUT', '/notifications/gotify', gotify)
cy.request('PUT', `${BASE_URL}/notifications/gotify`, gotify)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(110);
expect(body.extras).to.eq(null);
})
.request('/notifications/gotify')
.request(`${BASE_URL}/notifications/gotify`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(112);
@@ -144,13 +144,13 @@ describe('Check Gotify Notification Agent', () => {
token: faker.random.alphaNumeric(),
};
cy.request('PUT', '/notifications/gotify', gotify)
cy.request('PUT', `${BASE_URL}/notifications/gotify`, gotify)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(110);
expect(body.extras).to.eq(null);
})
.request('/notifications/gotify')
.request(`${BASE_URL}/notifications/gotify`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(112);
@@ -44,7 +44,7 @@ describe('Check PushBullet Notification Agent', () => {
beforeEach(nuke);
it('Check for Empty PushBullet Notification Agent Settings', () => {
cy.request('/notifications/pushbullet')
cy.request(`${BASE_URL}/notifications/pushbullet`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(102);
@@ -92,13 +92,13 @@ describe('Check PushBullet Notification Agent', () => {
accessToken: faker.random.alphaNumeric(),
};
cy.request('PUT', '/notifications/pushbullet', pushBullet)
cy.request('PUT', `${BASE_URL}/notifications/pushbullet`, pushBullet)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(100);
expect(body.extras).to.eq(null);
})
.request('/notifications/pushbullet')
.request(`${BASE_URL}/notifications/pushbullet`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(102);
@@ -144,13 +144,13 @@ describe('Check PushBullet Notification Agent', () => {
accessToken: faker.random.alphaNumeric(),
};
cy.request('PUT', '/notifications/pushbullet', pushBullet)
cy.request('PUT', `${BASE_URL}/notifications/pushbullet`, pushBullet)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(100);
expect(body.extras).to.eq(null);
})
.request('/notifications/pushbullet')
.request(`${BASE_URL}/notifications/pushbullet`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(102);
@@ -56,7 +56,7 @@ describe('Check PushOver Notification Agent', () => {
beforeEach(nuke);
it('Check for Empty PushOver Notification Agent Settings', () => {
cy.request('/notifications/pushOver')
cy.request(`${BASE_URL}/notifications/pushOver`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(132);
@@ -90,13 +90,13 @@ describe('Check PushOver Notification Agent', () => {
expire: faker.random.number(10000),
};
cy.request('PUT', '/notifications/pushOver', pushOver)
cy.request('PUT', `${BASE_URL}/notifications/pushOver`, pushOver)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(130);
expect(body.extras).to.eq(null);
})
.request('/notifications/pushOver')
.request(`${BASE_URL}/notifications/pushOver`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(132);
@@ -128,13 +128,13 @@ describe('Check PushOver Notification Agent', () => {
expire: faker.random.number(10000),
};
cy.request('PUT', '/notifications/pushOver', pushOver)
cy.request('PUT', `${BASE_URL}/notifications/pushOver`, pushOver)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(130);
expect(body.extras).to.eq(null);
})
.request('/notifications/pushOver')
.request(`${BASE_URL}/notifications/pushOver`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(132);
@@ -41,7 +41,7 @@ describe('Check Slack Notification Agent', () => {
beforeEach(nuke);
it('Check for Empty Slack Notification Agent Settings', () => {
cy.request('/notifications/slack')
cy.request(`${BASE_URL}/notifications/slack`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(92);
@@ -84,13 +84,13 @@ describe('Check Slack Notification Agent', () => {
webHookUrl: faker.internet.url(),
};
cy.request('PUT', '/notifications/slack', slack)
cy.request('PUT', `${BASE_URL}/notifications/slack`, slack)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(90);
expect(body.extras).to.eq(null);
})
.request('/notifications/slack')
.request(`${BASE_URL}/notifications/slack`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(92);
@@ -112,13 +112,13 @@ describe('Check Slack Notification Agent', () => {
webHookUrl: faker.internet.url(),
};
cy.request('PUT', '/notifications/slack', slack)
cy.request('PUT', `${BASE_URL}/notifications/slack`, slack)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(90);
expect(body.extras).to.eq(null);
})
.request('/notifications/slack')
.request(`${BASE_URL}/notifications/slack`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(92);
@@ -44,7 +44,7 @@ describe('Check Telegram Notification Agent', () => {
beforeEach(nuke);
it('Check for Empty Telegram Notification Agent Settings', () => {
cy.request('/notifications/telegram')
cy.request(`${BASE_URL}/notifications/telegram`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(82);
@@ -70,13 +70,13 @@ describe('Check Telegram Notification Agent', () => {
botId: faker.random.alphaNumeric(),
};
cy.request('PUT', '/notifications/telegram', telegram)
cy.request('PUT', `${BASE_URL}/notifications/telegram`, telegram)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(80);
expect(body.extras).to.eq(null);
})
.request('/notifications/telegram')
.request(`${BASE_URL}/notifications/telegram`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(82);
@@ -100,13 +100,13 @@ describe('Check Telegram Notification Agent', () => {
botId: faker.random.alphaNumeric(),
};
cy.request('PUT', '/notifications/telegram', telegram)
cy.request('PUT', `${BASE_URL}/notifications/telegram`, telegram)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(80);
expect(body.extras).to.eq(null);
})
.request('/notifications/telegram')
.request(`${BASE_URL}/notifications/telegram`)
.then((resp) => {
const { body } = resp;
expect(body.code).to.eq(82);
+2 -2
View File
@@ -37,7 +37,7 @@ function searchSawLibrary(cy) {
describe('Recommended API', () => {
it('Get Bad recommended', () => {
cy.request('/recommended/a/2')
cy.request(`${BASE_URL}/recommended/a/2`)
.then((resp) => {
cy.log(resp.body);
const result = resp.body;
@@ -49,7 +49,7 @@ describe('Recommended API', () => {
redLibraryBefore();
searchSawLibrary(cy);
cy.request('/libraries/c51c432ae94e316d52570550f915ecbcd71bede8/5')
cy.request(`${BASE_URL}/libraries/c51c432ae94e316d52570550f915ecbcd71bede8/5`)
.then((resp) => {
cy.log(resp.body);
const result = resp.body;