SlideShare a Scribd company logo
JavaScript
Understanding Asynchronism
Gennadii Mishchevskii, Ciklum, Ukraine
whoami
• Gennadii Mishchevskii
• Senior Automation QA Engineer at Ciklum
• 4 years in the industry
• Automated back-end, front-end and mobile
• https://www.linkedin.com/in/gennadiimishchevskii/
Agenda
• Async theory
• Callback
• Promises
• Async/Await
• Quiz
Warm-up
typeof null;
typeof NaN;
NaN instanceof Number;
typeof 'string';
'string' instanceof String;
'1' + +'1';
'1' - -'1';
null > 0;
null == 0;
null >= 0;
{} + [];
true + true - false > true ** 2;
let wtf = () => {
try {
return 24;
} finally {
return 42;
}
};
wtf();
object
number
false
false
string
‘11’
2
false
false
true
0
true
42
Async theory
Order
food
Pay
Clean
after
yourself
Async theory - PHP server, Single Sync thread
Async theory - PHP server, Single Sync thread
timeline
Order
food
Pay
Clean
after
yourself
Async theory - Multithreading Java server
Async theory - Multithreading Java server
timeline Main thread Thread 1 Thread 2 Thread 3
Order
food
Pay
Clean
after
yourself
Async theory - NodeJS Async server
Async theory - NodeJS Async server
timeline Single thread
Libuv
Order
food
Pay
Clean
after
yourself
// example1.js
Async theory - Stack and heap
// stack.js, stackTrace.js, maxCallStack.js
Async theory - Full picture
// fullPicture.js
Promises - 99.99% can't solve this task
func1().then(function () {
return func2();
});
func1().then(function () {
func2();
});
func1().then(func2());
func1().then(func2);
Promises - evolution
Async/Await
Promise
Callback
Callback – why don't we love callbacks
• Callback hell
• Catching errors
• Difficult to wait for several async actions to finish
// callbackLinux.js
Promises – the rescuer
• Callback hell
• Catching errors
• Difficult to wait for several async actions to finish
Promises – the rescuer (specs)
• A promise or “thenable” is an object
that supplies a standard-
compliant .then() method.
• A pending promise may transition
into a fulfilled or rejected state.
Promises – the rescuer (specs)
• A fulfilled or rejected promise is settled, and must not transition into
any other state.
• Once a promise is settled, it must have a value (which may
be undefined). That value must not change.
• Every promise must supply a .then() method with the following
signature:
promise.then(
onFulfilled?: Function,
onRejected?: Function
) => Promise
Promises – the rescuer (specs)
• Both onFulfilled() and onRejected() are optional.​
• If the arguments supplied are not functions, they must be ignored.​
• onFulfilled() will be called after the promise is fulfilled, with the promise’s
value as the first argument.​
• onRejected() will be called after the promise is rejected, with the reason for
rejection as the first argument. The reason may be any valid JavaScript value,
but because rejections are essentially synonymous with exceptions, I
recommend using Error objects.​
Promises – the rescuer (specs)
• .then() may be called many times on the same promise. ​
• .then() must return a new promise, promise2.​
• If either onFulfilled or onRejected throws an exception e, promise2 must be
rejected with e as the reason.​
• If onFulfilled is not a function and promise1 is fulfilled, promise2 must be
fulfilled with the same value as promise1.​
• If onRejected is not a function and promise1 is rejected, promise2 must be
rejected with the same reason as promise1.​
Promises – the rescuer (create and chain)
function myRandomPromise() {
return new Promise(function (resolve, reject) {
const random = Math.random();
random < 0.5
? resolve('Yay, it worked')
: reject('Oh no, something went wrong');
})
}
myPromise()
.then(console.log)
.catch(console.log);
myRandomPromise()
.then(result => console.log(result),
error => console.log(error));
myRandomPromise()
.then(console.log,
console.log);
myRandomPromise()
.catch(console.log);
myRandomPromise()
.then(null, console.log);
Promises – the rescuer (don't forget to catch)
Promise.resolve(42)
.then(doFirst)
.then(doSecond)
.catch(console.log)
.then(doThird)
.catch(err => {
console.log(err);
return err.message;
})
.then(doFourth)
.catch(console.log);
Promises – the rescuer
(what’s gonna happen?)
function myPromise() {
return new Promise(resolve => {
Object.notExistingFunction();
resolve('Resolved');
})
}
myPromise()
.then(console.log)
.catch(console.log);
setTimeout(_ => console.log('setTimeout'));
Promises – the rescuer
(how to ruin it)
function myRandomPromise(num) {
return new Promise(function (resolve) {
resolve(Math.random());
});
}myRandomPromise().then(num => {
return myRandomPromise().then(num => {
return myRandomPromise().then(num => {
return myRandomPromise().then(num => {
return myRandomPromise().then(num => {
return myRandomPromise().then(num => {
console.log(num);
});
});
});
});
});
});
myRandomPromise()
.then(num => {
return myRandomPromise()
})
.then(num => {
return myRandomPromise()
})
.then(num => {
console.log(num);
});
// callbackedPromise.js
Async/Await – the advanced rescuer
• Callback hell
• Catching errors
• Difficult to wait for several async actions to finish
// promiseLunix.js, promise0-1.js , asyncAwaitSimple.js, asyncAwaitFlow.js , asyncAwaitLinux.js, promise2+.js
Async theory - NodeJS Async server
Async theory - NodeJS Async server
timeline Single thread
Libuv
Order
food
Pay
Clean
after
yourself
// example2.js
Quiz – 1. What will be the result
let prоm = new Promise((resolve, reject) => {
resolve('Some message');
});
prоm
.then((result) => {
console.log(result);
}, (err) => {
console.log('Errоr оccurred');
});
1. Some message
2. Errоr оccurred
3. Nothing
4. Some message
Errоr оccurred
5. Errоr оccurred
Some message
Quiz – 2. What will be the result
let prоm = new Promise((resolve, reject) => {
reject('Some message');
});
prоm
.then((result) => {
console.log(result);
}, (err) => {
console.log('Errоr оccurred: ' + err);
});
1. Some message
2. Error occurred:
3. Error occurred: Some message
4. Some message
Error occurred:
5. Nothing
Quiz – 3. What will be the result
let prоm = new Promise((resolve, reject) => {
reject('Some message');
});
prоm
.then((result) => {
console.log(result);
})
.catch(err => {
console.log('Errоr оccurred: ' + err);
});
1. Some message
2. Error occurred: undefined
3. Error occurred: Some message
4. Some message
Error occurred:
5. Error will be thrown
Quiz – 4. What will be the result
let prоm = new Promise((resolve, reject) => {
resolve('Some message');
});
prоm
.then(result => {
throw new Error(result);
}, err => {
console.log('Error occurred: ' + err)
})
.catch((err) => {
console.log('Error occurred inside: ' + err)
});
1. Error occurred: Some message
2. Error occurred inside: Some message
3. Some message
4. Nothing
5. Error will be thrown
Quiz – 5. There's an element with locator
#myId. What will be the result
console.log(element(by.css('#myId')).isPresent() === true);
console.log(element(by.css('#myId')).isPresent() === false);
1. true
true
2. false
false
3. Error
4. true
false
5. false
true
Quiz – 6. There's an element with locator
#myId and text inside 'some text'. What will be the result
element(by.css('#myId'))
.getText()
.then(value => {
return element(by.css('#myId')).getText()
.then(value2 => {
console.log(value + ' ' + value2)
});
});
1. Error
2. some text some text
3. some text Promise
4. some text undefined
5. getText getText
6. Promise Promise
Quiz – 7. There's an element with locator
#myId and text inside 'some text'. After click on element
text changes to 'Clicked'. What will be the result
let elem = element(by.css('#myId'));
let txt = elem.getText();
txt
.then(txtBefore => {
return elem.click()
.then(_ => txt)
.then(txtAfter => {
console.log(txtBefore + ' ' + txtAfter);
});
});
1. some text some text
2. some text Clicked
3. some text undefined
4. Error
5. txtBefore txtAfter
Quiz – 8. There's an element with locator
#myId and text inside 'some text'. After click on element
text changes to 'Clicked'. What will be the result
let elem = element(by.css('#myId'));
elem
.getText()
.then(txtBefore => {
return elem.click()
.then(_ => elem.getText())
.then(txtAfter => {
console.log(txtBefore + ' ' + txtAfter);
});
});
1. some text some text
2. some text Clicked
3. some text undefined
4. Error
5. txtBefore txtAfter
Quiz – 9. There's an element with locator
#myId and text inside 'some text'. After click on element
text changes to 'Clicked'. What will be the result
let elem = element(by.css('#myId'));
void async function logValues() {
let txtBefore = await elem.getText();
await elem.click();
let txtAfter = await elem.getText();
console.log(txtBefore+ ' ' + txtAfter);
}();
1. some text some text
2. some text Clicked
3. txtBefore txtAfter
4. Promise Promise
Quiz – 10. There's an element with locator
#myId and text inside 'some text'. After click on element
text changes to 'Clicked'. What will be the result
let elem = element(by.css('#myId'));
void async function logValues() {
let txtBefore = elem.getText();
await elem.click();
let txtAfter = elem.getText();
console.log(txtBefore + ' ' + txtAfter);
}();
1. some text some text
2. some text Clicked
3. txtBefore txtAfter
4. Promise Promise
Repo
https://github.com/Gennadiii/testingStage18
Repo
https://goo.gl/2no6Zc
We’ve done it!

More Related Content

What's hot

JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript Promises
L&T Technology Services Limited
 
Callbacks, promises, generators - asynchronous javascript
Callbacks, promises, generators - asynchronous javascriptCallbacks, promises, generators - asynchronous javascript
Callbacks, promises, generators - asynchronous javascript
Łukasz Kużyński
 
Akka in-action
Akka in-actionAkka in-action
Akka in-action
Raymond Roestenburg
 
Asynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsAsynchronous programming done right - Node.js
Asynchronous programming done right - Node.js
Piotr Pelczar
 
Akka tips
Akka tipsAkka tips
AngularJS Testing Strategies
AngularJS Testing StrategiesAngularJS Testing Strategies
AngularJS Testing Strategies
njpst8
 
Integrating React.js with PHP projects
Integrating React.js with PHP projectsIntegrating React.js with PHP projects
Integrating React.js with PHP projects
Ignacio Martín
 
Advanced akka features
Advanced akka featuresAdvanced akka features
Advanced akka features
Grzegorz Duda
 
JavaScript Promise
JavaScript PromiseJavaScript Promise
JavaScript Promise
Joseph Chiang
 
Understanding Asynchronous JavaScript
Understanding Asynchronous JavaScriptUnderstanding Asynchronous JavaScript
Understanding Asynchronous JavaScript
jnewmanux
 
Intro to Cocoa KVC/KVO and Bindings
Intro to Cocoa KVC/KVO and BindingsIntro to Cocoa KVC/KVO and Bindings
Intro to Cocoa KVC/KVO and Bindings
Sergio Acosta
 
The Ring programming language version 1.6 book - Part 41 of 189
The Ring programming language version 1.6 book - Part 41 of 189The Ring programming language version 1.6 book - Part 41 of 189
The Ring programming language version 1.6 book - Part 41 of 189
Mahmoud Samir Fayed
 
Promises - Asynchronous Control Flow
Promises - Asynchronous Control FlowPromises - Asynchronous Control Flow
Promises - Asynchronous Control Flow
Henrique Barcelos
 
Avoiding Callback Hell with Async.js
Avoiding Callback Hell with Async.jsAvoiding Callback Hell with Async.js
Avoiding Callback Hell with Async.js
cacois
 
Avoiding callback hell with promises
Avoiding callback hell with promisesAvoiding callback hell with promises
Avoiding callback hell with promises
TorontoNodeJS
 
The Ring programming language version 1.4 book - Part 11 of 30
The Ring programming language version 1.4 book - Part 11 of 30The Ring programming language version 1.4 book - Part 11 of 30
The Ring programming language version 1.4 book - Part 11 of 30
Mahmoud Samir Fayed
 
A Lifecycle Of Code Under Test by Robert Fornal
A Lifecycle Of Code Under Test by Robert FornalA Lifecycle Of Code Under Test by Robert Fornal
A Lifecycle Of Code Under Test by Robert Fornal
QA or the Highway
 
Programming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for AndroidProgramming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for Android
Emanuele Di Saverio
 
PostgreSQL Open SV 2018
PostgreSQL Open SV 2018PostgreSQL Open SV 2018
PostgreSQL Open SV 2018
artgillespie
 
Redux Sagas - React Alicante
Redux Sagas - React AlicanteRedux Sagas - React Alicante
Redux Sagas - React Alicante
Ignacio Martín
 

What's hot (20)

JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript Promises
 
Callbacks, promises, generators - asynchronous javascript
Callbacks, promises, generators - asynchronous javascriptCallbacks, promises, generators - asynchronous javascript
Callbacks, promises, generators - asynchronous javascript
 
Akka in-action
Akka in-actionAkka in-action
Akka in-action
 
Asynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsAsynchronous programming done right - Node.js
Asynchronous programming done right - Node.js
 
Akka tips
Akka tipsAkka tips
Akka tips
 
AngularJS Testing Strategies
AngularJS Testing StrategiesAngularJS Testing Strategies
AngularJS Testing Strategies
 
Integrating React.js with PHP projects
Integrating React.js with PHP projectsIntegrating React.js with PHP projects
Integrating React.js with PHP projects
 
Advanced akka features
Advanced akka featuresAdvanced akka features
Advanced akka features
 
JavaScript Promise
JavaScript PromiseJavaScript Promise
JavaScript Promise
 
Understanding Asynchronous JavaScript
Understanding Asynchronous JavaScriptUnderstanding Asynchronous JavaScript
Understanding Asynchronous JavaScript
 
Intro to Cocoa KVC/KVO and Bindings
Intro to Cocoa KVC/KVO and BindingsIntro to Cocoa KVC/KVO and Bindings
Intro to Cocoa KVC/KVO and Bindings
 
The Ring programming language version 1.6 book - Part 41 of 189
The Ring programming language version 1.6 book - Part 41 of 189The Ring programming language version 1.6 book - Part 41 of 189
The Ring programming language version 1.6 book - Part 41 of 189
 
Promises - Asynchronous Control Flow
Promises - Asynchronous Control FlowPromises - Asynchronous Control Flow
Promises - Asynchronous Control Flow
 
Avoiding Callback Hell with Async.js
Avoiding Callback Hell with Async.jsAvoiding Callback Hell with Async.js
Avoiding Callback Hell with Async.js
 
Avoiding callback hell with promises
Avoiding callback hell with promisesAvoiding callback hell with promises
Avoiding callback hell with promises
 
The Ring programming language version 1.4 book - Part 11 of 30
The Ring programming language version 1.4 book - Part 11 of 30The Ring programming language version 1.4 book - Part 11 of 30
The Ring programming language version 1.4 book - Part 11 of 30
 
A Lifecycle Of Code Under Test by Robert Fornal
A Lifecycle Of Code Under Test by Robert FornalA Lifecycle Of Code Under Test by Robert Fornal
A Lifecycle Of Code Under Test by Robert Fornal
 
Programming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for AndroidProgramming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for Android
 
PostgreSQL Open SV 2018
PostgreSQL Open SV 2018PostgreSQL Open SV 2018
PostgreSQL Open SV 2018
 
Redux Sagas - React Alicante
Redux Sagas - React AlicanteRedux Sagas - React Alicante
Redux Sagas - React Alicante
 

Similar to 4 mishchevskii - testing stage18-

Async Web QA
Async Web QAAsync Web QA
Async Web QA
Vlad Maniak
 
MT_01_unittest_python.pdf
MT_01_unittest_python.pdfMT_01_unittest_python.pdf
MT_01_unittest_python.pdf
Hans Jones
 
To Err Is Human
To Err Is HumanTo Err Is Human
To Err Is Human
Alex Liu
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript Everywhere
Pascal Rettig
 
Java script advance-auroskills (2)
Java script advance-auroskills (2)Java script advance-auroskills (2)
Java script advance-auroskills (2)
BoneyGawande
 
Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101
Fastly
 
Java Performance Tuning
Java Performance TuningJava Performance Tuning
Java Performance Tuning
Atthakorn Chanthong
 
Testing React hooks with the new act function
Testing React hooks with the new act functionTesting React hooks with the new act function
Testing React hooks with the new act function
Daniel Irvine
 
Unit Testing JavaScript Applications
Unit Testing JavaScript ApplicationsUnit Testing JavaScript Applications
Unit Testing JavaScript Applications
Ynon Perek
 
Ruxmon cve 2012-2661
Ruxmon cve 2012-2661Ruxmon cve 2012-2661
Ruxmon cve 2012-2661
snyff
 
Intro to Asynchronous Javascript
Intro to Asynchronous JavascriptIntro to Asynchronous Javascript
Intro to Asynchronous Javascript
Garrett Welson
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The Landing
Haci Murat Yaman
 
Akka Testkit Patterns
Akka Testkit PatternsAkka Testkit Patterns
Akka Testkit Patterns
Mykhailo Kotsur
 
Easy mock
Easy mockEasy mock
Easy mock
Srikrishna k
 
Promise: async programming hero
Promise: async programming heroPromise: async programming hero
Promise: async programming hero
The Software House
 
Intro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJSIntro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJS
Jim Lynch
 
Unit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and HowsUnit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and Hows
atesgoral
 
How to develop frontend quiz app using vue js
How to develop frontend quiz app using vue jsHow to develop frontend quiz app using vue js
How to develop frontend quiz app using vue js
Katy Slemon
 
Sane Async Patterns
Sane Async PatternsSane Async Patterns
Sane Async Patterns
TrevorBurnham
 
Javascript: master this
Javascript: master thisJavascript: master this
Javascript: master this
Barak Drechsler
 

Similar to 4 mishchevskii - testing stage18- (20)

Async Web QA
Async Web QAAsync Web QA
Async Web QA
 
MT_01_unittest_python.pdf
MT_01_unittest_python.pdfMT_01_unittest_python.pdf
MT_01_unittest_python.pdf
 
To Err Is Human
To Err Is HumanTo Err Is Human
To Err Is Human
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript Everywhere
 
Java script advance-auroskills (2)
Java script advance-auroskills (2)Java script advance-auroskills (2)
Java script advance-auroskills (2)
 
Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101
 
Java Performance Tuning
Java Performance TuningJava Performance Tuning
Java Performance Tuning
 
Testing React hooks with the new act function
Testing React hooks with the new act functionTesting React hooks with the new act function
Testing React hooks with the new act function
 
Unit Testing JavaScript Applications
Unit Testing JavaScript ApplicationsUnit Testing JavaScript Applications
Unit Testing JavaScript Applications
 
Ruxmon cve 2012-2661
Ruxmon cve 2012-2661Ruxmon cve 2012-2661
Ruxmon cve 2012-2661
 
Intro to Asynchronous Javascript
Intro to Asynchronous JavascriptIntro to Asynchronous Javascript
Intro to Asynchronous Javascript
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The Landing
 
Akka Testkit Patterns
Akka Testkit PatternsAkka Testkit Patterns
Akka Testkit Patterns
 
Easy mock
Easy mockEasy mock
Easy mock
 
Promise: async programming hero
Promise: async programming heroPromise: async programming hero
Promise: async programming hero
 
Intro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJSIntro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJS
 
Unit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and HowsUnit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and Hows
 
How to develop frontend quiz app using vue js
How to develop frontend quiz app using vue jsHow to develop frontend quiz app using vue js
How to develop frontend quiz app using vue js
 
Sane Async Patterns
Sane Async PatternsSane Async Patterns
Sane Async Patterns
 
Javascript: master this
Javascript: master thisJavascript: master this
Javascript: master this
 

More from Ievgenii Katsan

8 andrew kalyuzhin - 30 ux-advices, that will make users love you
8   andrew kalyuzhin - 30 ux-advices, that will make users love you8   andrew kalyuzhin - 30 ux-advices, that will make users love you
8 andrew kalyuzhin - 30 ux-advices, that will make users love you
Ievgenii Katsan
 
5 hans van loenhoud - master-class the 7 skills of highly successful teams
5   hans van loenhoud - master-class the 7 skills of highly successful teams5   hans van loenhoud - master-class the 7 skills of highly successful teams
5 hans van loenhoud - master-class the 7 skills of highly successful teams
Ievgenii Katsan
 
4 alexey orlov - life of product in startup and enterprise
4   alexey orlov - life of product in startup and enterprise4   alexey orlov - life of product in startup and enterprise
4 alexey orlov - life of product in startup and enterprise
Ievgenii Katsan
 
3 dmitry gomeniuk - how to make data-driven decisions in saa s products
3   dmitry gomeniuk - how to make data-driven decisions in saa s products3   dmitry gomeniuk - how to make data-driven decisions in saa s products
3 dmitry gomeniuk - how to make data-driven decisions in saa s products
Ievgenii Katsan
 
7 hans van loenhoud - the problem-goal-solution trinity
7   hans van loenhoud - the problem-goal-solution trinity7   hans van loenhoud - the problem-goal-solution trinity
7 hans van loenhoud - the problem-goal-solution trinity
Ievgenii Katsan
 
1 hans van loenhoud -
1   hans van loenhoud - 1   hans van loenhoud -
1 hans van loenhoud -
Ievgenii Katsan
 
3 denys gobov - change request specification the knowledge base or the task...
3   denys gobov - change request specification the knowledge base or the task...3   denys gobov - change request specification the knowledge base or the task...
3 denys gobov - change request specification the knowledge base or the task...
Ievgenii Katsan
 
5 victoria cupet - learn to play business analysis
5   victoria cupet - learn to play business analysis5   victoria cupet - learn to play business analysis
5 victoria cupet - learn to play business analysis
Ievgenii Katsan
 
5 alina petrenko - key requirements elicitation during the first contact wi...
5   alina petrenko - key requirements elicitation during the first contact wi...5   alina petrenko - key requirements elicitation during the first contact wi...
5 alina petrenko - key requirements elicitation during the first contact wi...
Ievgenii Katsan
 
3 karabak kuyavets transformation of business analyst to product owner
3   karabak kuyavets transformation of business analyst to product owner3   karabak kuyavets transformation of business analyst to product owner
3 karabak kuyavets transformation of business analyst to product owner
Ievgenii Katsan
 
4 andrii melnykov - stakeholder management for pd ms and b-as and why it is...
4   andrii melnykov - stakeholder management for pd ms and b-as and why it is...4   andrii melnykov - stakeholder management for pd ms and b-as and why it is...
4 andrii melnykov - stakeholder management for pd ms and b-as and why it is...
Ievgenii Katsan
 
3 zornitsa nikolova - the product manager between decision making and facil...
3   zornitsa nikolova - the product manager between decision making and facil...3   zornitsa nikolova - the product manager between decision making and facil...
3 zornitsa nikolova - the product manager between decision making and facil...
Ievgenii Katsan
 
4 viktoriya gudym - how to effectively manage remote employees
4   viktoriya gudym - how to effectively manage remote employees4   viktoriya gudym - how to effectively manage remote employees
4 viktoriya gudym - how to effectively manage remote employees
Ievgenii Katsan
 
9 natali renska - product and outsource development, how to cook 2 meals in...
9   natali renska - product and outsource development, how to cook 2 meals in...9   natali renska - product and outsource development, how to cook 2 meals in...
9 natali renska - product and outsource development, how to cook 2 meals in...
Ievgenii Katsan
 
7 denis parkhomenko - from idea to execution how to make a product that cus...
7   denis parkhomenko - from idea to execution how to make a product that cus...7   denis parkhomenko - from idea to execution how to make a product that cus...
7 denis parkhomenko - from idea to execution how to make a product that cus...
Ievgenii Katsan
 
6 anton vitiaz - inside the mvp in 3 days
6   anton vitiaz - inside the mvp in 3 days6   anton vitiaz - inside the mvp in 3 days
6 anton vitiaz - inside the mvp in 3 days
Ievgenii Katsan
 
5 mariya popova - ideal product management. unicorns in our reality
5   mariya popova - ideal product management. unicorns in our reality5   mariya popova - ideal product management. unicorns in our reality
5 mariya popova - ideal product management. unicorns in our reality
Ievgenii Katsan
 
2 victor podzubanov - design thinking game
2   victor podzubanov - design thinking game2   victor podzubanov - design thinking game
2 victor podzubanov - design thinking game
Ievgenii Katsan
 
3 sergiy potapov - analyst to product owner
3   sergiy potapov - analyst to product owner3   sergiy potapov - analyst to product owner
3 sergiy potapov - analyst to product owner
Ievgenii Katsan
 
4 anton parkhomenko - how to make effective user research with no budget at...
4   anton parkhomenko - how to make effective user research with no budget at...4   anton parkhomenko - how to make effective user research with no budget at...
4 anton parkhomenko - how to make effective user research with no budget at...
Ievgenii Katsan
 

More from Ievgenii Katsan (20)

8 andrew kalyuzhin - 30 ux-advices, that will make users love you
8   andrew kalyuzhin - 30 ux-advices, that will make users love you8   andrew kalyuzhin - 30 ux-advices, that will make users love you
8 andrew kalyuzhin - 30 ux-advices, that will make users love you
 
5 hans van loenhoud - master-class the 7 skills of highly successful teams
5   hans van loenhoud - master-class the 7 skills of highly successful teams5   hans van loenhoud - master-class the 7 skills of highly successful teams
5 hans van loenhoud - master-class the 7 skills of highly successful teams
 
4 alexey orlov - life of product in startup and enterprise
4   alexey orlov - life of product in startup and enterprise4   alexey orlov - life of product in startup and enterprise
4 alexey orlov - life of product in startup and enterprise
 
3 dmitry gomeniuk - how to make data-driven decisions in saa s products
3   dmitry gomeniuk - how to make data-driven decisions in saa s products3   dmitry gomeniuk - how to make data-driven decisions in saa s products
3 dmitry gomeniuk - how to make data-driven decisions in saa s products
 
7 hans van loenhoud - the problem-goal-solution trinity
7   hans van loenhoud - the problem-goal-solution trinity7   hans van loenhoud - the problem-goal-solution trinity
7 hans van loenhoud - the problem-goal-solution trinity
 
1 hans van loenhoud -
1   hans van loenhoud - 1   hans van loenhoud -
1 hans van loenhoud -
 
3 denys gobov - change request specification the knowledge base or the task...
3   denys gobov - change request specification the knowledge base or the task...3   denys gobov - change request specification the knowledge base or the task...
3 denys gobov - change request specification the knowledge base or the task...
 
5 victoria cupet - learn to play business analysis
5   victoria cupet - learn to play business analysis5   victoria cupet - learn to play business analysis
5 victoria cupet - learn to play business analysis
 
5 alina petrenko - key requirements elicitation during the first contact wi...
5   alina petrenko - key requirements elicitation during the first contact wi...5   alina petrenko - key requirements elicitation during the first contact wi...
5 alina petrenko - key requirements elicitation during the first contact wi...
 
3 karabak kuyavets transformation of business analyst to product owner
3   karabak kuyavets transformation of business analyst to product owner3   karabak kuyavets transformation of business analyst to product owner
3 karabak kuyavets transformation of business analyst to product owner
 
4 andrii melnykov - stakeholder management for pd ms and b-as and why it is...
4   andrii melnykov - stakeholder management for pd ms and b-as and why it is...4   andrii melnykov - stakeholder management for pd ms and b-as and why it is...
4 andrii melnykov - stakeholder management for pd ms and b-as and why it is...
 
3 zornitsa nikolova - the product manager between decision making and facil...
3   zornitsa nikolova - the product manager between decision making and facil...3   zornitsa nikolova - the product manager between decision making and facil...
3 zornitsa nikolova - the product manager between decision making and facil...
 
4 viktoriya gudym - how to effectively manage remote employees
4   viktoriya gudym - how to effectively manage remote employees4   viktoriya gudym - how to effectively manage remote employees
4 viktoriya gudym - how to effectively manage remote employees
 
9 natali renska - product and outsource development, how to cook 2 meals in...
9   natali renska - product and outsource development, how to cook 2 meals in...9   natali renska - product and outsource development, how to cook 2 meals in...
9 natali renska - product and outsource development, how to cook 2 meals in...
 
7 denis parkhomenko - from idea to execution how to make a product that cus...
7   denis parkhomenko - from idea to execution how to make a product that cus...7   denis parkhomenko - from idea to execution how to make a product that cus...
7 denis parkhomenko - from idea to execution how to make a product that cus...
 
6 anton vitiaz - inside the mvp in 3 days
6   anton vitiaz - inside the mvp in 3 days6   anton vitiaz - inside the mvp in 3 days
6 anton vitiaz - inside the mvp in 3 days
 
5 mariya popova - ideal product management. unicorns in our reality
5   mariya popova - ideal product management. unicorns in our reality5   mariya popova - ideal product management. unicorns in our reality
5 mariya popova - ideal product management. unicorns in our reality
 
2 victor podzubanov - design thinking game
2   victor podzubanov - design thinking game2   victor podzubanov - design thinking game
2 victor podzubanov - design thinking game
 
3 sergiy potapov - analyst to product owner
3   sergiy potapov - analyst to product owner3   sergiy potapov - analyst to product owner
3 sergiy potapov - analyst to product owner
 
4 anton parkhomenko - how to make effective user research with no budget at...
4   anton parkhomenko - how to make effective user research with no budget at...4   anton parkhomenko - how to make effective user research with no budget at...
4 anton parkhomenko - how to make effective user research with no budget at...
 

Recently uploaded

“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
Claudio Di Ciccio
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
Techgropse Pvt.Ltd.
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 

Recently uploaded (20)

“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 

4 mishchevskii - testing stage18-

  • 2. whoami • Gennadii Mishchevskii • Senior Automation QA Engineer at Ciklum • 4 years in the industry • Automated back-end, front-end and mobile • https://www.linkedin.com/in/gennadiimishchevskii/
  • 3. Agenda • Async theory • Callback • Promises • Async/Await • Quiz
  • 4. Warm-up typeof null; typeof NaN; NaN instanceof Number; typeof 'string'; 'string' instanceof String; '1' + +'1'; '1' - -'1'; null > 0; null == 0; null >= 0; {} + []; true + true - false > true ** 2; let wtf = () => { try { return 24; } finally { return 42; } }; wtf(); object number false false string ‘11’ 2 false false true 0 true 42
  • 6. Async theory - PHP server, Single Sync thread
  • 7. Async theory - PHP server, Single Sync thread timeline Order food Pay Clean after yourself
  • 8. Async theory - Multithreading Java server
  • 9. Async theory - Multithreading Java server timeline Main thread Thread 1 Thread 2 Thread 3 Order food Pay Clean after yourself
  • 10. Async theory - NodeJS Async server
  • 11. Async theory - NodeJS Async server timeline Single thread Libuv Order food Pay Clean after yourself // example1.js
  • 12. Async theory - Stack and heap // stack.js, stackTrace.js, maxCallStack.js
  • 13. Async theory - Full picture // fullPicture.js
  • 14. Promises - 99.99% can't solve this task func1().then(function () { return func2(); }); func1().then(function () { func2(); }); func1().then(func2()); func1().then(func2);
  • 16. Callback – why don't we love callbacks • Callback hell • Catching errors • Difficult to wait for several async actions to finish // callbackLinux.js
  • 17. Promises – the rescuer • Callback hell • Catching errors • Difficult to wait for several async actions to finish
  • 18. Promises – the rescuer (specs) • A promise or “thenable” is an object that supplies a standard- compliant .then() method. • A pending promise may transition into a fulfilled or rejected state.
  • 19. Promises – the rescuer (specs) • A fulfilled or rejected promise is settled, and must not transition into any other state. • Once a promise is settled, it must have a value (which may be undefined). That value must not change. • Every promise must supply a .then() method with the following signature: promise.then( onFulfilled?: Function, onRejected?: Function ) => Promise
  • 20. Promises – the rescuer (specs) • Both onFulfilled() and onRejected() are optional.​ • If the arguments supplied are not functions, they must be ignored.​ • onFulfilled() will be called after the promise is fulfilled, with the promise’s value as the first argument.​ • onRejected() will be called after the promise is rejected, with the reason for rejection as the first argument. The reason may be any valid JavaScript value, but because rejections are essentially synonymous with exceptions, I recommend using Error objects.​
  • 21. Promises – the rescuer (specs) • .then() may be called many times on the same promise. ​ • .then() must return a new promise, promise2.​ • If either onFulfilled or onRejected throws an exception e, promise2 must be rejected with e as the reason.​ • If onFulfilled is not a function and promise1 is fulfilled, promise2 must be fulfilled with the same value as promise1.​ • If onRejected is not a function and promise1 is rejected, promise2 must be rejected with the same reason as promise1.​
  • 22. Promises – the rescuer (create and chain) function myRandomPromise() { return new Promise(function (resolve, reject) { const random = Math.random(); random < 0.5 ? resolve('Yay, it worked') : reject('Oh no, something went wrong'); }) } myPromise() .then(console.log) .catch(console.log); myRandomPromise() .then(result => console.log(result), error => console.log(error)); myRandomPromise() .then(console.log, console.log); myRandomPromise() .catch(console.log); myRandomPromise() .then(null, console.log);
  • 23. Promises – the rescuer (don't forget to catch) Promise.resolve(42) .then(doFirst) .then(doSecond) .catch(console.log) .then(doThird) .catch(err => { console.log(err); return err.message; }) .then(doFourth) .catch(console.log);
  • 24. Promises – the rescuer (what’s gonna happen?) function myPromise() { return new Promise(resolve => { Object.notExistingFunction(); resolve('Resolved'); }) } myPromise() .then(console.log) .catch(console.log); setTimeout(_ => console.log('setTimeout'));
  • 25. Promises – the rescuer (how to ruin it) function myRandomPromise(num) { return new Promise(function (resolve) { resolve(Math.random()); }); }myRandomPromise().then(num => { return myRandomPromise().then(num => { return myRandomPromise().then(num => { return myRandomPromise().then(num => { return myRandomPromise().then(num => { return myRandomPromise().then(num => { console.log(num); }); }); }); }); }); }); myRandomPromise() .then(num => { return myRandomPromise() }) .then(num => { return myRandomPromise() }) .then(num => { console.log(num); }); // callbackedPromise.js
  • 26. Async/Await – the advanced rescuer • Callback hell • Catching errors • Difficult to wait for several async actions to finish // promiseLunix.js, promise0-1.js , asyncAwaitSimple.js, asyncAwaitFlow.js , asyncAwaitLinux.js, promise2+.js
  • 27. Async theory - NodeJS Async server
  • 28. Async theory - NodeJS Async server timeline Single thread Libuv Order food Pay Clean after yourself // example2.js
  • 29. Quiz – 1. What will be the result let prоm = new Promise((resolve, reject) => { resolve('Some message'); }); prоm .then((result) => { console.log(result); }, (err) => { console.log('Errоr оccurred'); }); 1. Some message 2. Errоr оccurred 3. Nothing 4. Some message Errоr оccurred 5. Errоr оccurred Some message
  • 30. Quiz – 2. What will be the result let prоm = new Promise((resolve, reject) => { reject('Some message'); }); prоm .then((result) => { console.log(result); }, (err) => { console.log('Errоr оccurred: ' + err); }); 1. Some message 2. Error occurred: 3. Error occurred: Some message 4. Some message Error occurred: 5. Nothing
  • 31. Quiz – 3. What will be the result let prоm = new Promise((resolve, reject) => { reject('Some message'); }); prоm .then((result) => { console.log(result); }) .catch(err => { console.log('Errоr оccurred: ' + err); }); 1. Some message 2. Error occurred: undefined 3. Error occurred: Some message 4. Some message Error occurred: 5. Error will be thrown
  • 32. Quiz – 4. What will be the result let prоm = new Promise((resolve, reject) => { resolve('Some message'); }); prоm .then(result => { throw new Error(result); }, err => { console.log('Error occurred: ' + err) }) .catch((err) => { console.log('Error occurred inside: ' + err) }); 1. Error occurred: Some message 2. Error occurred inside: Some message 3. Some message 4. Nothing 5. Error will be thrown
  • 33. Quiz – 5. There's an element with locator #myId. What will be the result console.log(element(by.css('#myId')).isPresent() === true); console.log(element(by.css('#myId')).isPresent() === false); 1. true true 2. false false 3. Error 4. true false 5. false true
  • 34. Quiz – 6. There's an element with locator #myId and text inside 'some text'. What will be the result element(by.css('#myId')) .getText() .then(value => { return element(by.css('#myId')).getText() .then(value2 => { console.log(value + ' ' + value2) }); }); 1. Error 2. some text some text 3. some text Promise 4. some text undefined 5. getText getText 6. Promise Promise
  • 35. Quiz – 7. There's an element with locator #myId and text inside 'some text'. After click on element text changes to 'Clicked'. What will be the result let elem = element(by.css('#myId')); let txt = elem.getText(); txt .then(txtBefore => { return elem.click() .then(_ => txt) .then(txtAfter => { console.log(txtBefore + ' ' + txtAfter); }); }); 1. some text some text 2. some text Clicked 3. some text undefined 4. Error 5. txtBefore txtAfter
  • 36. Quiz – 8. There's an element with locator #myId and text inside 'some text'. After click on element text changes to 'Clicked'. What will be the result let elem = element(by.css('#myId')); elem .getText() .then(txtBefore => { return elem.click() .then(_ => elem.getText()) .then(txtAfter => { console.log(txtBefore + ' ' + txtAfter); }); }); 1. some text some text 2. some text Clicked 3. some text undefined 4. Error 5. txtBefore txtAfter
  • 37. Quiz – 9. There's an element with locator #myId and text inside 'some text'. After click on element text changes to 'Clicked'. What will be the result let elem = element(by.css('#myId')); void async function logValues() { let txtBefore = await elem.getText(); await elem.click(); let txtAfter = await elem.getText(); console.log(txtBefore+ ' ' + txtAfter); }(); 1. some text some text 2. some text Clicked 3. txtBefore txtAfter 4. Promise Promise
  • 38. Quiz – 10. There's an element with locator #myId and text inside 'some text'. After click on element text changes to 'Clicked'. What will be the result let elem = element(by.css('#myId')); void async function logValues() { let txtBefore = elem.getText(); await elem.click(); let txtAfter = elem.getText(); console.log(txtBefore + ' ' + txtAfter); }(); 1. some text some text 2. some text Clicked 3. txtBefore txtAfter 4. Promise Promise