Skip to content

Commit 52ade97

Browse files
Initial project UI & mobile
1 parent b83d097 commit 52ade97

12 files changed

+8842
-0
lines changed

.github/workflows/playwright.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Playwright Tests
2+
on:
3+
push:
4+
branches: [ main, master ]
5+
pull_request:
6+
branches: [ main, master ]
7+
jobs:
8+
test:
9+
timeout-minutes: 60
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: lts/*
16+
- name: Install dependencies
17+
run: npm install -g yarn && yarn
18+
- name: Install Playwright Browsers
19+
run: yarn playwright install --with-deps
20+
- name: Run Playwright tests
21+
run: yarn playwright test
22+
- uses: actions/upload-artifact@v4
23+
if: ${{ !cancelled() }}
24+
with:
25+
name: playwright-report
26+
path: playwright-report/
27+
retention-days: 30

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
/test-results/
3+
/playwright-report/
4+
/blob-report/
5+
/playwright/.cache/
6+
wdio-appium.log
29.4 MB
Binary file not shown.

config/playwright.config.js

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
// @ts-check
2+
const { defineConfig, devices } = require('@playwright/test');
3+
4+
/**
5+
* Read environment variables from file.
6+
* https://github.com/motdotla/dotenv
7+
*/
8+
// require('dotenv').config({ path: path.resolve(__dirname, '.env') });
9+
10+
/**
11+
* @see https://playwright.dev/docs/test-configuration
12+
*/
13+
module.exports = defineConfig({
14+
testDir: '../tests/ui',
15+
/* Run tests in files in parallel */
16+
fullyParallel: true,
17+
/* Fail the build on CI if you accidentally left test.only in the source code. */
18+
forbidOnly: !!process.env.CI,
19+
/* Retry on CI only */
20+
retries: process.env.CI ? 2 : 0,
21+
/* Opt out of parallel tests on CI. */
22+
workers: process.env.CI ? 1 : undefined,
23+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
24+
reporter: [
25+
['list'],
26+
['html'],
27+
['junit', { outputFile: '../results.xml' }]
28+
],
29+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
30+
use: {
31+
/* Base URL to use in actions like `await page.goto('/')`. */
32+
// baseURL: 'http://127.0.0.1:3000',
33+
34+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
35+
trace: 'on-first-retry',
36+
},
37+
38+
/* Configure projects for major browsers */
39+
projects: [
40+
{
41+
name: 'chromium',
42+
use: { ...devices['Desktop Chrome'] },
43+
},
44+
45+
{
46+
name: 'firefox',
47+
use: { ...devices['Desktop Firefox'] },
48+
},
49+
50+
{
51+
name: 'webkit',
52+
use: { ...devices['Desktop Safari'] },
53+
},
54+
55+
/* Test against mobile viewports. */
56+
// {
57+
// name: 'Mobile Chrome',
58+
// use: { ...devices['Pixel 5'] },
59+
// },
60+
// {
61+
// name: 'Mobile Safari',
62+
// use: { ...devices['iPhone 12'] },
63+
// },
64+
65+
/* Test against branded browsers. */
66+
// {
67+
// name: 'Microsoft Edge',
68+
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
69+
// },
70+
// {
71+
// name: 'Google Chrome',
72+
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
73+
// },
74+
],
75+
76+
/* Run your local dev server before starting the tests */
77+
// webServer: {
78+
// command: 'npm run start',
79+
// url: 'http://127.0.0.1:3000',
80+
// reuseExistingServer: !process.env.CI,
81+
// },
82+
});
83+

config/wdio.config.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
const { join } = require('path');
2+
3+
exports.config = {
4+
runner: 'local',
5+
port: 4723,
6+
path: '/wd/hub',
7+
specs: [
8+
'./tests/**/*.js'
9+
],
10+
exclude: [],
11+
maxInstances: 1,
12+
capabilities: [
13+
{
14+
platformName: 'Android',
15+
'appium:platformVersion': '15.0',
16+
'appium:deviceName': 'emulator-5554',
17+
'appium:automationName': 'UIAutomator2',
18+
'appium:appPackage': 'com.wdiodemoapp',
19+
'appium:appActivity': 'com.wdiodemoapp.SplashActivity',
20+
'appium:app': join(process.cwd(), './apps/android/Android-NativeDemoApp-0.4.0.apk'),
21+
'appium:autoGrantPermissions': true
22+
}
23+
],
24+
logLevel: 'info',
25+
bail: 0,
26+
baseUrl: '',
27+
waitforTimeout: 10000,
28+
connectionRetryTimeout: 90000,
29+
connectionRetryCount: 3,
30+
specs: [["../tests/mobile/**"]],
31+
services: [
32+
['appium', {
33+
args: {
34+
address: 'localhost',
35+
port: 4723
36+
},
37+
logPath: './'
38+
}]
39+
],
40+
framework: 'mocha',
41+
reporters: ['spec'],
42+
mochaOpts: {
43+
ui: 'bdd',
44+
timeout: 60000
45+
}
46+
};

package.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "playwright-automation",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"author": "Marcin Kapturski <[email protected]>",
6+
"license": "MIT",
7+
"devDependencies": {
8+
"@playwright/test": "^1.48.0",
9+
"@types/node": "^22.7.5",
10+
"@wdio/appium-service": "^9.2.1",
11+
"@wdio/cli": "^9.2.1",
12+
"@wdio/local-runner": "^9.2.1",
13+
"@wdio/mocha-framework": "^9.1.3",
14+
"@wdio/spec-reporter": "^9.1.3",
15+
"appium": "^2.11.5",
16+
"appium-chromedriver": "^6.0.7",
17+
"appium-uiautomator2-driver": "^3.8.0",
18+
"axios": "^1.7.7",
19+
"chai": "^5.1.1"
20+
},
21+
"scripts": {
22+
"test": "playwright test --config config/playwright.config.js",
23+
"test:mobile": "wdio config/wdio.config.js",
24+
"show-report": "playwright show-report",
25+
"appium": "appium --allow-insecure chromedriver_autodownload"
26+
}
27+
}

0 commit comments

Comments
 (0)