Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-an committed Nov 23, 2024
1 parent 6143a24 commit aede9fd
Show file tree
Hide file tree
Showing 11 changed files with 195 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/test-pr-multi-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test multi-project

env:
MOMENTIC_API_KEY: ${{ secrets.MOMENTIC_API_KEY }}

on:
pull_request:

jobs:
run-tests:
name: Run all project tests
runs-on: ubuntu-latest
permissions:
contents: read
repository-projects: read
defaults:
run:
working-directory: ./multi-project-workspace-example
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 21
cache: "pnpm"
- name: Install dependencies
run: pnpm i
- name: Run specific marketing tests using project name and substring match
run: npx momentic@^1 run --filter marketing variable
env:
VAR_FROM_SHELL: test-var-from-shell
- name: Run all QA tests using config path
run: npx momentic@^1 run --config qa/momentic.config.yaml .
- name: Run dashboard tests using absolute path
run: |
cd apps/dashboard
npx momentic@^1 run google-search.test.yaml
2 changes: 2 additions & 0 deletions momentic.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: default
include:
- "**/*.test.yaml"
- "**/*.module.yaml"
exclude:
- "multi-project-workspace-example/**/*"
environments:
- name: development
baseUrl: https://momentic-github-actions-demo.vercel.app/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
fileType: momentic/test
id: cfa6eb04-a97e-42c0-aeaa-5de0bc3cac0d
name: google-search
baseUrl: https://google.com
schemaVersion: 1.0.18
advanced:
disableAICaching: false
viewport:
width: 1920
height: 1080
browserType: Chromium
retries: 0
steps:
- id: 980f048a-7ab1-4b8f-b55d-0a0f7b195283
type: PRESET_ACTION
command:
id: e37b1fbc-bce3-4415-abd8-f5614db2b582
clearContent: true
pressEnter: true
type: TYPE
target:
type: description
elementDescriptor: search bar
value: hello world
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: dashboard
include:
- "**/*.test.yaml"
- "**/*.module.yaml"
- "../../common/**/*.module.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: marketing
include:
- "**/*.test.yaml"
- "**/*.module.yaml"
- "../../common/**/*.module.yaml"
environments:
- name: test
baseUrl: https://google.com
envFile: ../../test.env
envVariables:
VAR_FROM_SHELL: ${VAR_FROM_SHELL}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
fileType: momentic/test
id: 345ced8b-ba15-4681-9fab-ba5e8296aa28
name: variable-showcase
schemaVersion: 1.0.18
advanced:
disableAICaching: false
viewport:
width: 1920
height: 1080
retries: 0
envs:
- name: test
default: true
steps:
- id: 1ab5e9b2-eb86-4b05-a20e-a47338d9ceeb
type: PRESET_ACTION
command:
id: f2e39d7f-db4a-4ce4-9cc9-22988c9cb83e
code: |-
assert(env.VAR_FROM_FILE === "test-var-from-file")
assert(env.INTERPOLATED_VAR_FROM_FILE === "test-var-from-file-default")
type: JAVASCRIPT
- id: b8f38734-b3ab-45a7-bbd1-bc790fee8cf5
type: PRESET_ACTION
command:
id: 4b905660-e1d0-4209-b09c-f9d08598a167
code: |
assert(env.VAR_FROM_SHELL === "test-var-from-shell")
type: JAVASCRIPT
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
fileType: momentic/module
schemaVersion: 1.0.18
moduleId: a0575e3f-bba8-48a3-91f6-1fb77de5188b
name: practice-test-login
description: ""
enabled: true
steps:
- id: 4657574e-caab-4c1e-9f50-2dfa4a4b4927
type: PRESET_ACTION
command:
id: 4f0c99f5-743d-4e21-b642-0d2772d32941
clearContent: true
type: TYPE
target:
type: description
elementDescriptor: username textbox
value: student
- id: 42056ded-31aa-458e-82ec-c3a981172e6f
type: PRESET_ACTION
command:
id: 4b56e24d-d471-4123-8bb6-5ab1d04ad06e
clearContent: true
type: TYPE
target:
type: description
elementDescriptor: password textbox
value: Password123
- id: d78e2d9c-9dff-4363-a9da-bc2222240258
type: PRESET_ACTION
command:
id: da49a90d-d83d-460c-99c1-ae0005ff80c8
type: PRESS
value: Enter
5 changes: 5 additions & 0 deletions multi-project-workspace-example/momentic.workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
projects:
- qa
# immediate children directories of apps
- apps/*

6 changes: 6 additions & 0 deletions multi-project-workspace-example/qa/momentic.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: qa
include:
- "**/*.test.yaml"
- "**/*.module.yaml"
- ../common/**/*.module.yaml"
moduleCreationDir: ../common
39 changes: 39 additions & 0 deletions multi-project-workspace-example/qa/practice-test-login.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
fileType: momentic/test
id: 032132e8-0271-44d3-a439-5165d6c5e182
name: practice-test-login
baseUrl: https://practicetestautomation.com/practice-test-login/
schemaVersion: 1.0.18
advanced:
disableAICaching: false
viewport:
width: 1920
height: 1080
browserType: Chromium
retries: 0
steps:
- id: 4657574e-caab-4c1e-9f50-2dfa4a4b4927
type: PRESET_ACTION
command:
id: 4f0c99f5-743d-4e21-b642-0d2772d32941
clearContent: true
type: TYPE
target:
type: description
elementDescriptor: username textbox
value: student
- id: 42056ded-31aa-458e-82ec-c3a981172e6f
type: PRESET_ACTION
command:
id: 4b56e24d-d471-4123-8bb6-5ab1d04ad06e
clearContent: true
type: TYPE
target:
type: description
elementDescriptor: password textbox
value: Password123
- id: d78e2d9c-9dff-4363-a9da-bc2222240258
type: PRESET_ACTION
command:
id: da49a90d-d83d-460c-99c1-ae0005ff80c8
type: PRESS
value: Enter
2 changes: 2 additions & 0 deletions multi-project-workspace-example/test.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VAR_FROM_FILE=test-var-from-file
INTERPOLATED_VAR_FROM_FILE=${NON_EXISTENT:-test-var-from-file-default}

0 comments on commit aede9fd

Please sign in to comment.