worried-lifeguard-15953
11/15/2022, 11:29 PMenough-truck-68085
11/15/2022, 11:32 PMlocalName
but that seems to do the trickworried-lifeguard-15953
11/15/2022, 11:32 PMgray-kilobyte-89541
11/16/2022, 12:23 AMfuture-eye-56254
11/16/2022, 1:29 AMfuture-eye-56254
11/16/2022, 1:30 AMe2e: {
setupNodeEvents(on, config) {
on("task", {
async run() {
let messages
await consumer.connect();
await consumer.subscribe({
topic,
fromBeginning: true //to be changed to false later to read only latest
});
await consumer.run({
eachMessage: async ({
topic,
partition,
message
}) => {
console.log({
topic,
partition,
offset: message.offset,
value: message.value.toString()
});
messages = message.value.tostring();
}
})
return messages //value returned to the consume function
}
});
}
}
future-eye-56254
11/16/2022, 1:32 AMit('test 1, () => {
cy.task('run').then((data) => {
cy.log(data);
//or some assertions on the data
})
})
gray-kilobyte-89541
11/16/2022, 1:55 AMawait consumer.run({
eachMessage: async ({
topic,
partition,
message
}) => {
console.log({
topic,
partition,
offset: message.offset,
value: message.value.toString()
});
messages = message.value.tostring();
}
})
return messages //value returned to the consume function
seems you await consumer.run
BUT you never confirm that you have received any messages there, right? You provided a callback eachMessage
, but how do you know that it has executed at least once? You simply return messages
variable, but since it is set inside the eachMessage
, and eachMessage
has not run, then you return the undefined
default value of the variable messages
gentle-dinner-26394
11/16/2022, 2:01 AMfuture-eye-56254
11/16/2022, 2:01 AMfuture-eye-56254
11/16/2022, 3:01 AMfew-oyster-82478
11/16/2022, 9:32 AMparallel: 5
script:
...
- npx cypress run --parallel --browser chrome --group "UI - Chrome"
https://docs.cypress.io/guides/continuous-integration/gitlab-ci#Worker-Jobsmysterious-belgium-25713
11/16/2022, 10:12 AMnarrow-cpu-2218
11/16/2022, 10:27 AMmysterious-belgium-25713
11/16/2022, 10:32 AMmysterious-belgium-25713
11/16/2022, 10:32 AMnarrow-cpu-2218
11/16/2022, 10:58 AMfaint-thailand-67863
11/16/2022, 11:09 AMfew-oyster-82478
11/16/2022, 11:15 AM11.x
, when I execute cypress open
in local environment, it stays a long time showing loading tests
animation, and this are the two requests that is making in the background:
GET /__cypress/tests?p=cypress%5Csupport%5Ce2e.ts 200 349523.700 ms - -
GET /__cypress/tests?p=cypress%5Ce2e%5Cup.feature 200 373655.954 ms - -
(about 5 min each of these two GETs, before the page is loaded)
The code so far is very simple:
// up.feature
Feature: Server is up
Scenario: visiting the frontpage
When I visit the frontpage
Then I should see the auth form label
// up.cy.ts
import { Then, When } from '@badeball/cypress-cucumber-preprocessor';
When('I visit the frontpage', () => {
const url = String(Cypress.config().baseUrl);
cy.visit(url);
});
Then('I should see the auth form label', () => {
cy.findByRole('heading', {
name: /log into your account/i,
});
});
when executing the tests in local, I have the local environment already running with the baseUrl
(http:localhost:9000
in my case), maybe I'm misunderstanding how this works and cypress is somehow trying to start the project by itself?
I'm using this config for `cypress.config.ts`: https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/examples/webpack-ts/cypress.config.tsgray-kilobyte-89541
11/16/2022, 11:48 AMacceptable-hamburger-48790
11/16/2022, 12:30 PMfaint-thailand-67863
11/16/2022, 12:33 PMacceptable-hamburger-48790
11/16/2022, 12:48 PMbrash-tiger-52405
11/16/2022, 2:31 PMcareful-tent-30457
11/16/2022, 3:13 PMoctet-stream
and we can get the strem data as arrayBuffers using Axios. so an example component looks like
async function getFile(id) {
const response = await axios.get(`/api/file/%{id}`, {responseType: 'arrayBuffer'});
return response.data;
}
const Comp = (id) => {
const { data } = useQuery(['file', id], () => fetchFile(id));
const [dataUrl, dataUrl] = useState();
useEffect(() => {
if (!data) { return }
const objectUrl = URL.createObjectURL(new Blob([data]));
setDataUrl(objectUrl);
return () => URL.revokeObjectURL(objectUrl);
}, [data]);
...
so my issue is I cannot figure out how to get this code that works fine in dev/prod to work in cypress with an intercept.. I cannot seem to get the intercept to return same arrayBuffer data as get in dev/prod.. any assistance welcome.gray-kilobyte-89541
11/16/2022, 3:21 PMcareful-tent-30457
11/16/2022, 3:22 PMred-gpu-23661
11/16/2022, 4:53 PMred-gpu-23661
11/16/2022, 5:45 PMcy.task('sqlServer') timed out after waiting 60000ms.Learn more
red-smartphone-84750
11/16/2022, 6:26 PMit("should the form be filled when the page is redirected", () => {
cy.open("checkout", {
checkout,
})
cy.findByText("Pagar").click()
cy.wait("@checkout").intercept(
"https://www.mercadopago.com/mla/checkout/start?pref_id=202809963-a2201f8d-11cb-443f-adf6-de5a42eed67d",
req => {
req.redirect("http://localhost:3000/checkout")
}
)
cy.location().should(loc => {
expect(loc.toString()).to.eq("http://localhost:3000/checkout")
})
cy.findAllByLabelText("Punto de venta 3 - Calle 1 123").should(
"be.checked"
)
})
Sometimes pass the last findAllByLabelText
, sometimes does not exist. I tried using cy.location
but it does not work well. How can I solve this situation?