Skip to content

Commit ce93b08

Browse files
authored
Merge pull request #250 from codeceptjs/kobenguyent-patch-1
2 parents 710a9ab + cbe7c48 commit ce93b08

File tree

8 files changed

+119
-0
lines changed

8 files changed

+119
-0
lines changed

Diff for: .github/workflows/e2-tests.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This to verify lib version bump doesn't break anything
2+
name: E2E Tests
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
- main
9+
pull_request:
10+
branches:
11+
- '**'
12+
13+
jobs:
14+
publish-npm:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 16
21+
registry-url: https://registry.npmjs.org/
22+
- run: git config --global user.name "GitHub CD bot"
23+
- run: git config --global user.email "[email protected]"
24+
- name: Install deps
25+
run: npm i -g wait-for-localhost-cli && npm i
26+
- name: Start app and run tests
27+
run: npm run serve & wait-for-localhost 8080; cd test/e2e; npm i && npx playwright install chromium && npm run test
28+
env:
29+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: .gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,8 @@ yarn-error.log*
2424
/dist_electron
2525

2626
package-lock.json
27+
28+
29+
test/e2e/node_modules
30+
test/e2e/yarn.lock
31+
test/e2e/output

Diff for: test/e2e/codecept.conf.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export const config: CodeceptJS.MainConfig = {
2+
tests: './*_test.ts',
3+
output: './output',
4+
helpers: {
5+
Playwright: {
6+
browser: 'chromium',
7+
url: 'http://localhost:8080',
8+
show: false,
9+
timeout: 10000,
10+
waitForNavigation: 'load',
11+
waitForTimeout: 10000
12+
}
13+
},
14+
include: {
15+
I: './steps_file'
16+
},
17+
name: 'e2e'
18+
}

Diff for: test/e2e/homepage_test.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const { I } = inject();
2+
3+
Feature('homepage');
4+
5+
6+
Scenario('Home page is loaded', () => {
7+
I.amOnPage('');
8+
I.waitForText('Write a Test');
9+
});
10+

Diff for: test/e2e/package.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "e2e",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "npx codeceptjs run --verbose"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"dependencies": {
12+
"codeceptjs": "^3.5.14",
13+
"playwright": "^1.41.2"
14+
},
15+
"devDependencies": {
16+
"@types/node": "20.11.20",
17+
"ts-node": "10.9.2",
18+
"typescript": "5.3.3"
19+
}
20+
}

Diff for: test/e2e/steps.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// <reference types='codeceptjs' />
2+
type steps_file = typeof import('./steps_file');
3+
4+
declare namespace CodeceptJS {
5+
interface SupportObject { I: I, current: any }
6+
interface Methods extends Playwright {}
7+
interface I extends ReturnType<steps_file> {}
8+
namespace Translation {
9+
interface Actions {}
10+
}
11+
}

Diff for: test/e2e/steps_file.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// in this file you can append custom step methods to 'I' object
2+
3+
export = function() {
4+
return actor({
5+
6+
// Define custom steps here, use 'this' to access default methods of I.
7+
// It is recommended to place a general 'login' function here.
8+
9+
});
10+
}

Diff for: test/e2e/tsconfig.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"ts-node": {
3+
"files": true
4+
},
5+
"compilerOptions": {
6+
"target": "es2018",
7+
"lib": ["es2018", "DOM"],
8+
"esModuleInterop": true,
9+
"module": "commonjs",
10+
"strictNullChecks": false,
11+
"types": ["codeceptjs", "node"],
12+
"declaration": true,
13+
"skipLibCheck": true
14+
},
15+
"exclude": ["node_modules"]
16+
}

0 commit comments

Comments
 (0)