forked from testomatio/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'testomatio:master' into master
- Loading branch information
Showing
137 changed files
with
3,666 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
# - cron: "0 5 */2 * *" | ||
name: CodeceptJS example reporting results | ||
|
||
on: | ||
schedule: | ||
- cron: "0 5 */6 * *" | ||
|
||
jobs: | ||
reporting: | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
working-directory: ./codeceptJS | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Setup dependancies | ||
run: npm i | ||
- name: Playwright browser updates | ||
run: npx playwright install | ||
- name: Run tests | ||
run: bash run-tests-and-check-results.sh | ||
env: | ||
TESTOMATIO: "${{ secrets.TESTOMATIO }}" | ||
TESTOMATIO_URL: "${{ secrets.TESTOMATIO_URL }}" | ||
CODECEPT_GROUP_TESTS: "${{ secrets.CODECEPT_GROUP_TESTS }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
# - cron: "10 5 */2 * *" | ||
name: Cypress example reporting results | ||
|
||
on: | ||
schedule: | ||
- cron: "10 5 */6 * *" | ||
|
||
jobs: | ||
reporting: | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
working-directory: ./cypress | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Setup dependancies | ||
run: npm i | ||
- name: Run tests | ||
run: bash run-tests-and-check-results.sh | ||
env: | ||
TESTOMATIO: "${{ secrets.TESTOMATIO_CYPRESS }}" | ||
TESTOMATIO_URL: "${{ secrets.TESTOMATIO_URL }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: newman tests | ||
on: | ||
pull_request: | ||
branches: [master] | ||
|
||
concurrency: | ||
group: newman-tests-${{github.event.pull_request.number}} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
newman-global: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: newman | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18.x | ||
- run: npm i newman-reporter-testomatio newman -g | ||
- run: TESTOMATIO=m6ef70356h7c newman run collection.json -e env.json -r testomatio | ||
|
||
newman-local: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: newman | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18.x | ||
- run: npm i | ||
- run: TESTOMATIO=m6ef70356h7c npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
# - cron: "20 5 */2 * *" | ||
name: Playwright example reporting results | ||
|
||
on: | ||
schedule: | ||
- cron: "20 5 */6 * *" | ||
|
||
jobs: | ||
reporting: | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
working-directory: ./playwright | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Setup dependancies | ||
run: npm i | ||
- name: Playwright browser updates | ||
run: npx playwright install | ||
- name: Run tests | ||
run: bash run-tests-and-check-results.sh | ||
env: | ||
TESTOMATIO: "${{ secrets.TESTOMATIO_PLAYWRIGHT }}" | ||
TESTOMATIO_URL: "${{ secrets.TESTOMATIO_URL }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
output/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Feature('Test feature name'); | ||
|
||
Scenario('test something', ({ I }) => { | ||
I.amOnPage('https://www.google.com/'); | ||
I.see('Google'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { setHeadlessWhen, setCommonPlugins } from '@codeceptjs/configure'; | ||
// turn on headless mode when running with HEADLESS=true environment variable | ||
// export HEADLESS=true && npx codeceptjs run | ||
setHeadlessWhen(process.env.HEADLESS); | ||
|
||
// enable all common plugins https://github.com/codeceptjs/configure#setcommonplugins | ||
setCommonPlugins(); | ||
|
||
export const config: CodeceptJS.MainConfig = { | ||
tests: './__tests__/**/*_test.ts', | ||
output: './output', | ||
helpers: { | ||
Playwright: { | ||
browser: 'chromium', | ||
url: 'http://localhost', | ||
show: false | ||
} | ||
}, | ||
include: { | ||
I: './steps_file' | ||
}, | ||
name: 'codeceptJS-typescript', | ||
|
||
plugins: { | ||
testomatio: { | ||
enabled: true, | ||
require: '@testomatio/reporter/lib/adapter/codecept', | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "codeceptjs-typescript", | ||
"version": "1.0.0", | ||
"description": "Example project for CodeceptJS + TypeScript", | ||
"scripts": { | ||
"test": "npx codeceptjs run --steps" | ||
}, | ||
"author": "Oleksandr Pelykh / Testomatio", | ||
"license": "ISC", | ||
"dependencies": { | ||
"codeceptjs": "^3.5.11", | ||
"playwright": "^1.40.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.10.7", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.3.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/// <reference types='codeceptjs' /> | ||
type steps_file = typeof import('./steps_file'); | ||
|
||
declare namespace CodeceptJS { | ||
interface SupportObject { I: I, current: any } | ||
interface Methods extends Playwright {} | ||
interface I extends ReturnType<steps_file> {} | ||
namespace Translation { | ||
interface Actions {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// in this file you can append custom step methods to 'I' object | ||
|
||
export = function() { | ||
return actor({ | ||
|
||
// Define custom steps here, use 'this' to access default methods of I. | ||
// It is recommended to place a general 'login' function here. | ||
|
||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"ts-node": { | ||
"files": true | ||
}, | ||
"compilerOptions": { | ||
"target": "es2018", | ||
"lib": ["es2018", "DOM"], | ||
"esModuleInterop": true, | ||
"module": "commonjs", | ||
"strictNullChecks": false, | ||
"types": ["codeceptjs", "node"], | ||
"declaration": true, | ||
"skipLibCheck": true | ||
}, | ||
"exclude": ["node_modules"] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is test artifact content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
npx codeceptjs run > test-results.txt | ||
fail_tests=$(grep -oE '\b[0-9]+\s+failed\b' test-results.txt | grep -oE '[0-9]+') | ||
echo "Number of failed tests: $fail_tests" | ||
if [ "$fail_tests" -gt 12 ]; then | ||
echo "More than 12 failed tests. Exiting with error." | ||
exit 1 | ||
else | ||
exit 0 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const testomat = require('@testomatio/reporter'); | ||
|
||
Feature('Testomat functions'); | ||
|
||
Scenario('Upload file', async () => { | ||
testomat.artifact('artifacts/artifact-test-text.txt'); | ||
}); | ||
|
||
Scenario('Upload image', async () => { | ||
testomat.artifact({ | ||
path: 'artifacts/artifact-test-image.png', | ||
}); | ||
}); | ||
|
||
Scenario('Add Step to report', async () => { | ||
testomat.step('This is step message'); | ||
}); | ||
|
||
Scenario('Add log message to report', async () => { | ||
testomat.log('This is log message'); | ||
testomat.log`This is log message with template literal`; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const { logger, log } = require('@testomatio/reporter'); | ||
|
||
// console messages are added to report by default when import "logger" from reporter | ||
// but to prevent unsused variable warning, you can call next code: | ||
logger; | ||
|
||
Feature('Logger @Sebd746ef'); | ||
|
||
Scenario('Intercept console logs @Tebebb252', async () => { | ||
console.warn('This is warning message'); | ||
}); | ||
|
||
Scenario('Add own log message @T35d1887d', async () => { | ||
const someObject = { | ||
name: 'John', | ||
surname: 'Doe', | ||
age: 30, | ||
}; | ||
log('This is log message', someObject); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.