(floatComponent.spec.ts): update test values and remove redundant checks

 (inputListComponent.spec.ts): correct test IDs and update element counts
 (promptModalComponent.spec.ts): fix incorrect locator ID
 (textAreaModalComponent.spec.ts): fix incorrect locator ID
 (textInputOutput.spec.ts): update hover element locator for accuracy
This commit is contained in:
cristhianzl 2024-06-14 11:49:16 -03:00
commit 04f578f8be
5 changed files with 45 additions and 91 deletions

View file

@ -39,107 +39,61 @@ test("FloatComponent", async ({ page }) => {
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
await page.waitForTimeout(2000);
await page.locator('//*[@id="float-input"]').click();
await page.locator('//*[@id="float-input"]').fill("");
await page.waitForTimeout(2000);
await page.locator('//*[@id="float-input"]').fill("3");
let value = await page.locator('//*[@id="float-input"]').inputValue();
if (value != "1") {
if (value != "2") {
expect(false).toBeTruthy();
}
await page.waitForTimeout(2000);
await page.locator('//*[@id="float-input"]').click();
await page.locator('//*[@id="float-input"]').fill("");
await page.waitForTimeout(2000);
await page.locator('//*[@id="float-input"]').fill("-3");
value = await page.locator('//*[@id="float-input"]').inputValue();
if (value != "-1") {
if (value != "-2") {
expect(false).toBeTruthy();
}
await page.getByTestId("more-options-modal").click();
await page.getByTestId("edit-button-modal").click();
await page.getByTestId("showformat").click();
expect(await page.locator('//*[@id="showformat"]').isChecked()).toBeTruthy();
await page.getByTestId("showformat").click();
expect(await page.locator('//*[@id="showformat"]').isChecked()).toBeFalsy();
await page.getByTestId("showmirostat").click();
expect(await page.locator('//*[@id="showmirostat"]').isChecked()).toBeFalsy();
await page.getByTestId("showmirostat").click();
await page.getByTestId("showmirostat_eta").click();
expect(
await page.locator('//*[@id="showmirostat"]').isChecked()
await page.locator('//*[@id="showmirostat_eta"]').isChecked(),
).toBeTruthy();
await page.getByTestId("showmirostat_eta").click();
expect(
await page.locator('//*[@id="showmirostat"]').isChecked()
await page.locator('//*[@id="showmirostat_eta"]').isChecked(),
).toBeFalsy();
await page.getByTestId("showmirostat_eta").click();
expect(
await page.locator('//*[@id="showmirostat_eta"]').isChecked(),
).toBeTruthy();
await page.getByTestId("showmirostat_eta").click();
expect(
await page.locator('//*[@id="showmirostat"]').isChecked()
).toBeTruthy();
await page.getByTestId("showmirostat_eta").click();
expect(
await page.locator('//*[@id="showmirostat_eta"]').isChecked()
).toBeTruthy();
await page.getByTestId("showmirostat_eta").click();
expect(
await page.locator('//*[@id="showmirostat_eta"]').isChecked()
await page.locator('//*[@id="showmirostat_eta"]').isChecked(),
).toBeFalsy();
await page.getByTestId("showmirostat_tau").click();
expect(
await page.locator('//*[@id="showmirostat_tau"]').isChecked()
await page.locator('//*[@id="showmirostat_tau"]').isChecked(),
).toBeTruthy();
await page.getByTestId("showmirostat_tau").click();
expect(
await page.locator('//*[@id="showmirostat_tau"]').isChecked()
).toBeFalsy();
await page.getByTestId("showmodel").click();
expect(await page.locator('//*[@id="showmodel"]').isChecked()).toBeFalsy();
await page.getByTestId("showmodel").click();
expect(await page.locator('//*[@id="showmodel"]').isChecked()).toBeTruthy();
await page.getByTestId("shownum_ctx").click();
expect(await page.locator('//*[@id="shownum_ctx"]').isChecked()).toBeTruthy();
await page.getByTestId("shownum_ctx").click();
expect(await page.locator('//*[@id="shownum_ctx"]').isChecked()).toBeFalsy();
await page.getByTestId("shownum_gpu").click();
expect(await page.locator('//*[@id="shownum_gpu"]').isChecked()).toBeTruthy();
await page.getByTestId("shownum_gpu").click();
expect(await page.locator('//*[@id="shownum_gpu"]').isChecked()).toBeFalsy();
await page.getByTestId("shownum_thread").click();
expect(
await page.locator('//*[@id="shownum_thread"]').isChecked()
).toBeTruthy();
await page.getByTestId("shownum_thread").click();
expect(
await page.locator('//*[@id="shownum_thread"]').isChecked()
).toBeFalsy();
await page.getByTestId("showrepeat_last_n").click();
expect(
await page.locator('//*[@id="showrepeat_last_n"]').isChecked()
).toBeTruthy();
await page.getByTestId("showrepeat_last_n").click();
expect(
await page.locator('//*[@id="showrepeat_last_n"]').isChecked()
await page.locator('//*[@id="showmirostat_tau"]').isChecked(),
).toBeFalsy();
await page.getByText("Save Changes", { exact: true }).click();
@ -155,7 +109,7 @@ test("FloatComponent", async ({ page }) => {
// showtemperature
await page.locator('//*[@id="showtemperature"]').click();
expect(
await page.locator('//*[@id="showtemperature"]').isChecked()
await page.locator('//*[@id="showtemperature"]').isChecked(),
).toBeTruthy();
await page.getByText("Save Changes", { exact: true }).click();

View file

@ -41,19 +41,19 @@ test("InputListComponent", async ({ page }) => {
await page.getByTestId("edit-button-modal").click();
expect(
await page.getByTestId("showmetadata_indexing_exclude").isChecked()
await page.getByTestId("showmetadata_indexing_exclude").isChecked(),
).toBeFalsy();
await page.getByTestId("showmetadata_indexing_exclude").click();
expect(
await page.getByTestId("showmetadata_indexing_exclude").isChecked()
await page.getByTestId("showmetadata_indexing_exclude").isChecked(),
).toBeTruthy();
expect(
await page.getByTestId("showmetadata_indexing_include").isChecked()
await page.getByTestId("showmetadata_indexing_include").isChecked(),
).toBeFalsy();
await page.getByTestId("showmetadata_indexing_include").click();
expect(
await page.getByTestId("showmetadata_indexing_include").isChecked()
await page.getByTestId("showmetadata_indexing_include").isChecked(),
).toBeTruthy();
await page
@ -89,11 +89,11 @@ test("InputListComponent", async ({ page }) => {
}
await page
.getByTestId("input-list-minus-btn_metadata_indexing_include-0")
.getByTestId("input-list-minus-btn_metadata_indexing_include-1")
.click();
const plusButtonLocator = page.getByTestId(
"input-list-plus-btn_metadata_indexing_include-1"
"input-list-plus-btn_metadata_indexing_include-1",
);
const elementCount = await plusButtonLocator?.count();
@ -105,13 +105,13 @@ test("InputListComponent", async ({ page }) => {
.getByTestId("input-list-plus-btn_metadata_indexing_include-0")
.click();
await page
.getByTestId("input-list-plus-btn_metadata_indexing_include-1")
.getByTestId("input-list-plus-btn_metadata_indexing_include-0")
.click();
await page
.getByTestId("input-list-plus-btn_metadata_indexing_include-2")
.getByTestId("input-list-plus-btn_metadata_indexing_include-0")
.click();
await page
.getByTestId("input-list-plus-btn_metadata_indexing_include-3")
.getByTestId("input-list-plus-btn_metadata_indexing_include-0")
.click();
await page
@ -154,7 +154,7 @@ test("InputListComponent", async ({ page }) => {
}
await page
.getByTestId("input-list-minus-btn-edit_metadata_indexing_include-0")
.getByTestId("input-list-minus-btn-edit_metadata_indexing_include-1")
.click();
await page
.getByTestId("input-list-minus-btn-edit_metadata_indexing_include-1")
@ -164,32 +164,32 @@ test("InputListComponent", async ({ page }) => {
.click();
const plusButtonLocatorEdit0 = await page.getByTestId(
"input-list-plus-btn-edit_metadata_indexing_include-0"
"input-list-plus-btn-edit_metadata_indexing_include-0",
);
const elementCountEdit0 = await plusButtonLocatorEdit0?.count();
const plusButtonLocatorEdit2 = await page.getByTestId(
"input-list-plus-btn-edit_metadata_indexing_include-2"
"input-list-plus-btn-edit_metadata_indexing_include-2",
);
const elementCountEdit2 = await plusButtonLocatorEdit2?.count();
if (elementCountEdit0 > 0 || elementCountEdit2 > 0) {
if (elementCountEdit0 > 1 || elementCountEdit2 > 0) {
expect(false).toBeTruthy();
}
const minusButtonLocatorEdit1 = await page.getByTestId(
"input-list-minus-btn-edit_metadata_indexing_include-1"
"input-list-minus-btn-edit_metadata_indexing_include-1",
);
const elementCountMinusEdit1 = await minusButtonLocatorEdit1?.count();
const minusButtonLocatorEdit2 = await page.getByTestId(
"input-list-minus-btn-edit_metadata_indexing_include-2"
"input-list-minus-btn-edit_metadata_indexing_include-2",
);
const elementCountMinusEdit2 = await minusButtonLocatorEdit2?.count();
if (elementCountMinusEdit1 > 0 || elementCountMinusEdit2 > 0) {
if (elementCountMinusEdit1 > 1 || elementCountMinusEdit2 > 0) {
expect(false).toBeTruthy();
}
});

View file

@ -29,7 +29,7 @@ test("PromptTemplateComponent", async ({ page }) => {
await page.waitForTimeout(1000);
await page
.locator('//*[@id="inputsPrompt"]')
.locator('//*[@id="promptsPrompt"]')
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
@ -140,7 +140,7 @@ test("PromptTemplateComponent", async ({ page }) => {
await page.locator('//*[@id="showtemplate"]').click();
expect(
await page.locator('//*[@id="showtemplate"]').isChecked()
await page.locator('//*[@id="showtemplate"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showprompt"]').click();
@ -160,7 +160,7 @@ test("PromptTemplateComponent", async ({ page }) => {
await page.locator('//*[@id="showtemplate"]').click();
expect(
await page.locator('//*[@id="showtemplate"]').isChecked()
await page.locator('//*[@id="showtemplate"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showprompt"]').click();

View file

@ -29,7 +29,7 @@ test("TextAreaModalComponent", async ({ page }) => {
await page.waitForTimeout(1000);
await page
.locator('//*[@id="inputsPrompt"]')
.locator('//*[@id="promptsPrompt"]')
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
@ -51,7 +51,7 @@ test("TextAreaModalComponent", async ({ page }) => {
await page
.getByTestId("textarea-text")
.fill(
"test test test test test test test test test test test !@#%*)( 123456789101010101010101111111111 !!!!!!!!!!"
"test test test test test test test test test test test !@#%*)( 123456789101010101010101111111111 !!!!!!!!!!",
);
await page.getByTestId("textarea-text-ExternalLink").click();

View file

@ -60,7 +60,7 @@ test("TextInputOutputComponent", async ({ page }) => {
// Click and hold on the first element
await page
.locator(
'//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[1]/div/div[2]/div[6]/button/div/div'
'//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[1]/div/div[2]/div[6]/button/div/div',
)
.hover();
await page.mouse.down();
@ -68,7 +68,7 @@ test("TextInputOutputComponent", async ({ page }) => {
// Move to the second element
await page
.locator(
'//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[2]/div/div[2]/div[9]/div/button/div/div'
'//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[2]/div/div[2]/div[3]/div/button/div/div',
)
.hover();
@ -92,7 +92,7 @@ test("TextInputOutputComponent", async ({ page }) => {
// Click and hold on the first element
await page
.locator(
'//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[2]/div/div[2]/div[13]/button/div/div'
'//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[2]/div/div[2]/div[13]/button/div/div',
)
.hover();
await page.mouse.down();
@ -100,7 +100,7 @@ test("TextInputOutputComponent", async ({ page }) => {
// Move to the second element
await page
.locator(
'//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[3]/div/div[2]/div[3]/div/button/div/div'
'//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[3]/div/div[2]/div[3]/div/button/div/div',
)
.hover();