diff --git a/buildstatic.sh b/buildstatic.sh index 5edf465..9f8189e 100755 --- a/buildstatic.sh +++ b/buildstatic.sh @@ -11,4 +11,4 @@ cp -r assets/ $DST/assets cp -r dist/ $DST/scram cp -r static/* $DST -echo 'let _CONFIG = { wispurl: "wss://puter.cafe/", bareurl: "https://aluu.xyz/bare/" }' > $DST/config.js +echo 'let _CONFIG = { wispurl: "wss://puter.cafe/", bareurl: "https://aluu.xyz/bare/" }' >> $DST/config.js diff --git a/static/config.js b/static/config.js index e69de29..8773384 100644 --- a/static/config.js +++ b/static/config.js @@ -0,0 +1 @@ +let _CONFIG = { wispurl: "wss://puter.cafe/", bareurl: "https://aluu.xyz/bare/" } \ No newline at end of file diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..fc5299a --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,5 @@ +node_modules/ +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ \ No newline at end of file diff --git a/tests/.gitmodules b/tests/.gitmodules new file mode 100644 index 0000000..25e9da5 --- /dev/null +++ b/tests/.gitmodules @@ -0,0 +1,3 @@ +[submodule "scramjet"] + path = scramjet + url = git@github.com:MercuryWorkshop/scramjet.git diff --git a/tests/location.html b/tests/location.html deleted file mode 100644 index 3d11eb9..0000000 --- a/tests/location.html +++ /dev/null @@ -1,7 +0,0 @@ -
- - diff --git a/tests/package.json b/tests/package.json new file mode 100644 index 0000000..48f7bf5 --- /dev/null +++ b/tests/package.json @@ -0,0 +1,14 @@ +{ + "name": "scramjet-tests", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": {}, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@playwright/test": "^1.48.0", + "@types/node": "^22.7.5" + } +} diff --git a/tests/playwright.config.ts b/tests/playwright.config.ts new file mode 100644 index 0000000..d5f6f34 --- /dev/null +++ b/tests/playwright.config.ts @@ -0,0 +1,54 @@ +import { defineConfig, devices } from '@playwright/test'; + +/** + * Read environment variables from file. + * https://github.com/motdotla/dotenv + */ +// import dotenv from 'dotenv'; +// import path from 'path'; +// dotenv.config({ path: path.resolve(__dirname, '.env') }); + +/** + * 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-first-retry', + }, + + /* Configure projects for major browsers */ + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + + // { + // name: 'firefox', + // use: { ...devices['Desktop Firefox'] }, + // }, + ], + + /* Run your local dev server before starting the tests */ + webServer: { + command: 'cd .. && pnpm run dev', + url: 'http://127.0.0.1:1337', + reuseExistingServer: !process.env.CI, + }, +}); diff --git a/tests/tests/scramjet.spec.ts b/tests/tests/scramjet.spec.ts new file mode 100644 index 0000000..b2af53b --- /dev/null +++ b/tests/tests/scramjet.spec.ts @@ -0,0 +1,12 @@ +import { test, expect, type Page } from '@playwright/test'; + +test.beforeEach(async ({ page }) => { + await page.goto('http://localhost:1337'); +}); + +test.describe("Page loaded", () => { + test("should display the title", async ({ page }) => { + const title = await page.locator('h1').textContent(); + expect(title).toBe('Percury Unblocker'); + }); +}) \ No newline at end of file