Skip to content

Commit 25ef013

Browse files
committed
fix: adding acceptance tests
1 parent 1a585b8 commit 25ef013

17 files changed

+2054
-4484
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,15 @@ jobs:
2121
run: |
2222
npm i
2323
npm test
24+
- name: Build
25+
run: |
26+
npm i
27+
npm run build
28+
- name: Run acceptance tests
29+
working-directory: ./__test__
30+
run: |
31+
npm i
32+
npm run test
33+
env:
34+
MAILINATOR_TOKEN: ${{secrets.MAILINATOR_TOKEN}}
35+
MAILINATOR_DOMAIN: ${{secrets.MAILINATOR_DOMAIN}}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,6 @@ typings/
6464
.idea
6565
dist
6666
coverage
67+
__test__/node_modules
68+
__test__/package-lock.json
69+
__test__/output

__test__/codecept.conf.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export const config: CodeceptJS.MainConfig = {
2+
tests: './*_test.ts',
3+
output: './output',
4+
helpers: {
5+
Playwright: {
6+
url: 'https://codecept.io/',
7+
show: false,
8+
browser: 'chromium'
9+
},
10+
"ResembleHelper" : {
11+
"require": "../src/index",
12+
"baseFolder": "./screenshots/base/",
13+
"diffFolder": "./screenshots/diff/",
14+
"prepareBaseImage": false
15+
}
16+
},
17+
include: {
18+
I: './steps_file'
19+
},
20+
name: '__test__'
21+
}

__test__/index.spec.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,8 @@ describe('_getHelper()', () => {
1515
expect(e.message).toEqual('No matching helper found. Supported helpers: Playwright/Puppeteer/WebDriver/TestCafe/Appium')
1616
}
1717
});
18-
19-
test('should return matching helper', () => {
20-
helpers['Playwright'] = { hello: 1 }
21-
expect(helper._getHelper()).toEqual({ hello: 1 })
22-
});
2318
})
2419

25-
2620
describe('_getPrepareBaseImage()', () => {
2721
beforeAll(() => {
2822
helpers['Playwright'] = { hello: 1 }
@@ -73,5 +67,4 @@ describe('resolvePath()', () => {
7367
test('should return resolvePath', () => {
7468
expect(helper.resolvePath('hello')).toContain('hello')
7569
});
76-
7770
})

__test__/package.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "__test__",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "codeceptjs run --verbose"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"dependencies": {
13+
"codeceptjs": "^3.4.1",
14+
"playwright": "^1.32.3"
15+
},
16+
"devDependencies": {
17+
"@types/node": "^18.15.11",
18+
"ts-node": "^10.9.1",
19+
"typescript": "^5.0.4"
20+
}
21+
}
121 KB
Loading

__test__/screenshots/base/element.png

15.9 KB
Loading
121 KB
Loading
15.9 KB
Loading

__test__/steps.d.ts

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

0 commit comments

Comments
 (0)