create-playwright-pom-start 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +51 -21
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,47 +1,76 @@
1
- # create-playwright-pom-start
1
+ <div align="center">
2
+ <h1>Playwright POM framework</h1>
3
+ <hr />
4
+ <p><small>An open source CLI-tool for quick start with Page Object Model project and Playwright framework</small></p>
5
+ <p>
6
+ <a href="https://www.npmjs.com/package/create-playwright-pom-start"><img src="https://img.shields.io/npm/v/create-playwright-pom-start?color=0062cc" alt="npm version" /></a>
7
+ <a href="https://github.com/GabrielDali/pom-pw-js/actions"><img src="https://img.shields.io/github/actions/workflow/status/GabrielDali/pom-pw-js/publish.yml?branch=main&label=CI&logo=github" alt="CI" /></a>
8
+ <a href="https://www.npmjs.com/package/create-playwright-pom-start"><img src="https://img.shields.io/npm/l/create-playwright-pom-start?color=006e75" alt="MIT License" /></a>
9
+ </p>
10
+ </div>
2
11
 
3
- Scaffold a **Playwright Page Object Model (POM)** structure for test projects in **JavaScript** or **TypeScript** with one command. Creates a base page, optional page classes, folders, global setup/teardown, and installs Playwright when needed.
12
+ ```bash
13
+ npm init playwright-pom-start
14
+ ```
15
+
16
+ ## Table of Contents
4
17
 
5
- ## How to start
18
+ 1. 💡 [Why use this](#why-use-this)
19
+ 2. 🚀 [Getting started](#getting-started)
20
+ - 2.1 [New project](#new-project)
21
+ - 2.2 [Add pages to an existing project](#add-pages-to-an-existing-project)
22
+ 3. ⚙️ [How it works](#how-it-works)
23
+ 4. 🗂️ [Generated structure](#generated-structure)
24
+ 5. 🏷️ [Page naming](#page-naming)
25
+ 6. 🖼️ [Examples](#examples)
26
+ 7. 🔗 [Repository & docs](#repository--docs)
27
+ 8. 👤 [Author & license](#author--license)
6
28
 
7
- From an empty folder (or where you want the project):
29
+ ## Why use this
30
+
31
+ Playwright gives you a powerful testing API but no folder structure. As your test suite grows, tests start reaching directly into selectors and actions, which means one UI change can break many tests instead of one. Page Object Model fixes that by keeping each page's interactions in one place. Your tests only call methods, not raw selectors.
32
+
33
+ Setting up POM manually means writing the same base class, the same folder layout, and the same boilerplate on every project. This CLI does it in one command: it creates the structure, scaffolds your first pages, and installs Playwright if it isn't there yet.
34
+
35
+ ## Getting started
36
+
37
+ **Requirements:** Node.js **v18** or later.
38
+
39
+ ### New project
40
+
41
+ Run in an empty folder or from any directory to scaffold into a named subfolder:
8
42
 
9
43
  ```bash
10
44
  npm init playwright-pom-start
11
45
  ```
12
46
 
13
- Or with a project name:
47
+ or into a subfolder:
14
48
 
15
49
  ```bash
16
- npm init playwright-pom-start my-playwright-project
50
+ npx playwright-pom my-project
17
51
  ```
18
52
 
53
+ You'll be prompted for:
19
54
 
20
-
21
- You’ll be prompted for:
22
-
23
- 1. **Language** — JavaScript or TypeScript (arrow keys + Enter). Default is JS.
24
- 2. **Page names** — optional; space-separated, or Enter to skip. Names are normalized to PascalCase + `Page` (e.g. `dashboard` → `DashboardPage`).
55
+ 1. **Language** — JavaScript or TypeScript (arrow keys + Enter). Default is JS. Skipped if Playwright is already detected in the folder.
56
+ 2. **Page names** — optional; type names separated by spaces, or press Enter to skip. Names are normalized to PascalCase + `Page` (e.g. `dashboard` → `DashboardPage`).
25
57
  3. **Playwright** — installed automatically if missing.
26
58
 
27
- **Requirements:** Node.js **v18** or later.
59
+ ### Add pages to an existing project
28
60
 
29
- ## Alternative: install then run
61
+ Run from the root of your project, where the `pages` folder lives:
30
62
 
31
63
  ```bash
32
- npm i playwright-pom
33
- npx playwright-pom
64
+ npx playwright-pom add pages
34
65
  ```
35
66
 
36
- Or scaffold in a subfolder: `npx playwright-pom my-project`
37
-
38
- To **add more pages** to an existing project, run from the project root: `npx playwright-pom add pages`.
67
+ The CLI detects your project language from existing config files or the `pages` folder contents. If it can't detect a language, it asks. If no `pages` folder exists yet, it creates one and copies `BasePage` before prompting for page names.
39
68
 
40
- ## Flow
69
+ ## How it works
41
70
 
42
71
  - If Playwright is **already installed** in the folder, the CLI detects JS or TS and skips the language question.
43
72
  - Templates are copied, folders and placeholder files are created.
44
- - If Playwright isnt installed yet, the CLI runs `npm init playwright@latest -- --quiet --lang=js` or `--lang=ts` to match the chosen language.
73
+ - If Playwright isn't installed yet, the CLI runs `npm init playwright@latest -- --quiet --lang=js` or `--lang=ts` to match the chosen language.
45
74
  - If the folder already has a scaffold (e.g. `pages/BasePage.js` or `pages/BasePage.ts`), the CLI prints **"Project already set up. Skipping."** and may run `npm install`.
46
75
 
47
76
  ## Generated structure
@@ -73,6 +102,7 @@ To **add more pages** to an existing project, run from the project root: `npx pl
73
102
  - Converted to PascalCase + `Page` (e.g. `checkout` → `CheckoutPage`, `userProfile` → `UserProfilePage`).
74
103
  - Invalid tokens and existing files are skipped (reported in the console).
75
104
 
105
+ ## Examples
76
106
 
77
107
  **JavaScript based output project structure**
78
108
 
@@ -97,5 +127,5 @@ To **add more pages** to an existing project, run from the project root: `npx pl
97
127
 
98
128
  ## Author & license
99
129
 
100
- **Author:** [Gabriel Dali](https://www.linkedin.com/in/gabriel-dali-qa/)
130
+ **Author:** [Gabriel Dali](https://www.linkedin.com/in/gabriel-dali-qa/)
101
131
  **License:** MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-playwright-pom-start",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Scaffold a Playwright POM project (run via npm init playwright-pom-start)",
5
5
  "keywords": [
6
6
  "playwright",