Skip to content

Enhance e2e testing, add tests #622

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

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
use -cli only for e2e testing on all platforms
  • Loading branch information
umbynos committed Feb 25, 2021
commit 2797deb5266280b2e43154486420bb24e9cbc1fd
39 changes: 21 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,28 @@ jobs:
- name: Run unit tests
run: task test-unit

- name: Build the Agent for linux
run: task build
if: matrix.os == 'ubuntu-18.04'

# build the agent without GUI support (no tray icon)
# build the agent without GUI support (no tray icon) for e2e testing
- name: Build the Agent-cli
run: task build-cli
if: matrix.os != 'windows-2019'

- name: Build the Agent-cli for win
run: task build-win-cli
if: matrix.os == 'windows-2019'

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'

- name: Run e2e tests
run: |
pip install poetry
task test-e2e

- name: Build the Agent for linux
run: task build
if: matrix.os == 'ubuntu-18.04'

# the manifest is required by windows GUI apps, otherwise the binary will crash with: "Unable to create main window: TTM_ADDTOOL failed" (for reference https://github.com/lxn/walk/issues/28)
Expand Down Expand Up @@ -91,25 +106,13 @@ jobs:
run: task build
if: matrix.os == 'macos-10.15'

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
if: matrix.os == 'macos-10.15'

- name: Run e2e tests
run: |
pip install poetry
task test-e2e
if: matrix.os == 'macos-10.15'

# config.ini is required by the executable when it's run
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: arduino-create-agent-${{ matrix.os }}${{ matrix.arch }}
path: |
!arduino-create-agent_cli*
arduino-create-agent*
config.ini
if-no-files-found: error
8 changes: 8 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ tasks:
WIN_FLAGS: -H=windowsgui
- rm *.syso # rm file to avoid compilation problems on other platforms

build-win-cli:
desc: Build the project without tray support
cmds:
- task: build
vars:
APP_NAME: arduino-create-agent_cli.exe
ADDITIONAL_FLAGS: -tags cli

test-unit:
desc: Run unit tests only
cmds:
Expand Down
5 changes: 4 additions & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@pytest.fixture(scope="function")
def agent(pytestconfig):

agent_cli = str(Path(pytestconfig.rootdir) / "arduino-create-agent")
agent_cli = str(Path(pytestconfig.rootdir) / "arduino-create-agent_cli")
env = {
# "ARDUINO_DATA_DIR": data_dir,
# "ARDUINO_DOWNLOADS_DIR": downloads_dir,
Expand All @@ -23,6 +23,9 @@ def agent(pytestconfig):
runner = Local(run_context) # execute a command on the local filesystem

cd_command = "cd"
if platform.system() == "Windows":
cd_command += " /d"

with run_context.prefix(f'{cd_command} ..'):
runner.run(agent_cli, echo=True, hide=True, warn=True, env=env, asynchronous=True)

Expand Down