mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00
Setup tests with new user system (#344)
* chore(.gitignore): add auth.json to gitignore test(landing.spec.js): remove commented out code and add check for landing page title test(login.spec.js): add test for login page title feat(package.json): add e2e:auth script to generate auth.json storage file for e2e tests * test(landing.spec.js): add beforeEach hook to create a new browser context with auth.json storage state test(landing.spec.js): change test name from 'landing page' to 'Landing title' fix(package.json): change e2e:auth script to save auth.json in e2e directory
This commit is contained in:
parent
8c7ad09977
commit
5964b71e14
4 changed files with 26 additions and 7 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -64,4 +64,4 @@ src/style - official.css
|
||||||
# meilisearch
|
# meilisearch
|
||||||
meilisearch
|
meilisearch
|
||||||
data.ms/*
|
data.ms/*
|
||||||
|
auth.json
|
||||||
|
|
|
@ -1,9 +1,18 @@
|
||||||
import { expect, test } from '@playwright/test';
|
import { expect, test } from '@playwright/test';
|
||||||
|
|
||||||
test('landing page', async ({ page }) => {
|
test.describe('Landing suite', () => {
|
||||||
await page.goto('http://localhost:3080/');
|
let myBrowser;
|
||||||
// expect (await page.title()).toBe('ChatGPT Clone');
|
|
||||||
expect(await page.textContent('#landing-title')).toBe(
|
test.beforeEach(async ({ browser }) => {
|
||||||
import.meta.env.VITE_APP_TITLE || 'ChatGPT Clone'
|
myBrowser = await browser.newContext({
|
||||||
);
|
storageState: 'e2e/auth.json',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Landing title', async () => {
|
||||||
|
const page = await myBrowser.newPage();
|
||||||
|
await page.goto('http://localhost:3080/');
|
||||||
|
const pageTitle = await page.textContent('#landing-title')
|
||||||
|
expect(pageTitle.length).toBeGreaterThan(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
9
e2e/specs/login.spec.js
Normal file
9
e2e/specs/login.spec.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import { expect, test } from '@playwright/test';
|
||||||
|
|
||||||
|
test('landing page', async ({ page }) => {
|
||||||
|
await page.goto('http://localhost:3080/');
|
||||||
|
const pageTitle = await page.$eval('h1', pageTitle => pageTitle.textContent);
|
||||||
|
console.log('pageTitle', pageTitle);
|
||||||
|
expect(pageTitle.length).toBeGreaterThan(0);
|
||||||
|
expect(pageTitle).toEqual('Welcome back');
|
||||||
|
});
|
|
@ -15,6 +15,7 @@
|
||||||
"e2e:update": "playwright test --config=e2e/playwright.config.js --update-snapshots",
|
"e2e:update": "playwright test --config=e2e/playwright.config.js --update-snapshots",
|
||||||
"e2e:debug": "cross-env PWDEBUG=1 playwright test --config=e2e/playwright.config.js",
|
"e2e:debug": "cross-env PWDEBUG=1 playwright test --config=e2e/playwright.config.js",
|
||||||
"e2e:report": "npx playwright show-report e2e/playwright-report",
|
"e2e:report": "npx playwright show-report e2e/playwright-report",
|
||||||
|
"e2e:auth": "npx playwright codegen --save-storage=e2e/auth.json http://localhost:3080/",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"format": "prettier-eslint --write \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\""
|
"format": "prettier-eslint --write \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\""
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue