mirror of https://github.com/Ombi-app/Ombi
parent
a6274bc38d
commit
cd6b70f771
@ -0,0 +1,27 @@
|
||||
import { defineConfig } from 'cypress'
|
||||
|
||||
export default defineConfig({
|
||||
watchForFileChanges: true,
|
||||
chromeWebSecurity: false,
|
||||
viewportWidth: 2560,
|
||||
viewportHeight: 1440,
|
||||
retries: {
|
||||
runMode: 2,
|
||||
openMode: 0,
|
||||
},
|
||||
env: {
|
||||
username: 'a',
|
||||
password: 'a',
|
||||
},
|
||||
projectId: 'o5451s',
|
||||
e2e: {
|
||||
// We've imported your old cypress plugins here.
|
||||
// You may want to clean this up later by importing these.
|
||||
setupNodeEvents(on, config) {
|
||||
return require('./cypress/plugins/index.js')(on, config)
|
||||
},
|
||||
baseUrl: 'http://localhost:5000',
|
||||
specPattern: 'cypress/tests/**/*.spec.ts*',
|
||||
excludeSpecPattern: ['**/snapshots/*'],
|
||||
},
|
||||
})
|
@ -1,23 +0,0 @@
|
||||
{
|
||||
"$schema": "https://on.cypress.io/cypress.schema.json",
|
||||
"supportFile": "cypress/support/index.ts",
|
||||
"baseUrl": "http://localhost:5000",
|
||||
"integrationFolder": "cypress/tests",
|
||||
"testFiles": "**/*.spec.ts*",
|
||||
"watchForFileChanges": true,
|
||||
"chromeWebSecurity": false,
|
||||
"viewportWidth": 2560,
|
||||
"viewportHeight": 1440,
|
||||
"retries": {
|
||||
"runMode": 2,
|
||||
"openMode": 0
|
||||
},
|
||||
"ignoreTestFiles": [
|
||||
"**/snapshots/*"
|
||||
],
|
||||
"env": {
|
||||
"username": "a",
|
||||
"password": "a"
|
||||
},
|
||||
"projectId": "o5451s"
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
import { BasePage } from "../../base.page";
|
||||
|
||||
class PlexCredentials {
|
||||
get username(): Cypress.Chainable<any> {
|
||||
return cy.get('#username');
|
||||
}
|
||||
|
||||
get password(): Cypress.Chainable<any> {
|
||||
return cy.get('#password');
|
||||
}
|
||||
|
||||
get loadServers(): Cypress.Chainable<any> {
|
||||
return cy.get('#loadServers');
|
||||
}
|
||||
|
||||
get serverDropdown(): Cypress.Chainable<any> {
|
||||
return cy.get('#servers');
|
||||
}
|
||||
}
|
||||
|
||||
class PlexServerModal {
|
||||
get serverName(): Cypress.Chainable<any> {
|
||||
return cy.get('#serverName');
|
||||
}
|
||||
get hostName(): Cypress.Chainable<any> {
|
||||
return cy.get('#ip');
|
||||
}
|
||||
get port(): Cypress.Chainable<any> {
|
||||
return cy.get('#port');
|
||||
}
|
||||
get ssl(): Cypress.Chainable<any> {
|
||||
return cy.get('#ssl');
|
||||
}
|
||||
get authToken(): Cypress.Chainable<any> {
|
||||
return cy.get('#authToken');
|
||||
}
|
||||
get machineIdentifier(): Cypress.Chainable<any> {
|
||||
return cy.get('#machineId');
|
||||
}
|
||||
get externalHostname(): Cypress.Chainable<any> {
|
||||
return cy.get('#externalHostname');
|
||||
}
|
||||
get batchSize(): Cypress.Chainable<any> {
|
||||
return cy.get('#batchSize');
|
||||
}
|
||||
get loadLibraries(): Cypress.Chainable<any> {
|
||||
return cy.get('#loadLibs');
|
||||
}
|
||||
get testButton(): Cypress.Chainable<any> {
|
||||
return cy.get('#testPlexButton');
|
||||
}
|
||||
get deleteButton(): Cypress.Chainable<any> {
|
||||
return cy.get('#deleteServer');
|
||||
}
|
||||
get cancelButton(): Cypress.Chainable<any> {
|
||||
return cy.get('#cancel');
|
||||
}
|
||||
get saveButton(): Cypress.Chainable<any> {
|
||||
return cy.get('#saveServer');
|
||||
}
|
||||
}
|
||||
|
||||
class PlexServersGrid {
|
||||
serverCardButton(name: string): Cypress.Chainable<any> {
|
||||
return cy.get(`#${name}-button`);
|
||||
}
|
||||
}
|
||||
|
||||
class PlexSettingsPage extends BasePage {
|
||||
|
||||
|
||||
get enableCheckbox(): Cypress.Chainable<any> {
|
||||
return cy.get('#enable');
|
||||
}
|
||||
|
||||
get enableWatchlist(): Cypress.Chainable<any> {
|
||||
return cy.get('#enableWatchlistImport');
|
||||
}
|
||||
|
||||
get submit(): Cypress.Chainable<any> {
|
||||
return cy.get('#save');
|
||||
}
|
||||
|
||||
get fullySync(): Cypress.Chainable<any> {
|
||||
return cy.get('#fullSync');
|
||||
}
|
||||
|
||||
get partialSync(): Cypress.Chainable<any> {
|
||||
return cy.get('#recentlyAddedSync');
|
||||
}
|
||||
|
||||
get clearAndResync(): Cypress.Chainable<any> {
|
||||
return cy.get('#clearData');
|
||||
}
|
||||
|
||||
get runWatchlist(): Cypress.Chainable<any> {
|
||||
return cy.get('#watchlistImport');
|
||||
}
|
||||
|
||||
plexCredentials = new PlexCredentials();
|
||||
plexServerModal = new PlexServerModal();
|
||||
plexServerGrid = new PlexServersGrid();
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
visit(options: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow>;
|
||||
visit(): Cypress.Chainable<Cypress.AUTWindow>;
|
||||
visit(id: string): Cypress.Chainable<Cypress.AUTWindow>;
|
||||
visit(id: string, options: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow>;
|
||||
visit(id?: any, options?: any) {
|
||||
return cy.visit(`/Settings/Plex`, options);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const plexSettingsPage = new PlexSettingsPage();
|
@ -0,0 +1,20 @@
|
||||
import { BasePage } from "../base.page";
|
||||
|
||||
|
||||
class SettingsPage extends BasePage {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
visit(options: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow>;
|
||||
visit(): Cypress.Chainable<Cypress.AUTWindow>;
|
||||
visit(id: string): Cypress.Chainable<Cypress.AUTWindow>;
|
||||
visit(id: string, options: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow>;
|
||||
visit(id?: any, options?: any) {
|
||||
return cy.visit(`/Settings/About`, options);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const settingsPage = new SettingsPage();
|
@ -0,0 +1,12 @@
|
||||
|
||||
Cypress.Commands.add('clearPlexServers', () => {
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: '/api/v1/Settings/Plex/',
|
||||
body: `{"enable":false,"enableWatchlistImport":false,"monitorAll":false,"installId":"0c5c597d-56ea-4f34-8f59-18d34ec82482","servers":[],"id":2}`,
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + window.localStorage.getItem('id_token'),
|
||||
'Content-Type':"application/json"
|
||||
}
|
||||
})
|
||||
})
|
@ -0,0 +1,122 @@
|
||||
import { plexSettingsPage as Page } from "@/integration/page-objects";
|
||||
|
||||
describe("Plex Settings Tests", () => {
|
||||
beforeEach(() => {
|
||||
cy.login();
|
||||
cy.clearPlexServers();
|
||||
});
|
||||
|
||||
const plexTvApiResponse = `{
|
||||
"success": true,
|
||||
"message": null,
|
||||
"servers": {
|
||||
"server": [
|
||||
{
|
||||
"accessToken": "myaccessToken",
|
||||
"name": "AutomationServer",
|
||||
"address": "1.1.1.1",
|
||||
"port": "32400",
|
||||
"version": "1.30.0.6442-5070ad484",
|
||||
"scheme": "http",
|
||||
"host": "2.2.2.2",
|
||||
"localAddresses": "localhost",
|
||||
"machineIdentifier": "9999999999999999",
|
||||
"createdAt": "5555555555",
|
||||
"updatedAt": "6666666666",
|
||||
"owned": "1",
|
||||
"synced": "0",
|
||||
"sourceTitle": null,
|
||||
"ownerId": null,
|
||||
"home": null
|
||||
}
|
||||
],
|
||||
"friendlyName": "myPlex",
|
||||
"identifier": "com.plexapp.plugins.myplex",
|
||||
"machineIdentifier": "3dd86546546546540ff065465460c2654654654654",
|
||||
"size": "1"
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
it("Load Servers from Plex.TV Api and Save", () => {
|
||||
loadServerFromPlexTvApi();
|
||||
|
||||
const modal = Page.plexServerModal;
|
||||
modal.serverName.should('have.value','AutomationServer');
|
||||
modal.hostName.should('have.value','localhost');
|
||||
modal.port.should('have.value','32400');
|
||||
modal.authToken.should('have.value','myaccessToken');
|
||||
modal.machineIdentifier.should('have.value','9999999999999999');
|
||||
|
||||
modal.saveButton.click();
|
||||
|
||||
Page.plexServerGrid.serverCardButton('AutomationServer').should('be.visible');
|
||||
|
||||
Page.submit.click();
|
||||
|
||||
cy.wait("@plexSave");
|
||||
|
||||
});
|
||||
|
||||
it("Load Servers from Plex.TV Api and Edit", () => {
|
||||
loadServerFromPlexTvApi();
|
||||
|
||||
const modal = Page.plexServerModal;
|
||||
modal.saveButton.click();
|
||||
|
||||
Page.plexServerGrid.serverCardButton('AutomationServer').should('be.visible');
|
||||
|
||||
Page.submit.click();
|
||||
|
||||
cy.wait("@plexSave");
|
||||
|
||||
// Edit server
|
||||
Page.plexServerGrid.serverCardButton('AutomationServer').click();
|
||||
modal.serverName.should('have.value','AutomationServer');
|
||||
modal.hostName.should('have.value','localhost');
|
||||
modal.port.should('have.value','32400');
|
||||
modal.authToken.should('have.value','myaccessToken');
|
||||
modal.machineIdentifier.should('have.value','9999999999999999');
|
||||
|
||||
});
|
||||
|
||||
// Need to finish the witemock container
|
||||
it.skip("Load Servers from Plex.TV Api and Test", () => {
|
||||
loadServerFromPlexTvApi();
|
||||
cy.intercept("POST", "api/v1/tester/plex", (req) => {
|
||||
req.reply((res) => {
|
||||
res.send(plexTvApiResponse);
|
||||
});
|
||||
}).as("testResponse");
|
||||
|
||||
const modal = Page.plexServerModal;
|
||||
|
||||
modal.testButton.click();
|
||||
cy.wait("@testResponse");
|
||||
|
||||
});
|
||||
|
||||
function loadServerFromPlexTvApi() {
|
||||
cy.intercept("POST", "api/v1/Plex/servers", (req) => {
|
||||
req.reply((res) => {
|
||||
res.send(plexTvApiResponse);
|
||||
});
|
||||
}).as("serverResponse");
|
||||
|
||||
cy.intercept("POST", "api/v1/Settings/Plex").as('plexSave');
|
||||
|
||||
Page.visit();
|
||||
|
||||
Page.plexCredentials.username.type('username');
|
||||
Page.plexCredentials.password.type('password');
|
||||
|
||||
Page.plexCredentials.loadServers.click();
|
||||
|
||||
cy.wait("@serverResponse");
|
||||
|
||||
Page.plexCredentials.serverDropdown.click().get('mat-option').contains('AutomationServer').click();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue