Skip to content

Commit 6401016

Browse files
committed
refactor: remove deprecated features and streamline question generation process
- Deleted the feature file for assimilating with ignored points as it is no longer needed. - Removed related step definitions and methods for handling ignored checklist topics in the question generation service. - Updated the assimilation page object to eliminate unused methods, enhancing clarity and maintainability. Co-authored-by: terry <terry@odd-e.com>
1 parent ca0d4a0 commit 6401016

File tree

6 files changed

+0
-169
lines changed

6 files changed

+0
-169
lines changed

e2e_test/features/assimilation/assimilating_with_ignored_points.feature

Lines changed: 0 additions & 31 deletions
This file was deleted.

e2e_test/features/assimilation/remove_points.feature

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ Feature: Remove points from note when assimilating
1414
| English dominates the internet and digital world |
1515
| Proficiency in English enhances career opportunities and simplifies international travel |
1616

17-
When I start assimilating "English"
18-
And I mark the point "English is the world's most widespread lingua franca"
19-
2017
Given OpenAI will rephrase the note as "English plays a crucial role in global communication, enabling people from different cultures and nations to understand one another. It is the primary language used in international business, science, technology, and diplomacy, which significantly broadens professional and academic opportunities. The language is deeply embedded in the digital world, with a large majority of online content created in English. Global media—such as films, music, and entertainment—relies heavily on English, offering access to a wide range of cultures and ideas. Knowledge of English also makes international travel easier, helping people navigate foreign environments and communicate with locals more effectively. As an official language in over 60 countries and a widely taught foreign language elsewhere, English is essential for global participation and education."
2118
And OpenAI generates understanding checklist with points:
2219
| English enables effective communication between people from different cultures and countries |

e2e_test/start/pageObjects/assimilationPage.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -169,23 +169,6 @@ export const assumeAssimilationPage = () => ({
169169
cy.contains('Understanding Checklist:').should('not.exist')
170170
return this
171171
},
172-
selectChecklistTopicToIgnore(topicText: string) {
173-
cy.pageIsNotLoading()
174-
// Find the understanding checklist container
175-
cy.contains('Understanding Checklist:')
176-
.closest('.daisy-bg-accent')
177-
.should('be.visible')
178-
.within(() => {
179-
// Find the list item containing the topic text
180-
cy.contains('li', topicText)
181-
.should('be.visible')
182-
.within(() => {
183-
// Find and check the checkbox within the list item
184-
cy.get('input[type="checkbox"]').check()
185-
})
186-
})
187-
return this
188-
},
189172
rephraseNoteWithIgnoredTopic() {
190173
cy.pageIsNotLoading()
191174
cy.contains('Understanding Checklist:')

e2e_test/start/questionGenerationService.ts

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -88,71 +88,4 @@ export const questionGenerationService = () => ({
8888
}
8989
})
9090
},
91-
92-
stubQuestionWhenPromptDoesNotIncludeIgnoreText: (
93-
ignoreText: string,
94-
record: Record<string, string>
95-
) => {
96-
const mcqWithAnswer = createMcqWithAnswer(
97-
record['Question Stem']!,
98-
record['Correct Choice']!,
99-
record['Incorrect Choice 1']!,
100-
record['Incorrect Choice 2']!
101-
)
102-
const reply = JSON.stringify(mcqWithAnswer)
103-
cy.then(async () => {
104-
// Set up the less specific stub (doesn't include) - this should be registered after the "includes" stub
105-
await mock_services
106-
.openAi()
107-
.chatCompletion()
108-
.requestMatchesWithExclusion(
109-
{
110-
messages: [
111-
{
112-
role: 'user',
113-
content: '.*',
114-
},
115-
],
116-
},
117-
{
118-
messages: [
119-
{
120-
role: 'user',
121-
content: `.*${ignoreText}.*`,
122-
},
123-
],
124-
}
125-
)
126-
.stubQuestionGenerationWithBodyMatch(reply)
127-
})
128-
},
129-
130-
stubQuestionWhenPromptIncludesIgnoreText: (
131-
ignoreText: string,
132-
record: Record<string, string>
133-
) => {
134-
const mcqWithAnswer = createMcqWithAnswer(
135-
record['Question Stem']!,
136-
record['Correct Choice']!,
137-
record['Incorrect Choice 1']!,
138-
record['Incorrect Choice 2']!
139-
)
140-
const reply = JSON.stringify(mcqWithAnswer)
141-
cy.then(async () => {
142-
// Set up the more specific stub first (includes ignore text)
143-
// The ignoreText should match literally - single quotes are not special regex chars
144-
await mock_services
145-
.openAi()
146-
.chatCompletion()
147-
.requestMatches({
148-
messages: [
149-
{
150-
role: 'user',
151-
content: `.*${ignoreText}.*`,
152-
},
153-
],
154-
})
155-
.stubQuestionGenerationWithBodyMatch(reply)
156-
})
157-
},
15891
})

