 	it "a project", (done) ->
 		@timeout(4000)
 		command =  """
-			curl -v #{buildUrl("project/#{Settings.smokeTest.projectId}")}
+			curl -H "X-Forwarded-Proto: https" -v #{buildUrl("project/#{Settings.smokeTest.projectId}")}
 		"""
 		child.exec command, (error, stdout, stderr)->
 			expect(error, "smoke test: error in getting project").to.not.exist

Settings = require "settings-sharelatex"
port = Settings.internal?.web?.port or Settings.port or 3000
cookeFilePath = "/tmp/smoke-test-cookie-#{port}.txt"
buildUrl = (path) -> " -b #{cookeFilePath} -c #{cookeFilePath}  -H 'X-Forwarded-Proto: https' --resolve 'smoke#{Settings.cookieDomain}:#{port}:127.0.0.1' http://smoke#{Settings.cookieDomain}:#{port}/#{path}?setLng=en"

describe "Opening", ->

	before (done) ->

		command =  """
			curl #{buildUrl('register')}
		"""
		child.exec command, (err, stdout, stderr)->
			if err? then done(err)
			csrf = stdout.match("<input name=\"_csrf\" type=\"hidden\" value=\"(.*?)\">")[1]
		
			command = """
				curl -H "Content-Type: application/json" -d '{"_csrf":"#{csrf}", "email":"#{Settings.smokeTest.user}", "password":"#{Settings.smokeTest.password}"}' #{buildUrl('register')}
			"""

			child.exec command, (err, stdout, stderr)->

				done(err)

	after (done)-> 
		fs.unlink cookeFilePath, done

	it "the project list", (done) ->
		@timeout(4000)
		command =  """
			curl -H "X-Forwarded-Proto: https" -v #{buildUrl("project")}
		"""
		child.exec command, (error, stdout, stderr)->
		
