In my project, I don't wanna use construction function () {}, instead of that I wanna use () => {} or () => (). Code below. In first example I can see this, in second case this undefined. So I wonder, Is it possible way to make () => {} see this? I tried to use () => {}.bind(this) did not work and ({ context: this }) => {} did not work either.
// Example 1
describe('Currency converter', () => {
it('should be shown on the page', function () {
console.log(this); // { bla: ..., blabla: ... }
return this.browser
.url('/')
.keys(['currence', '\uE007'])
.isExisting('.converter-form')
.then((exists) => {
assert.ok(exists, 'currence did not show');
});
});
});
// Example 2
describe('Currency converter', () => {
it('should be shown on the page', () => {
console.log(this) // undefinded
return this.browser
.url('/')
.keys(['currence', '\uE007'])
.isExisting('.converter-form')
.then((exists) => {
assert.ok(exists, 'currence did not show');
});
});
});