mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
test: add cypress foundation (#2903) [skip ci]
This commit is contained in:
149
cypress/config/settings.cypress.json
Normal file
149
cypress/config/settings.cypress.json
Normal file
@@ -0,0 +1,149 @@
|
||||
{
|
||||
"clientId": "6919275e-142a-48d8-be6b-93594cbd4626",
|
||||
"vapidPrivate": "tmnslaO8ZWN6bNbSEv_rolPeBTlNxOwCCAHrM9oZz3M",
|
||||
"vapidPublic": "BK_EpP8NDm9waor2zn6_S28o3ZYv4kCkJOfYpO3pt3W6jnPmxrgTLANUBNbbyaNatPnSQ12De9CeqSYQrqWzHTs",
|
||||
"main": {
|
||||
"apiKey": "testkey",
|
||||
"applicationTitle": "Overseerr",
|
||||
"applicationUrl": "",
|
||||
"csrfProtection": false,
|
||||
"cacheImages": false,
|
||||
"defaultPermissions": 32,
|
||||
"defaultQuotas": {
|
||||
"movie": {},
|
||||
"tv": {}
|
||||
},
|
||||
"hideAvailable": false,
|
||||
"localLogin": true,
|
||||
"newPlexLogin": true,
|
||||
"region": "",
|
||||
"originalLanguage": "",
|
||||
"trustProxy": false,
|
||||
"partialRequestsEnabled": true,
|
||||
"locale": "en"
|
||||
},
|
||||
"plex": {
|
||||
"name": "Seerr",
|
||||
"ip": "192.168.1.1",
|
||||
"port": 32400,
|
||||
"useSsl": false,
|
||||
"libraries": [
|
||||
{
|
||||
"id": "1",
|
||||
"name": "Movies",
|
||||
"enabled": true,
|
||||
"type": "movie"
|
||||
}
|
||||
],
|
||||
"machineId": "test"
|
||||
},
|
||||
"tautulli": {},
|
||||
"radarr": [],
|
||||
"sonarr": [],
|
||||
"public": {
|
||||
"initialized": true
|
||||
},
|
||||
"notifications": {
|
||||
"agents": {
|
||||
"email": {
|
||||
"enabled": false,
|
||||
"options": {
|
||||
"emailFrom": "",
|
||||
"smtpHost": "",
|
||||
"smtpPort": 587,
|
||||
"secure": false,
|
||||
"ignoreTls": false,
|
||||
"requireTls": false,
|
||||
"allowSelfSigned": false,
|
||||
"senderName": "Overseerr"
|
||||
}
|
||||
},
|
||||
"discord": {
|
||||
"enabled": false,
|
||||
"types": 0,
|
||||
"options": {
|
||||
"webhookUrl": "",
|
||||
"enableMentions": true
|
||||
}
|
||||
},
|
||||
"lunasea": {
|
||||
"enabled": false,
|
||||
"types": 0,
|
||||
"options": {
|
||||
"webhookUrl": ""
|
||||
}
|
||||
},
|
||||
"slack": {
|
||||
"enabled": false,
|
||||
"types": 0,
|
||||
"options": {
|
||||
"webhookUrl": ""
|
||||
}
|
||||
},
|
||||
"telegram": {
|
||||
"enabled": false,
|
||||
"types": 0,
|
||||
"options": {
|
||||
"botAPI": "",
|
||||
"chatId": "",
|
||||
"sendSilently": false
|
||||
}
|
||||
},
|
||||
"pushbullet": {
|
||||
"enabled": false,
|
||||
"types": 0,
|
||||
"options": {
|
||||
"accessToken": ""
|
||||
}
|
||||
},
|
||||
"pushover": {
|
||||
"enabled": false,
|
||||
"types": 0,
|
||||
"options": {
|
||||
"accessToken": "",
|
||||
"userToken": ""
|
||||
}
|
||||
},
|
||||
"webhook": {
|
||||
"enabled": false,
|
||||
"types": 0,
|
||||
"options": {
|
||||
"webhookUrl": "",
|
||||
"jsonPayload": "IntcbiAgICBcIm5vdGlmaWNhdGlvbl90eXBlXCI6IFwie3tub3RpZmljYXRpb25fdHlwZX19XCIsXG4gICAgXCJldmVudFwiOiBcInt7ZXZlbnR9fVwiLFxuICAgIFwic3ViamVjdFwiOiBcInt7c3ViamVjdH19XCIsXG4gICAgXCJtZXNzYWdlXCI6IFwie3ttZXNzYWdlfX1cIixcbiAgICBcImltYWdlXCI6IFwie3tpbWFnZX19XCIsXG4gICAgXCJ7e21lZGlhfX1cIjoge1xuICAgICAgICBcIm1lZGlhX3R5cGVcIjogXCJ7e21lZGlhX3R5cGV9fVwiLFxuICAgICAgICBcInRtZGJJZFwiOiBcInt7bWVkaWFfdG1kYmlkfX1cIixcbiAgICAgICAgXCJ0dmRiSWRcIjogXCJ7e21l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VudGVkQnlfZW1haWxcIjogXCJ7e2NvbW1lbnRlZEJ5X2VtYWlsfX1cIixcbiAgICAgICAgXCJjb21tZW50ZWRCeV91c2VybmFtZVwiOiBcInt7Y29tbWVudGVkQnlfdXNlcm5hbWV9fVwiLFxuICAgICAgICBcImNvbW1lbnRlZEJ5X2F2YXRhclwiOiBcInt7Y29tbWVudGVkQnlfYXZhdGFyfX1cIlxuICAgIH0sXG4gICAgXCJ7e2V4dHJhfX1cIjogW11cbn0i"
|
||||
}
|
||||
},
|
||||
"webpush": {
|
||||
"enabled": false,
|
||||
"options": {}
|
||||
},
|
||||
"gotify": {
|
||||
"enabled": false,
|
||||
"types": 0,
|
||||
"options": {
|
||||
"url": "",
|
||||
"token": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"jobs": {
|
||||
"plex-recently-added-scan": {
|
||||
"schedule": "0 */5 * * * *"
|
||||
},
|
||||
"plex-full-scan": {
|
||||
"schedule": "0 0 3 * * *"
|
||||
},
|
||||
"radarr-scan": {
|
||||
"schedule": "0 0 4 * * *"
|
||||
},
|
||||
"sonarr-scan": {
|
||||
"schedule": "0 30 4 * * *"
|
||||
},
|
||||
"download-sync": {
|
||||
"schedule": "0 * * * * *"
|
||||
},
|
||||
"download-sync-reset": {
|
||||
"schedule": "0 0 1 * * *"
|
||||
}
|
||||
}
|
||||
}
|
44
cypress/e2e/discover.cy.ts
Normal file
44
cypress/e2e/discover.cy.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
const clickFirstTitleCardInSlider = (sliderTitle: string): void => {
|
||||
cy.contains('.slider-header', sliderTitle)
|
||||
.next('[data-testid=media-slider]')
|
||||
.find('[data-testid=title-card]')
|
||||
.first()
|
||||
.trigger('mouseover')
|
||||
.find('[data-testid=title-card-title]')
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
cy.contains('.slider-header', sliderTitle)
|
||||
.next('[data-testid=media-slider]')
|
||||
.find('[data-testid=title-card]')
|
||||
.first()
|
||||
.click();
|
||||
cy.get('[data-testid=media-title]').should('contain', text);
|
||||
});
|
||||
};
|
||||
|
||||
describe('Discover', () => {
|
||||
beforeEach(() => {
|
||||
cy.login(Cypress.env('ADMIN_EMAIL'), Cypress.env('ADMIN_PASSWORD'));
|
||||
cy.visit('/');
|
||||
});
|
||||
|
||||
it('loads a trending item', () => {
|
||||
clickFirstTitleCardInSlider('Trending');
|
||||
});
|
||||
|
||||
it('loads popular movies', () => {
|
||||
clickFirstTitleCardInSlider('Popular Movies');
|
||||
});
|
||||
|
||||
it('loads upcoming movies', () => {
|
||||
clickFirstTitleCardInSlider('Upcoming Movies');
|
||||
});
|
||||
|
||||
it('loads popular series', () => {
|
||||
clickFirstTitleCardInSlider('Popular Series');
|
||||
});
|
||||
|
||||
it('loads upcoming series', () => {
|
||||
clickFirstTitleCardInSlider('Upcoming Series');
|
||||
});
|
||||
});
|
13
cypress/e2e/login.cy.ts
Normal file
13
cypress/e2e/login.cy.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
describe('Login Page', () => {
|
||||
it('succesfully logs in as an admin', () => {
|
||||
cy.login(Cypress.env('ADMIN_EMAIL'), Cypress.env('ADMIN_PASSWORD'));
|
||||
cy.visit('/');
|
||||
cy.contains('Recently Added');
|
||||
});
|
||||
|
||||
it('succesfully logs in as a local user', () => {
|
||||
cy.login(Cypress.env('USER_EMAIL'), Cypress.env('USER_PASSWORD'));
|
||||
cy.visit('/');
|
||||
cy.contains('Recently Added');
|
||||
});
|
||||
});
|
12
cypress/e2e/movie-details.cy.ts
Normal file
12
cypress/e2e/movie-details.cy.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
describe('Movie Details', () => {
|
||||
it('loads a movie page', () => {
|
||||
cy.login(Cypress.env('ADMIN_EMAIL'), Cypress.env('ADMIN_PASSWORD'));
|
||||
// Try to load minions: rise of gru
|
||||
cy.visit('/movie/438148');
|
||||
|
||||
cy.get('[data-testid=media-title]').should(
|
||||
'contain',
|
||||
'Minions: The Rise of Gru (2022)'
|
||||
);
|
||||
});
|
||||
});
|
12
cypress/e2e/tv-details.cy.ts
Normal file
12
cypress/e2e/tv-details.cy.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
describe('TV Details', () => {
|
||||
it('loads a movie page', () => {
|
||||
cy.login(Cypress.env('ADMIN_EMAIL'), Cypress.env('ADMIN_PASSWORD'));
|
||||
// Try to load stranger things
|
||||
cy.visit('/tv/66732');
|
||||
|
||||
cy.get('[data-testid=media-title]').should(
|
||||
'contain',
|
||||
'Stranger Things (2016)'
|
||||
);
|
||||
});
|
||||
});
|
67
cypress/e2e/user/user-list.cy.ts
Normal file
67
cypress/e2e/user/user-list.cy.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
const testUser = {
|
||||
displayName: 'Test User',
|
||||
emailAddress: 'test@seeerr.dev',
|
||||
password: 'test1234',
|
||||
};
|
||||
|
||||
describe('User List', () => {
|
||||
beforeEach(() => {
|
||||
cy.login(Cypress.env('ADMIN_EMAIL'), Cypress.env('ADMIN_PASSWORD'));
|
||||
});
|
||||
|
||||
it('opens the user list from the home page', () => {
|
||||
cy.visit('/');
|
||||
|
||||
cy.get('[data-testid=sidebar-toggle]').click();
|
||||
cy.get('[data-testid=sidebar-menu-users-mobile]').click();
|
||||
|
||||
cy.get('[data-testid=page-header').should('contain', 'User List');
|
||||
});
|
||||
|
||||
it('can find the admin user and friend user in the user list', () => {
|
||||
cy.visit('/users');
|
||||
|
||||
cy.get('[data-testid=user-list-row]').contains(Cypress.env('ADMIN_EMAIL'));
|
||||
cy.get('[data-testid=user-list-row]').contains(Cypress.env('USER_EMAIL'));
|
||||
});
|
||||
|
||||
it('can create a local user', () => {
|
||||
cy.visit('/users');
|
||||
|
||||
cy.contains('Create Local User').click();
|
||||
|
||||
cy.get('[data-testid=modal-title').should('contain', 'Create Local User');
|
||||
|
||||
cy.get('#displayName').type(testUser.displayName);
|
||||
cy.get('#email').type(testUser.emailAddress);
|
||||
cy.get('#password').type(testUser.password);
|
||||
|
||||
cy.intercept('/api/v1/user?take=10&skip=0&sort=displayname').as('user');
|
||||
|
||||
cy.get('[data-testid=modal-ok-button').click();
|
||||
|
||||
cy.wait('@user');
|
||||
|
||||
cy.get('[data-testid=user-list-row]').contains(testUser.emailAddress);
|
||||
});
|
||||
|
||||
it('can delete the created local test user', () => {
|
||||
cy.visit('/users');
|
||||
|
||||
cy.contains('[data-testid=user-list-row]', testUser.emailAddress)
|
||||
.contains('Delete')
|
||||
.click();
|
||||
|
||||
cy.get('[data-testid=modal-title]').should('contain', 'Delete User');
|
||||
|
||||
cy.intercept('/api/v1/user?take=10&skip=0&sort=displayname').as('user');
|
||||
|
||||
cy.get('[data-testid=modal-ok-button').should('contain', 'Delete').click();
|
||||
|
||||
cy.wait('@user');
|
||||
|
||||
cy.get('[data-testid=user-list-row]')
|
||||
.contains(testUser.emailAddress)
|
||||
.should('not.exist');
|
||||
});
|
||||
});
|
26
cypress/support/commands.ts
Normal file
26
cypress/support/commands.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
Cypress.Commands.add('login', (email, password) => {
|
||||
cy.session(
|
||||
[email, password],
|
||||
() => {
|
||||
cy.visit('/login');
|
||||
cy.contains('Use your Overseerr account').click();
|
||||
|
||||
cy.get('[data-testid=email]').type(email);
|
||||
cy.get('[data-testid=password]').type(password);
|
||||
|
||||
cy.intercept('/api/v1/auth/local').as('localLogin');
|
||||
cy.get('[data-testid=local-signin-button]').click();
|
||||
|
||||
cy.wait('@localLogin');
|
||||
|
||||
cy.url().should('contain', '/');
|
||||
},
|
||||
{
|
||||
validate() {
|
||||
cy.request('/api/v1/auth/me').its('status').should('eq', 200);
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
7
cypress/support/e2e.ts
Normal file
7
cypress/support/e2e.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import './commands';
|
||||
|
||||
before(() => {
|
||||
if (Cypress.env('SEED_DATABASE')) {
|
||||
cy.exec('yarn cypress:prepare');
|
||||
}
|
||||
});
|
12
cypress/support/index.ts
Normal file
12
cypress/support/index.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
/// <reference types="cypress" />
|
||||
|
||||
declare global {
|
||||
namespace Cypress {
|
||||
interface Chainable {
|
||||
login(email?: string, password?: string): Chainable<Element>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
10
cypress/tsconfig.json
Normal file
10
cypress/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["es5", "dom"],
|
||||
"types": ["cypress", "node"],
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": ["**/*.ts"]
|
||||
}
|
Reference in New Issue
Block a user