-
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.
- Loading branch information
0 parents
commit 2d20c41
Showing
22 changed files
with
835 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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 @@ | ||
name: Acceptance Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [20.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: Run tests | ||
run: | | ||
npm i && npx playwright install chromium | ||
npx codeceptjs run --steps |
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,64 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
output | ||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# next.js build output | ||
.next | ||
|
||
package-lock.json | ||
.idea |
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,76 @@ | ||
This repo contains tests for TodoMVC application written with Typescript. | ||
Tests can be executed via different helpers. | ||
|
||
![](todo.png) | ||
|
||
# Installation | ||
|
||
This is a playground for your first steps in testing with Typescript, so instead of installing it from NPM it is recommended to clone it from repo instead and then install the dependencies: | ||
|
||
``` | ||
git clone git@github.com:codecept-js/examples-ts.git codeceptjs-examples-ts && cd codeceptjs-examples-ts && npm i | ||
``` | ||
|
||
This will install CodeceptJS with Puppeteer, WebdriverIO & TestCafe packages. | ||
|
||
# Running Tests | ||
|
||
The default helper is Playwright. | ||
|
||
## Playwright | ||
|
||
Use `codecept.conf.ts` to run tests with Playwright: | ||
|
||
``` | ||
npx codeceptjs run --steps | ||
``` | ||
|
||
## Puppeteer | ||
|
||
Use `codecept.puppeteer.conf.ts` to run tests with Puppeteer: | ||
|
||
``` | ||
npx codeceptjs run --steps -c codecept.puppeteer.conf.ts | ||
``` | ||
|
||
|
||
## WebdriverIO | ||
|
||
Use `codecept.webdriver.conf.ts` to run tests with WebdriverIO in Chrome: | ||
|
||
``` | ||
npx codeceptjs run -c codecept.webdriver.conf.ts --steps | ||
``` | ||
|
||
## TestCafe | ||
|
||
Use `codecept.testcafe.conf.ts` to run tests with TestCafe in Chrome: | ||
|
||
``` | ||
npx codeceptjs run -c codecept.testcafe.conf.ts --steps | ||
``` | ||
|
||
## Headless Mode | ||
|
||
Run tests in headless mode: | ||
|
||
``` | ||
HEADLESS=true npx codeceptjs run --steps | ||
``` | ||
|
||
## Parallel Execution | ||
|
||
Run tests in parallel with 3 workers: | ||
|
||
``` | ||
npx codeceptjs run-workers 3 | ||
``` | ||
|
||
## Credits | ||
|
||
Created as part of codepress by Stefan Huber. | ||
Maintained by CodeceptJS Team. | ||
|
||
## LICENSE | ||
|
||
MIT |
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 @@ | ||
const { setHeadlessWhen } = require('@codeceptjs/configure'); | ||
|
||
setHeadlessWhen(process.env.HEADLESS); | ||
|
||
exports.config = { | ||
tests: './todomvc-tests/**/*_test.ts', | ||
output: './output', | ||
helpers: { | ||
Playwright: { | ||
url: 'http://localhost', | ||
waitForTimeout: 5000, | ||
show: false, | ||
}, | ||
|
||
REST: {}, | ||
|
||
CustomHelper: { | ||
require: './todomvc-tests/helpers/custom.helper.ts' | ||
} | ||
}, | ||
|
||
gherkin: { | ||
features: './todomvc-tests/features/*.feature', | ||
steps: [ | ||
'./todomvc-tests/step-definitions/create-todos.steps.ts' | ||
] | ||
}, | ||
|
||
include: { | ||
TodosPage: './todomvc-tests/pages/todos.page.ts' | ||
}, | ||
bootstrap: null, | ||
mocha: {}, | ||
name: 'codecept demo 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,37 @@ | ||
const { setHeadlessWhen } = require('@codeceptjs/configure'); | ||
|
||
setHeadlessWhen(process.env.HEADLESS); | ||
|
||
exports.config = { | ||
tests: './todomvc-tests/**/*_test.ts', | ||
output: './output', | ||
helpers: { | ||
Puppeteer: { | ||
url: 'http://localhost', | ||
waitForTimeout: 5000, | ||
waitForNavigation: 'networkidle0', | ||
waitForAction: 0, | ||
show: true, | ||
}, | ||
|
||
REST: {}, | ||
|
||
CustomHelper: { | ||
require: './todomvc-tests/helpers/custom.helper.ts' | ||
} | ||
}, | ||
|
||
gherkin: { | ||
features: './todomvc-tests/features/*.feature', | ||
steps: [ | ||
'./todomvc-tests/step-definitions/create-todos.steps.ts' | ||
] | ||
}, | ||
|
||
include: { | ||
TodosPage: './todomvc-tests/pages/todos.page.ts' | ||
}, | ||
bootstrap: null, | ||
mocha: {}, | ||
name: 'codecept demo 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,35 @@ | ||
const { setHeadlessWhen } = require('@codeceptjs/configure'); | ||
|
||
setHeadlessWhen(process.env.HEADLESS); | ||
|
||
exports.config = { | ||
tests: './todomvc-tests/**/*_test.ts', | ||
output: './output', | ||
helpers: { | ||
TestCafe: { | ||
url: 'http://localhost', | ||
browser: 'chrome', | ||
show: true, | ||
}, | ||
|
||
REST: {}, | ||
|
||
CustomHelper: { | ||
require: './todomvc-tests/helpers/custom.helper.ts' | ||
} | ||
}, | ||
|
||
gherkin: { | ||
features: './todomvc-tests/features/*.feature', | ||
steps: [ | ||
'./todomvc-tests/step-definitions/create-todos.steps.ts' | ||
] | ||
}, | ||
|
||
include: { | ||
TodosPage: './todomvc-tests/pages/todos.page.ts' | ||
}, | ||
bootstrap: null, | ||
mocha: {}, | ||
name: 'codecept demo 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,42 @@ | ||
const { setHeadlessWhen } = require('@codeceptjs/configure'); | ||
|
||
setHeadlessWhen(process.env.HEADLESS); | ||
|
||
exports.config = { | ||
tests: './todomvc-tests/**/*_test.ts', | ||
output: './output', | ||
helpers: { | ||
WebDriver: { | ||
url: 'http://localhost', | ||
browser: 'chrome', | ||
}, | ||
|
||
REST: {}, | ||
|
||
CustomHelper: { | ||
require: './todomvc-tests/helpers/custom.helper.ts' | ||
} | ||
}, | ||
|
||
gherkin: { | ||
features: './todomvc-tests/features/*.feature', | ||
steps: [ | ||
'./todomvc-tests/step-definitions/create-todos.steps.ts' | ||
] | ||
}, | ||
|
||
include: { | ||
TodosPage: './todomvc-tests/pages/todos.page.ts' | ||
}, | ||
|
||
plugins: { | ||
wdio: { | ||
enabled: true, | ||
services: ['selenium-standalone'] | ||
} | ||
}, | ||
|
||
bootstrap: null, | ||
mocha: {}, | ||
name: 'codecept demo 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 @@ | ||
{ | ||
"name": "@codeceptjs/examples-ts", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "kobenguyent, davert", | ||
"license": "ISC", | ||
"dependencies": { | ||
"ts-node": "10.9.2" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/codeceptjs/examples-ts.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/codeceptjs/examples-ts.git/issues" | ||
}, | ||
"homepage": "https://github.com/codeceptjs/examples-ts.git#readme", | ||
"description": "", | ||
"devDependencies": { | ||
"@codeceptjs/configure": "^0.5.0", | ||
"@codeceptjs/ui": "^0.2.0", | ||
"@types/node": "^20.11.30", | ||
"@wdio/selenium-standalone-service": "^5.16.10", | ||
"codeceptjs": "3.5.12", | ||
"playwright": "1.41.2", | ||
"puppeteer": "^2.0.0", | ||
"testcafe": "^1.7.0", | ||
"webdriverio": "^5.16.11" | ||
} | ||
} |
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,12 @@ | ||
/// <reference types='codeceptjs' /> | ||
type TodosPage = typeof import('./todomvc-tests/pages/todos.page'); | ||
type CustomHelper = import('./todomvc-tests/helpers/custom.helper'); | ||
|
||
declare namespace CodeceptJS { | ||
interface SupportObject { I: I, current: any, TodosPage: TodosPage } | ||
interface Methods extends Playwright, REST, CustomHelper {} | ||
interface I extends WithTranslation<Methods> {} | ||
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,4 @@ | ||
# Testing "Create TODOs" using page objects | ||
|
||
- Create single todo | ||
- Create multiple todos |
Oops, something went wrong.