simple-playwright-framework 0.0.7 → 0.0.9
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.
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/scripts/init-demo-project.js +16 -5
package/dist/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export { envConfigFixture } from "./fixtures/envConfig.fixture";
|
|
|
7
7
|
export { dataFixture } from "./fixtures/data.fixture";
|
|
8
8
|
export { fileFixture } from "./fixtures/file.fixture";
|
|
9
9
|
export { testrailFixture } from "./fixtures/testrail.fixture";
|
|
10
|
+
export type { AuthProvider, AuthStorageConfig } from "./types/auth";
|
package/package.json
CHANGED
|
@@ -26,7 +26,7 @@ writeFileSafe(path.join(demoDir, "package.json"),
|
|
|
26
26
|
private: true,
|
|
27
27
|
scripts: {
|
|
28
28
|
init: "node ../framework/scripts/init-demo-project.js",
|
|
29
|
-
clean: "rimraf dist tsconfig.tsbuildinfo",
|
|
29
|
+
clean: "npx rimraf dist tsconfig.tsbuildinfo",
|
|
30
30
|
build: "tsc --build --force",
|
|
31
31
|
test: "playwright test"
|
|
32
32
|
},
|
|
@@ -52,7 +52,7 @@ writeFileSafe(path.join(demoDir, "tsconfig.json"),
|
|
|
52
52
|
resolveJsonModule: true,
|
|
53
53
|
types: ["@playwright/test", "simple-playwright-framework", "node"],
|
|
54
54
|
baseUrl: ".",
|
|
55
|
-
paths: { "@demo-project/*": ["./*"] },
|
|
55
|
+
paths: { "@demo-project/*": ["./*"] , "@demo-project/auth": ["auth/index.ts"]},
|
|
56
56
|
outDir: "dist"
|
|
57
57
|
},
|
|
58
58
|
include: ["tests/**/*.ts", "global.d.ts"]
|
|
@@ -64,6 +64,7 @@ writeFileSafe(path.join(demoDir, "playwright.config.ts"), `import { defineConfig
|
|
|
64
64
|
export default defineConfig({ testDir: './tests', reporter: [['html']] });
|
|
65
65
|
`);
|
|
66
66
|
|
|
67
|
+
|
|
67
68
|
// config
|
|
68
69
|
writeFileSafe(path.join(demoDir, "config/environments.json"),
|
|
69
70
|
JSON.stringify({
|
|
@@ -100,6 +101,16 @@ writeFileSafe(path.join(demoDir, "data/login/loginwithauthstorage.json"),
|
|
|
100
101
|
JSON.stringify({ prod: { users: { admin: { username: "Admin", password: "admin123" } } } }, null, 2)
|
|
101
102
|
);
|
|
102
103
|
|
|
104
|
+
|
|
105
|
+
// -------------------- auth/index.ts --------------------
|
|
106
|
+
writeFileSafe(path.join(demoDir, "auth/index.ts"),
|
|
107
|
+
`import { OrangeHRMLogin } from "./orangehrm.login";
|
|
108
|
+
|
|
109
|
+
export const providerRegistry = {
|
|
110
|
+
OrangeHRMLogin,
|
|
111
|
+
};
|
|
112
|
+
`);
|
|
113
|
+
|
|
103
114
|
// data/api
|
|
104
115
|
writeFileSafe(path.join(demoDir, "data/api/payload.json"),
|
|
105
116
|
JSON.stringify({ createUser: { username: "demoUser", password: "demoPass" } }, null, 2)
|
|
@@ -115,7 +126,7 @@ writeFileSafe(path.join(demoDir, "storage/authStorage.json"),
|
|
|
115
126
|
|
|
116
127
|
// auth
|
|
117
128
|
writeFileSafe(path.join(demoDir, "auth/orangehrm.login.ts"), `import { Page } from '@playwright/test';
|
|
118
|
-
import { AuthProvider } from 'simple-playwright-framework
|
|
129
|
+
import { AuthProvider } from 'simple-playwright-framework';
|
|
119
130
|
export class OrangeHRMLogin implements AuthProvider {
|
|
120
131
|
constructor(private creds: { username: string; password: string }) {}
|
|
121
132
|
async login(page: Page): Promise<void> {
|
|
@@ -182,7 +193,7 @@ test('Login linked to TestRail case C1234', async ({ page, envConfig, testrail }
|
|
|
182
193
|
`);
|
|
183
194
|
|
|
184
195
|
// tests/filehandling
|
|
185
|
-
writeFileSafe(path.join(demoDir, "tests/filehandling/filehandling.spec.ts"), `import { test } from 'simple-playwright-framework
|
|
196
|
+
writeFileSafe(path.join(demoDir, "tests/filehandling/filehandling.spec.ts"), `import { test } from 'simple-playwright-framework';
|
|
186
197
|
test("upload and download demo", async ({ page, fileUtils }) => {
|
|
187
198
|
await page.goto("https://the-internet.herokuapp.com/upload");
|
|
188
199
|
await fileUtils.uploadFile("#file-upload", "data/ui/sample.txt");
|
|
@@ -202,7 +213,7 @@ test('sample API call', async ({ request, envConfig }) => {
|
|
|
202
213
|
`);
|
|
203
214
|
|
|
204
215
|
// tests/utils
|
|
205
|
-
writeFileSafe(path.join(demoDir, "tests/utils/fileutils.test.ts"), `import { test } from 'simple-playwright-framework
|
|
216
|
+
writeFileSafe(path.join(demoDir, "tests/utils/fileutils.test.ts"), `import { test } from 'simple-playwright-framework';
|
|
206
217
|
test('use fileUtils directly', async ({ fileUtils }) => {
|
|
207
218
|
const path = await fileUtils.downloadFile("https://example.com/file.txt");
|
|
208
219
|
console.log("Downloaded:", path);
|