Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/ip-1.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent authored Feb 27, 2024
2 parents aadde33 + ce93b08 commit 77f6005
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/e2-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This to verify lib version bump doesn't break anything
name: E2E Tests

on:
push:
branches:
- master
- main
pull_request:
branches:
- '**'

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: git config --global user.name "GitHub CD bot"
- run: git config --global user.email "[email protected]"
- name: Install deps
run: npm i -g wait-for-localhost-cli && npm i
- name: Start app and run tests
run: npm run serve & wait-for-localhost 8080; cd test/e2e; npm i && npx playwright install chromium && npm run test
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ yarn-error.log*
/dist_electron

package-lock.json


test/e2e/node_modules
test/e2e/yarn.lock
test/e2e/output
18 changes: 18 additions & 0 deletions test/e2e/codecept.conf.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export const config: CodeceptJS.MainConfig = {
tests: './*_test.ts',
output: './output',
helpers: {
Playwright: {
browser: 'chromium',
url: 'http://localhost:8080',
show: false,
timeout: 10000,
waitForNavigation: 'load',
waitForTimeout: 10000
}
},
include: {
I: './steps_file'
},
name: 'e2e'
}
10 changes: 10 additions & 0 deletions test/e2e/homepage_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { I } = inject();

Feature('homepage');


Scenario('Home page is loaded', () => {
I.amOnPage('');
I.waitForText('Write a Test');
});

20 changes: 20 additions & 0 deletions test/e2e/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "e2e",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "npx codeceptjs run --verbose"
},
"author": "",
"license": "ISC",
"dependencies": {
"codeceptjs": "^3.5.14",
"playwright": "^1.41.2"
},
"devDependencies": {
"@types/node": "20.11.20",
"ts-node": "10.9.2",
"typescript": "5.3.3"
}
}
11 changes: 11 additions & 0 deletions test/e2e/steps.d.ts
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 {}
}
}
10 changes: 10 additions & 0 deletions test/e2e/steps_file.ts
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.

});
}
16 changes: 16 additions & 0 deletions test/e2e/tsconfig.json
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"]
}

0 comments on commit 77f6005

Please sign in to comment.