e2e_test/step_definitions/ai.ts

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -201,43 +201,6 @@ Given(
201201
}
202202
)
203203

204-
Given(
205-
"AI will generate a question when prompt doesn't include {string}:",
206-
(ignoreText: string, questionTable: DataTable) => {
207-
const hashes = questionTable.hashes()
208-
if (hashes.length !== 1 || !hashes[0]) {
209-
throw new Error(
210-
`Expected exactly one row in the data table, but got ${hashes.length}`
211-
)
212-
}
213-
// Extract the actual ignore text from the quoted string (remove quotes)
214-
const actualIgnoreText = ignoreText.replace(/^"|"$/g, '')
215-
start
216-
.questionGenerationService()
217-
.stubQuestionWhenPromptDoesNotIncludeIgnoreText(
218-
actualIgnoreText,
219-
hashes[0]
220-
)
221-
}
222-
)
223-
224-
Given(
225-
'AI will generate a question when prompt include {string}:',
226-
(ignoreText: string, questionTable: DataTable) => {
227-
const hashes = questionTable.hashes()
228-
if (hashes.length !== 1 || !hashes[0]) {
229-
throw new Error(
230-
`Expected exactly one row in the data table, but got ${hashes.length}`
231-
)
232-
}
233-
// Extract the actual ignore text from the quoted string (remove quotes)
234-
const actualIgnoreText = ignoreText.replace(/^"|"$/g, '')
235-
start
236-
.questionGenerationService()
237-
.stubQuestionWhenPromptIncludesIgnoreText(actualIgnoreText, hashes[0])
238-
}
239-
)
240-
241204
Given(
242205
'OpenAI will rephrase the note as {string}',
243206
(rephrasedContent: string) => {

e2e_test/step_definitions/recall.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,6 @@ When('I am assimilating the note {string}', (noteTitle: string) => {
110110
start.jumpToNotePage(noteTitle).moreOptions().openAssimilationPage()
111111
})
112112

113-
When(
114-
'one of the checklist topic is selected to ignore {string} and assimilate the note',
115-
(topicText: string) => {
116-
start
117-
.assumeAssimilationPage()
118-
.selectChecklistTopicToIgnore(topicText)
119-
.assimilateCurrentNote()
120-
}
121-
)
122-
123113
Then('I assimilate the note {string}', (noteTitle: string) => {
124114
start.jumpToNotePage(noteTitle).moreOptions().assimilateNote()
125115
})
@@ -320,10 +310,6 @@ Then('I can continue with the assimilation', () => {
320310
})
321311
})
322312

323-
When('I mark the point {string}', (point: string) => {
324-
start.assumeAssimilationPage().selectChecklistTopicToIgnore(point)
325-
})
326-
327313
Then('I should see the note rephrased as {string}', (rephrasedNote: string) => {
328314
start.assumeAssimilationPage().expectNoteRephrased(rephrasedNote)
329315
})

0 commit comments

Comments
 (0)