When I set js: true in my test, I get the default website:
"This domain is established to be used for illustrative examples in documents. You may use this"...
But when I dissable js: true, I get my right webpage. Also, I tryed with js_erros: false but does not work.
it 'my tests', js: true do
# ....
end
Anyone knows something about it? Anything to read? I looked for a while for a solution without results.
Any help will be appreciated.
Thanks.
Switch your something_url to something_path.
I was having the same problem and this approach solved it. I hope it helps!
Related
Let's say I've just open a random Stackoverflow page, then I open Console in Firefox and run something like this:
alert(document.getElementsByClassName("question-hyperlink")["0"]["firstChild"].textContent)
As a result, it will pop up me the question asked on that page (on this particular page it would be Vimperator and Javascript: getting value of an object).
Now, I want to use that value in a script with Vimperator. I add something like this to my .vimperatorrc
:js << EOF
function dummyFu() {
var myElement = document.getElementsByClassName("question-hyperlink");
alert(myElement["0"].firstChild.textContent);
}
EOF
map <F5> :js dummyFu()<CR>
However, when run, it says TypeError: myElement[0] is undefined.
So, what is wrong? Would be grateful for any suggestion, thanks.
See https://developer.mozilla.org/en-US/docs/Web/API/Window/content
E.g., content.document.getElementsByClassName("question-hyperlink")[0].firstChild.textContent;
(No, it's not me, but all the credits go to GitHub user dkearns, actually. Thanks them a lot. :)
I’m using Angular 1.3.15. I’m trying to disable automatic scrolling when the hash changes.
According to the documentation I need to call disableAutoScrolling() on the $anchorScrollProvider. So here’s my code:
var app = angular.module("myApp", [
// ... dependencies here ...
]);
app.config(['$locationProvider', '$anchorScrollProvider', function($locationProvider, $anchorScrollProvider) {
$locationProvider.html5Mode({ enabled: true, requireBase: false });
$anchorScrollProvider.disableAutoScrolling();
}]);
This, however, throws an “undefined is not a function” error on the second to last line.
Any ideas why it’s happening?
Thanks.
Solution is The issue was rather embarrassing (this is the author of the question, BTW).
While looking for a way to disable auto scrolling, some people suggested that the only way to make it actually work was to remove $anchorScroll from the module.
So in one of my controllers I’d added .value($anchorScroll, angular.noop) and forgot about it. Obviously that removed $anchorScroll from my module hence the errors.
Thanks everyone for help. You guided me towards the solution.
I have a 17000 line page with lots of HTML/JavaScript/jQuery and it's always frustrating when I make a typo and there's no clue when the page loads into the browser what the problem is. It just - doesn't do anything. Consider the patch of code below, for example, where the third line terminates with a ' instead of a ; .
$(document).on('click', 'input#answer_chkbx', function(e) {
if(e.target.checked){
x$ = g.currentElement$.find('.cellContent')'
g.currentElement$.addClass('answerBox')
.css('background-color','tansparent')
.height(25)
.width(150);
}
});
There should be something that runs through the code and finds that immediately.
Is there a way to check for things like this?
Thanks
You might consider a tool such as JSLint or JSHint.
For offline coding you can use Netbeans IDE or Dreamweaver
I started using Jasmine to test javascript code and its working fine. But I would like to display inputs to the test suite in specrunner.html.
I tried HtmlReporter() and TrivialReporter() but no luck.
SPEC CODE:
checkAddition("TEST_SUITE","Test INPUTS1",getResult(2,3),5);
checkAddition("TEST_SUITE","Test INPUTS2",getResult(3,8),11);
function checkAddition(suite_name,testcase,result,equalto){
describe(suite_name, function() {
it(testcase, function() {
expect(result).toEqual(equalto);
});
});
}
JavaScript CODE:
function getResult(input1,input2){
return input1+input2;
}
OUTPUT :
EXPECTED OUTPUT :
I need to display inputs that looks like expected output (I edited code in browser using firebug to share expected output).
Please help me. Help would be appreciated :)
The built reporters won't do this. You either need to need to hack the innards of those built in reporters to do this (you're on your own with this route), or create your own reports from scratch (see here for some examples).
But I find this to be a strange request. Perhaps there is a cleaner way to achieve your goal, whatever that may be. Maybe a test suite isn't what you want if you want this info.
I'm using everyauth, and am having trouble authenticating it with github. It seems like all of the steps I've followed thus far are correct, but it keeps telling me it cannot GET /auth/github when clicking the "connect with github" link.
Here's a gist with my code: https://gist.github.com/2641260
Any help would be greatly appreciated!
I know its probably too late to answer, but I just had the same problem and figured out the solution.
Its really simple.
Place the EveryAuth code before the app.configure() code.
This way: Fork of your Gist
Not sure if this will help but have you tried adding the ".entryPath" chainable parameter?
everyauth.github
.entryPath('/auth/github')
.appId("APP_ID")
.appSecret("APP_SECRET")
.findOrCreateUser( function (sess, accessToken, accessTokenExtra, ghUser) {
console.log('find user')
// return usersByGhId[ghUser.id] || (usersByGhId[ghUser.id] = addUser('github', ghUser));
})
.redirectPath('/');