-
-
Notifications
You must be signed in to change notification settings - Fork 737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I.askGptOnPageFragment is not a function #4360
Comments
Not sure if this #4319 will resolve this issue. |
@DavertMik may you advise this?
|
Yes, documentation should be updated to explicitly mention this. Thank you, I will pick it up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We are trying to test the following AI features of codecept.io,
First 2 are working but when trying to use the third one (Arbitrary GPT Prompts), we are getting the error as 'I.askGptOnPageFragment is not a function'.
Note: Extended the AI helper in types file (we could also see the definitions for the methods 'askGptOnPage', 'askGptOnPageFragment').
Output from Terminal:
CodeceptJS v3.6.2 #StandWithUkraine
Using test root "C:\Users\hkrishn6\codecept_demo"
Run E-Commerce test on desktop --
Execution happening on desktop
Γ Place an order from demo e-commerce site on desktop @ai-test in 5304ms
-- FAILURES:
Place an order from demo e-commerce site on desktop @ai-test:
I.askGptOnPageFragment is not a function
at Test. (tests\web_test.js:15:29)
Artifacts:
FAIL | 0 passed, 1 failed // 6s
Run with --verbose flag to see complete NodeJS stacktrace
npm verb exit 1
npm verb code 1
npm verb exit 1
npm verb code 1
npm verb exit 1
npm verb code 1
// paste test
CodeceptJS version: 3.6.2
NodeJS Version: 20.12.2
Operating System: Windows 11
puppeteer || webdriverio || testcafe version (if related) : Playwright : 1.41.1
Configuration file:
const {
setHeadlessWhen,
setCommonPlugins
} = require('@codeceptjs/configure');
require('./heal')
let aiLogs
// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);
// enable all common plugins https://github.com/codeceptjs/configure#setcommonplugins
setCommonPlugins();
/** @type {CodeceptJS.MainConfig} */
exports.config = {
tests: './tests/web_test.js',
timeout: 260,
output: './output',
helpers: {
Playwright: {
url: "https://www.saucedemo.com",
show: true,
channel: 'msedge',
waitForAction: 100,
timeout: 180000
},
"Mochawesome": {
"uniqueScreenshotNames": "true"
}
},
ai: {
request: async (messages) => {
const allure = codeceptjs.container.plugins('allure');
const OpenAI = require('openai');
const openai = new OpenAI({
apiKey: "[key]"
})
const completion = await openai.chat.completions.create({
model: 'gpt-3.5-turbo',
messages
});
aiLogs = completion?.choices[0]?.message?.content
allure.createStep('AI self heal log', () => {
allure.addAttachment(
"heal_information.txt",
String(aiLogs),
"string"
);
});
return completion?.choices[0]?.message?.content;
}
},
plugins: {
allure: {
enabled: true,
require: '@codeceptjs/allure-legacy',
},
Playwright: {
coverage: {
enabled: true
},
trace: true,
video: true,
subtitles: {
enabled: true
}
},
heal: {
enabled: true
}
},
include: {
I: './steps_file.js'
},
}
The text was updated successfully, but these errors were encountered: