Added e2e test cases

This commit is contained in:
Borys Levytskyi
2015-04-12 15:26:34 +03:00
parent 74c7183a87
commit cace2f6ebf
3 changed files with 46 additions and 18 deletions

View File

@@ -142,12 +142,12 @@
<table class="expression">
<tr>
<td class="label">{m.operand1.input}</td>
<td class="bin">{m.operand1Binary}</td>
<td class="bin">{m.operand1.bin.padLeft(m.bitsSize, '0')}</td>
<td class="other">{m.operand1.other}</td>
</tr>
<tr class="result">
<td class="label">{m.sign}{m.operand1.input}={m.result.input}</td>
<td class="bin">{m.resultBinary}</td>
<td class="bin">{m.result.bin.padLeft(m.bitsSize, '0')}</td>
<td class="other">{m.result.other}</td>
</tr>
</table>

View File

@@ -2,6 +2,7 @@ exports.config = {
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
specs: [
'./e2e/cmdDriver.js',
'./e2e/spec.js'
],

View File

@@ -62,14 +62,40 @@ describe('launch of application', function() {
it('should do a shift operation', function() {
driver.get(appUrl)
.then(function() {
return assertOperation('1<<1',
[{ label: '1', bin:'00000001', other: '0x1'},
{ label: '1<<1=2', bin:'00000010', other: '0x2'}])
});
return assertOperation('1<<1',
[{ label: '1', bin:'00000001', other: '0x1'},
{ label: '1<<1=2', bin:'00000010', other: '0x2'}])
});
it('should do a ignroe sign RIGHT shift operation', function() {
return assertOperation('-1>>>1',
[{ label: '-1', bin:'11111111111111111111111111111111', other: '-0x1'},
{ label: '-1>>>1=2147483647', bin:'01111111111111111111111111111111', other: '0x7fffffff'}])
});
it('should do NOT operation', function() {
return assertOperation('~1',
[{ label: '1', bin:'00000000000000000000000000000001', other: '0x1'},
{ label: '~1=-2', bin:'11111111111111111111111111111110', other: '-0x2'}])
});
it('should do OR operation', function() {
return assertOperation('1|2',
[{ label: '1', bin:'00000001', other: '0x1'},
{ label: '2', bin:'00000010', other: '0x2'},
{ label: '3', bin:'00000011', other: '0x3'}])
});
it('should do prefer hex result', function() {
return assertOperation('1|0x2',
[{ label: '1', bin:'00000001', other: '0x1'},
{ label: '0x2', bin:'00000010', other: '2'},
{ label: '0x3', bin:'00000011', other: '3'}])
});
xit('should emphasize bytes', function() {
@@ -103,7 +129,6 @@ function assertNoErrors(cmd) {
});
}
function assertBitwiseNumbersResults(contaier, array) {
return contaier.findElement(By.css('.expression')).then(function (tableExpr){
@@ -118,11 +143,11 @@ function assertBitwiseNumbersResults(contaier, array) {
}
});
});
}
function assertSingleRowResult(row, label, bin, other) {
return row.findElement(by.css('.label')).then(function (tbLabel) {
return row.findElement(by.css('.label')).then(function (tbLabel) {
expect(tbLabel.getText()).toBe(label);
}).then(function () {
return row.findElement(by.css('.bin')).then(function (tdBin) {
@@ -136,11 +161,13 @@ function assertSingleRowResult(row, label, bin, other) {
}
function assertOperation(op, expected) {
return sendCommand('clear')
.then(function() { return sendCommand(op)})
.then(assertNoErrors)
.then(function() {
return assertBitwiseNumbersResults(driver,
expected)
});
return driver.get(appUrl).then(function() {
return sendCommand('clear')
.then(function() { return sendCommand(op)})
.then(assertNoErrors)
.then(function() {
return assertBitwiseNumbersResults(driver, expected)
});
})
}