limited-fish-66138
04/19/2023, 10:49 AMable-twilight-99822
04/19/2023, 3:04 PMhttps://cdn.discordapp.com/attachments/1098262854391562271/1098262855092023406/Screenshot_2023-04-19_at_15.55.13.png▾
modern-air-62164
04/19/2023, 3:34 PMjavascript
Cypress.Commands.add("getFirebaseUserByEmail", (email) => {
return cy.task("getFirebaseUserByEmail", { email })
})
getFirebaseUserByEmail:
javascript
export async function getFirebaseUserByEmail({ email }: { email: string }): Promise<UserRecord | null> {
try {
const user = await getAuth().getUserByEmail(email.toLocaleLowerCase())
return user
} catch (error) {
if (error.code === 'auth/user-not-found') {
return null
}
throw error
}}
That works as a custom command. But, if the user hasn't been created in the backend yet, the command will immediately fail thus failing the e2e test. I'd like to change this to a custom query so that Cypress will retry the user retrieval until the timeout threshold is reached. Here's my attempt at that:
javascript
Cypress.Commands.addQuery('getFirebaseUserByEmail', function getFirebaseUserByEmail(email) {
return () => {
cy.task('getFirebaseUserByEmail', { email }).then(user => {
return user
})
}
})
That command fails with an error:
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.
Is it just not possible to do anything asynchronously within a custom query?hundreds-helicopter-24420
04/19/2023, 3:54 PMtarget="_blank"
and this is supposed to change the target attribute before visiting it. But the action seems to hang and fail on invoke .attr()
with the following message:
> Cannot set property message of [object DOMException] which has only a getter
Now the selector in cy.get
is very simple and works on its own, so I don’t get what’s happening. The whole command looks like that:
cy.get("[data-cy=voir-fiche-spectacle]")
.invoke("attr", "target", "_self")
.click()
bulky-sundown-7164
04/19/2023, 4:03 PMstrong-london-87756
04/19/2023, 9:55 PMhttps://cdn.discordapp.com/attachments/1098366339074248754/1098366339208462366/Screenshot_from_2023-04-19_22-48-42.png▾
better-carpenter-28878
04/19/2023, 10:16 PMstart server command "npm start"
current working directory "/home/runner/work/Collaboration/Collaboration"
/usr/local/bin/npm start
npm ERR! Missing script: "start"
This is the repo link that is failing.
https://github.com/BOT-TC/Collaboration/actions/runs/4748229651/jobs/8434175506#step:3:61broad-window-45549
04/20/2023, 7:42 AMbulky-kilobyte-52158
04/20/2023, 8:14 AMaloof-australia-92236
04/20/2023, 11:41 AMchilly-agent-91912
04/20/2023, 12:08 PMnice-hamburger-65093
04/20/2023, 1:33 PMflat-painter-96557
04/20/2023, 3:26 PMcurved-magician-42592
04/20/2023, 6:59 PMcy.task('renameFile', file).then((result) => {
const renamed_file = result;
cy.wrap(renamed_file).as('updated_file');
cy.log('@updated_file');
cy.log('renamed_file);
}
my cy.task() function, renameFile, simply takes a file path and name and renames it for me and then returns me the new file name as a String.
In my test, i'm trying to retrieve that renamed file and THEN assign it to a variable I made in the test called 'renamed_file'.
I tried to log updated_file and renamed_file to see if either one is going to be the new string but they both return Null!
How can I fix my cy.task() to get it to return the text value instead of a null object? I know i'm missing something but I just can't put my finger on it.. Thanksfast-artist-45202
04/20/2023, 9:38 PMcy.intercept(
"GET",
"https://mywebsite.com/api/checkout",
{
statusCode: 500,
}
).as("checkout500");
I was under the impression that we're just intercepting the traffic, modifying it, and sending it on it's way.
Is that traffic still hitting the backend, or are we stopping the request entirely and faking the response altogether?
Thanks folks! 🙏strong-london-87756
04/20/2023, 9:49 PMhttps://cdn.discordapp.com/attachments/1098727256832081930/1098727257066975372/Screenshot_from_2023-04-20_22-31-58.png▾
red-flag-46123
04/21/2023, 8:38 AMhttps://cdn.discordapp.com/attachments/1098890462347153429/1098890462921769000/IMG_3407.jpg▾
wide-eye-45012
04/21/2023, 9:45 AMsome-zoo-23167
04/21/2023, 1:40 PMhttps://cdn.discordapp.com/attachments/1098966382131040296/1098966383359951019/1AF124C5-3EE1-439F-8D25-615B3EE307C5.jpg▾
https://cdn.discordapp.com/attachments/1098966382131040296/1098966384484044810/BC6E1D0D-83DB-4C07-9C36-E8BEDB179D85.jpg▾
limited-fish-66138
04/21/2023, 4:50 PMwide-eye-45012
04/22/2023, 11:45 AMmelodic-quill-67962
04/22/2023, 3:15 PMbrainy-translator-85865
04/23/2023, 5:14 AMhttps://cdn.discordapp.com/attachments/1099564026951893113/1099564027195183185/image.png▾
handsome-wolf-98416
04/24/2023, 6:30 AMvictorious-salesclerk-78076
04/24/2023, 7:12 AMBASE_URL
is set correctly to the servers address.
For the CI job I am using the cypress/included
(cypress/browsers
also works) image. I install npm dependencies and run cypress with cypress run --e2e
via npm script. However Cypress fails to verify that the server is running.
I can confirm that the QA server is running and accessible all the time. I attached a screenshot with the relevant GitLab CI job output (sensitive info blurred). The input also shows that that pinging the server before running Cypress is successful. The QA server is only accessible via VPN. Since the container can also ping the server it also should be able to access it. Running the command locally (with VPN enabled) works like a charm.
How can I get Cypress to verify that the server is available?
https://cdn.discordapp.com/attachments/1099955930977808444/1099955931128791091/CleanShot_2023-04-24_at_08.46.072x.png▾
important-yacht-33847
04/24/2023, 7:48 AMcy.origin
cy.visit('https://google.com')
cy.origin(
'auth.recruitee.com',
{ args: { username, password } },
({ username, password }) => {
cy.visit('/')
cy.get('input[id="admin_email"]').focus().type(username)
cy.get('input[id="admin_password"]').focus().type(password, { log: false })
cy.get('button[type=submit]').focus().click()
}
)
cy.url().should('equal', 'https://app.recruitee.com/')
But instead to be redirected to https://app.recruitee.com/
, i am on https://auth.recruitee.com/sign-in
.
And the url is equal to nothing instead of one of the two above.
https://cdn.discordapp.com/attachments/1099965142025900154/1099965142755725342/Screenshot_2023-04-24_at_09.45.42.png▾
millions-spring-40239
04/24/2023, 9:44 AM"test:e2e:ui": "start-server-and-test serve 8080 'cypress open --port 8888 --e2e --browser electron'",
stack trace in image
https://cdn.discordapp.com/attachments/1099994163971375124/1099994164181086228/MicrosoftTeams-image_2.png▾
rich-pharmacist-74804
04/24/2023, 10:02 AMself-hosted
as a runner. While npx cypress verify
I get the error as missing dependency xvfb
. Xvfb is just for display right? As I am running headless mode why should I install this dependency? Your help is highly appreciated.
https://cdn.discordapp.com/attachments/1099998824249950258/1099998824430313552/Screenshot_from_2023-04-24_15-54-46.png▾
lively-balloon-98986
04/24/2023, 11:21 AMbumpy-breakfast-50891
04/24/2023, 12:38 PM