For usage as in
test(testName, async (t) => {
const ua = await getUA()
await t.takeScreenshot(
fixtureName +
"/" +
testName +
"/" +
identifyUserAgent(ua) +
"/" +
"scsh_1.png",
)
...
As of [email protected] my workaround is
const fixtureName = "Index_Page_Test"
fixture(fixtureName).page(...)
...
const testName = "dom_has_critical_elements"
test(testName, async (t) => {
...
but would prefer to have it available on t. Am i missing something?
According to https://github.com/DevExpress/testcafe/issues/2826, you can use
t.testRun.test.name
to obtain the current test's name, and t.testRun.test.testFile.currentFixture.name
to obtain the current fixture's name.Tried it myself, and it works. It seems to be a non-documented feature, though.
Currently, there is no way to get testname from the test or fixture, please refer to enhancement request logged in TestCafe:
https://github.com/DevExpress/testcafe/issues/2823 (No way to get current testname using c.ctx or c.fixtureCtx? #2823)
https://github.com/DevExpress/testcafe/issues/2826 (Allow to use test and fixture names inside hooks and test bodies)
At preset, t
does not contain the test and fixtures names. For your purpose (build path for takeScreenshot
action) you can use the custom screenshot pattern feature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With