Protractor e2e test for downloading and comparing file with browser.driver.wait is timing out - protractor

I followed the suggestions in this thread: Protractor e2e test case for downloading pdf file and the file is downloading properly, but the test is timing out before the compare/expect is reached.
var filename = 'somefilename';
var content = 'some content\r\nsome more content';
download.click();
browser.driver.wait(function() {
return fs.existsSync(filename);
}, 5000).then(function() {
expect(fs.readFileSync(filename, {encoding: 'utf8'})).toEqual(content);
});
It creates and downloads the file and then sits there for 5 seconds before continuing on. The message I get is:
Message:
Error: Wait timed out after 5000ms
Stacktrace:
Error: Wait timed out after 5000ms
at Array.forEach (native)
From: Task: <anonymous wait>
at /path/to/test/e2e/scenarios.js:337:28
at Array.forEach (native)
Where line 337 is the browser.driver.wait line.
I tried doing it without the browser.driver.wait since the download is actually very quick since the file is just two short line by doing the following:
expect(fs.existsSync(filename));
browser.sleep(5000);
expect(fs.readFileSync(filename, {encoding: 'utf8'})).toEqual(content);
but it says that the filename doesn't exist for readFileSync and I assume this is because the file is not downloaded yet and the browser.sleep(5000) doesn't do anything.
Is there another way to do promises in protractor? Or can anyone clue me in as to why this might not be working? I'm running Protractor 2.1.0. I was running 1.0.0 and updated everything before trying again, but alas, it still isn't working.
Best regards,
Julie

I figured out the problem. My filename didn't contain the path that I set in the 'default_directory' of my protractor-conf.js file. Once I put in the whole path, it worked. Boy do I feel silly!

Related

vscode python lint problem at the first column of first line

I have python modules that I run in VSCode for development.
And everything works fine until today VSCode suddenly said that one of the module had some binding problem and made the file name tab red.
VSCode the problem occurs in the first character of the first line which is the following standard line at every module of my program.
from __future__ import print_function # (at top of module)
But strangely VSCode did not raise the same problem for other module that starts with the same line.
The problem message is like this.
An internal error occurred while binding file "aModule.py": Error: Debug Failure. createKeyForReference received unexpected expression type
at createKeyForReference (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\codeFlowTypes.ts:240:9)
at createKeyForReference (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\codeFlowTypes.ts:218:25)
at C.visitAssignment (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:849:50)
at C.visitNode (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:132:29)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:98:37)
at forEach (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:107:22)
at Array.forEach (<anonymous>)
at C.walkMultiple (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:105:15)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:100:18)
at C._walkStatementsAndReportUnreachable (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:2583:22)
at C.visitSuite (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:345:14)
at C.visitNode (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:330:29)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:98:37)
at callback (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:1290:22)
at C._trackCodeFlowExpressions (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:3236:9)
at C.visitIf (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:1265:48)
at C.visitNode (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:184:29)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:98:37)
at C._walkStatementsAndReportUnreachable (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:2583:22)
at C.visitSuite (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:345:14)
at C.visitNode (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:330:29)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:98:37)
at Object.callback (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:545:22)
at C._bindDeferred (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:4140:22)
at C.bindModule (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:298:14)
at callback (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\sourceFile.ts:1197:28)
at s.timeOperation (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\common\timing.ts:40:20)
at callback (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\sourceFile.ts:1184:38)
at t.LogTracker.log (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\common\logTracker.ts:43:20)
at t.SourceFile.bind (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\sourceFile.ts:1181:33)
at O._bindFile (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\program.ts:931:34)
at c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\program.ts:1051:18
Can someone help?
Thanks
Farn

Internal /bin/cp command failed. xCode compiler error

