Created
March 16, 2017 19:40
-
-
Save jankcat/31fe960192c15bbde77d8237622a3d0a to your computer and use it in GitHub Desktop.
Applitools Eyes with Native Promise Manager And Timeout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* In the shell script that runs my tests: */ | |
#Disable the Selenium Promise Manager | |
export SELENIUM_PROMISE_MANAGER=0 | |
/* In my test file */ | |
/*...getConfig into host, capabilities, key vars...*/ | |
let driver = new webdriver.Builder().usingServer(host).withCapabilities(capabilities).build(); | |
let eyes = new Eyes(); | |
eyes.setApiKey(key); | |
/*...eyes setBatch, setDefaultMatchTimeout, setWaitBeforeScreenshots, setSaveNewTests, setStitchMode, setForceFullPageScreenshot...*/ | |
eyes.open(driver, testName, testArea).then(function (driver) { | |
const page = new SomePage(driver, eyes); | |
return page.open(); // basically just: function { this.driver.get('someUrl'); } | |
.then(()=>page.blink()); // basically just: this.eyes.checkWindow('someStepName'); | |
/*...same code for 7-8 other pages...*/ | |
}).then(function() { | |
return driver.quit(); | |
.then(()=>{ | |
return new Promise(function(resolve, reject) { | |
setTimeout(function() { | |
resolve(); | |
}, timeOutValueInMS); | |
eyes.close(false).then(()=>{resolve()}); | |
}); | |
}) | |
.then(()=>eyes.abortIfNotClosed()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment