Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
langtind committed Apr 19, 2023
0 parents commit 8d31e7f
Show file tree
Hide file tree
Showing 25 changed files with 3,420 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
]
}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
out
dist
node_modules
.vscode-test/
*.vsix
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint"
]
}
34 changes: 34 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
"workbench.colorCustomizations": {
"activityBar.background": "#0B3240",
"titleBar.activeBackground": "#0F4659",
"titleBar.activeForeground": "#F4FBFD"
}
}
20 changes: 20 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
15 changes: 15 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules/
!node_modules/{js-yaml,vscode-yaml,fs,path}

.vscode/**
out/test/**
src/**
**/*.map
.git
.gitignore
tsconfig.json
debug.log
scripts
tslint.json
*.log
**/*.ts
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Change Log

All notable changes to the `maestro-assistant` extension will be documented in this file.

## [Unreleased]
Nothing at the moment

## [0.1.0] - 2023-04-19
Initial public release.

## [0.0.6] - 2023-04-18
### Changed
- Updated command name "Maestro: Run maestro flows with current file" for improved consistency
- Optimized extension size by including only required node modules

## [0.0.5] - 2023-04-17
### Added
- Support for loading template files from `${workspaceFolder}/templates`

## [0.0.4] - 2023-04-13
### Added
- Support for creating a flow from template

## [0.0.3] - 2023-04-12
### Added
- Command for launching maestro test with current file
### Changed
- Renamed the extension

## [0.0.2] - 2023-03-29
### Fixed
- Typo in end result added to clipboard

## [0.0.1] - 2023-03-29
- Initial release
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Agens

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# VSCode Maestro Assistant

Maestro Assistant is a Visual Studio Code extension that provides useful Maestro shortcuts and simplifies repetitive workflows, like creating or running flows.

## Getting Started

1. Install the Maestro Assistant extension. See [manual install](#manual-install) for instructions.
2. Configure the extension. See [configuration](#configuration).
3. Open the Maestro-project in VSCode.
4. Enjoy!

## Usage
This extension currently supports the following commands:
1. Maestro: Run Maestro flows with the current file
2. Maestro: Create a new flow from template
3. Maestro: Copy AutomationID to clipboard

**Open Command Palette and type "Maestro" to see available commands.**

### 1. Maestro: Run Maestro flows with the current file
This command displays a list of available commands, which are configured in the "maestro-assistant.commands" section in settings.json. You can select and invoke these commands to run Maestro flows with the currently opened file.

### 2. Maestro: Create a new flow from template
This command allows you to create a new flow using templates stored in the configured templates folder. This feature simplifies the process of setting up new test flows, ensuring consistency and reducing the time needed to start new tests.

### 3. Maestro: Copy AutomationID to clipboard
This command is used to fetch the Automation ID needed for test management software, such as TestRail. The Automation ID corresponds with the output you get when running Maestro with JUnit reporting. By having the Automation ID readily available in your clipboard, you can easily input it into your test management software, streamlining the process of tracking and managing test cases.


## Configuration
![Available config for the extension](images/vscode-config.png)

### Commands
You can configure the Maestro Assistant extension commands by modifying the `maestro-assistant.commands` object in your `settings.json` file. Each key in the object represents a platform, and its value is the corresponding command to run Maestro tests on that platform.

For example:

```json
"maestro-assistant.commands": {
"iOS": "maestro test -e APP_ID=no.agens.maestro.ios -e PLATFORM=ios {FILE_PATH}",
"Android": "maestro test -e APP_ID=no.agens.maestro.android -e PLATFORM=android {FILE_PATH}"
}
```
### Template Folder Path
By default, the extension looks for template flows in the `${workspaceFolder}/templates` directory. If you prefer to store your templates elsewhere, you can update the configuration to point to the desired location.

### Test Root Folder
By default, the extension looks for test flows in the `${workspaceFolder}/tests` directory. If your tests are stored in a different folder, you can configure the extension to search for the correct path. When using the `Maestro: Create a new flow from template` command, you can choose the subfolder (if any) where you'd like to save the flow.
## Templates

The Maestro Assistant extension uses templates to create new flows. By default, the template path is set to `${workspaceFolder}/templates`. You can change the template path in your `settings.json` file in Visual Studio Code.

### Template Example

Here's an example of a template file (flow_template.yaml):

```yaml
// CLEAR_LAUNCH: true, false
// ENVIRONMENT: prod, qa01, dev
// LOGIN: true, false

# {{description}}

appId: ${APP_ID}
name: {{FLOW_NAME}}
env:
CLEAR_LAUNCH: {{CLEAR_LAUNCH}}
ENVIRONMENT: {{ENVIRONMENT}}
LOGIN: {{LOGIN}}
---

# TODO: Add Maestro commands, if any, you want to be a part of the template
- launchApp

```
The first three lines define valid input values for the placeholders. When running the "Create Flow" command, the user will be presented with a selection list to choose from these predefined values. A placeholder like {{description}} without a predefined value in the template file will give a free-text input field.
## Changelog
See [CHANGELOG.md](CHANGELOG.md) for updated changelog.
## Manual install
Until this extension is distributed through the Marketplace you have to install it manually.
1. Download the latest .vsix file from the repository or release page.
2. Launch Visual Studio Code and open the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window.
3. Click on the "More Actions" button (represented by three dots) located in the top-right corner of the Extensions view.
4. Select "Install from VSIX..." from the dropdown menu.
5. Navigate to the downloaded .vsix file and click on "Open" to install the extension.
![Installation steps for the extension](images/extension-install.png)
Once the installation is complete, the extension will be activated and ready for use.
7 changes: 7 additions & 0 deletions example.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"maestro-assistant.commands": {
"iOS": "maestro test -e APP_ID=no.agens.maestro.ios -e PLATFORM=ios {FILE_PATH}",
"Android": "maestro test -e APP_ID=no.agens.maestro.android -e PLATFORM=android {FILE_PATH}"
}
}

Binary file added images/extension-install.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/vscode-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"comments": {
"lineComment": "#"
},
"brackets": [
["{", "}"],
["[", "]"]
],
"autoClosingPairs": [
{"open": "{", "close": "}"},
{"open": "[", "close": "]"},
{"open": "'", "close": "'", "notIn": ["string", "comment"]},
{"open": "\"", "close": "\"", "notIn": ["string"]},
{"open": "`", "close": "`", "notIn": ["string", "comment"]}
]
}

Loading

0 comments on commit 8d31e7f

Please sign in to comment.