OAuth.cy.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /// <reference types="cypress" />
  2. describe('OAuth with Authentik', () => {
  3. let token;
  4. if (Cypress.env('skipStackCheck') === 'true' || Cypress.env('stack') === 'postgres') {
  5. before(() => {
  6. cy.getToken().then((tok) => {
  7. token = tok;
  8. // cy.task('backendApiPut', {
  9. // token: token,
  10. // path: '/api/settings/oauth-auth',
  11. // data: {
  12. // value: {
  13. // client_id: '7iO2AvuUp9JxiSVkCcjiIbQn4mHmUMBj7yU8EjqU',
  14. // client_secret: 'VUMZzaGTrmXJ8PLksyqzyZ6lrtz04VvejFhPMBP9hGZNCMrn2LLBanySs4ta7XGrDr05xexPyZT1XThaf4ubg00WqvHRVvlu4Naa1aMootNmSRx3VAk6RSslUJmGyHzq',
  15. // authorization_url: 'http://authentik:9000/application/o/authorize/',
  16. // resource_url: 'http://authentik:9000/application/o/userinfo/',
  17. // token_url: 'http://authentik:9000/application/o/token/',
  18. // logout_url: 'http://authentik:9000/application/o/npm/end-session/',
  19. // identifier: 'preferred_username',
  20. // scopes: [],
  21. // auto_create_user: true
  22. // }
  23. // }
  24. // }).then((data) => {
  25. // cy.validateSwaggerSchema('put', 200, '/settings/{name}', data);
  26. // expect(data.result).to.have.property('id');
  27. // expect(data.result.id).to.be.greaterThan(0);
  28. // });
  29. // cy.task('backendApiPut', {
  30. // token: token,
  31. // path: '/api/settings/auth-methods',
  32. // data: {
  33. // value: [
  34. // 'local',
  35. // 'oauth'
  36. // ]
  37. // }
  38. // }).then((data) => {
  39. // cy.validateSwaggerSchema('put', 200, '/settings/{name}', data);
  40. // expect(data.result).to.have.property('id');
  41. // expect(data.result.id).to.be.greaterThan(0);
  42. // });
  43. });
  44. });
  45. it.skip('Should log in with OAuth', function() {
  46. // cy.task('backendApiGet', {
  47. // path: '/oauth/login?redirect_base=' + encodeURI(Cypress.config('baseUrl')),
  48. // }).then((data) => {
  49. // expect(data).to.have.property('result');
  50. // cy.origin('http://authentik:9000', {args: data.result}, (url) => {
  51. // cy.visit(url);
  52. // cy.get('ak-flow-executor')
  53. // .shadow()
  54. // .find('ak-stage-identification')
  55. // .shadow()
  56. // .find('input[name="uidField"]', { visible: true })
  57. // .type('cypress');
  58. // cy.get('ak-flow-executor')
  59. // .shadow()
  60. // .find('ak-stage-identification')
  61. // .shadow()
  62. // .find('button[type="submit"]', { visible: true })
  63. // .click();
  64. // cy.get('ak-flow-executor')
  65. // .shadow()
  66. // .find('ak-stage-password')
  67. // .shadow()
  68. // .find('input[name="password"]', { visible: true })
  69. // .type('fqXBfUYqHvYqiwBHWW7f');
  70. // cy.get('ak-flow-executor')
  71. // .shadow()
  72. // .find('ak-stage-password')
  73. // .shadow()
  74. // .find('button[type="submit"]', { visible: true })
  75. // .click();
  76. // })
  77. // // we should be logged in
  78. // cy.get('#root p.chakra-text')
  79. // .first()
  80. // .should('have.text', 'Nginx Proxy Manager');
  81. // // logout:
  82. // cy.clearLocalStorage();
  83. // });
  84. });
  85. }
  86. });