-
-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add cypress foundation (#2903) [skip ci]
- Loading branch information
Showing
27 changed files
with
848 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,4 @@ public/os_logo_filled.png | |
public/preview.jpg | ||
snap | ||
stylelint.config.js | ||
cypress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Cypress Tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- '*' | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Cypress run | ||
uses: cypress-io/github-action@v4 | ||
with: | ||
build: yarn cypress:build | ||
start: yarn start | ||
wait-on: 'http://localhost:5055' | ||
record: true | ||
env: | ||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
WITH_MIGRATIONS: true | ||
# Fix test titles in cypress dashboard | ||
COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}} | ||
COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { defineConfig } from 'cypress'; | ||
|
||
export default defineConfig({ | ||
projectId: 'onnqy3', | ||
e2e: { | ||
baseUrl: 'http://localhost:5055', | ||
experimentalSessionAndOrigin: true, | ||
}, | ||
env: { | ||
ADMIN_EMAIL: '[email protected]', | ||
ADMIN_PASSWORD: 'test1234', | ||
USER_EMAIL: '[email protected]', | ||
USER_PASSWORD: 'test1234', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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": "IntcbiAgICBcIm5vdGlmaWNhdGlvbl90eXBlXCI6IFwie3tub3RpZmljYXRpb25fdHlwZX19XCIsXG4gICAgXCJldmVudFwiOiBcInt7ZXZlbnR9fVwiLFxuICAgIFwic3ViamVjdFwiOiBcInt7c3ViamVjdH19XCIsXG4gICAgXCJtZXNzYWdlXCI6IFwie3ttZXNzYWdlfX1cIixcbiAgICBcImltYWdlXCI6IFwie3tpbWFnZX19XCIsXG4gICAgXCJ7e21lZGlhfX1cIjoge1xuICAgICAgICBcIm1lZGlhX3R5cGVcIjogXCJ7e21lZGlhX3R5cGV9fVwiLFxuICAgICAgICBcInRtZGJJZFwiOiBcInt7bWVkaWFfdG1kYmlkfX1cIixcbiAgICAgICAgXCJ0dmRiSWRcIjogXC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iY29tbWVudGVkQnlfZW1haWxcIjogXCJ7e2NvbW1lbnRlZEJ5X2VtYWlsfX1cIixcbiAgICAgICAgXCJjb21tZW50ZWRCeV91c2VybmFtZVwiOiBcInt7Y29tbWVudGVkQnlfdXNlcm5hbWV9fVwiLFxuICAgICAgICBcImNvbW1lbnRlZEJ5X2F2YXRhclwiOiBcInt7Y29tbWVudGVkQnlfYXZhdGFyfX1cIlxuICAgIH0sXG4gICAgXCJ7e2V4dHJhfX1cIjogW11cbn0i" | ||
} | ||
}, | ||
"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 * * *" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)' | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)' | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
const testUser = { | ||
displayName: 'Test User', | ||
emailAddress: '[email protected]', | ||
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'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}, | ||
} | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import './commands'; | ||
|
||
before(() => { | ||
if (Cypress.env('SEED_DATABASE')) { | ||
cy.exec('yarn cypress:prepare'); | ||
} | ||
}); |
Oops, something went wrong.