This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
Bug 915661 - [Gallery] Add Marionette tests #12169
Merged
lightsofapollo
merged 1 commit into
mozilla-b2g:master
from
hotzenklotz:915661_marionette_gallery
Nov 12, 2013
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
var Gallery = require('./lib/gallery.js'), | ||
Marionette = require('marionette-client'), | ||
assert = require('assert'), | ||
TestCommon = require('./lib/test_common'); | ||
|
||
marionette('using the gallery menu', function() { | ||
|
||
var app, client; | ||
|
||
client = marionette.client({ | ||
prefs: { | ||
'device.storage.enabled': true, | ||
'device.storage.testing': true, | ||
'device.storage.prompt.testing': true | ||
} | ||
}); | ||
|
||
setup(function() { | ||
TestCommon.prepareTestSuite('pictures', client); | ||
app = new Gallery(client); | ||
actions = new Marionette.Actions(client); | ||
app.launch(); | ||
}); | ||
|
||
test('should let you select images', function() { | ||
// Use the 'selection' button and select the test image. | ||
// Selected images should have an border/highlight. | ||
app.thumbnailsSelectButton.click(); | ||
app.thumbnail.click(); | ||
|
||
var outline = app.thumbnail.cssProperty('outline'); | ||
assert.ok(outline != null); | ||
}); | ||
|
||
test('should let you delete images', function() { | ||
// This test deletes the test image. | ||
app.thumbnailsSelectButton.click(); | ||
app.thumbnail.click(); | ||
app.thumbnailsDeleteButton.click(); | ||
app.confirmButton.click(); | ||
|
||
// Wait for the overlay with 'No photos or videos' message. | ||
var overlayView = app.overlayView; | ||
client.helper.waitForElement(overlayView); | ||
assert.ok(overlayView.displayed()); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
var Gallery = require('./lib/gallery.js'), | ||
Marionette = require('marionette-client'), | ||
assert = require('assert'), | ||
TestCommon = require('./lib/test_common'); | ||
|
||
marionette('editing an image', function() { | ||
|
||
var app, actions, client, chrome; | ||
|
||
client = marionette.client({ | ||
prefs: { | ||
'device.storage.enabled': true, | ||
'device.storage.testing': true, | ||
'device.storage.prompt.testing': true, | ||
'webgl.force-enabled': true | ||
} | ||
}); | ||
|
||
setup(function() { | ||
TestCommon.prepareTestSuite('pictures', client); | ||
app = new Gallery(client); | ||
actions = new Marionette.Actions(client); | ||
app.launch(); | ||
}); | ||
|
||
test('should have different options', function() { | ||
// You should be able to switch between the different 'operations' | ||
// in the image editor. | ||
app.thumbnail.click(); | ||
app.editButton.click(); | ||
app.waitForImageEditor(); | ||
assert.ok(app.exposureOptions.displayed()); | ||
|
||
app.editCropButton.click(); | ||
assert.ok(app.cropOptions.displayed()); | ||
|
||
app.editEffectButton.click(); | ||
assert.ok(app.effectOptions.displayed()); | ||
|
||
app.editBorderButton.click(); | ||
assert.ok(app.borderOptions.displayed()); | ||
|
||
}); | ||
|
||
test('should change exposure', function() { | ||
// Changing the exposure of an image creates a new modified | ||
// version of original. | ||
app.thumbnail.click(); | ||
app.editButton.click(); | ||
app.waitForImageEditor(); | ||
app.editExposureButton.click(); | ||
actions.flick(app.exposureSlider, 0, 0, 50, 0).perform(); | ||
app.editSaveButton.click(); | ||
client.waitFor(function() { | ||
return app.thumbnails.length == 2; | ||
}); | ||
assert.strictEqual(app.thumbnails.length, 2); | ||
}); | ||
|
||
test('should crop it', function() { | ||
// Croping an image creates a new modified version of original. | ||
app.thumbnail.click(); | ||
app.editButton.click(); | ||
app.editCropButton.click(); | ||
app.waitForImageEditor(); | ||
app.editCropAspectPortraitButton.click(); | ||
app.editSaveButton.click(); | ||
client.waitFor(function() { | ||
return app.thumbnails.length == 2; | ||
}); | ||
assert.strictEqual(app.thumbnails.length, 2); | ||
}); | ||
|
||
test('should apply an effect', function() { | ||
// Applying a sepia effect creates a new modified version of original. | ||
app.thumbnail.click(); | ||
app.editButton.click(); | ||
app.editEffectButton.click(); | ||
app.waitForImageEditor(); | ||
app.editEffectSepiaButton.click(); | ||
app.editSaveButton.click(); | ||
client.waitFor(function() { | ||
return app.thumbnails.length == 2; | ||
}); | ||
assert.strictEqual(app.thumbnails.length, 2); | ||
}); | ||
|
||
test('should add a border', function() { | ||
// Add a border to an image creates a new modified version of original. | ||
app.thumbnail.click(); | ||
app.editButton.click(); | ||
app.waitForImageEditor(); | ||
app.editBorderButton.click(); | ||
app.editBorderThickWhiteButton.click(); | ||
app.editSaveButton.click(); | ||
client.waitFor(function() { | ||
return app.thumbnails.length == 2; | ||
}); | ||
assert.strictEqual(app.thumbnails.length, 2); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
var Gallery = require('./lib/gallery.js'), | ||
Marionette = require('marionette-client'), | ||
assert = require('assert'), | ||
TestCommon = require('./lib/test_common'); | ||
|
||
marionette('the gallery', function() { | ||
|
||
var app, client, actions; | ||
|
||
client = marionette.client({ | ||
prefs: { | ||
'device.storage.enabled': true, | ||
'device.storage.testing': true, | ||
'device.storage.prompt.testing': true, | ||
'webgl.force-enabled': true | ||
} | ||
}); | ||
|
||
setup(function() { | ||
TestCommon.prepareTestSuite('pictures', client); | ||
app = new Gallery(client); | ||
actions = new Marionette.Actions(client); | ||
app.launch(); | ||
}); | ||
|
||
test('should only have one image present', function() { | ||
// There should only be a single test image in the gallery | ||
// after running the test suite setup. | ||
// This mainly tests if TestCommon runs smoothly. | ||
assert.strictEqual(app.thumbnails.length, 1); | ||
}); | ||
|
||
test('should display an image fullscreen and go back', function() { | ||
// You should be able to click on an image to view a fullscreen | ||
// preview and go back by pressing the 'back' button. | ||
app.thumbnail.click(); | ||
assert.ok(app.fullscreenView.displayed()); | ||
|
||
app.fullscreenBackButton.click(); | ||
assert.ok(app.thumbnailsView.displayed()); | ||
}); | ||
|
||
test('should flick through images in fullscreen mode', function() { | ||
// Acquire a duplicate of an image by launching the editing | ||
// mode and saving it. | ||
app.thumbnail.click(); | ||
app.editButton.click(); | ||
app.waitForImageEditor(); | ||
app.editSaveButton.click(); | ||
client.waitFor(function() { | ||
return app.thumbnails.length == 2; | ||
}); | ||
|
||
// You should be able to swipe between the two in fullscreen mode. | ||
app.thumbnail.click(); | ||
var translateX = app.getFrameTranslation(app.fullscreenFrame2); | ||
assert.strictEqual(translateX, 0); | ||
|
||
actions.flick(app.fullscreenFrame2, 0, 0, -300, 0).perform(); | ||
|
||
//Swiping centers the fullscreen view on the second frame. | ||
translateX = app.getFrameTranslation(app.fullscreenFrame3); | ||
assert.strictEqual(translateX, 0); | ||
}); | ||
|
||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hotzenklotz when trying to run on local, the test failed here with below message. Should we have a check here 'if editButton is visible', if not we make it visible
ElementNotVisible: (11) Element is not visible
Remote Stack:
at Error.MarionetteError (/Users/ssaroha/source/gaia/node_modules/marionette-client/lib/marionette/error.js:67:13)
at Object.Client._handleCallback (/Users/ssaroha/source/gaia/node_modules/marionette-client/lib/marionette/client.js:463:19)
at Client._sendCommand (/Users/ssaroha/source/gaia/node_modules/marionette-client/lib/marionette/client.js:492:21)
at TcpSync.send (/Users/ssaroha/source/gaia/node_modules/marionette-client/lib/marionette/drivers/tcp-sync.js:94:10)
at Object.send (/Users/ssaroha/source/gaia/node_modules/marionette-client/lib/marionette/client.js:444:36)
at Object.Client._sendCommand (/Users/ssaroha/source/gaia/node_modules/marionette-client/lib/marionette/client.js:485:19)
at Object.Element._sendCommand (/Users/ssaroha/source/gaia/node_modules/marionette-client/lib/marionette/element.js:49:21)
at Object.click (/Users/ssaroha/source/gaia/node_modules/marionette-client/lib/marionette/element.js:172:19)
at Context. (/Users/ssaroha/Source/gaia/apps/gallery/test/marionette/edit_image_test.js:30:20)
at Test.Runnable.run (/Users/ssaroha/source/gaia/node_modules/mocha/lib/runnable.js:211:32)
at Runner.runTest (/Users/ssaroha/source/gaia/node_modules/mocha/lib/runner.js:355:10)
at Runner.runTests.next (/Users/ssaroha/source/gaia/node_modules/mocha/lib/runner.js:401:12)
at next (/Users/ssaroha/source/gaia/node_modules/mocha/lib/runner.js:281:14)
at Runner.hooks (/Users/ssaroha/source/gaia/node_modules/mocha/lib/runner.js:290:7)
at next (/Users/ssaroha/source/gaia/node_modules/mocha/lib/runner.js:234:23)
at Runner.hook (/Users/ssaroha/source/gaia/node_modules/mocha/lib/runner.js:253:7)
at Hook.Runnable.run (/Users/ssaroha/source/gaia/node_modules/mocha/lib/runnable.js:213:5)
at next (/Users/ssaroha/source/gaia/node_modules/mocha/lib/runner.js:246:10)
at Runner.hook (/Users/ssaroha/source/gaia/node_modules/mocha/lib/runner.js:253:7)
at done (/Users/ssaroha/source/gaia/node_modules/mocha/lib/runnable.js:185:5)
at Runnable.run.duration (/Users/ssaroha/source/gaia/node_modules/mocha/lib/runnable.js:197:9)
at Object.executeHook (/Users/ssaroha/source/gaia/node_modules/marionette-client/lib/marionette/client.js:368:18)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)