Skip to content

Commit 9ef2f47

Browse files
committed
fix broken redirect with prompt & tests
1 parent d744fd9 commit 9ef2f47

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

e2e/chat.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ testMatrix.forEach((testConfig) => {
1616
testConfig.courses.forEach((course) => {
1717
test.describe(`${course ? `Course` : 'General'} chat test for ${testConfig.role}`, () => {
1818
test.beforeEach(async ({ page }) => {
19-
await page.goto(`/v2/${course || ''}`)
19+
await page.goto(`/${course || ''}`)
2020
})
2121

2222
test('Disclaimer is visible', async ({ page }) => {
@@ -87,17 +87,17 @@ testMatrix.forEach((testConfig) => {
8787
await acceptDisclaimer(page)
8888
await useMockModel(page)
8989

90-
await sendChatMessage(page, 'tää tyhjennetään')
90+
await sendChatMessage(page, 'say minttujam')
9191

9292
await closeSendPreference(page)
9393

94-
await expect(page.getByTestId('user-message')).toContainText('tää tyhjennetään')
95-
await expect(page.getByTestId('assistant-message')).toContainText('OVER', { timeout: 6000 })
94+
await expect(page.getByTestId('user-message')).toContainText('say minttujam')
95+
await expect(page.getByTestId('assistant-message')).toContainText('minttujam')
9696

97-
await sendChatMessage(page, 'ja tämä')
97+
await sendChatMessage(page, 'say minttujam2')
9898

99-
await expect(page.getByTestId('user-message')).toContainText('ja tämä')
100-
await expect(page.getByTestId('assistant-message')).toContainText('OVER', { timeout: 6000 })
99+
await expect(page.getByTestId('user-message').nth(1)).toContainText('say minttujam2')
100+
await expect(page.getByTestId('assistant-message').nth(1)).toContainText('minttujam2')
101101

102102
page.on('dialog', (dialog) => dialog.accept())
103103
await page.getByTestId('empty-conversation-button').click()

e2e/prompts.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { acceptDisclaimer, closeSendPreference, sendChatMessage } from './utils/
44

55
test.describe('Prompts', () => {
66
test('Custom prompt text works', async ({ page }) => {
7-
await page.goto('/v2')
7+
await page.goto('/')
88

99
await acceptDisclaimer(page)
1010

@@ -66,7 +66,7 @@ test.describe('Prompts', () => {
6666
await page.getByTestId('settings-button').click()
6767

6868
// The prompt is active.
69-
expect(page.getByText(newPromptName)).toBeVisible()
69+
await expect(page.getByText(newPromptName)).toBeVisible()
7070

7171
// When prompt selector is opened, it is also visible in the list, so 2 times:
7272
await page.getByTestId('prompt-selector-button').click()
@@ -106,7 +106,7 @@ test.describe('Prompts', () => {
106106

107107
test('Own prompts work in course chat and normal chat', async ({ page }) => {
108108
// First create own prompt in course chat view
109-
await page.goto('/v2/test-course')
109+
await page.goto('/test-course')
110110
await acceptDisclaimer(page)
111111
await page.getByTestId('settings-button').click()
112112

@@ -127,7 +127,7 @@ test.describe('Prompts', () => {
127127
await expect(page.getByText(newPromptName, { exact: true })).toHaveCount(2) // Visible in the button and in the menu list
128128

129129
// Now go to normal chat
130-
await page.goto('/v2')
130+
await page.goto('/')
131131
await page.getByTestId('settings-button').click()
132132

133133
// Own prompt is visible in normal chat

e2e/student.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { studentTest as test } from './fixtures'
44

55
test.describe('Student', () => {
66
test('Enrolled chat works', async ({ page }) => {
7-
await page.goto('/v2/test-course')
7+
await page.goto('/test-course')
88
await acceptDisclaimer(page)
99

1010
await page.getByTestId('model-selector').first().click()
@@ -19,17 +19,17 @@ test.describe('Student', () => {
1919

2020
test('is sent to chats page from general chat', async ({ page }) => {
2121
// Tries to access general chat
22-
await page.goto('/v2')
22+
await page.goto('/')
2323
// Student is sent to chats page
24-
await expect(page).not.toHaveURL(/v2\/sandbox/)
24+
await expect(page).not.toHaveURL(/sandbox/)
2525
await expect(page).toHaveURL(/chats/)
2626
})
2727

2828
test('is sent to chats page from non-enrolled course', async ({ page }) => {
2929
// Tries to access sandbox course
30-
await page.goto('/v2/sandbox')
30+
await page.goto('/sandbox')
3131
// Student is sent to chats page
32-
await expect(page).not.toHaveURL(/v2\/sandbox/)
32+
await expect(page).not.toHaveURL(/sandbox/)
3333
await expect(page).toHaveURL(/chats/)
3434
})
3535
})

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default defineConfig({
2222
/* Global timeout for each test */
2323
timeout: inCI ? 20_000 : 15_000,
2424
expect: {
25-
timeout: inCI ? 4_500 : 3000,
25+
timeout: inCI ? 5_000 : 4000,
2626
},
2727
/* Opt out of parallel tests on CI. */
2828
// workers: inCI ? 1 : undefined,

scripts/k6_load_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function handleTokens(tokenizedStr) {
7171
}
7272

7373
export default function () {
74-
const url = `${staging}/v2`
74+
const url = `${staging}/`
7575
let prevResponseId = ''
7676

7777
for (const message of messages) {

src/client/components/Courses/Course/Prompt.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const Prompt = ({ prompt, handleDelete, mandatoryPromptId }: { prompt: PromptTyp
2929
const [updatedName, setUpdatedName] = useState(name)
3030
const [updatedHidden, setUpdatedHidden] = useState(hidden)
3131
const [updatedMandatory, setUpdatedMandatory] = useState(mandatory)
32-
const chatPath = `/v2/${courseId}?promptId=${id}`
32+
const chatPath = `/${courseId}?promptId=${id}`
3333
const directLink = `${window.location.origin}${PUBLIC_URL}/${chatPath}`
3434

3535
const handleSave = async () => {
@@ -107,7 +107,7 @@ const Prompt = ({ prompt, handleDelete, mandatoryPromptId }: { prompt: PromptTyp
107107
{!editPrompt ? (
108108
<>
109109
<Box width="80%">
110-
<SystemMessage system={systemMessage} setSystem={() => { }} showInfo={false} disabled />
110+
<SystemMessage system={systemMessage} setSystem={() => {}} showInfo={false} disabled />
111111
</Box>
112112
<Box>
113113
{messages.map(({ role, content }, index) => (

src/client/components/Courses/Course/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const Course = () => {
4949

5050
if (userLoading || !user || !isCourseSuccess) return null
5151

52-
const studentLink = `${window.location.origin}${PUBLIC_URL}/v2/${chatInstance.courseId}`
52+
const studentLink = `${window.location.origin}${PUBLIC_URL}/${chatInstance.courseId}`
5353

5454
const amongResponsibles = chatInstance.responsibilities ? chatInstance.responsibilities.some((r) => r.user.id === user.id) : false
5555

0 commit comments

Comments
 (0)