Last active
February 1, 2016 18:54
-
-
Save SthanleyLima/2b89242ac2ad0c316b86 to your computer and use it in GitHub Desktop.
Apresentação Calculadora Sem PO
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
// Report sem screenShot | |
var jasmineSpecReporterSetup = function() { | |
var SpecReporter = require('jasmine-spec-reporter'); | |
jasmine.getEnv().addReporter(new SpecReporter({ | |
displayFailuresSummary: true, //mostra resumo das falhas | |
displaysFailedSpec: true, //exibe os testes que falharam | |
displaySuiteNumber: true, //numero do teste na suite | |
displaySpecDuration: true //tempo de execução dos testes | |
})); | |
}; | |
//Report com screenShot | |
var jasmine2HtmlReporter = function() { | |
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter'); | |
jasmine.getEnv().addReporter( | |
new Jasmine2HtmlReporter({ | |
savePath: 'reports' | |
}) | |
); | |
}; | |
//confiração de pastas | |
exports.config = { | |
seleniumAddress: 'http://localhost:4444/wd/hub', | |
// Framework usada | |
framework: 'jasmine2', | |
// arquivos que serão chamados | |
specs: ['*_spec.js'], | |
baseUrl: 'http://juliemr.github.io/protractor-demo', | |
//Rodando no Chrome | |
capabilities: { | |
'browserName': 'chrome' | |
// rodando em Headless | |
/*'browserName': 'phantomjs', | |
"phantomjs.binary.path": require("phantomjs").path, | |
"phantomjs.ghostdriver.cli.args": ["--loglevel=DEBUG"]*/ | |
}, | |
//melhorar o reports de retorno | |
onPrepare: jasmineSpecReporterSetup, | |
// opções de uso do Jasmine | |
jasmineNodeOpts: { | |
defaultTimeoutInterval: 30000 | |
} | |
}; |
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
// helper.js | |
module.exports = { | |
verifyElementPresenceById : function(id) { | |
var elemento = $('#' + id); | |
expect(elemento.isDisplayed()).toBeTruthy(); | |
} | |
}; |
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
{ | |
"name": "example", | |
"version": "1.0.0", | |
"description": "", | |
"main": "conf.js", | |
"scripts": { | |
"start": "webdriver-manager start", | |
"test": "protractor conf.js" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"jasmine": "^2.3.2", | |
"jasmine-spec-reporter": "^2.4.0", | |
"protractor-screenshot-reporter": "0.0.5", | |
"protractor-jasmine2-html-reporter": "0.0.5" | |
}, | |
"devDependencies": { | |
"karma": "^0.13.10", | |
"karma-phantomjs-launcher": "^0.2.1", | |
"phantomjs": "^1.9.18" | |
} | |
} |
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
var helper = require('./helper'); | |
describe('Testando Calculadora', function() { | |
it('Somando Valores', function() { | |
browser.get('/protractor-demo'); | |
var campoInicial = element(by.model('first')); | |
campoInicial.sendKeys("1"); | |
var operador = element(by.model('operator')); | |
operador.element(by.css('option[value="ADDITION"]')).click(); | |
var campoFinal = element(by.model('second')); | |
campoFinal.sendKeys("1"); | |
var btGo = element(by.id('gobutton')); | |
btGo.click(); | |
var resultText = element(by.css('.ng-binding')); | |
expect(resultText.getText()).toContain('2'); | |
}) | |
it('subtraindo Valores', function() { | |
browser.get('/protractor-demo'); | |
var campoInicial = element(by.model('first')); | |
campoInicial.sendKeys("2"); | |
var operador = element(by.model('operator')); | |
operador.element(by.css('option[value="SUBTRACTION"]')).click(); | |
var campoFinal = element(by.model('second')); | |
campoFinal.sendKeys("1"); | |
var btGo = element(by.id('gobutton')); | |
btGo.click(); | |
var resultText = element(by.css('.ng-binding')); | |
expect(resultText.getText()).toContain('1'); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment