wonderful-carpenter-84941
03/23/2023, 8:04 PM--last-failed
is there a way to achieve this in cypress? ( I'm already aware of https://docs.cypress.io/guides/guides/test-retries in cypress but it retries the test case as soon as it fails )chilly-queen-22182
03/23/2023, 10:13 PMmagnificent-waiter-2215
03/24/2023, 10:49 AMtrigger()
with pointer events, but haven't been successful so far.
Do you have any suggestions or tips on how to simulate a click-and-drag action in Cypress that would allow me to draw the desired figure? Any help would be appreciated!
it('Should draw a rectangle', { scrollBehavior: false }, function () {
cy.visit('https://recogito.github.io/annotorious/getting-started/');
cy.wait(1500);
cy.get('.a9s-annotationlayer')
.trigger('pointerdown', {
position: 'topLeft',
force: true,
x: 50,
y: 50,
})
.trigger('pointermove', {
position: 'topLeft',
force: true,
x: 150,
y: 150,
})
.trigger('pointerup', {
position: 'topLeft',
force: true,
x: 150,
y: 150,
});
});
icy-sundown-22930
03/24/2023, 3:49 PMthankful-pizza-16453
03/24/2023, 5:36 PMhelpful-country-95146
04/13/2023, 2:47 PMripe-notebook-54640
04/13/2023, 3:08 PMgifted-ability-23116
04/13/2023, 5:32 PMnarrow-lizard-57235
04/14/2023, 9:27 AMbumpy-insurance-8581
04/14/2023, 9:48 AMgetTextValueFromElement(){
let text;
cy.get('elementClass').then($element => {text = $element.text()}
return text;
}
But I meet this error message sometimes :
https://cdn.discordapp.com/attachments/1096371322042466354/1096371322398965800/IMG_3963.png▾
ambitious-animal-14300
04/14/2023, 10:24 AMstart-cypress
file next to index.jsc
and couldnt find it anywhere in the server package.
Havent been able to find any related issues.
bash
$ C:\Users\{user}\Documents\code\vue-webapp\node_modules\.bin\cypress run --e2e
Error: Cannot find module './start-cypress'
Require stack:
- C:\Users\{user}\AppData\Local\Cypress\Cache\12.9.0\Cypress\resources\app\packages\server\index.jsc
at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
at Module._load (node:internal/modules/cjs/loader:785:27)
at c._load (node:electron/js2c/asar_bundle:5:13339)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at i (C:\Users\{user}\AppData\Local\Cypress\Cache\12.9.0\Cypress\resources\app\index.js:1:2232)
at startCypress (evalmachine.<anonymous>:1:799866)
at evalmachine.<anonymous>:1:800126
at v (C:\Users\{user}\AppData\Local\Cypress\Cache\12.9.0\Cypress\resources\app\index.js:1:2573)
at Object.<anonymous> (C:\Users\{user}\AppData\Local\Cypress\Cache\12.9.0\Cypress\resources\app\index.js:1:2764)
at Module._compile (node:internal/modules/cjs/loader:1120:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\{user}\\AppData\\Local\\Cypress\\Cache\\12.9.0\\Cypress\\resources\\app\\packages\\server\\index.jsc'
]
}
broad-wire-63018
04/14/2023, 12:04 PMbest-flower-17510
04/14/2023, 4:08 PMechoing-actor-29720
04/14/2023, 7:29 PMbusy-agency-3812
04/14/2023, 8:39 PMCould not find any coverage information in your application
by looking at the window coverage object.
Did you forget to instrument your application?
See code-coverage#instrument-your-application
[@cypress/code-coverage]
Following these steps (https://docs.cypress.io/guides/tooling/code-coverage#E2E-code-coverage.) don't work for me because we're on version 12 and I think the issue is that plugins/index.js is no longer supported: https://docs.cypress.io/api/plugins/writing-a-plugin. I don't see instructions on instrumenting code coverage with cypress in typescript anywhere in the official docs
We are already using jest code coverage with --coverage and it generates lcov. I'm not sure to be honest what the value of @cypress/code-coverage is and whether we can just ignore it. I do not want the warning to show up in my cypress window either way.
I tried this even though we're using E2E and not component testing, no luck: https://glebbahmutov.com/blog/component-code-coverage/
also https://github.com/bahmutov/cra-ts-code-coverage-example
Does anyone have any suggestions? Happy to follow up w/ questions about my package.json or anything. Babel is in my project already.better-carpenter-12966
04/15/2023, 4:29 AMcurved-kangaroo-10618
04/16/2023, 4:24 PMlate-agency-82724
04/16/2023, 6:22 PMhttps://cdn.discordapp.com/attachments/1097225533076557844/1097225533584052234/Sans_titre.png▾
fresh-zebra-34262
04/17/2023, 2:22 AMhttps://cdn.discordapp.com/attachments/1097346357393641562/1097346357775302776/image.png▾
https://cdn.discordapp.com/attachments/1097346357393641562/1097346358098280508/image.png▾
https://cdn.discordapp.com/attachments/1097346357393641562/1097346358358331482/image.png▾
proud-vegetable-5507
04/17/2023, 9:17 AMrich-rain-38719
04/17/2023, 2:09 PMsome-zoo-23167
04/18/2023, 12:56 AMproud-ice-52191
04/18/2023, 5:47 AMCypress.Commands.add('createNewEntity', (entityType, entityData) => {
// Customize the API endpoint based on the entity type
let endpoint;
let modal;
// Code here to manage endpoint and the create form modal
// Intercept the create request
cy.intercept('POST', env.baseUrlAPI + endpoint).as('createRequest');
// Fill in the form fields based on the entity data
// cy.get(modal).within(() => {
Object.entries(entityData).forEach(([labelText, value]) => {
cy.fillField(modal, labelText, value);
});
cy.get('data-testId='create-button').click({ force: true });
// });
// Close the create modal and wait for the response
cy.get('.mdi-close').click();
cy.wait('@createRequest').its('response.status code).should('eq', 200);
// Verify that the entity was created
// extra assertions code goes here.
Now for instance I can now call this inside my tests using
// to be loaded by data from the customer fixture
// Create a new entity
cy.createNewEntity('customer', {
'first name': 'Test',
'last name': 'Tests',
'email': 'test001@test.com',
'phone': '0923823525',
'location': '32a Test',
'password': '12345678',
'confirm password': '12345678',
});
This works, however, I am not entirely sure if it is recommended, what are your thoughts?red-jordan-59778
04/18/2023, 6:40 AMbusy-author-51492
04/18/2023, 11:19 AMgray-exabyte-2941
04/18/2023, 5:20 PMif (window.Cypress) {window.model = model }
in the application code and then using
cy.window().its(‘model’)
to call the internal logic within my spec file. Is exposing the application something that a developer can easily add to existing files without much effort or would it be best for me to implement POM in this scenario?proud-breakfast-29892
04/18/2023, 6:20 PMcurved-magician-42592
04/18/2023, 7:24 PMcy.task('show_files', __dirname).then((file) => forEach((file) => cy.log(file)))
output:
task: show_files, cypress/integration/tests
my task code:
on('task', {
show_files(directory) {
return fs.readdirSync(directory);
}
}
My custom cy.task show_files()
works but I can't get my Cypress logs to list the contents of my directory. fs.readdirSync() returns an Array. How can I loop through the returned Array to show each element in Cypress? I spent 8 hours on this ticket and I can't figure it out.. :[green-elephant-92285
04/18/2023, 10:32 PMproud-breakfast-29892
04/19/2023, 10:07 AM