-
-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: plex watchlist sync integration (#2885)
- Loading branch information
Ryan Cohen
committed
Aug 21, 2022
1 parent
7943e0c
commit 301f2bf
Showing
35 changed files
with
1,325 additions
and
320 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
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,74 @@ | ||
const visitUserEditPage = (email: string): void => { | ||
cy.visit('/users'); | ||
|
||
cy.contains('[data-testid=user-list-row]', email).contains('Edit').click(); | ||
}; | ||
|
||
describe('Auto Request Settings', () => { | ||
beforeEach(() => { | ||
cy.login(Cypress.env('ADMIN_EMAIL'), Cypress.env('ADMIN_PASSWORD')); | ||
}); | ||
|
||
it('should not see watchlist sync settings on an account without permissions', () => { | ||
visitUserEditPage(Cypress.env('USER_EMAIL')); | ||
|
||
cy.contains('Auto-Request Movies').should('not.exist'); | ||
cy.contains('Auto-Request Series').should('not.exist'); | ||
}); | ||
|
||
it('should see watchlist sync settings on an admin account', () => { | ||
visitUserEditPage(Cypress.env('ADMIN_EMAIL')); | ||
|
||
cy.contains('Auto-Request Movies').should('exist'); | ||
cy.contains('Auto-Request Series').should('exist'); | ||
}); | ||
|
||
it('should see auto-request settings after being given permission', () => { | ||
visitUserEditPage(Cypress.env('USER_EMAIL')); | ||
|
||
cy.get('[data-testid=settings-nav-desktop').contains('Permissions').click(); | ||
|
||
cy.get('#autorequest').should('not.be.checked').click(); | ||
|
||
cy.intercept('/api/v1/user/*/settings/permissions').as('userPermissions'); | ||
|
||
cy.contains('Save Changes').click(); | ||
|
||
cy.wait('@userPermissions'); | ||
|
||
cy.reload(); | ||
|
||
cy.get('#autorequest').should('be.checked'); | ||
cy.get('#autorequestmovies').should('be.checked'); | ||
cy.get('#autorequesttv').should('be.checked'); | ||
|
||
cy.get('[data-testid=settings-nav-desktop').contains('General').click(); | ||
|
||
cy.contains('Auto-Request Movies').should('exist'); | ||
cy.contains('Auto-Request Series').should('exist'); | ||
|
||
cy.get('#watchlistSyncMovies').should('not.be.checked').click(); | ||
cy.get('#watchlistSyncTv').should('not.be.checked').click(); | ||
|
||
cy.intercept('/api/v1/user/*/settings/main').as('userMain'); | ||
|
||
cy.contains('Save Changes').click(); | ||
|
||
cy.wait('@userMain'); | ||
|
||
cy.reload(); | ||
|
||
cy.get('#watchlistSyncMovies').should('be.checked').click(); | ||
cy.get('#watchlistSyncTv').should('be.checked').click(); | ||
|
||
cy.contains('Save Changes').click(); | ||
|
||
cy.wait('@userMain'); | ||
|
||
cy.get('[data-testid=settings-nav-desktop').contains('Permissions').click(); | ||
|
||
cy.get('#autorequest').should('be.checked').click(); | ||
|
||
cy.contains('Save Changes').click(); | ||
}); | ||
}); |
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,25 @@ | ||
{ | ||
"page": 1, | ||
"totalPages": 1, | ||
"totalResults": 20, | ||
"results": [ | ||
{ | ||
"ratingKey": "5d776be17a53e9001e732ab9", | ||
"title": "Top Gun: Maverick", | ||
"mediaType": "movie", | ||
"tmdbId": 361743 | ||
}, | ||
{ | ||
"ratingKey": "5e16338fbc1372003ea68ab3", | ||
"title": "Nope", | ||
"mediaType": "movie", | ||
"tmdbId": 762504 | ||
}, | ||
{ | ||
"ratingKey": "5f409b8452f200004161e126", | ||
"title": "Hocus Pocus 2", | ||
"mediaType": "movie", | ||
"tmdbId": 642885 | ||
} | ||
] | ||
} |
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
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
Oops, something went wrong.