alessandro trinca tornidor
commited on
Commit
·
f91d9a6
1
Parent(s):
734545f
test: update test cases for My Ghost Writer integrated in lite.koboldai.net
Browse files- static/playwright.config.ts +2 -1
- static/tests/test-classic-0-lite.koboldai.net.spec.ts +5 -5
- static/tests/test-classic-0-lite.koboldai.net.spec.ts-snapshots/{test-My-Ghost-Writer-navigate-between-the-value-list-tables-1-chromium-linux.png → test-My-Ghost-Writer-navigate-between-the-value-list-tables-1-chromium-darwin.png} +2 -2
- static/tests/test-classic-0-lite.koboldai.net.spec.ts-snapshots/{test-My-Ghost-Writer-navigate-between-the-value-list-tables-2-chromium-linux.png → test-My-Ghost-Writer-navigate-between-the-value-list-tables-2-chromium-darwin.png} +2 -2
- static/tests/test-classic-0-lite.koboldai.net.spec.ts-snapshots/{test-My-Ghost-Writer-navigate-between-the-value-list-tables-3-chromium-linux.png → test-My-Ghost-Writer-navigate-between-the-value-list-tables-3-chromium-darwin.png} +2 -2
- static/tests/test-classic-0-lite.koboldai.net.spec.ts-snapshots/{test-My-Ghost-Writer-navigate-between-the-value-list-tables-4-chromium-linux.png → test-My-Ghost-Writer-navigate-between-the-value-list-tables-4-chromium-darwin.png} +2 -2
- static/tests/test-classic-1-lite.koboldai.net.spec.ts +27 -4
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-classic-1--asc-count.txt +1 -1
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-classic-1--asc-n-words-ngram.txt +1 -1
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-classic-1--asc-word-prefix.txt +1 -1
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-classic-1--desc-count.txt +1 -1
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-classic-1--desc-n-words-ngram.txt +1 -1
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-classic-1--desc-word-prefix.txt +1 -1
- static/tests/test-classic-lite-1.koboldai.net.spec copy.ts +0 -93
static/playwright.config.ts
CHANGED
|
@@ -46,13 +46,14 @@ export default defineConfig({
|
|
| 46 |
|
| 47 |
/* Configure projects for major browsers */
|
| 48 |
projects: [
|
|
|
|
| 49 |
{
|
| 50 |
name: 'chromium',
|
| 51 |
// grepInvert: /mobile/,
|
| 52 |
use: {
|
| 53 |
...devices['Desktop Chrome'],
|
| 54 |
viewport: { width: 1600, height: 1200 },
|
| 55 |
-
}
|
| 56 |
},
|
| 57 |
|
| 58 |
{
|
|
|
|
| 46 |
|
| 47 |
/* Configure projects for major browsers */
|
| 48 |
projects: [
|
| 49 |
+
// { name: 'setup_classic_lite.koboldai.net', testMatch: 'setup-classic-lite.koboldai.net.ts' },
|
| 50 |
{
|
| 51 |
name: 'chromium',
|
| 52 |
// grepInvert: /mobile/,
|
| 53 |
use: {
|
| 54 |
...devices['Desktop Chrome'],
|
| 55 |
viewport: { width: 1600, height: 1200 },
|
| 56 |
+
} //, dependencies: ["setup_classic_lite.koboldai.net"]
|
| 57 |
},
|
| 58 |
|
| 59 |
{
|
static/tests/test-classic-0-lite.koboldai.net.spec.ts
CHANGED
|
@@ -33,7 +33,7 @@ test('test My Ghost Writer: navigate between the value list/tables', async ({ pa
|
|
| 33 |
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).press('Enter');
|
| 34 |
await page.waitForTimeout(100)
|
| 35 |
|
| 36 |
-
await expect(page.getByLabel('id-filtered-value')).toContainText('
|
| 37 |
let currentTitleTableOfWords = page.getByLabel('id-current-table-of-words-title')
|
| 38 |
await expect(currentTitleTableOfWords).not.toContainText('the: 734');
|
| 39 |
|
|
@@ -46,21 +46,21 @@ test('test My Ghost Writer: navigate between the value list/tables', async ({ pa
|
|
| 46 |
await page.getByText('the: 734').click();
|
| 47 |
await page.waitForTimeout(100)
|
| 48 |
|
| 49 |
-
await expect(currentTitleTableOfWords).toContainText('the: 734');
|
| 50 |
await expect(currentTitleTableOfWords).toHaveAttribute("title", "stem: 'the'")
|
| 51 |
|
| 52 |
await assertCellAndLink(page, gameEditor, 'id-table-0-row-0-nth', "THE BOY WHO");
|
| 53 |
await assertCellAndLink(page, gameEditor, 'id-table-0-row-733-nth', "early the next");
|
| 54 |
-
await assertCellAndLink(page, gameEditor, 'id-table-0-row-1-nth', "were the last");
|
| 55 |
|
| 56 |
await page.getByText('the Dursleys:').click();
|
| 57 |
await page.waitForTimeout(100)
|
| 58 |
-
await expect(page.getByLabel('id-current-table-of-words-title')).toContainText('the Dursleys: 32');
|
| 59 |
|
| 60 |
await page.getByLabel('id-list-of-words-11-nth').click();
|
| 61 |
await page.waitForTimeout(100)
|
| 62 |
|
| 63 |
-
await assertCellAndLink(page, gameEditor, 'id-table-11-row-2-nth', "to be. The Dursleys", false);
|
| 64 |
|
| 65 |
let col2wordsFreq = page.getByLabel('id-col2-words-frequency', { exact: true })
|
| 66 |
await expect(col2wordsFreq).toHaveScreenshot()
|
|
|
|
| 33 |
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).press('Enter');
|
| 34 |
await page.waitForTimeout(100)
|
| 35 |
|
| 36 |
+
await expect(page.getByLabel('id-filtered-value')).toContainText('th: 1701');
|
| 37 |
let currentTitleTableOfWords = page.getByLabel('id-current-table-of-words-title')
|
| 38 |
await expect(currentTitleTableOfWords).not.toContainText('the: 734');
|
| 39 |
|
|
|
|
| 46 |
await page.getByText('the: 734').click();
|
| 47 |
await page.waitForTimeout(100)
|
| 48 |
|
| 49 |
+
await expect(currentTitleTableOfWords).toContainText('the : 734 ');
|
| 50 |
await expect(currentTitleTableOfWords).toHaveAttribute("title", "stem: 'the'")
|
| 51 |
|
| 52 |
await assertCellAndLink(page, gameEditor, 'id-table-0-row-0-nth', "THE BOY WHO");
|
| 53 |
await assertCellAndLink(page, gameEditor, 'id-table-0-row-733-nth', "early the next");
|
| 54 |
+
await assertCellAndLink(page, gameEditor, 'id-table-0-row-1-nth', "They were the last");
|
| 55 |
|
| 56 |
await page.getByText('the Dursleys:').click();
|
| 57 |
await page.waitForTimeout(100)
|
| 58 |
+
await expect(page.getByLabel('id-current-table-of-words-title')).toContainText('the Dursleys : 32 ');
|
| 59 |
|
| 60 |
await page.getByLabel('id-list-of-words-11-nth').click();
|
| 61 |
await page.waitForTimeout(100)
|
| 62 |
|
| 63 |
+
await assertCellAndLink(page, gameEditor, 'id-table-11-row-2-nth', "to be. The Dursleys shuddered", false);
|
| 64 |
|
| 65 |
let col2wordsFreq = page.getByLabel('id-col2-words-frequency', { exact: true })
|
| 66 |
await expect(col2wordsFreq).toHaveScreenshot()
|
static/tests/test-classic-0-lite.koboldai.net.spec.ts-snapshots/{test-My-Ghost-Writer-navigate-between-the-value-list-tables-1-chromium-linux.png → test-My-Ghost-Writer-navigate-between-the-value-list-tables-1-chromium-darwin.png}
RENAMED
|
File without changes
|
static/tests/test-classic-0-lite.koboldai.net.spec.ts-snapshots/{test-My-Ghost-Writer-navigate-between-the-value-list-tables-2-chromium-linux.png → test-My-Ghost-Writer-navigate-between-the-value-list-tables-2-chromium-darwin.png}
RENAMED
|
File without changes
|
static/tests/test-classic-0-lite.koboldai.net.spec.ts-snapshots/{test-My-Ghost-Writer-navigate-between-the-value-list-tables-3-chromium-linux.png → test-My-Ghost-Writer-navigate-between-the-value-list-tables-3-chromium-darwin.png}
RENAMED
|
File without changes
|
static/tests/test-classic-0-lite.koboldai.net.spec.ts-snapshots/{test-My-Ghost-Writer-navigate-between-the-value-list-tables-4-chromium-linux.png → test-My-Ghost-Writer-navigate-between-the-value-list-tables-4-chromium-darwin.png}
RENAMED
|
File without changes
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import { test, expect } from '@playwright/test';
|
| 2 |
|
| 3 |
const testStoryJsonTxt = `${import.meta.dirname}/../../tests/events/very_long_text.json`
|
|
@@ -5,9 +16,13 @@ const orderSelectionValues = ["asc", "desc"]
|
|
| 5 |
const sortSelectionValues = ["word_prefix", "n_words_ngram", "count"]
|
| 6 |
|
| 7 |
test('test My Ghost Writer: order/sort', async ({ page }) => {
|
|
|
|
| 8 |
await page.goto('http://localhost:8000/');
|
|
|
|
|
|
|
| 9 |
await page.getByRole('button', { name: 'Set UI' }).click();
|
| 10 |
|
|
|
|
| 11 |
console.log(`preparing uploading of file '${testStoryJsonTxt}'!`)
|
| 12 |
await page.getByRole('link', { name: 'Save / Load' }).click();
|
| 13 |
await page.waitForTimeout(100)
|
|
@@ -18,43 +33,51 @@ test('test My Ghost Writer: order/sort', async ({ page }) => {
|
|
| 18 |
await page.waitForTimeout(300)
|
| 19 |
console.log(`file '${testStoryJsonTxt}' uploaded!`)
|
| 20 |
|
|
|
|
| 21 |
await page.getByRole('link', { name: 'Settings' }).click();
|
| 22 |
await page.getByRole('link', { name: 'Tokens' }).click();
|
| 23 |
await page.waitForTimeout(100)
|
| 24 |
await page.getByRole('button', { name: 'id-expand-wordsfreqstats' }).click();
|
| 25 |
await page.getByRole('checkbox', { name: 'id-col2-words-frequency-enable' }).check();
|
| 26 |
-
//
|
| 27 |
await expect(page.getByRole('checkbox', { name: 'id-col2-words-frequency-enable' })).toBeChecked();
|
| 28 |
|
| 29 |
await page.getByRole('button', { name: 'OK' }).click();
|
| 30 |
await page.waitForTimeout(100)
|
| 31 |
console.log("#")
|
| 32 |
|
|
|
|
| 33 |
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).fill('th');
|
| 34 |
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).press('Enter');
|
| 35 |
await page.waitForTimeout(100)
|
| 36 |
-
|
|
|
|
| 37 |
|
|
|
|
| 38 |
let listOfWordsList = page.getByLabel('id-list-of-words-container').locator('list')
|
| 39 |
let listOfWordsListChildren = listOfWordsList.getByRole('listitem')
|
| 40 |
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).press('Enter');
|
| 41 |
await page.waitForTimeout(100)
|
| 42 |
expect(listOfWordsListChildren).toHaveCount(1701)
|
| 43 |
|
| 44 |
-
|
| 45 |
for (let currentOrderSelectionValueIdx in orderSelectionValues) {
|
| 46 |
let currentOrderSelectionValue = orderSelectionValues[currentOrderSelectionValueIdx]
|
| 47 |
for (let currentSortSelectionValueIdx in sortSelectionValues) {
|
| 48 |
let currentSortSelectionValue = sortSelectionValues[currentSortSelectionValueIdx]
|
|
|
|
| 49 |
console.log(`currentOrderSelectionValue:${currentOrderSelectionValue}, currentSelectionValue:${currentSortSelectionValue}.`)
|
| 50 |
-
|
| 51 |
await page.getByLabel('id-select-order-by').selectOption(currentOrderSelectionValue);
|
| 52 |
await page.getByLabel('id-select-sort-by').selectOption(currentSortSelectionValue);
|
|
|
|
| 53 |
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).fill('th');
|
| 54 |
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).press('Enter');
|
| 55 |
await page.waitForTimeout(300)
|
|
|
|
| 56 |
await expect(page.getByLabel('id-list-of-words-container')).toMatchAriaSnapshot({ name: `test-classic-1--${currentOrderSelectionValue}-${currentSortSelectionValue}.txt` });
|
| 57 |
}
|
| 58 |
}
|
|
|
|
| 59 |
console.log("end!")
|
| 60 |
});
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Playwright E2E test for My Ghost Writer "Text Stats" feature.
|
| 3 |
+
*
|
| 4 |
+
* Test scenario:
|
| 5 |
+
* 1. Connect to the local web server (http://localhost:8000).
|
| 6 |
+
* 2. Activate the UI mode required for testing (e.g., "Set UI").
|
| 7 |
+
* 3. Upload a saved JSON story file to populate the editor with long text content.
|
| 8 |
+
* 4. Activate the "My Ghost Writer" / text stats functionality.
|
| 9 |
+
* 5. Interact with the text stats UI: filter, sort, and verify word frequency tables.
|
| 10 |
+
* 6. Assert correct UI updates and ARIA snapshots for accessibility.
|
| 11 |
+
*/
|
| 12 |
import { test, expect } from '@playwright/test';
|
| 13 |
|
| 14 |
const testStoryJsonTxt = `${import.meta.dirname}/../../tests/events/very_long_text.json`
|
|
|
|
| 16 |
const sortSelectionValues = ["word_prefix", "n_words_ngram", "count"]
|
| 17 |
|
| 18 |
test('test My Ghost Writer: order/sort', async ({ page }) => {
|
| 19 |
+
// 1. Connect to the local web server page
|
| 20 |
await page.goto('http://localhost:8000/');
|
| 21 |
+
|
| 22 |
+
// 2. Activate the required UI mode (e.g., switch to classic or advanced UI)
|
| 23 |
await page.getByRole('button', { name: 'Set UI' }).click();
|
| 24 |
|
| 25 |
+
// 3. Upload a saved JSON story file to provide long text content for analysis
|
| 26 |
console.log(`preparing uploading of file '${testStoryJsonTxt}'!`)
|
| 27 |
await page.getByRole('link', { name: 'Save / Load' }).click();
|
| 28 |
await page.waitForTimeout(100)
|
|
|
|
| 33 |
await page.waitForTimeout(300)
|
| 34 |
console.log(`file '${testStoryJsonTxt}' uploaded!`)
|
| 35 |
|
| 36 |
+
// 4. Activate "My Ghost Writer" / text stats functionality via settings
|
| 37 |
await page.getByRole('link', { name: 'Settings' }).click();
|
| 38 |
await page.getByRole('link', { name: 'Tokens' }).click();
|
| 39 |
await page.waitForTimeout(100)
|
| 40 |
await page.getByRole('button', { name: 'id-expand-wordsfreqstats' }).click();
|
| 41 |
await page.getByRole('checkbox', { name: 'id-col2-words-frequency-enable' }).check();
|
| 42 |
+
// Assert that the checkbox is checked (feature is enabled)
|
| 43 |
await expect(page.getByRole('checkbox', { name: 'id-col2-words-frequency-enable' })).toBeChecked();
|
| 44 |
|
| 45 |
await page.getByRole('button', { name: 'OK' }).click();
|
| 46 |
await page.waitForTimeout(100)
|
| 47 |
console.log("#")
|
| 48 |
|
| 49 |
+
// 5. Interact with the text stats UI: filter, sort, and verify word frequency tables
|
| 50 |
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).fill('th');
|
| 51 |
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).press('Enter');
|
| 52 |
await page.waitForTimeout(100)
|
| 53 |
+
// Assert that the filtered value label contains the expected text and count
|
| 54 |
+
await expect(page.getByLabel('id-filtered-value')).toContainText('th: 1701');
|
| 55 |
|
| 56 |
+
// Get the list of filtered word frequency results and assert the count
|
| 57 |
let listOfWordsList = page.getByLabel('id-list-of-words-container').locator('list')
|
| 58 |
let listOfWordsListChildren = listOfWordsList.getByRole('listitem')
|
| 59 |
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).press('Enter');
|
| 60 |
await page.waitForTimeout(100)
|
| 61 |
expect(listOfWordsListChildren).toHaveCount(1701)
|
| 62 |
|
| 63 |
+
// 6. Loop through all combinations of order and sort, update the UI, and assert ARIA snapshots for accessibility and regression
|
| 64 |
for (let currentOrderSelectionValueIdx in orderSelectionValues) {
|
| 65 |
let currentOrderSelectionValue = orderSelectionValues[currentOrderSelectionValueIdx]
|
| 66 |
for (let currentSortSelectionValueIdx in sortSelectionValues) {
|
| 67 |
let currentSortSelectionValue = sortSelectionValues[currentSortSelectionValueIdx]
|
| 68 |
+
// Log the current combination for debugging
|
| 69 |
console.log(`currentOrderSelectionValue:${currentOrderSelectionValue}, currentSelectionValue:${currentSortSelectionValue}.`)
|
| 70 |
+
// Select the order and sort options in the UI
|
| 71 |
await page.getByLabel('id-select-order-by').selectOption(currentOrderSelectionValue);
|
| 72 |
await page.getByLabel('id-select-sort-by').selectOption(currentSortSelectionValue);
|
| 73 |
+
// Re-apply the filter and wait for the UI to update
|
| 74 |
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).fill('th');
|
| 75 |
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).press('Enter');
|
| 76 |
await page.waitForTimeout(300)
|
| 77 |
+
// Assert that the list of words container matches the expected ARIA snapshot for this combination
|
| 78 |
await expect(page.getByLabel('id-list-of-words-container')).toMatchAriaSnapshot({ name: `test-classic-1--${currentOrderSelectionValue}-${currentSortSelectionValue}.txt` });
|
| 79 |
}
|
| 80 |
}
|
| 81 |
+
// End of test
|
| 82 |
console.log("end!")
|
| 83 |
});
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-classic-1--asc-count.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
- text: /
|
| 2 |
- listitem: "anything strange: 1 repetitions"
|
| 3 |
- listitem: "because they: 1 repetitions"
|
| 4 |
- listitem: "they just: 1 repetitions"
|
|
|
|
| 1 |
+
- text: "/th : \\d+ occurrences/"
|
| 2 |
- listitem: "anything strange: 1 repetitions"
|
| 3 |
- listitem: "because they: 1 repetitions"
|
| 4 |
- listitem: "they just: 1 repetitions"
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-classic-1--asc-n-words-ngram.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
- text: /
|
| 2 |
- listitem: "/the: \\d+ repetitions/"
|
| 3 |
- listitem: "/that: \\d+ repetitions/"
|
| 4 |
- listitem: "/they: \\d+ repetitions/"
|
|
|
|
| 1 |
+
- text: "/th : \\d+ occurrences/"
|
| 2 |
- listitem: "/the: \\d+ repetitions/"
|
| 3 |
- listitem: "/that: \\d+ repetitions/"
|
| 4 |
- listitem: "/they: \\d+ repetitions/"
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-classic-1--asc-word-prefix.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
- text: /
|
| 2 |
- listitem: "! The: 1 repetitions"
|
| 3 |
- listitem: "\" Then: 2 repetitions"
|
| 4 |
- listitem: "\"Nothing: 1 repetitions"
|
|
|
|
| 1 |
+
- text: "/th : \\d+ occurrences/"
|
| 2 |
- listitem: "! The: 1 repetitions"
|
| 3 |
- listitem: "\" Then: 2 repetitions"
|
| 4 |
- listitem: "\"Nothing: 1 repetitions"
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-classic-1--desc-count.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
- text: /
|
| 2 |
- listitem: "/the: \\d+ repetitions/"
|
| 3 |
- listitem: "/that: \\d+ repetitions/"
|
| 4 |
- listitem: "/they: \\d+ repetitions/"
|
|
|
|
| 1 |
+
- text: "/th : \\d+ occurrences/"
|
| 2 |
- listitem: "/the: \\d+ repetitions/"
|
| 3 |
- listitem: "/that: \\d+ repetitions/"
|
| 4 |
- listitem: "/they: \\d+ repetitions/"
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-classic-1--desc-n-words-ngram.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
- text: /
|
| 2 |
- listitem: "the boy: 7 repetitions"
|
| 3 |
- listitem: "say that: 2 repetitions"
|
| 4 |
- listitem: "that they: 3 repetitions"
|
|
|
|
| 1 |
+
- text: "/th : \\d+ occurrences/"
|
| 2 |
- listitem: "the boy: 7 repetitions"
|
| 3 |
- listitem: "say that: 2 repetitions"
|
| 4 |
- listitem: "that they: 3 repetitions"
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-classic-1--desc-word-prefix.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
- text: /
|
| 2 |
- listitem: "— with: 1 repetitions"
|
| 3 |
- listitem: "— three: 1 repetitions"
|
| 4 |
- listitem: "— this: 2 repetitions"
|
|
|
|
| 1 |
+
- text: "/th : \\d+ occurrences/"
|
| 2 |
- listitem: "— with: 1 repetitions"
|
| 3 |
- listitem: "— three: 1 repetitions"
|
| 4 |
- listitem: "— this: 2 repetitions"
|
static/tests/test-classic-lite-1.koboldai.net.spec copy.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
| 1 |
-
import { test, expect } from '@playwright/test';
|
| 2 |
-
|
| 3 |
-
const setupClassicContextFile = `${import.meta.dirname}/setup-classic-lite.koboldai.net.json`
|
| 4 |
-
const testStoryJsonTxt = `${import.meta.dirname}/../../tests/events/very_long_text.json`
|
| 5 |
-
|
| 6 |
-
test('test', async ({ page }) => {
|
| 7 |
-
await page.goto('http://localhost:8000/');
|
| 8 |
-
await page.getByRole('button', { name: 'Set UI' }).click();
|
| 9 |
-
|
| 10 |
-
console.log(`preparing uploading of file '${testStoryJsonTxt}'!`)
|
| 11 |
-
await page.getByRole('link', { name: 'Save / Load' }).click();
|
| 12 |
-
await page.waitForTimeout(100)
|
| 13 |
-
const fileChooserPromise = page.waitForEvent('filechooser');
|
| 14 |
-
// filepickerawait page.getByRole('button', { name: '📁 Open File' }).click();
|
| 15 |
-
await page.getByRole('button', { name: '📁 Open File' }).click();
|
| 16 |
-
const fileChooser = await fileChooserPromise;
|
| 17 |
-
await fileChooser.setFiles(testStoryJsonTxt);
|
| 18 |
-
await page.waitForTimeout(300)
|
| 19 |
-
// await expect(page.locator('#gametext')).toHaveScreenshot()
|
| 20 |
-
console.log(`file '${testStoryJsonTxt}' uploaded!`)
|
| 21 |
-
|
| 22 |
-
await page.getByRole('link', { name: 'Settings' }).click();
|
| 23 |
-
await page.getByRole('link', { name: 'Tokens' }).click();
|
| 24 |
-
await page.waitForTimeout(100)
|
| 25 |
-
await page.getByRole('button', { name: 'id-expand-wordsfreqstats' }).click();
|
| 26 |
-
await page.getByRole('checkbox', { name: 'id-col2-words-frequency-enable' }).check();
|
| 27 |
-
// assert checkbox checked
|
| 28 |
-
await expect(page.getByRole('checkbox', { name: 'id-col2-words-frequency-enable' })).toBeChecked();
|
| 29 |
-
|
| 30 |
-
await page.getByRole('button', { name: 'OK' }).click();
|
| 31 |
-
await page.waitForTimeout(100)
|
| 32 |
-
console.log("#")
|
| 33 |
-
|
| 34 |
-
await page.getByLabel('order: ascend order: descend').selectOption('asc');
|
| 35 |
-
// await page.getByRole('searchbox', { name: 'filter-words-frequency' }).click();
|
| 36 |
-
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).fill('th');
|
| 37 |
-
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).press('Enter');
|
| 38 |
-
await page.waitForTimeout(100)
|
| 39 |
-
|
| 40 |
-
await expect(page.getByLabel('id-filtered-value')).toContainText('\'th\', 1701');
|
| 41 |
-
|
| 42 |
-
let listOfWordsList = page.getByLabel('id-list-of-words-container').locator('list')
|
| 43 |
-
let listOfWordsListChildren = listOfWordsList.getByRole('listitem')
|
| 44 |
-
console.log("listOfWordsListChildren:", await listOfWordsListChildren.count(), "#")
|
| 45 |
-
// await expect(listOfWordsList.getByLabel(`id-list-of-words-${0}-nth`)).toMatchAriaSnapshot("- text: \"the: 734 repetitions\"");
|
| 46 |
-
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).click();
|
| 47 |
-
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).press('Enter');
|
| 48 |
-
await page.waitForTimeout(100)
|
| 49 |
-
|
| 50 |
-
expect(listOfWordsListChildren).toHaveCount(1701)
|
| 51 |
-
await expect(listOfWordsListChildren.nth(0)).toContainText('anything strange: 1');
|
| 52 |
-
await expect(listOfWordsListChildren.nth(1)).toContainText('because they: 1');
|
| 53 |
-
console.log("#########")
|
| 54 |
-
await expect(listOfWordsListChildren.nth(1700)).toContainText('the: 734'); // .getByLabel('id-list-of-words-1700-nth')
|
| 55 |
-
|
| 56 |
-
await page.getByText('the Dursleys:').click();
|
| 57 |
-
await page.waitForTimeout(100)
|
| 58 |
-
|
| 59 |
-
await expect(page.getByLabel('id-current-table-of-words-title')).toContainText('the Dursleys: 32');
|
| 60 |
-
await expect(page.locator('#gametext')).toHaveScreenshot()
|
| 61 |
-
|
| 62 |
-
let col2wordsFreq = page.getByLabel('id-col2-words-frequency', { exact: true })
|
| 63 |
-
await expect(col2wordsFreq).toHaveScreenshot()
|
| 64 |
-
await page.getByText('The Dursley s had a', { exact: true }).click();
|
| 65 |
-
await page.waitForTimeout(100)
|
| 66 |
-
await expect(page.locator('#gametext')).toHaveScreenshot()
|
| 67 |
-
|
| 68 |
-
await page.getByText('that the Dursleys were', { exact: true }).click();
|
| 69 |
-
await page.waitForTimeout(100)
|
| 70 |
-
await expect(page.locator('#gametext')).toHaveScreenshot()
|
| 71 |
-
|
| 72 |
-
listOfWordsListChildren = page.getByLabel('id-list-of-words-container').locator('list')
|
| 73 |
-
expect(listOfWordsListChildren).toHaveCount(1701)
|
| 74 |
-
|
| 75 |
-
await page.getByLabel('id-select-sort-by').selectOption('word_prefix');
|
| 76 |
-
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).click();
|
| 77 |
-
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).press('Enter');
|
| 78 |
-
await expect(listOfWordsListChildren.nth(0)).toMatchAriaSnapshot();
|
| 79 |
-
await expect(listOfWordsListChildren.nth(1700)).toMatchAriaSnapshot();
|
| 80 |
-
|
| 81 |
-
await page.getByLabel('id-select-sort-by').selectOption('n_words_ngram');
|
| 82 |
-
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).click();
|
| 83 |
-
await page.getByRole('searchbox', { name: 'filter-words-frequency' }).press('Enter');
|
| 84 |
-
|
| 85 |
-
await expect(listOfWordsListChildren.nth(0)).toMatchAriaSnapshot();
|
| 86 |
-
await expect(listOfWordsListChildren.nth(1700)).toMatchAriaSnapshot();
|
| 87 |
-
|
| 88 |
-
/*
|
| 89 |
-
fileWriter(filepath, data)
|
| 90 |
-
fileReader(filepath)
|
| 91 |
-
*/
|
| 92 |
-
console.log("end!")
|
| 93 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|