From 2d3e2bc5a5bde2d0165cefd0d86abe6ea5a4361f Mon Sep 17 00:00:00 2001 From: martinRenou Date: Thu, 8 Jun 2017 17:30:27 +0100 Subject: [PATCH 01/11] Rename "Stop application" button to "Quit" --- frontend/tests/tests/user/test_application_label.js | 10 +++++----- frontend/user/vue-components/ApplicationLabel.vue | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/tests/tests/user/test_application_label.js b/frontend/tests/tests/user/test_application_label.js index c2f74b00c..dbbf76ccc 100644 --- a/frontend/tests/tests/user/test_application_label.js +++ b/frontend/tests/tests/user/test_application_label.js @@ -42,7 +42,7 @@ QUnit.test("application name", function(assert) { }); }); -QUnit.test("rendering stop button", function (assert) { +QUnit.test("rendering quit button", function (assert) { let done = assert.async(); assert.equal( @@ -50,18 +50,18 @@ QUnit.test("rendering stop button", function (assert) { model.appList[0].appData.image.ui_name ); - // Test stop button disabled + // Test quit button disabled assert.ok( - appLabel.$el.querySelector('#stop-button').classList.contains('disabled-entry') + appLabel.$el.querySelector('#quit-button').classList.contains('disabled-entry') ); // Select running application model.selectedIndex = 1; - // Test stop button enabled + // Test quit button enabled Vue.nextTick(function() { assert.notOk( - appLabel.$el.querySelector('#stop-button').classList.contains('disabled-entry') + appLabel.$el.querySelector('#quit-button').classList.contains('disabled-entry') ); done(); diff --git a/frontend/user/vue-components/ApplicationLabel.vue b/frontend/user/vue-components/ApplicationLabel.vue index 686cf6ebb..8a7c82502 100644 --- a/frontend/user/vue-components/ApplicationLabel.vue +++ b/frontend/user/vue-components/ApplicationLabel.vue @@ -12,14 +12,14 @@
  • + + + + + + + @@ -52,13 +70,11 @@ module.exports = Vue.extend({ data: function() { - return { clipboardSupported: Clipboard.isSupported() }; + return { shareModalVisible: false }; }, mounted: function() { - if(this.clipboardSupported) { - new Clipboard('#share-button'); - } + new Clipboard('#cp-clipboard-button'); }, computed: { From dac63348317cee5235b63bed2ac8c7cfbbcbaf56 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Thu, 8 Jun 2017 18:35:58 +0100 Subject: [PATCH 05/11] Add confirm dialog for quiting the application --- .../user/vue-components/ApplicationLabel.vue | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/frontend/user/vue-components/ApplicationLabel.vue b/frontend/user/vue-components/ApplicationLabel.vue index 209ab7bf0..566cd51a9 100644 --- a/frontend/user/vue-components/ApplicationLabel.vue +++ b/frontend/user/vue-components/ApplicationLabel.vue @@ -17,7 +17,7 @@ + @click="shareDialogVisible = true"> Share session @@ -28,7 +28,7 @@ + @click="quitDialogVisible = true"> Quit @@ -40,7 +40,7 @@ - + + + + +
    Are you sure you want to quit {{ currentApp.appData.image | appName }} ? (irreversible)
    +
    @@ -70,7 +78,7 @@ module.exports = Vue.extend({ data: function() { - return { shareModalVisible: false }; + return { shareDialogVisible: false, quitDialogVisible: false }; }, mounted: function() { From 43e55285be4d06f62fdb8e9f74f6028951ad8cb8 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Fri, 9 Jun 2017 09:27:47 +0100 Subject: [PATCH 06/11] Add application in blod --- frontend/user/vue-components/ApplicationLabel.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/user/vue-components/ApplicationLabel.vue b/frontend/user/vue-components/ApplicationLabel.vue index 566cd51a9..8c5053151 100644 --- a/frontend/user/vue-components/ApplicationLabel.vue +++ b/frontend/user/vue-components/ApplicationLabel.vue @@ -62,7 +62,7 @@ v-if="quitDialogVisible" :okCallback="() => {quitDialogVisible = false; stopApplication();}" :closeCallback="() => {quitDialogVisible = false;}"> -
    Are you sure you want to quit {{ currentApp.appData.image | appName }} ? (irreversible)
    +
    Are you sure you want to quit {{ currentApp.appData.image | appName }} ? (irreversible)
    From 50c544a7eab872cd13bc989dc4d3ecf5bf11fce7 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Fri, 9 Jun 2017 09:28:14 +0100 Subject: [PATCH 07/11] Fix jstest --- frontend/tests/tests/user/test_application_label.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/tests/tests/user/test_application_label.js b/frontend/tests/tests/user/test_application_label.js index dbbf76ccc..16d9dbb5f 100644 --- a/frontend/tests/tests/user/test_application_label.js +++ b/frontend/tests/tests/user/test_application_label.js @@ -113,9 +113,9 @@ QUnit.test("rendering share button", function (assert) { // Select running application model.selectedIndex = 1; - // Test share button disabled (Because clipboard save is not supported in test environment) + // Test share button enabled Vue.nextTick(function() { - assert.ok( + assert.notOk( appLabel.$el.querySelector('#share-button').classList.contains('disabled-entry') ); From 6c3f866a8ac638157424927ceb7c47c4360671f5 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Fri, 9 Jun 2017 13:35:17 +0100 Subject: [PATCH 08/11] Fix selenium tests --- selenium_tests/UserDriverTest.py | 11 ++++++----- selenium_tests/test_start_stop_container.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/selenium_tests/UserDriverTest.py b/selenium_tests/UserDriverTest.py index 23538d584..2e8f6c558 100644 --- a/selenium_tests/UserDriverTest.py +++ b/selenium_tests/UserDriverTest.py @@ -28,12 +28,13 @@ def open_application_settings(self): """ self.click_first_element_located(By.ID, "application-settings") - def stop_application(self): - """ Click on the stop button. It assumes that the application settings - menu is opened and that the application is running. This will stop the + def quit_application(self): + """ Click on the quit button. It assumes that the application settings + menu is opened and that the application is running. This will quit the currently selected application. """ - self.click_first_element_located(By.ID, "stop-button") + self.click_first_element_located(By.ID, "quit-button") + self.click_modal_footer_button("Ok") def start_application(self): """ Click on the start button. It assumes that the currently selected @@ -72,7 +73,7 @@ def running_container(self, index=0): self.select_application(index) self.wait_until_application_running() self.open_application_settings() - self.stop_application() + self.quit_application() self.wait_until_application_stopped() def tearDown(self): diff --git a/selenium_tests/test_start_stop_container.py b/selenium_tests/test_start_stop_container.py index b8e005206..4b5000636 100644 --- a/selenium_tests/test_start_stop_container.py +++ b/selenium_tests/test_start_stop_container.py @@ -12,7 +12,7 @@ def test_start_stop_container(self): self.wait_until_application_running() self.open_application_settings() - self.stop_application() + self.quit_application() self.wait_until_application_stopped() def test_focus(self): From 86c96626467af1e0929ba24ff2e8030489c0a9d6 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Fri, 9 Jun 2017 14:38:36 +0100 Subject: [PATCH 09/11] Add check before performing operations --- selenium_tests/UserDriverTest.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/selenium_tests/UserDriverTest.py b/selenium_tests/UserDriverTest.py index 2e8f6c558..a2a594d3c 100644 --- a/selenium_tests/UserDriverTest.py +++ b/selenium_tests/UserDriverTest.py @@ -63,10 +63,9 @@ def running_container(self, index=0): application is stopped at the end. """ self.wait_until_application_list_loaded() - self.select_application(index) self.start_application() - + self.wait_until_application_running() try: yield finally: From 8d34420d595e7b58220004ecf521cc8cfbc224f1 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Fri, 9 Jun 2017 14:38:56 +0100 Subject: [PATCH 10/11] Add tests for the share button --- selenium_tests/test_share_application.py | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 selenium_tests/test_share_application.py diff --git a/selenium_tests/test_share_application.py b/selenium_tests/test_share_application.py new file mode 100644 index 000000000..17218e441 --- /dev/null +++ b/selenium_tests/test_share_application.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +from selenium_tests.UserDriverTest import UserDriverTest +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys + + +class TestShareApplication(UserDriverTest): + def test_share_modal(self): + with self.running_container(): + self.open_application_settings() + + self.click_first_element_located(By.ID, "share-button") + + self.click_modal_footer_button("Close") + + def test_share_button(self): + with self.running_container(): + self.open_application_settings() + + self.click_first_element_located(By.ID, "share-button") + + self.click_first_element_located(By.ID, "cp-clipboard-button") + + # Now the share url should be in the clipboard + input_element = self.driver.find_element_by_id("shared-url") + + # Clear the input element and paste what is in the clipboard in + # order to retrieve it (lacking better way to retrieve the clipboard + # value) + input_element.clear() + input_element.send_keys(Keys.CONTROL, 'v') + clipboard_value = input_element.get_attribute("value") + + # Go to the shared url + self.driver.get(clipboard_value) + self.wait_until_presence_of_element_located(By.ID, "noVNC_screen") + + # Go back to simphony-remote + self.driver.back() + self.wait_until_application_list_loaded() From 2fae7ec7c4e5e4ea3e8501549734778fad6ec8ea Mon Sep 17 00:00:00 2001 From: martinRenou Date: Fri, 9 Jun 2017 14:47:57 +0100 Subject: [PATCH 11/11] Reviews --- .../user/vue-components/ApplicationLabel.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/user/vue-components/ApplicationLabel.vue b/frontend/user/vue-components/ApplicationLabel.vue index bf489d884..35977e2d6 100644 --- a/frontend/user/vue-components/ApplicationLabel.vue +++ b/frontend/user/vue-components/ApplicationLabel.vue @@ -17,7 +17,7 @@ + @click="shareDialog.visible = true"> Share session @@ -28,7 +28,7 @@ + @click="quitDialog.visible = true"> Quit @@ -40,7 +40,7 @@ - + + v-if="quitDialog.visible" + :okCallback="() => {quitDialog.visible = false; stopApplication();}" + :closeCallback="() => {quitDialog.visible = false;}">
    Are you sure you want to quit {{ currentApp.appData.image | appName }} ? (irreversible)
    @@ -78,7 +78,7 @@ module.exports = Vue.extend({ data: function() { - return { shareDialogVisible: false, quitDialogVisible: false }; + return { shareDialog: {visible: false}, quitDialog: {visible: false} }; }, mounted: function() {