From f86888bacd25e2770fc6cb0fbfdaab4f728b8272 Mon Sep 17 00:00:00 2001 From: Ryan Chia Date: Mon, 11 Nov 2024 05:34:02 +0800 Subject: [PATCH] Increase timeout for browser tests, verbosify jest --- .../frontend/__tests__/browser-tests/browser.test.ts | 9 +++++---- apps/frontend/__tests__/unit-tests/question.test.ts | 12 ++++++------ apps/frontend/package.json | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/apps/frontend/__tests__/browser-tests/browser.test.ts b/apps/frontend/__tests__/browser-tests/browser.test.ts index 1563112b01..22257250c3 100644 --- a/apps/frontend/__tests__/browser-tests/browser.test.ts +++ b/apps/frontend/__tests__/browser-tests/browser.test.ts @@ -23,12 +23,12 @@ describe("chrome browser", () => { await driver.get('http://www.google.com'); await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN); await driver.wait(until.titleIs('webdriver - Google Search'), 1000); - }); + }, 10000); it("does another google search", async () => { await driver.get('http://www.google.com'); await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN); await driver.wait(until.titleIs('webdriver - Google Search'), 1000); - }); + }, 10000); }); describe("browser-test", () => { @@ -48,8 +48,9 @@ describe("chrome browser", () => { const slogan1 = await driver.findElement(By.xpath("/html/body/div[1]/main/div/div[1]/div[2]/span[1]")).then(ele => ele.getText()) const slogan2 = await driver.findElement(By.xpath("/html/body/div[1]/main/div/div[1]/div[2]/span[2]")).then(ele => ele.getText()) - expect(slogan1 + slogan2).toBe("A better way to prepare for coding interviews withpeers"); - }); + expect(slogan1).toBe("A better way to prepare for coding interviews with"); + expect(slogan2).toBe("peers"); + }, 10000); }) }) diff --git a/apps/frontend/__tests__/unit-tests/question.test.ts b/apps/frontend/__tests__/unit-tests/question.test.ts index 417b4cc7aa..66e22635e3 100644 --- a/apps/frontend/__tests__/unit-tests/question.test.ts +++ b/apps/frontend/__tests__/unit-tests/question.test.ts @@ -126,7 +126,7 @@ describe("GetQuestions", () => { }); - it("gets all questions on the 2nd page with (2) call", async () => { + it("formats (page=2) params correctly", async () => { const res = await GetQuestions(2) @@ -138,7 +138,7 @@ describe("GetQuestions", () => { }]]) }); - it("gets all questions on the 2nd page with (limit=3) call", async () => { + it("formats (limit=3) params correctly", async () => { await GetQuestions(undefined, 3) @@ -150,7 +150,7 @@ describe("GetQuestions", () => { }]]) }); - it("gets all questions on the 2nd page with (limit=3) call", async () => { + it("formats (difficulty asc) params correctly", async () => { await GetQuestions(undefined, undefined, "difficulty asc") @@ -162,7 +162,7 @@ describe("GetQuestions", () => { }]]) }); - it("gets all questions on the 2nd page with (limit=3) call", async () => { + it("formats ([\"easy\", \"hard\"]) params correctly", async () => { await GetQuestions(undefined, undefined, undefined, ["easy", "hard"]) @@ -174,7 +174,7 @@ describe("GetQuestions", () => { }]]) }); - it("formats urls for categories", async () => { + it("formats cat params correctly", async () => { await GetQuestions(undefined, undefined, undefined, undefined, ["CatA", "CatB"]) @@ -189,7 +189,7 @@ describe("GetQuestions", () => { ]]) }); - it("formats url for title", async () => { + it("formats title params correctly", async () => { await GetQuestions(undefined, undefined, undefined, undefined, undefined, "The Title Name") diff --git a/apps/frontend/package.json b/apps/frontend/package.json index bab7a93c21..72690ce9c6 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -8,8 +8,8 @@ "start": "next start", "lint": "next lint", "test": "jest", - "unit-test": "jest __tests__/unit-tests", - "browser-test": "jest __tests__/browser-tests" + "unit-test": "jest --verbose __tests__/unit-tests", + "browser-test": "jest --verbose __tests__/browser-tests" }, "dependencies": { "@ant-design/icons": "^5.5.1",