mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-05 18:01:01 +00:00
Merge pull request #2398 from overleaf/ta-skip-registration-tests
Skip Registration-Related Tests in OSS Codebase GitOrigin-RevId: 72647f6f54799145bf7bec93ad088c35ceae8fa6
This commit is contained in:
parent
0aafef36ca
commit
465329527b
4 changed files with 70 additions and 0 deletions
|
@ -11,6 +11,11 @@
|
|||
*/
|
||||
let Features
|
||||
const Settings = require('settings-sharelatex')
|
||||
const fs = require('fs')
|
||||
|
||||
const publicRegistrationModuleAvailable = fs.existsSync(
|
||||
`${__dirname}/../../../modules/public-registration`
|
||||
)
|
||||
|
||||
module.exports = Features = {
|
||||
externalAuthenticationSystemUsed() {
|
||||
|
@ -56,6 +61,9 @@ module.exports = Features = {
|
|||
return Settings.enableSaml
|
||||
case 'link-url':
|
||||
return Settings.apis.linkedUrlProxy && Settings.apis.linkedUrlProxy.url
|
||||
|
||||
case 'public-registration':
|
||||
return publicRegistrationModuleAvailable
|
||||
default:
|
||||
throw new Error(`unknown feature: ${feature}`)
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ const Async = require('async')
|
|||
const User = require('./helpers/User')
|
||||
const settings = require('settings-sharelatex')
|
||||
const CollaboratorsEmailHandler = require('../../../app/src/Features/Collaborators/CollaboratorsEmailHandler')
|
||||
const Features = require('../../../app/src/infrastructure/Features')
|
||||
|
||||
const createInvite = (sendingUser, projectId, email, callback) => {
|
||||
sendingUser.getCsrfToken(err => {
|
||||
|
@ -623,6 +624,12 @@ describe('ProjectInviteTests', function() {
|
|||
|
||||
describe('user is not logged in initially', function() {
|
||||
describe('registration prompt workflow with valid token', function() {
|
||||
before(function() {
|
||||
if (!Features.hasFeature('public-registration')) {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
|
||||
it('should redirect to the register page', function(done) {
|
||||
expectInviteRedirectToRegister(this.user, this.link, done)
|
||||
})
|
||||
|
@ -648,6 +655,12 @@ describe('ProjectInviteTests', function() {
|
|||
})
|
||||
|
||||
describe('registration prompt workflow with non-valid token', function() {
|
||||
before(function() {
|
||||
if (!Features.hasFeature('public-registration')) {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
|
||||
it('should redirect to the register page', function(done) {
|
||||
Async.series(
|
||||
[
|
||||
|
|
|
@ -22,6 +22,7 @@ const request = require('./helpers/request')
|
|||
const settings = require('settings-sharelatex')
|
||||
const redis = require('./helpers/redis')
|
||||
const _ = require('lodash')
|
||||
const Features = require('../../../app/src/infrastructure/Features')
|
||||
|
||||
// Currently this is testing registration via the 'public-registration' module,
|
||||
// whereas in production we're using the 'overleaf-integration' module.
|
||||
|
@ -137,6 +138,12 @@ describe('Registration', function() {
|
|||
})
|
||||
|
||||
describe('CSRF protection', function() {
|
||||
before(function() {
|
||||
if (!Features.hasFeature('public-registration')) {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
|
||||
beforeEach(function() {
|
||||
this.user = new User()
|
||||
this.email = `test+${Math.random()}@example.com`
|
||||
|
@ -222,6 +229,12 @@ describe('Registration', function() {
|
|||
})
|
||||
|
||||
describe('Register', function() {
|
||||
before(function() {
|
||||
if (!Features.hasFeature('public-registration')) {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
|
||||
beforeEach(function() {
|
||||
return (this.user = new User())
|
||||
})
|
||||
|
@ -240,6 +253,12 @@ describe('Registration', function() {
|
|||
})
|
||||
|
||||
describe('Register with bonus referal id', function() {
|
||||
before(function() {
|
||||
if (!Features.hasFeature('public-registration')) {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
|
||||
beforeEach(function(done) {
|
||||
this.user1 = new User()
|
||||
this.user2 = new User()
|
||||
|
@ -286,6 +305,12 @@ describe('Registration', function() {
|
|||
})
|
||||
|
||||
describe('[Security] Trying to register/login as another user', function() {
|
||||
before(function() {
|
||||
if (!Features.hasFeature('public-registration')) {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
|
||||
it('should not allow sign in with secondary email', function(done) {
|
||||
const secondaryEmail = 'acceptance-test-secondary@example.com'
|
||||
return this.user1.addEmail(secondaryEmail, err => {
|
||||
|
|
|
@ -2,6 +2,7 @@ const AuthenticationManager = require('../../../app/src/Features/Authentication/
|
|||
const UserHelper = require('./helpers/UserHelper')
|
||||
const chai = require('chai')
|
||||
const chaiAsPromised = require('chai-as-promised')
|
||||
const Features = require('../../../app/src/infrastructure/Features')
|
||||
|
||||
const expect = chai.expect
|
||||
chai.should()
|
||||
|
@ -94,6 +95,12 @@ describe('UserHelper', function() {
|
|||
|
||||
describe('registerUser', function() {
|
||||
describe('with no args', function() {
|
||||
before(function() {
|
||||
if (!Features.hasFeature('public-registration')) {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
|
||||
it('should create new user with default username and password', async function() {
|
||||
const userHelper = await UserHelper.registerUser()
|
||||
userHelper.user.email.should.equal(userHelper.getDefaultEmail())
|
||||
|
@ -106,6 +113,12 @@ describe('UserHelper', function() {
|
|||
})
|
||||
|
||||
describe('with email', function() {
|
||||
before(function() {
|
||||
if (!Features.hasFeature('public-registration')) {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
|
||||
it('should create new user with provided email and default password', async function() {
|
||||
const userHelper = await UserHelper.registerUser({
|
||||
email: 'foo2@test.com'
|
||||
|
@ -120,6 +133,12 @@ describe('UserHelper', function() {
|
|||
})
|
||||
|
||||
describe('with password', function() {
|
||||
before(function() {
|
||||
if (!Features.hasFeature('public-registration')) {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
|
||||
it('should create new user with provided password and default email', async function() {
|
||||
const userHelper = await UserHelper.registerUser({
|
||||
password: 'foofoofoo'
|
||||
|
@ -136,6 +155,11 @@ describe('UserHelper', function() {
|
|||
|
||||
describe('after logout', function() {
|
||||
let userHelper, oldCsrfToken
|
||||
before(function() {
|
||||
if (!Features.hasFeature('public-registration')) {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
|
||||
beforeEach(async function() {
|
||||
userHelper = await UserHelper.registerUser()
|
||||
|
|
Loading…
Reference in a new issue