I'm working in Xcode trying to build a simple calendar app. As I tried to build and run I get this error
/Users/Zach/Downloads/Xcode-beta.app/COnonts/Developer/Toolchains/XcodeDefault.xctoolchain/
usr/bin/bitcode_strip: internal /bin/cp command failed.
Task Failed with exit 1 signal 0 {
All I know is that it gives me the error when this line is typed... It goes away when I comment it out.
let ce = NSKeyedUnarchiver.unarchiveObject(with: eventObject as Data) as! CalenderEvent
UPDATE:
I just tried to recompile and was given a new error.
"libswiftCore.dylib" couldn't be copied to "(A Document Being Saved BY Xcode)".
It appears like something is wrong with the swift std library. It randomly switches between the two errors.
I get this same error when I run low on disk space. Try moving the project to a different location, with more space, clean the project, and re-build.

capistrano upload! thinks ~ referenced local directory is on remote server

So every example I've looked up indicates this is how one is supposed to do it but I think I may have found a bug unless there's another way to do this.
I'm using upload! to upload assets to a remote list of servers. The task looks like this:
desc "Upload grunt compiled css/js."
task :upload_assets do
on roles(:all) do
%w{/htdocs/css /htdocs/js}.each do |asset|
upload! "#{fetch(:local_path) + asset}", "#{release_path.to_s + '/' + asset}", recursive: true
end
end
end
If local_path is defined as an absolute path such as:
set :local_path:, '/home/dcmbrown/projects/ABC'
This works fine. However if I do the following:
set :local_path:, '~/projects/ABC'
I end up getting the error:
The deploy has failed with an error: Exception while executing on ec2-54-23-88-125.us-west-2.compute.amazon.com: No such file or directory - ~/projects/ABC/htdocs/css
It's not a ' vs " issue as I've tried both (and I didn't think capistrano paid attention to that anyway).
Is this a bug? Is there a work around? Am I just doing it wrong?
I ended up discovering the best way to do this is to actually use path expansion! (headsmack)
irb> File.expand_path('~dcmbrown/projects/ABC')
=> "/home/dcmbrown/projects/ABC"
Of course what I'd like is to do automatic path expansion but you can't have everything. I think I was mostly dumbstruck that it didn't automatically; so much so I spent a couple of hours trying to figure out why it didn't work and ended up wasting time asking here. :(
I don't think the error is coming from the remote server, it just looks like it since it's running that upload command in the context of a deploy.
I just created a single cap task to just do an upload using the "~" character and it also fails with
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy#XXX: No such file or directory # rb_file_s_stat - ~/Projects/testapp/public/404.html
It appears to be a Ruby issue not Capistrano as this also fails in a Ruby console
~/Projects/testapp $ irb
2.2.2 :003 > File.stat('~/Projects/testapp/public/404.html')
Errno::ENOENT: No such file or directory # rb_file_s_stat - ~/Projects/testapp/public/404.html
from (irb):3:in `stat'
from (irb):3
from /Users/supairish/.rvm/rubies/ruby-2.2.2/bin/irb:11:in `<main>'

Emacs Elnode can't show html pages

I have installed Emacs elnode by Marmalade, and everything looks OK. And I have read the manual carefully.
Now elnode has started, and I can view the folder public_html under .emacs.d\elnode folder.
If I input url http://localhost:8000 in my Chrome, it will show following content:
/
.
..
default-webserver-image.png
test.html
But when I click the test.html file, chrome just can't get the response from elnode. I check my Emacs, the Message file provides two errors:
elnode-error: elnode--sentinel 'open from 127.0.0.1.' for process elnode-webserver-proc 127.0.0.1:2224 with buffer nil
elnode-error: Elnode status: elnode-webserver-proc 127.0.0.1:2224 open from 127.0.0.1
elnode-error: filter: calling handler on elnode-webserver-proc 127.0.0.1:2224
elnode-error: starting HTTP response on elnode-webserver-proc 127.0.0.1:2224
error in process filter: apply: Spawning child process: invalid argument
error in process filter: Spawning child process: invalid argument
I just don't know how to debug it. I also tried elnode-send-file function, it also doesn't work.
But If I run the Hello World example, it works:
(defun my-status-page (httpcon)
(elnode-http-start httpcon 200 '("Content-type" . "text/html"))
(elnode-http-return httpcon "<html><b>HELLO!</b></html>"))
(elnode-start 'my-status-page :port 8010)
The core problem is that Emacs can't send html page!
Is it necessary to do some basic configuration after installing elnode?
Thanks
Water Lin
The newest edition has solved the problem. If you meet the same problem as me, please download the newest edition.
My test environment is Windows7 & Emacs 24.2.1.

wurfl2 integration in TYPO3

everytime i try to install the wurfl2 extension in TYPO3 i get the following error message:
Fatal error: require_once() [function.require]: Failed opening required '' (include_path='.:/usr/local/php/lib/php:/usr/local/php/lib/php/PEAR') in /html/typo3conf/temp_CACHED_ps9b8e_ext_localconf.php on line 501
is anyone familiar with this error and knows how to fix it?
I get the same error message with TYPO3 4.4.4. I had to remove the extension folder and to delete all ./typo3conf/temp* files to get Typo3 running again afterwards.
(You might not see the error message if you don't have something like $TYPO3_CONF_VARS['SYS']['displayErrors'] = '1' in your localconf.php. You can set this with the installtool.
As already mentioned by the other answer first you have to get your system running again: set $TYPO3_CONF_VARS['SYS']['displayErrors'] = '1' in your localconf.php in order to see all error messages. Afterwards remove the extension folder.
I think the error is caused by a missing config file. The extension constant wurflConfig has to be set with the absolute path to the file /YOUR/PATH/TO/WEB_DIR/typo3conf/ext/wurfl2/res1/li/wurfl_config.php and might have to adjust the settings there.