diff --git a/tests/basic.js b/tests/basic.js new file mode 100644 index 0000000..b7789a1 --- /dev/null +++ b/tests/basic.js @@ -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(); + } +}; \ No newline at end of file diff --git a/tests/navigation.js b/tests/navigation.js index 31eb387..5f60650 100644 --- a/tests/navigation.js +++ b/tests/navigation.js @@ -1,4 +1,11 @@ module.exports = { + 'Navigation doesn’t 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 it’s failing. It works fine manually .assert.attr('[id="4"]', 'class').to.contain('active', 'Previous slide is Active') .done(); }, diff --git a/tests/shortcuts.js b/tests/shortcuts.js index dac0c16..3b89155 100644 --- a/tests/shortcuts.js +++ b/tests/shortcuts.js @@ -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(); }, // --------------------------------