All Questions
29
questions
0
votes
1
answer
164
views
How to define global hooks in TestCafe using TypeScript?
In documentation it is recommended to use js configuration file in order to define a global hook, however this is a problem for TypeScript solution.
I wasn't able to use my TS classes/functions in .js ...
0
votes
1
answer
731
views
In TestCafe, typeError: Cannot read properties of undefined (reading "match"). What part of my code is not correct?
getVerificationUrlFromEmailData(emailData:any){
const emailBody = emailData.email_text;
const urlRegex = /(https?:\/\/[^\n]*)/;
const url = emailBody.match(urlRegex)[0];
return url
}
}
0
votes
2
answers
978
views
Returning a value from a cypress command / request
I would like to return an access token from a cypress request, I am doing this in commands as it will be used frequently, the current code is using cy.wrap but this feels very cumbersome for something ...
0
votes
1
answer
225
views
Typing TestCafe userVariables configuration with Typescript?
I've been trying to work with the .testcaferc.js configuration file in my project to consolidate some configuration that has been spread out until now.
Regarding the userVariables configuration, I'm ...
1
vote
1
answer
3k
views
Cypress is not running in ci SyntaxError: Unexpected token 'export' with cypress-io/github-action@v2 typescript
I have the following plugin file for cypress:
frontend/cypress/plugins/index.ts:
export default ((on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the ...
0
votes
1
answer
1k
views
Read JSON data one by one in TypeScript
I have written a JSON file using TypeScript/TestCafe.
import fs = require("fs");
fixture`Create test data and pass them to the other tests`
.page(url)
.before(async (t) => {
...
0
votes
1
answer
2k
views
Create test data in a fixture
Currently, I am working on a project which we have to create users and do tests for those users. I am using faker to generate user first name, last name and other data. I want to create a user with ...
0
votes
2
answers
663
views
TestCafe: await t.expect(Selector().exists).ok() sporadically throwing a TypeError
Is there any possible reason for await t.expect(Selector().exists).ok() to throw TypeError: Cannot read property '0' of null? It happens sporadically so it's hard to track down but my understanding is ...
2
votes
1
answer
247
views
Why testcafe runs tests twice?
I just don't understand, why testcafe runs this test twice in my case :
MainApp.ts :
const getUrl = ClientFunction(() => window.location.href);
class MainApp {
async login(url:string) {
await ...
0
votes
1
answer
244
views
Testcafe Role constructor does not execute authentication function
My Testcafe tests cannot run at the moment because my defined roles wont initialize.
I have a function where I wanted to retrieve data during the login process. But it seems like the entire login ...
0
votes
1
answer
369
views
How can I get original response in TestCafe RequestMock
Testcafe gives you the ability to mock the response of a request, which I am able to do.
I would like to implement a caching system for all GET/Ajax request.
This works fine if the URL is in the ...
2
votes
0
answers
197
views
Is it possible to get string locator from already defined Selector in Testcafe?
I'm very curios about this, and I would be really happy if there is a way to extract only string value from already defined Selector in Testcafe.
Example:
const element = Selector('[test-id="some-...
0
votes
2
answers
200
views
How to make assertions with variable text content
await t.expect(Selector('#elementId').innerText)
.eql('Discounted 20% with your subscription');
Here the text - Discounted 20% with your membership
20% is not constant, it may change to 15% or ...
0
votes
1
answer
539
views
Run setup before each fixture using before
I would like to run a fixture or a set of testController methods before each fixture using testcafe's before function
fixture I want to run before each fixture extracted into a separate function
// ...
0
votes
1
answer
161
views
Migrating testcafe suite to TypeScript
We have a huge testcafe e2e tests database and as a part of TS migration I'm rewriting test helper files to TypeScript.
But when I import a .ts helper inside of a .js test, test run fails with a ...