Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelangarano committed Oct 4, 2023
0 parents commit b89efba
Show file tree
Hide file tree
Showing 13 changed files with 1,533 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .circleci/config-noorbs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2.1

jobs:
test:
parallelism: 3
docker:
- image: openstax/python3-chrome-base
steps:
- checkout
- run: npx pwc --key $CURRENTS_RECORD_KEY --project-id $CURRENTS_PROJECT_ID
workflows:
playwright:
jobs:
- test:
context: currents
50 changes: 50 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
version: 2.1

aliases:
- &cache_restore
restore_cache:
keys:
- v2-dependencies-{{ checksum "yarn.lock" }}

- &cache_save
save_cache:
paths:
- node_modules
- ~/.cache/yarn
key: v2-dependencies-{{ checksum "yarn.lock" }}

- &install_dependencies
run: yarn install --frozen-lockfile --cache-folder ~/.cache/yarn

jobs:
playwright-run:
executor: plugin-e2e-tester
parallelism: 1
steps:
- checkout
- *cache_restore
- *install_dependencies
- *cache_save

- run:
name: Install playwright
command: |
npx playwright install --with-deps chromium
- run:
name: Run E2E tests
command: |
yarn pwc --key $CURRENTS_RECORD_KEY --project-id $CURRENTS_PROJECT_ID
- store_test_results:
path: ~/repo/apps/plugin/e2e/reports/junit

- store_artifacts:
path: ~/repo/apps/plugin/e2e/recordings
destination: artifacts

workflows:
version: 2
all:
jobs:
- playwright-run
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
/test-results/
/playwright-report/
/playwright/.cache/
.DS_Store
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Currents.dev - CircleCI Playwright Example

This is an example repository that showcases using [CircleCI](https://circleci.com) with [Currents.dev](https://currents.dev).

The example [config file](https://github.com/currents-dev/circleci-example/blob/master/.circleci/config.yml):

- uses [Test CLI commands](https://playwright.dev/docs/test-cli) to run `@currents/playwright` for recording test results and parallelization with [Currents.dev](https://currents.dev)

- Note: set the `CURRENTS_PROJECT_ID` [Environment variable](https://circleci.com/docs/2.0/env-vars/) - obtain the project id from [Currents.dev](https://app.currents.dev)

- Note: use CLI arguments to customize your Playwright runs, e.g.: `pwc --key <your Currents.dev key>`

- Note: create an organization, get your record key at [Currents.dev](https://app.currents.dev) and set [Environment variable](https://circleci.com/docs/2.0/env-vars/) `CURRENTS_RECORD_KEY`

---
Empty file added index.js
Empty file.
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "circleci-pw-example",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"typescript": "^5.0.2"
},
"devDependencies": {
"@currents/playwright": "^0.8.1",
"@playwright/test": "^1.38.1",
"@types/node": "^20.8.2",
"playwright": "^1.38.1"
}
}
52 changes: 52 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { defineConfig, devices } from "@playwright/test";

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: "./tests",
/* 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: "html",
/* 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",
video: "on",
screenshot: "on",
},

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

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

{
name: "webkit",
use: { ...devices["Desktop Safari"] },
},
],
});
Loading

0 comments on commit b89efba

Please sign in to comment.