miniature-vegetable-57836
09/06/2022, 7:44 PM<input type=range />
. The simple solution would probably be to rewrite the component, but I'm getting it from another team so want to see if I can at least solve it on my side. This code actually works, for chrome, but not for headless chrome nor for electron. I have no idea why it doesn't work for those but it just doesn't. No error is thrown, except for the fact that it just isn't triggered. I can add an eventListener and see that the change event is triggered, but the line above it just doesn't do anything in headless or in electron. Any input at all would be greatly appreciated.
js
Cypress.Commands.add("swipe", {prevSubject: true},
(subject, value) => {
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
window.HTMLInputElement.prototype,
'value'
).set
const changeInputValue = inputToChange => (newValue: Number) => {
nativeInputValueSetter.call(inputToChange[0], newValue) // this is only triggered in Chrome
inputToChange[0].dispatchEvent(new Event('change', { bubbles: true }))
}
return cy.wrap(subject)
.trigger("mousedown", {force: true})
.then(input => {
changeInputValue(input)(value)
})
.trigger("mouseup", {force: true})
})
miniature-vegetable-57836
09/06/2022, 8:03 PMwonderful-petabyte-11328
09/07/2022, 12:42 AMnutritious-megabyte-64190
09/07/2022, 1:24 AMcold-van-45410
09/07/2022, 5:29 AMhappy-application-86491
09/07/2022, 6:03 AMdescribe('My First Test', () => {
it('Does not do much!', () => {
this.test.myvalue = "Some Value" // I need to pass this to my customer reporter
expect(true).to.equal(true)
})
})
Here is the custom reporter. In the code below, all I am doing is printing the contents of the Test object based on the corresponding events below.
function CustomerReporter(runner, options) {
runner.on(EVENT_TEST_PENDING, function(test) {
console.log(test) // Print all the values of the Test object
});
runner.on(EVENT_TEST_PASS, function(test) {
console.log(test) // Print all the values of the Test object
});
runner.on(EVENT_TEST_FAIL, function(test) {
console.log(test) // Print all the values of the Test object
});
runner.once(EVENT_RUN_END, function() {
// ...
});
}
When the Test objects are printed, I never get the variable with my custom data. I only get the original Test object with no modifications. So my first question is my approach right for doing this? My second question is if not, how can I pass custom data either through the Test object or some other object so that I can have it available in my custom reporter? Any help would be so much appreciated.acoustic-secretary-90500
09/07/2022, 9:10 AMacoustic-secretary-90500
09/07/2022, 9:10 AMacoustic-secretary-90500
09/07/2022, 9:11 AMacoustic-secretary-90500
09/07/2022, 9:11 AMfierce-engineer-40904
09/07/2022, 9:33 AMjs
Argument of type '(jsx: React.ReactNode, options?: MountOptions, rerenderKey?: string) => Chainable<any>' is not assignable to parameter of type 'CommandFn<"mount">'.
cold-van-45410
09/07/2022, 11:47 AMfresh-doctor-14925
09/07/2022, 11:54 AMdamp-memory-26821
09/07/2022, 1:09 PMfresh-doctor-14925
09/07/2022, 1:12 PMaloof-student-42798
09/07/2022, 2:27 PMrough-jackal-15806
09/07/2022, 3:08 PMenough-summer-50273
09/07/2022, 4:28 PMenough-summer-50273
09/07/2022, 4:48 PMfreezing-wall-7568
09/07/2022, 4:58 PMnutritious-megabyte-64190
09/07/2022, 5:29 PMfreezing-wall-7568
09/07/2022, 6:24 PMswift-rain-28843
09/07/2022, 8:07 PMcy.get("doc-code-box").each((element, index) => {
outside of the it
. But this is apperently now allowed.
The reason I want to do it this way, is that cypress immediately jumps to the next forEach
case if one test in the each
fails. But I need cypress to actually keep running each
case and only after they are finished, it should go to the next forEach
case.
js
function routeFn(component) {
return `components/${component}/examples`;
}
const components = ["button", "chip", "icon"];
describe("Component screenshot", () => {
components.forEach((component) => {
describe(`${component} should match previous screenshot`, () => {
before(() => {
cy.visit({ url: routeFn(component), failOnStatusCode: false });
cy.wait(1000);
});
cy.get("doc-code-box").each((element, index) => {
it("element" + "index", () => {
const name = `${component}-${index}`;
cy.wrap(element).compareSnapshot(name);
});
});
});
});
});
freezing-wall-7568
09/07/2022, 9:07 PMstraight-chef-47891
09/08/2022, 12:57 AMCannot find type definition file for 'cypress/support/globals.d.ts'.
I already included /// <reference types="cypress" />
inside globals.d.ts
as per some suggested solution in Stackoverflow but still get that error. Here's what my tsconfig.ts
on the root dir looks like:
json
{
"compilerOptions": {
"target": "es5",
"lib": ["dom"],
"types": [
"cypress",
"cypress/support/globals.d.ts",
"node"
],
"strict": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"baseUrl": "../node_modules",
},
"include": ["cypress/**/*.ts"]
}
gray-kilobyte-89541
09/08/2022, 1:00 AMglamorous-country-57678
09/08/2022, 1:16 AMhappy-application-86491
09/08/2022, 5:48 AMcold-van-45410
09/08/2022, 5:56 AMswift-finland-73880
09/08/2022, 6:28 AMFor security, we don't support URLs that include login credentials. Log in on this page instead.
Does anyone have experience using Cypress in Salesforce testing?