mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-23 12:41:46 +00:00
Fix smoke tests
This commit is contained in:
parent
4c4aaac7a9
commit
1a7d4f6be1
1 changed files with 20 additions and 14 deletions
|
@ -10,6 +10,18 @@ cookeFilePath = "/tmp/smoke-test-cookie-#{port}.txt"
|
||||||
buildUrl = (path) -> " -b #{cookeFilePath} --resolve 'smoke#{Settings.cookieDomain}:#{port}:127.0.0.1' http://smoke#{Settings.cookieDomain}:#{port}/#{path}?setLng=en"
|
buildUrl = (path) -> " -b #{cookeFilePath} --resolve 'smoke#{Settings.cookieDomain}:#{port}:127.0.0.1' http://smoke#{Settings.cookieDomain}:#{port}/#{path}?setLng=en"
|
||||||
logger = require "logger-sharelatex"
|
logger = require "logger-sharelatex"
|
||||||
|
|
||||||
|
# Change cookie to be non secure so curl will send it
|
||||||
|
convertCookieFile = (callback) ->
|
||||||
|
fs = require("fs")
|
||||||
|
fs.readFile cookeFilePath, "utf8", (err, data) ->
|
||||||
|
return callback(err) if err
|
||||||
|
firstTrue = data.indexOf("TRUE")
|
||||||
|
secondTrue = data.indexOf("TRUE", firstTrue+4)
|
||||||
|
result = data.slice(0, secondTrue)+"FALSE"+data.slice(secondTrue+4)
|
||||||
|
fs.writeFile cookeFilePath, result, "utf8", (err) ->
|
||||||
|
return callback(err) if err
|
||||||
|
callback()
|
||||||
|
|
||||||
describe "Opening", ->
|
describe "Opening", ->
|
||||||
|
|
||||||
before (done) ->
|
before (done) ->
|
||||||
|
@ -26,20 +38,14 @@ describe "Opening", ->
|
||||||
return done("smoke test: does not have csrf token")
|
return done("smoke test: does not have csrf token")
|
||||||
csrf = csrfMatches[1]
|
csrf = csrfMatches[1]
|
||||||
|
|
||||||
# Change cookie to be non secure so curl will send it
|
convertCookieFile (err) ->
|
||||||
fs = require("fs")
|
return done(err) if err?
|
||||||
fs.readFile cookeFilePath, "utf8", (err, data) ->
|
command = """
|
||||||
return done(err) if err
|
curl -c #{cookeFilePath} -H "Content-Type: application/json" -H "X-Forwarded-Proto: https" -d '{"_csrf":"#{csrf}", "email":"#{Settings.smokeTest.user}", "password":"#{Settings.smokeTest.password}"}' #{buildUrl('register')}
|
||||||
firstTrue = data.indexOf("TRUE")
|
"""
|
||||||
secondTrue = data.indexOf("TRUE", firstTrue+4)
|
child.exec command, (err) ->
|
||||||
result = data.slice(0, secondTrue)+"FALSE"+data.slice(secondTrue+4)
|
return done(err) if err?
|
||||||
fs.writeFile cookeFilePath, result, "utf8", (err) ->
|
convertCookieFile done
|
||||||
return done(err) if err
|
|
||||||
|
|
||||||
command = """
|
|
||||||
curl -H "Content-Type: application/json" -H "X-Forwarded-Proto: https" -d '{"_csrf":"#{csrf}", "email":"#{Settings.smokeTest.user}", "password":"#{Settings.smokeTest.password}"}' #{buildUrl('register')}
|
|
||||||
"""
|
|
||||||
child.exec command, done
|
|
||||||
|
|
||||||
after (done)->
|
after (done)->
|
||||||
command = """
|
command = """
|
||||||
|
|
Loading…
Reference in a new issue