Skip to content

Commit cb0220d

Browse files
committed
feat(init): MVP of carouosel upload with Playwright
1 parent e1e8347 commit cb0220d

File tree

7 files changed

+435
-0
lines changed

7 files changed

+435
-0
lines changed

.github/workflows/playwright.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Playwright Tests
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
email:
6+
description: "Email to login"
7+
type: environment
8+
required: true
9+
pass:
10+
description: "Pass to login"
11+
type: environment
12+
required: true
13+
url:
14+
description: "URL of carousel to upload"
15+
type: environment
16+
required: true
17+
altOfFile:
18+
description: "Alternative text of carousel"
19+
type: environment
20+
required: true
21+
postText:
22+
description: "Text of the post"
23+
type: environment
24+
required: true
25+
jobs:
26+
test:
27+
timeout-minutes: 60
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v3
31+
- uses: actions/setup-node@v3
32+
with:
33+
node-version: 16
34+
- name: Install dependencies
35+
run: npm ci
36+
- name: Install Playwright Browsers
37+
run: npx playwright install --with-deps
38+
- name: Run Playwright tests
39+
run: npx playwright test
40+
- uses: actions/upload-artifact@v3
41+
if: always()
42+
with:
43+
name: playwright-report
44+
path: playwright-report/
45+
retention-days: 30

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules/
2+
/test-results/
3+
/playwright-report/
4+
/playwright/.cache/
5+
resources

i18n/texts.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export const texts = {
2+
en: {
3+
start: "Start a post",
4+
addDoc: "Add a document",
5+
choose: "Choose file",
6+
description: "Add a descriptive title to your document",
7+
done: "Done",
8+
content: "Text editor for creating content",
9+
post: "Pst",
10+
},
11+
} as const;
12+
13+
export const down = "Download file";

package-lock.json

Lines changed: 210 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"version": "0.1.0",
3+
"devDependencies": {
4+
"@playwright/test": "^1.29.2",
5+
"cross-env": "^7.0.3"
6+
},
7+
"scripts": {
8+
"start": "npx playwright test"
9+
}
10+
}

playwright.config.ts

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import type { PlaywrightTestConfig } from "@playwright/test";
2+
import { devices } from "@playwright/test";
3+
4+
/**
5+
* Read environment variables from file.
6+
* https://github.com/motdotla/dotenv
7+
*/
8+
// require('dotenv').config();
9+
10+
/**
11+
* See https://playwright.dev/docs/test-configuration.
12+
*/
13+
const config: PlaywrightTestConfig = {
14+
testDir: "./tests",
15+
/* Maximum time one test can run for. */
16+
timeout: 30 * 1000,
17+
expect: {
18+
/**
19+
* Maximum time expect() should wait for the condition to be met.
20+
* For example in `await expect(locator).toHaveText();`
21+
*/
22+
timeout: 5000,
23+
},
24+
/* Run tests in files in parallel */
25+
fullyParallel: true,
26+
/* Fail the build on CI if you accidentally left test.only in the source code. */
27+
forbidOnly: !!process.env.CI,
28+
/* Retry on CI only */
29+
retries: process.env.CI ? 2 : 0,
30+
/* Opt out of parallel tests on CI. */
31+
workers: process.env.CI ? 1 : undefined,
32+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
33+
reporter: "list",
34+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
35+
use: {
36+
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
37+
actionTimeout: 0,
38+
/* Base URL to use in actions like `await page.goto('/')`. */
39+
// baseURL: 'http://localhost:3000',
40+
41+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
42+
trace: "on-first-retry",
43+
headless: false,
44+
},
45+
46+
/* Configure projects for major browsers */
47+
projects: [
48+
{
49+
name: "chromium",
50+
use: {
51+
...devices["Desktop Chrome"],
52+
},
53+
},
54+
55+
/* Test against mobile viewports. */
56+
// {
57+
// name: 'Mobile Chrome',
58+
// use: {
59+
// ...devices['Pixel 5'],
60+
// },
61+
// },
62+
// {
63+
// name: 'Mobile Safari',
64+
// use: {
65+
// ...devices['iPhone 12'],
66+
// },
67+
// },
68+
69+
/* Test against branded browsers. */
70+
// {
71+
// name: 'Microsoft Edge',
72+
// use: {
73+
// channel: 'msedge',
74+
// },
75+
// },
76+
// {
77+
// name: 'Google Chrome',
78+
// use: {
79+
// channel: 'chrome',
80+
// },
81+
// },
82+
],
83+
84+
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
85+
// outputDir: 'test-results/',
86+
87+
/* Run your local dev server before starting the tests */
88+
// webServer: {
89+
// command: 'npm run start',
90+
// port: 3000,
91+
// },
92+
};
93+
94+
export default config;

0 commit comments

Comments
 (0)