Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop E2E Test: MM-T2827 Copy and Paste when connecting Jira plugin #1915

Closed
mattermod opened this issue Nov 25, 2021 · 7 comments · Fixed by #2047
Closed

Desktop E2E Test: MM-T2827 Copy and Paste when connecting Jira plugin #1915

mattermod opened this issue Nov 25, 2021 · 7 comments · Fixed by #2047

Comments

@mattermod
Copy link
Contributor

mattermod commented Nov 25, 2021

This ticket is to create a test script to automate some testing for the Desktop App.

The testing framework makes use of a few frameworks to successfully automate Desktop App tasks:

  • Playwright: An E2E testing framework provided by Microsoft that currently has “experimental” support for Electron. Using Playwright, you can access individual BrowserWindows or BrowserViews and automate most functionality provided within those windows. You can also get access to the main Electron process and verify/check functionality in the main process. See here for docs: https://playwright.dev/docs/api/class-electron
  • RobotJS: A Node.JS Desktop Automation tool that allows us to arbitrary emulate mouse and keyboard inputs. This is used for automation around Electron keyboard shortcuts and the menu bar. It is useful to cover cases that aren’t automatable directly through Playwright (since the menu is not an HTML control). See here for docs: http://robotjs.io/docs/syntax

The test should be written in the file e2e/specs/popup_test.js
If the file doesn’t exist, feel free to create it.

If you’re looking for examples, see these PRs:
#1841
#1843
#1846

The test script for this ticket is as follows:

  1. Ensure the test config is using the Demo Mattermost server, and make sure the app opens on said server.
  2. Login to the demo server
  3. In the message box, type /jira connect. Verify that a new window opens.
  4. Type something in the username box.
  5. Use CtrlC and then CtrlA and then CtrlV. Verify that the text reappears.

Expected:
See above.


If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.

New contributors please see our Developer's Guide.

JIRA: https://mattermost.atlassian.net/browse/MM-39796

@shadowshot-x
Copy link
Contributor

shadowshot-x commented Jan 26, 2022

Wont we need to install the jira plugin for this? I cannot see jira command in my normal mattermost desktop

@mickmister
Copy link
Contributor

I'd like to work on this

@mickmister
Copy link
Contributor

@devinbinnie It seems Playwright doesn't have full support of using the clipboard based on these two issues:
microsoft/playwright#2511 (comment)
microsoft/playwright#8114

I'm able to get the Jira login dialog to show, but I think we're not able to complete this ticket since copy/paste is not properly supported.

We also have the issue of requiring the Jira plugin to be installed, and configured with a Jira server/cloud instance, as @shadowshot-x pointed out. This is quite a manual process, so I would think we would try to mock the dialog instead, though that's not a realistic test at that point. I'm thinking this ticket should temporarily be closed or labeled in some way to signal that it can't be implemented, since it appears that's the case at the moment.

@devinbinnie
Copy link
Member

@mickmister

@devinbinnie It seems Playwright doesn't have full support of using the clipboard based on these two issues: microsoft/playwright#2511 (comment) microsoft/playwright#8114

I'm able to get the Jira login dialog to show, but I think we're not able to complete this ticket since copy/paste is not properly supported.

We can use RobotJS here to send Ctrl+A, Ctrl+C and Ctrl+V signals using the keyboard to the window that pops up to simulate keyboard events. This is the intent of the ticket, to test if those shortcuts work correctly as there were issues in the past where those events were suppressed.

We also have the issue of requiring the Jira plugin to be installed, and configured with a Jira server/cloud instance, as @shadowshot-x pointed out. This is quite a manual process, so I would think we would try to mock the dialog instead, though that's not a realistic test at that point. I'm thinking this ticket should temporarily be closed or labeled in some way to signal that it can't be implemented, since it appears that's the case at the moment.

This might not be that big of an issue, all we need to do for this test is simply have the window pop and show us some kind of login screen. The original test case calls for JIRA but we could definitely use GitHub in its place to avoid having to hook up a server. That still leaves us with the issue of having to install and enable the GitHub plugin, is that something we could do through mmctl?

@mickmister
Copy link
Contributor

mickmister commented Feb 4, 2022

We can use RobotJS here to send Ctrl+A, Ctrl+C and Ctrl+V signals using the keyboard to the window that pops up to simulate keyboard events. This is the intent of the ticket, to test if those shortcuts work correctly as there were issues in the past where those events were suppressed.

@devinbinnie 👍 Makes sense

The original test case calls for JIRA but we could definitely use GitHub in its place to avoid having to hook up a server. That still leaves us with the issue of having to install and enable the GitHub plugin, is that something we could do through mmctl?

Even if we used GitHub or Jira Cloud as the integration, there still needs to be "configuration" on the external integration side before a /github connect or /jira connect command is available. For instance, you have to manually create an OAuth application in GitHub, and store the OAuth client id and secret in the plugin settings.

What's the value/effort tradeoff to this? Can we implement a simple dialog to test the keyboard events?

@devinbinnie
Copy link
Member

The original test case calls for JIRA but we could definitely use GitHub in its place to avoid having to hook up a server. That still leaves us with the issue of having to install and enable the GitHub plugin, is that something we could do through mmctl?

Even if we used GitHub or Jira Cloud as the integration, there still needs to be "configuration" on the external integration side before a /github connect or /jira connect command is available. For instance, you have to manually create an OAuth application in GitHub, and store the OAuth client id and secret in the plugin settings.

What's the value/effort tradeoff to this? Can we implement a simple dialog to test the keyboard events?

Hmm alright, I'm curious would the demo plugin have a popup window that we could test with? If not, could we add one? The reason is that I still want to test the plugin pop-up flow, and those only fire if the URL is of the form http://myserver.com/plugins/<whatever>.

@mickmister
Copy link
Contributor

I'm curious would the demo plugin have a popup window that we could test with? If not, could we add one? The reason is that I still want to test the plugin pop-up flow, and those only fire if the URL is of the form http://myserver.com/plugins/<whatever>.

Yes we can add a popup to https://github.com/mattermost/mattermost-plugin-test to use here, which is usually used for automated tests like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants