kind-photographer-81911
12/20/2022, 3:33 PMconst REGISTERED_INTERCEPT_HANDLERS: {
// eslint-disable-next-line @typescript-eslint/ban-types
[k: string]: Function[];
} = {};
const applyInterceptMutations = (type: string, response: any) =>
(REGISTERED_INTERCEPT_HANDLERS[type] || []).reduce(
(currentResponse, handler) =>
produce((draft) => handler(draft.data, currentResponse) ?? draft)(
currentResponse,
),
response,
);
if (req.body.variables?.input?.residentId === '14259942') {
req.reply(
applyInterceptMutations('resident', {
data: {
resident: {
resident: {
...residentYardiSingleId.data.resident.resident,
invite: {
...residentYardiSingleId.data.resident.resident.invite,
sourceMethod: 'manual',
},
status: 'UNCLAIMED',
},
},
},
}),
);
return;
}
Is there a way to update these graphql fixtures using cy.fixture? The cypress doc says to do this:
// โ
RESPOND WITH OBJECT
cy.fixture('todo.json').then((todo) => {
cy.intercept('GET', '/todos/1', { body: todo }).as('todo')
// application requests the /todos/1 resource
// the intercept replies with the initial object
cy.wait('@todo').then(() => {
// modify the response object
todo.title = 'New data'
// and override the intercept
cy.intercept('GET', '/todos/1', { body: todo })
})
})
but it doesn't work with graphql. The method signature call fo cy.intercept is for REST and I don't have a place to put the (req, res) and then update the res.bodyfresh-doctor-14925
12/20/2022, 3:52 PMcy.fixture()
is for getting the fixture for use in a spec. You could change parts of the fixture in the callback, however:
It seems to me like the most straightforward approach would be for your dev to turn applyInterceptMutations
into a function that can optionally take some parameters to tweak the graph query/mutation as you needkind-photographer-81911
12/20/2022, 5:04 PMfresh-doctor-14925
12/20/2022, 5:20 PMwide-mechanic-91934
12/20/2022, 5:49 PMwide-mechanic-91934
12/20/2022, 5:50 PMbumpy-monitor-32508
12/20/2022, 6:15 PM**libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[934181:1129/083805.379269:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.**
Do you know which drivers or configs need?fresh-doctor-14925
12/20/2022, 6:55 PMnutritious-analyst-96582
12/20/2022, 6:55 PMgray-kilobyte-89541
12/20/2022, 7:23 PMacceptable-bear-67664
12/20/2022, 8:07 PMmodern-air-62164
12/20/2022, 8:11 PMcy.task()
in custom queries?
I'm trying to add a custom query to retrieve a user from firebase:
Cypress.Commands.addQuery(
'getFirebaseUserByEmail',
function getFirebaseUserByEmail(email) {
return () => cy.task('getFirebaseUserByEmail', { email })
}
)
The request has to be performed in a custom task since it runs in node and needs access to the admin SDK which isn't available in the client application.
When I attempt to use the query, I receive:
Timed out retrying after 4000ms: Cypress detected that you returned a promise from a command while also invoking one or more cy commands in that promise.
The command that returned the promise was:
> cy.getFirebaseUserByEmail()
The cy command you invoked inside the promise was:
> cy.task()
Because Cypress commands are already promise-like, you don't need to wrap them or return your own promise.
Cypress will resolve your command with whatever the final Cypress command yields.
The reason this is an error instead of a warning is because Cypress internally queues commands serially whereas Promises execute as soon as they are invoked. Attempting to reconcile this would prevent Cypress from ever resolving.
Thanks, all!limited-barista-33480
12/20/2022, 9:45 PMgray-kilobyte-89541
12/20/2022, 9:46 PMgray-kilobyte-89541
12/20/2022, 9:47 PMbrainy-airplane-28375
12/21/2022, 4:39 AMfresh-doctor-14925
12/21/2022, 7:54 AMswift-spoon-76449
12/21/2022, 8:18 AMpowerful-orange-86819
12/21/2022, 8:46 AMjson
{
"retries": {
// Configure retry attempts for `cypress run`
// Default is 0
"runMode": 2
}
fresh-doctor-14925
12/21/2022, 9:04 AMexport default defineConfig({
e2e: {
retries: 2
},
})
powerful-orange-86819
12/21/2022, 9:06 AMwide-mechanic-91934
12/21/2022, 9:15 AMbumpy-insurance-8581
12/21/2022, 11:12 AMbumpy-insurance-8581
12/21/2022, 11:14 AMon('task', {
requestReturnResponseStatus(response) {
let respBody = response.body;
respBody = formatRequestResponseBody(respBody);
respBody = JSON.parse(respBody);
return respBody.status;
}
});
gray-kilobyte-89541
12/21/2022, 11:43 AMcy.visit
commandbumpy-insurance-8581
12/21/2022, 2:38 PMfresh-doctor-14925
12/21/2022, 2:49 PMproud-fall-12182
12/21/2022, 3:14 PMyarn
3) Running yarn build
4) Running yarn binary-build
5) Copying the contents of AppData\Local\Temp\cypress-build\win32\build\win-unpacked
to AppData\Local\Cypress\Cache\12.0.0
6) Running my project with the npx cypress run
command as usual
However, when doing so, cypress gets stuck and throws the error Timed out waiting for browser to connect
(even though browser does get launched).
Could someone guide me on where I'm going wrong?wide-mechanic-91934
12/21/2022, 3:26 PMgray-kilobyte-89541
12/21/2022, 4:21 PM