Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Unified Diff: ui/file_manager/integration_tests/audio_player/click_control_buttons.js

Issue 1526923002: AudioPlayer: Add UI tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/file_manager/integration_tests/audio_player/click_control_buttons.js
diff --git a/ui/file_manager/integration_tests/audio_player/click_control_buttons.js b/ui/file_manager/integration_tests/audio_player/click_control_buttons.js
new file mode 100644
index 0000000000000000000000000000000000000000..352bfd4e618c2757e040c4c2802c8c52a048a354
--- /dev/null
+++ b/ui/file_manager/integration_tests/audio_player/click_control_buttons.js
@@ -0,0 +1,114 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+'use strict';
+
+/**
+ * @return {Promise} Promise to be fulfilled with on success.
+ */
+testcase.clickControlButtons = function() {
yawano 2015/12/16 02:54:14 This test case has more than 20 steps. It seems to
fukino 2015/12/16 07:42:02 Thank you for the suggestion! Done.
+ var openAudio = launch('local', 'downloads',
+ [ENTRIES.beautiful, ENTRIES.newlyAdded]);
+ var appId;
+ return openAudio.then(function(args) {
+ appId = args[0];
+ }).then(function() {
+ // Audio player should start playing automatically.
+ return remoteCallAudioPlayer.waitForElement(
+ appId, 'audio-player[playing]');
+ }).then(function() {
+ // While playing, the play/pause button should have 'Pause' label.
+ return remoteCallAudioPlayer.waitForElement(
+ appId, ['#play[aria-label=\'Pause\']']);
yawano 2015/12/16 02:54:14 nit: How about to use double quotes here? Our HTML
fukino 2015/12/16 07:42:02 Chromium coding style overrides the rule...: "Use
+ }).then(function() {
+ // Clicking the pause button should change the playback state to pause.
+ return remoteCallAudioPlayer.callRemoteTestUtil(
+ 'fakeMouseClick', appId, ['#play']);
+ }).then(function() {
+ return remoteCallAudioPlayer.waitForElement(
+ appId, 'audio-player:not([playing])');
+ }).then(function() {
+ // ... and the play/pause button should have 'Play' label.
+ return remoteCallAudioPlayer.waitForElement(
+ appId, ['#play[aria-label=\'Play\']']);
+ }).then(function() {
+ // The default volume level should be 50.
+ return remoteCallAudioPlayer.waitForElement(
+ appId, ['control-panel[volume=\'50\']']);
+ }).then(function() {
+ // Clicking volume button should mute the player.
+ return remoteCallAudioPlayer.callRemoteTestUtil(
+ 'fakeMouseClick', appId, ['#volumeButton']);
+ }).then(function() {
+ return Promise.all([
+ remoteCallAudioPlayer.waitForElement(
+ appId, ['control-panel[volume=\'0\']']),
+ remoteCallAudioPlayer.waitForElement(
+ appId, ['#volumeButton[aria-label=\'Unmute\']'])
+ ]);
+ }).then(function() {
+ // Clicking volume button again should restore volume.
+ return remoteCallAudioPlayer.callRemoteTestUtil(
+ 'fakeMouseClick', appId, ['#volumeButton']);
+ }).then(function() {
+ return Promise.all([
+ remoteCallAudioPlayer.waitForElement(
+ appId, ['control-panel[volume=\'50\']']),
+ remoteCallAudioPlayer.waitForElement(
+ appId, ['#volumeButton[aria-label=\'Mute\']'])
+ ]);
+ }).then(function() {
+ // The first track should be active.
+ return remoteCallAudioPlayer.waitForElement(
+ appId, ['.track[index=\'0\'][active]']);
+ }).then(function() {
+ // Clicking next button should activate the second track and start playing.
+ return remoteCallAudioPlayer.callRemoteTestUtil(
+ 'fakeMouseClick', appId, ['#next']);
+ }).then(function() {
+ return Promise.all([
+ remoteCallAudioPlayer.waitForElement(
+ appId, ['.track[index=\'1\'][active]']),
+ remoteCallAudioPlayer.waitForElement(
+ appId, 'audio-player[playing]')
+ ]);
+ }).then(function() {
+ // Pause to prepare for remaining steps.
+ return remoteCallAudioPlayer.callRemoteTestUtil(
+ 'fakeMouseClick', appId, ['#play']);
+ }).then(function() {
+ return remoteCallAudioPlayer.waitForElement(
+ appId, 'audio-player:not([playing])');
+ }).then(function() {
+ // Clicking playlist button should expand track list.
+ return remoteCallAudioPlayer.callRemoteTestUtil(
+ 'fakeMouseClick', appId, ['#playList']);
+ }).then(function() {
+ return remoteCallAudioPlayer.waitForElement(
+ appId, 'track-list[expanded]');
+ }).then(function() {
+ // Clicking the first track should make it active, but shouldn't start
+ // playing.
+ return remoteCallAudioPlayer.callRemoteTestUtil(
+ 'fakeMouseClick', appId, ['.track[index=\'0\']']);
+ }).then(function() {
+ return remoteCallAudioPlayer.waitForElement(
+ appId, '.track[index=\'0\'][active]');
+ }).then(function() {
+ return remoteCallAudioPlayer.waitForElement(
+ appId, 'audio-player:not([playing])');
+ }).then(function() {
+ // Clicking the play icon on the second should make it active, and start
+ // playing.
+ return remoteCallAudioPlayer.callRemoteTestUtil(
+ 'fakeMouseClick', appId, ['.track[index=\'1\'] .icon']);
+ }).then(function() {
+ return remoteCallAudioPlayer.waitForElement(
+ appId, '.track[index=\'1\'][active]');
+
yawano 2015/12/16 02:54:14 nit: unnecessary blank line.
fukino 2015/12/16 07:42:01 Done.
+ }).then(function() {
+ return remoteCallAudioPlayer.waitForElement(
+ appId, 'audio-player[playing]');
+ });
+};

Powered by Google App Engine
This is Rietveld 408576698