* Add test to reproduce chat lore bug Co-authored-by: Copilot <copilot@github.com> Given that I wanted to reliably reproduce the bug, I created a playwright Docker container as part of this commit, along with the applicable unit test. The included docker-compose includes an environment variable that is passed for use by the frontend test harness, default to the host that the playwright and the ST instance containers are running on. * Fix stale chat bound lore name after rename Co-authored-by: Copilot <copilot@github.com> Given the function renameWorldInfo and the resulting call to updateWorldInfoLinks, this fix ensures that if the world_info key in the chat_metadata is still set to the old name, it will be updated to the name Resolves: #5608 * Start to separate test runner from branch Given the bug fix for #5608 should be separate from the test runner compose file, this commit removes the file from the branch associated with the bug fix. * Fix frontend test setup to check for login page Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> * Make change to eslint configuration Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> Given the updates to the setup of frontend-utils, configure eslint to recognize browser and jquery specific globals --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
41 lines
1.5 KiB
JavaScript
41 lines
1.5 KiB
JavaScript
const baseURL = process.env.ST_BASE_URL || process.env.PLAYWRIGHT_BASE_URL || 'http://127.0.0.1:8000';
|
|
|
|
export const testSetup = {
|
|
/**
|
|
* Navigates to the home page without waiting for SillyTavern to load.
|
|
* @param {Object} params
|
|
* @param {import('@playwright/test').Page} params.page
|
|
*/
|
|
goST: async ({ page }) => {
|
|
await page.goto('/');
|
|
},
|
|
|
|
/**
|
|
* Waits for SillyTavern to fully load by navigating to the home page and waiting for the preloader to disappear.
|
|
* @param {Object} params
|
|
* @param {import('@playwright/test').Page} params.page
|
|
*/
|
|
awaitST: async ({ page }) => {
|
|
await page.goto('/');
|
|
if (await testSetup.isLoginPage({ page })) {
|
|
// eslint-disable-next-line playwright/no-networkidle
|
|
await page.waitForLoadState('networkidle');
|
|
const userSelect = page.locator('#userList .userSelect').last();
|
|
if (await userSelect.count()) {
|
|
await userSelect.click();
|
|
}
|
|
await page.waitForURL(url => url.toString().startsWith(baseURL) && url.pathname !== '/login');
|
|
}
|
|
await page.waitForFunction('document.getElementById("preloader") === null', { timeout: 0 });
|
|
},
|
|
|
|
/**
|
|
* Checks if the current page is the login page by looking for a body element with the class 'login'.
|
|
* @param {Object} params
|
|
* @param {import('@playwright/test').Page} params.page
|
|
*/
|
|
isLoginPage: async ({ page }) => {
|
|
return await page.locator('body.login').count() > 0;
|
|
},
|
|
};
|