Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CFWEB-69 Run Playwright tests with browserstack by using Github workflow #19

Merged
merged 22 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fb6475d
CFWEB-69-playwright-and-browserstack
stefanheinze Jan 22, 2024
bdb3a1c
CFWEB-69-playwright-and-browserstack
stefanheinze Jan 22, 2024
f7dd24e
CFWEB-69-playwright-and-browserstack
stefanheinze Jan 22, 2024
d0286c7
CFWEB-69-playwright-and-browserstack
stefanheinze Jan 22, 2024
c1126f6
CFWEB-69-playwright-and-browserstack
stefanheinze Jan 22, 2024
39c016c
CFWEB-69-playwright-and-browserstack
stefanheinze Jan 22, 2024
8bef0b4
Merge pull request #1 from stefanheinze/task/CFWEB-69-playwright-and-…
stefanheinze Jan 22, 2024
6013688
CFWEB-69-playwright-and-browserstack
stefanheinze Jan 22, 2024
0337586
CFWEB-69-playwright-and-browserstack
stefanheinze Jan 22, 2024
f5b02ab
CFWEB-69-playwright-and-browserstack
stefanheinze Jan 22, 2024
9e24381
CFWEB-69-playwright-and-browserstack
stefanheinze Jan 22, 2024
fb5b657
CFWEB-69-playwright-and-browserstack
stefanheinze Jan 22, 2024
6d9796a
CFWEB-69-playwright-and-browserstack
stefanheinze Jan 22, 2024
d81ae9d
CFWEB-69-playwright-and-browserstack
stefanheinze Jan 22, 2024
dccae5c
CFWEB-69-playwright-and-browserstack
stefanheinze Jan 22, 2024
e9dbdc6
CFWEB-69-playwright-and-browserstack
stefanheinze Feb 5, 2024
e8d1f4a
try different form of defining secret credentials
dominik-olwig Feb 5, 2024
e7db7bf
try different form of defining secret credentials
dominik-olwig Feb 5, 2024
c9d5116
remove unused env variables
dominik-olwig Feb 5, 2024
eaf47ca
CFWEB-69 fix PR comments
dominik-olwig Feb 5, 2024
0eec1e6
CFWEB-69-playwright-and-browserstack
stefanheinze Feb 5, 2024
d21a1bd
Merge branch 'main' of https://github.com/stefanheinze/angular-styleg…
stefanheinze Feb 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/run-playwright-browserstack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Run Playwright on Browserstack

on:
workflow_dispatch:
inputs:
user_name:
description: browserstack user name
required: true
type: string
access_key:
description: browserstack access key
required: true
type: string

jobs:
build:
runs-on: ubuntu-latest

# define node version
strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v3

# setting up node
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

# install
- name: Install Dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: |
npm ci

# install playwright
- name: Install Playwright with Chrome
run: |
npx playwright install --with-deps

# build
- name: Build
run: |
npm run build:prod

# Run E2E Tests
- name: PlayWright Test
run: |
npm run e2e:playwright:ci-browserstack
env:
BROWSERSTACK_USER_NAME: ${{ inputs.user_name }}
BROWSERSTACK_ACCESS_KEY: ${{ inputs.access_key }}
ssaring marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ Run `npm run e2e:playwright` to execute the end-to-end tests via Playwright.

