alessandro trinca tornidor
commited on
Commit
·
d0fef9b
1
Parent(s):
6a7e950
test: refactor test case 1, update test case 0
Browse files- static/tests/test-classic-0-lite.koboldai.net.spec.ts +4 -1
- static/tests/test-classic-0-lite.koboldai.net.spec.ts-snapshots/test-classic-0-5-wordsearch-results-0-chromium.txt +0 -0
- static/tests/test-classic-0-lite.koboldai.net.spec.ts-snapshots/test-classic-0-5-wordsearch-results-1-chromium.txt +0 -0
- static/tests/test-classic-1-lite.koboldai.net.spec.ts +16 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-first-assertions-2-MobileChromeLandscape-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-MobileChrome-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-MobileChromeLandscape-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-MobileSafari-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-MobileSafariLandscape-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-chromium-linux.png +2 -2
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-firefox-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-Mini-landscape-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-Mini-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-Pro-11-landscape-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-Pro-11-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-gen-11--linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-gen-11-landscape-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-gen-7--linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-gen-7-landscape-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-responsiveLandscape-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-responsivePortrait-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-webkit-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-words-with-ap-d62d0-elements-NO-match-for-queries-with-new-lines-1-MobileChromeLandscape-linux.png +0 -3
- static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-words-with-apostrophes-hyphens-digits-diacritics-1-MobileChromeLandscape-linux.png +0 -3
- static/tests/test-helper.ts +4 -1
static/tests/test-classic-0-lite.koboldai.net.spec.ts
CHANGED
|
@@ -246,6 +246,9 @@ test('test My Ghost Writer/4: navigate between the list/tables containing the st
|
|
| 246 |
|
| 247 |
test('test My Ghost Writer/5: sort by frequency and alphabetically', async ({ page }: { page: Page }, workerInfo: TestInfo) => {
|
| 248 |
const projectName = await initTest({page, workerInfo, filepath:testStoryJsonTxt})
|
|
|
|
|
|
|
|
|
|
| 249 |
await fillInputFieldWithString(page, '');
|
| 250 |
await page.waitForTimeout(200)
|
| 251 |
|
|
@@ -257,7 +260,7 @@ test('test My Ghost Writer/5: sort by frequency and alphabetically', async ({ pa
|
|
| 257 |
|
| 258 |
await page.locator('#wordsearch_sort').selectOption('0');
|
| 259 |
await page.getByRole('button', { name: 'id-perform-wordsearch' }).click();
|
| 260 |
-
await expect(page.getByLabel('wordsearch_candidates_count')).toMatchAriaSnapshot(`- text: /
|
| 261 |
await expect(wordsearch_results).toMatchAriaSnapshot({ name: `test-classic-0-5-wordsearch_results-1-${projectName}.txt` });
|
| 262 |
|
| 263 |
console.log("end!")
|
|
|
|
| 246 |
|
| 247 |
test('test My Ghost Writer/5: sort by frequency and alphabetically', async ({ page }: { page: Page }, workerInfo: TestInfo) => {
|
| 248 |
const projectName = await initTest({page, workerInfo, filepath:testStoryJsonTxt})
|
| 249 |
+
await page.getByRole('link', { name: 'Settings' }).click();
|
| 250 |
+
await page.getByRole('spinbutton', { name: 'wordsearch_n_max_words_duplicated' }).fill('2');
|
| 251 |
+
await page.getByRole('button', { name: 'OK' }).click();
|
| 252 |
await fillInputFieldWithString(page, '');
|
| 253 |
await page.waitForTimeout(200)
|
| 254 |
|
|
|
|
| 260 |
|
| 261 |
await page.locator('#wordsearch_sort').selectOption('0');
|
| 262 |
await page.getByRole('button', { name: 'id-perform-wordsearch' }).click();
|
| 263 |
+
await expect(page.getByLabel('wordsearch_candidates_count')).toMatchAriaSnapshot(`- text: /12\\d\\d\\d result\\(s\\) found/`);
|
| 264 |
await expect(wordsearch_results).toMatchAriaSnapshot({ name: `test-classic-0-5-wordsearch_results-1-${projectName}.txt` });
|
| 265 |
|
| 266 |
console.log("end!")
|
static/tests/test-classic-0-lite.koboldai.net.spec.ts-snapshots/test-classic-0-5-wordsearch-results-0-chromium.txt
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
static/tests/test-classic-0-lite.koboldai.net.spec.ts-snapshots/test-classic-0-5-wordsearch-results-1-chromium.txt
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts
CHANGED
|
@@ -41,6 +41,9 @@ test(`test My Ghost Writer: first assertions`, async ({ page }: { page: Page },
|
|
| 41 |
const projectName = await initTest({ page, workerInfo, filepath: testStoryJsonTxt })
|
| 42 |
await standardCheck(page, projectName, expectedStringArray[0], `test-classic-1-wordsearch_results`)
|
| 43 |
|
|
|
|
|
|
|
|
|
|
| 44 |
if (projectName !== "MobileChromeLandscape") {
|
| 45 |
await assertVisibleTextAfterNavigation(page, 'id-div-1-range-23-nth', expectedStringArray[1], "top", "gametext");
|
| 46 |
} else {
|
|
@@ -86,7 +89,7 @@ test(`test My Ghost Writer: search for multi words, with apostrophes, hyphens, d
|
|
| 86 |
console.error("since the space is not much, only in case of MobileChromeLandscape let's skip this check...")
|
| 87 |
}
|
| 88 |
// needed to assert correct text selection, we have faith only one screenshot is enough =)
|
| 89 |
-
await expect(page.locator("#gametext")).toHaveScreenshot()
|
| 90 |
await page.waitForTimeout(200)
|
| 91 |
console.log("end!")
|
| 92 |
await page.close()
|
|
@@ -152,8 +155,9 @@ test(`test My Ghost Writer: search for words with apostrophes, digits, within co
|
|
| 152 |
// TODO: find a way to avoid matching html element text like buttons (find in markdown-generated CODE snippet)
|
| 153 |
await fillInputFieldWithString(page, 'emphasis’s text');
|
| 154 |
|
|
|
|
| 155 |
if (projectName !== "MobileChromeLandscape") {
|
| 156 |
-
await page.getByLabel(
|
| 157 |
await assertVisibleTextAfterNavigation(page, 'id-div-0-range-0-nth', expectedStringArray[6], "top", "gametext");
|
| 158 |
|
| 159 |
await fillInputFieldWithString(page, '', "click");
|
|
@@ -162,14 +166,23 @@ test(`test My Ghost Writer: search for words with apostrophes, digits, within co
|
|
| 162 |
await expect(page.getByLabel('wordsearch_candidates_count')).toMatchAriaSnapshot(`- text: /1\\d\\d\\d result\\(s\\) found/`);
|
| 163 |
|
| 164 |
await fillInputFieldWithString(page, 'pack my box');
|
| 165 |
-
await page.getByLabel(
|
| 166 |
await assertVisibleTextAfterNavigation(page, 'id-div-0-range-1-nth', expectedStringArray[7], "bottom", "gametext");
|
|
|
|
|
|
|
| 167 |
await assertVisibleTextAfterNavigation(page, 'id-div-0-range-2-nth', expectedStringArray[8], "bottom", "gametext");
|
|
|
|
|
|
|
| 168 |
await assertVisibleTextAfterNavigation(page, 'id-div-0-range-8-nth', expectedStringArray[9], "top", "gametext");
|
|
|
|
|
|
|
| 169 |
await assertVisibleTextAfterNavigation(page, 'id-div-0-range-9-nth', expectedStringArray[10], "top", "gametext");
|
| 170 |
} else {
|
| 171 |
// no assert for mobile chrome landscape...
|
| 172 |
}
|
|
|
|
|
|
|
|
|
|
| 173 |
// at the moment this assertion always fails on MobileSafariLandscape ('iPhone 13 Pro Max landscape')
|
| 174 |
// re-check it in the future, especially when safari mobile will support a fullscreen mode
|
| 175 |
if (projectName !== "MobileSafariLandscape" && projectName !== "MobileChromeLandscape") {
|
|
|
|
| 41 |
const projectName = await initTest({ page, workerInfo, filepath: testStoryJsonTxt })
|
| 42 |
await standardCheck(page, projectName, expectedStringArray[0], `test-classic-1-wordsearch_results`)
|
| 43 |
|
| 44 |
+
await page.getByLabel('id-div-candidate-1-nth').click();
|
| 45 |
+
await page.waitForTimeout(200)
|
| 46 |
+
|
| 47 |
if (projectName !== "MobileChromeLandscape") {
|
| 48 |
await assertVisibleTextAfterNavigation(page, 'id-div-1-range-23-nth', expectedStringArray[1], "top", "gametext");
|
| 49 |
} else {
|
|
|
|
| 89 |
console.error("since the space is not much, only in case of MobileChromeLandscape let's skip this check...")
|
| 90 |
}
|
| 91 |
// needed to assert correct text selection, we have faith only one screenshot is enough =)
|
| 92 |
+
await expect(page.locator("#gametext")).toHaveScreenshot({ maxDiffPixelRatio: 0.05 })
|
| 93 |
await page.waitForTimeout(200)
|
| 94 |
console.log("end!")
|
| 95 |
await page.close()
|
|
|
|
| 155 |
// TODO: find a way to avoid matching html element text like buttons (find in markdown-generated CODE snippet)
|
| 156 |
await fillInputFieldWithString(page, 'emphasis’s text');
|
| 157 |
|
| 158 |
+
const idCandidate = 'id-div-candidate-0-nth'
|
| 159 |
if (projectName !== "MobileChromeLandscape") {
|
| 160 |
+
await page.getByLabel(idCandidate).click();
|
| 161 |
await assertVisibleTextAfterNavigation(page, 'id-div-0-range-0-nth', expectedStringArray[6], "top", "gametext");
|
| 162 |
|
| 163 |
await fillInputFieldWithString(page, '', "click");
|
|
|
|
| 166 |
await expect(page.getByLabel('wordsearch_candidates_count')).toMatchAriaSnapshot(`- text: /1\\d\\d\\d result\\(s\\) found/`);
|
| 167 |
|
| 168 |
await fillInputFieldWithString(page, 'pack my box');
|
| 169 |
+
await page.getByLabel(idCandidate).click();
|
| 170 |
await assertVisibleTextAfterNavigation(page, 'id-div-0-range-1-nth', expectedStringArray[7], "bottom", "gametext");
|
| 171 |
+
await page.getByLabel(idCandidate).click();
|
| 172 |
+
await page.waitForTimeout(200)
|
| 173 |
await assertVisibleTextAfterNavigation(page, 'id-div-0-range-2-nth', expectedStringArray[8], "bottom", "gametext");
|
| 174 |
+
await page.getByLabel(idCandidate).click();
|
| 175 |
+
await page.waitForTimeout(200)
|
| 176 |
await assertVisibleTextAfterNavigation(page, 'id-div-0-range-8-nth', expectedStringArray[9], "top", "gametext");
|
| 177 |
+
await page.getByLabel(idCandidate).click();
|
| 178 |
+
await page.waitForTimeout(200)
|
| 179 |
await assertVisibleTextAfterNavigation(page, 'id-div-0-range-9-nth', expectedStringArray[10], "top", "gametext");
|
| 180 |
} else {
|
| 181 |
// no assert for mobile chrome landscape...
|
| 182 |
}
|
| 183 |
+
await page.getByLabel(idCandidate).click();
|
| 184 |
+
await page.waitForTimeout(200)
|
| 185 |
+
console.log("###########")
|
| 186 |
// at the moment this assertion always fails on MobileSafariLandscape ('iPhone 13 Pro Max landscape')
|
| 187 |
// re-check it in the future, especially when safari mobile will support a fullscreen mode
|
| 188 |
if (projectName !== "MobileSafariLandscape" && projectName !== "MobileChromeLandscape") {
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-first-assertions-2-MobileChromeLandscape-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-MobileChrome-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-MobileChromeLandscape-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-MobileSafari-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-MobileSafariLandscape-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-chromium-linux.png
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-firefox-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-Mini-landscape-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-Mini-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-Pro-11-landscape-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-Pro-11-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-gen-11--linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-gen-11-landscape-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-gen-7--linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-iPad-gen-7-landscape-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-responsiveLandscape-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-responsivePortrait-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-multi-words--7f83a-elements-NO-match-for-queries-with-new-lines-1-webkit-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-words-with-ap-d62d0-elements-NO-match-for-queries-with-new-lines-1-MobileChromeLandscape-linux.png
DELETED
Git LFS Details
|
static/tests/test-classic-1-lite.koboldai.net.spec.ts-snapshots/test-My-Ghost-Writer-search-for-words-with-apostrophes-hyphens-digits-diacritics-1-MobileChromeLandscape-linux.png
DELETED
Git LFS Details
|
static/tests/test-helper.ts
CHANGED
|
@@ -344,7 +344,8 @@ export async function assertVisibleTextAfterNavigation(page: Page, idElement: st
|
|
| 344 |
} else if (scrollTo === "bottom") {
|
| 345 |
await scrollToBottomById(page, idElementContentEditable);
|
| 346 |
}
|
| 347 |
-
console.log("#")
|
|
|
|
| 348 |
if (projectName === "MobileChromeLandscape") {
|
| 349 |
let newIdEl = idElement.replace('-div', "")
|
| 350 |
await page.getByRole('link', { name: newIdEl }).click({timeout: 1000})
|
|
@@ -352,6 +353,8 @@ export async function assertVisibleTextAfterNavigation(page: Page, idElement: st
|
|
| 352 |
await page.getByLabel(idElement).click();
|
| 353 |
}
|
| 354 |
await page.waitForTimeout(200)
|
|
|
|
|
|
|
| 355 |
// assert visible gametext
|
| 356 |
|
| 357 |
if (projectName !== "MobileChromeLandscape") {
|
|
|
|
| 344 |
} else if (scrollTo === "bottom") {
|
| 345 |
await scrollToBottomById(page, idElementContentEditable);
|
| 346 |
}
|
| 347 |
+
console.log("# assertVisibleTextAfterNavigation:: args:", idElement, "|", expectedString, "|", projectName, "#")
|
| 348 |
+
console.log("# assertVisibleTextAfterNavigation:: args:", idElement, "|", expectedString, "|", projectName, "#")
|
| 349 |
if (projectName === "MobileChromeLandscape") {
|
| 350 |
let newIdEl = idElement.replace('-div', "")
|
| 351 |
await page.getByRole('link', { name: newIdEl }).click({timeout: 1000})
|
|
|
|
| 353 |
await page.getByLabel(idElement).click();
|
| 354 |
}
|
| 355 |
await page.waitForTimeout(200)
|
| 356 |
+
await page.getByRole('button', { name: 'id-rightpanel-thesaurus-close' }).click();
|
| 357 |
+
await page.waitForTimeout(200)
|
| 358 |
// assert visible gametext
|
| 359 |
|
| 360 |
if (projectName !== "MobileChromeLandscape") {
|