New basic tests, updated navigation and shortcuts

This commit is contained in:
Vadim Makeev 2014-02-19 02:44:36 +04:00
parent e4b79d066f
commit 50596cb8cd
3 changed files with 96 additions and 5 deletions

84
tests/basic.js Normal file
View File

@ -0,0 +1,84 @@
module.exports = {
// --------------------------------
// Click
// --------------------------------
'Click on slide is switching from List to Full': function (test) {
test
.open('http://localhost:7497/tests/')
.click('[id="1"]')
.assert.attr('body', 'class').to.contain('full', 'Mode is Full')
.done();
},
// --------------------------------
// Walking
// --------------------------------
'All slides could be switched from first to last in List mode': function (test) {
test
.open('http://localhost:7497/tests/#1')
.sendKeys('body', '\uE014') // Right
.sendKeys('body', '\uE014') // Right
.sendKeys('body', '\uE014') // Right
.sendKeys('body', '\uE014') // Right
.sendKeys('body', '\uE014') // Right
.assert.attr('[id="6"]', 'class').to.contain('active', 'Last slide is Active')
.done();
},
'All slides could be switched from last to first in List mode': function (test) {
test
.open('http://localhost:7497/tests/#6')
.sendKeys('body', '\uE012') // Left
.sendKeys('body', '\uE012') // Left
.sendKeys('body', '\uE012') // Left
.sendKeys('body', '\uE012') // Left
.sendKeys('body', '\uE012') // Left
.assert.attr('[id="1"]', 'class').to.contain('active', 'First slide is Active')
.done();
},
'All slides could be switched from first to last in Full mode': function (test) {
test
.open('http://localhost:7497/tests/?full#1')
.sendKeys('body', '\uE014') // Right
.sendKeys('body', '\uE014') // Right
.sendKeys('body', '\uE014') // Right
.sendKeys('body', '\uE014') // Right
.sendKeys('body', '\uE014') // Right
.sendKeys('body', '\uE014') // Right
.sendKeys('body', '\uE014') // Right
.sendKeys('body', '\uE014') // Right
.assert.attr('[id="6"]', 'class').to.contain('active', 'Last slide is Active')
.done();
},
'All slides could be switched from last to first in Full mode': function (test) {
test
.open('http://localhost:7497/tests/?full#6')
.sendKeys('body', '\uE012') // Left
.sendKeys('body', '\uE012') // Left
.sendKeys('body', '\uE012') // Left
.sendKeys('body', '\uE012') // Left
.sendKeys('body', '\uE012') // Left
.assert.attr('[id="1"]', 'class').to.contain('active', 'First slide is Active')
.done();
},
// --------------------------------
// Back
// --------------------------------
'Back is switching from Full to List': function (test) {
test
.open('http://localhost:7497/tests/')
.click('[id="1"]')
.back()
.assert.attr('body', 'class').to.contain('list', 'Mode is List')
.done();
},
// --------------------------------
// Zoom
// --------------------------------
'Back from Full to List is restoring scale': function (test) {
test
.open('http://localhost:7497/tests/')
.click('[id="1"]')
.back()
.assert.attr('body', 'style').to.contain('none', 'Scale is restored')
.done();
}
};

View File

@ -1,4 +1,11 @@
module.exports = {
'Navigation doesnt work in List mode': function (test) {
test
.open('http://localhost:7497/tests/#5')
.sendKeys('body', '\uE014') // Right
.assert.attr('[id="6"]', 'class').to.contain('active', 'Next slide is Active')
.done();
},
'Right Arrow key is switching first Next item to Active': function (test) {
test
.open('http://localhost:7497/tests/?full#5')
@ -30,10 +37,10 @@ module.exports = {
test
.open('http://localhost:7497/tests/?full#5')
.sendKeys('body', '\uE014') // Right
.screenshot('tests/1.png')
.sendKeys('body', '\uE014') // Right
.sendKeys('body', '\uE014') // Right
.sendKeys('body', '\uE012') // Left
// Not sure why its failing. It works fine manually
.assert.attr('[id="4"]', 'class').to.contain('active', 'Previous slide is Active')
.done();
},

View File

@ -6,14 +6,14 @@ module.exports = {
test
.open('http://localhost:7497/tests/')
.sendKeys('body', '\uE035') // F5
.assert.attr('body', 'class', 'full', 'Mode is Full')
.assert.attr('body', 'class').to.contain('full', 'Mode is Full')
.done();
},
'F5 is switching from Full to List': function (test) {
test
.open('http://localhost:7497/tests/?full')
.sendKeys('body', '\uE035') // F5
.assert.attr('body', 'class', 'list', 'Mode is List')
.assert.attr('body', 'class').to.contain('list', 'Mode is List')
.done();
},
// --------------------------------
@ -23,14 +23,14 @@ module.exports = {
test
.open('http://localhost:7497/tests/')
.sendKeys('body', '\uE03D\uE00A\u0070') // Cmd Alt P
.assert.attr('body', 'class', 'full', 'Mode is Full')
.assert.attr('body', 'class').to.contain('full', 'Mode is Full')
.done();
},
'Cmd Alt P keys are not switching from Full to List': function (test) {
test
.open('http://localhost:7497/tests/?full#1')
.sendKeys('body', '\uE03D\uE00A\u0070') // Cmd Alt P
.assert.attr('body', 'class', 'full', 'Mode is Full')
.assert.attr('body', 'class').to.contain('full', 'Mode is Full')
.done();
},
// --------------------------------