Skip to content

Commit

Permalink
Merge pull request #1 from marcinkapturski/initial-project
Browse files Browse the repository at this point in the history
Initial project UI & mobile
  • Loading branch information
marcinkapturski authored Oct 14, 2024
2 parents b83d097 + 52ade97 commit 1133a20
Show file tree
Hide file tree
Showing 12 changed files with 8,842 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Playwright Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm install -g yarn && yarn
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Run Playwright tests
run: yarn playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
wdio-appium.log
Binary file added apps/android/Android-NativeDemoApp-0.4.0.apk
Binary file not shown.
83 changes: 83 additions & 0 deletions config/playwright.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// @ts-check
const { defineConfig, devices } = require('@playwright/test');

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config({ path: path.resolve(__dirname, '.env') });

/**
* @see https://playwright.dev/docs/test-configuration
*/
module.exports = defineConfig({
testDir: '../tests/ui',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
['list'],
['html'],
['junit', { outputFile: '../results.xml' }]
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],

/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
});

46 changes: 46 additions & 0 deletions config/wdio.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const { join } = require('path');

exports.config = {
runner: 'local',
port: 4723,
path: '/wd/hub',
specs: [
'./tests/**/*.js'
],
exclude: [],
maxInstances: 1,
capabilities: [
{
platformName: 'Android',
'appium:platformVersion': '15.0',
'appium:deviceName': 'emulator-5554',
'appium:automationName': 'UIAutomator2',
'appium:appPackage': 'com.wdiodemoapp',
'appium:appActivity': 'com.wdiodemoapp.SplashActivity',
'appium:app': join(process.cwd(), './apps/android/Android-NativeDemoApp-0.4.0.apk'),
'appium:autoGrantPermissions': true
}
],
logLevel: 'info',
bail: 0,
baseUrl: '',
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
specs: [["../tests/mobile/**"]],
services: [
['appium', {
args: {
address: 'localhost',
port: 4723
},
logPath: './'
}]
],
framework: 'mocha',
reporters: ['spec'],
mochaOpts: {
ui: 'bdd',
timeout: 60000
}
};
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "playwright-automation",
"version": "1.0.0",
"main": "index.js",
"author": "Marcin Kapturski <[email protected]>",
"license": "MIT",
"devDependencies": {
"@playwright/test": "^1.48.0",
"@types/node": "^22.7.5",
"@wdio/appium-service": "^9.2.1",
"@wdio/cli": "^9.2.1",
"@wdio/local-runner": "^9.2.1",
"@wdio/mocha-framework": "^9.1.3",
"@wdio/spec-reporter": "^9.1.3",
"appium": "^2.11.5",
"appium-chromedriver": "^6.0.7",
"appium-uiautomator2-driver": "^3.8.0",
"axios": "^1.7.7",
"chai": "^5.1.1"
},
"scripts": {
"test": "playwright test --config config/playwright.config.js",
"test:mobile": "wdio config/wdio.config.js",
"show-report": "playwright show-report",
"appium": "appium --allow-insecure chromedriver_autodownload"
}
}
Loading

0 comments on commit 1133a20

Please sign in to comment.