Run `npm run e2e:playwright:ui` to start [Playwright UI Mode](https://playwright.dev/docs/test-ui-mode).

### Running Playwright tests with Browserstack

Precondition: You need a browserstack account to get your username and access key https://www.browserstack.com/docs/iaam/security/manage-access-keys.
ssaring marked this conversation as resolved.
Show resolved Hide resolved

Run tests with Github workflow:

- Follow the Github Guide (https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow)
- The workflow that needs to be started is called `Run Playwright on Browserstack`
- Enter the Browserstack credentials as input parameters.
ssaring marked this conversation as resolved.
Show resolved Hide resolved

## Running layout tests

Run `npm run galen` to run layout tests using the [Galen Framework](http://galenframework.com/).
Expand Down
3 changes: 2 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
}
},
"cli": {
"schematicCollections": ["@angular-eslint/schematics"]
"schematicCollections": ["@angular-eslint/schematics"],
"analytics": false
},
"schematics": {
"@angular-eslint/schematics:application": {
Expand Down
79 changes: 79 additions & 0 deletions browserstack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# =============================
# Set BrowserStack Credentials
# =============================
# Add your BrowserStack userName and accessKey here or set BROWSERSTACK_USERNAME and
# BROWSERSTACK_ACCESS_KEY as env variables
userName: ${BROWSERSTACK_USER_NAME}
accessKey: ${BROWSERSTACK_ACCESS_KEY}

# ======================
# BrowserStack Reporting
# ======================
# The following capabilities are used to set up reporting on BrowserStack:
# Set 'projectName' to the name of your project. Example, Marketing Website
projectName: Angular Styleguide
# Set `buildName` as the name of the job / testsuite being run
buildName: Ice Cream Shop
# `buildIdentifier` is a unique id to differentiate every execution that gets appended to
# buildName. Choose your buildIdentifier format from the available expressions:
# ${BUILD_NUMBER} (Default): Generates an incremental counter with every execution
# ${DATE_TIME}: Generates a Timestamp with every execution. Eg. 05-Nov-19:30
# Read more about buildIdentifiers here -> https://www.browserstack.com/docs/automate/selenium/organize-tests
buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression}

# =======================================
# Platforms (Browsers / Devices to test)
# =======================================
# Platforms object contains all the browser / device combinations you want to test on.
# Entire list available here -> (https://www.browserstack.com/list-of-browsers-and-platforms/automate)
platforms:
- os: OS X
osVersion: Big Sur
browserName: Chrome
browserVersion: latest
- os: Windows
osVersion: 10
browserName: Edge
browserVersion: latest
- deviceName: Samsung Galaxy S22 Ultra
browserName: chrome # Try 'samsung' for Samsung browser
osVersion: 12.0

# =======================
# Parallels per Platform
# =======================
# The number of parallel threads to be used for each platform set.
# BrowserStack's SDK runner will select the best strategy based on the configured value
#
# Example 1 - If you have configured 3 platforms and set `parallelsPerPlatform` as 2, a total of 6 (2 * 3) parallel threads will be used on BrowserStack
#
# Example 2 - If you have configured 1 platform and set `parallelsPerPlatform` as 5, a total of 5 (1 * 5) parallel threads will be used on BrowserStack
parallelsPerPlatform: 1
retryTestsOnFailure: true
testIterations: 3

# ==========================================
# BrowserStack Local
# (For localhost, staging/private websites)
# ==========================================
# Set browserStackLocal to true if your website under test is not accessible publicly over the internet
# Learn more about how BrowserStack Local works here -> https://www.browserstack.com/docs/automate/selenium/local-testing-introduction
browserstackLocal: true # <boolean> (Default false)
# browserStackLocalOptions:
# Options to be passed to BrowserStack local in-case of advanced configurations
# localIdentifier: # <string> (Default: null) Needed if you need to run multiple instances of local.
# forceLocal: true # <boolean> (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel.
# Entire list of arguments available here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections

# ===================
# Debugging features
# ===================
debug: false # <boolean> # Set to true if you need screenshots for every selenium command ran
networkLogs: false # <boolean> Set to true to enable HAR logs capturing
consoleLogs: errors # <string> Remote browser's console debug levels to be printed (Default: errors)
# Available options are `disable`, `errors`, `warnings`, `info`, `verbose` (Default: errors)
# CUSTOM_TAG_<INT>: # <string> (Default: parent folder name of the test file) Custom tag for your test suite

# Test Observability is an intelligent test reporting & debugging product. It collects data using the SDK. Read more about what data is collected at https://www.browserstack.com/docs/test-observability/references/terms-and-conditions
# Visit observability.browserstack.com to see your test reports and insights. To disable test observability, specify `testObservability: false` in the key below.
testObservability: true
2 changes: 0 additions & 2 deletions e2e-playwright/playwright.config.ci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,3 @@ const config: PlaywrightTestConfig = {
],
};
export default config;

export const baseUrl: string = 'http://localhost:4200';
Loading