Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Cypress to the project #24

Open
iusehooks opened this issue Dec 17, 2020 · 35 comments
Open

Adding Cypress to the project #24

iusehooks opened this issue Dec 17, 2020 · 35 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@iusehooks
Copy link
Owner

We would like to add Cypress https://www.cypress.io/ to the project and write some automation tests.

@Loriage
Copy link

Loriage commented Mar 3, 2021

Hello there!
I'm new to open-source contribution and I'm interested by your issue.

Can I take a look at it?
Thanks in advance

@iusehooks
Copy link
Owner Author

Hi @Loriage ,

You are welcome. You can take a look into it.

Thanks.

@Loriage
Copy link

Loriage commented Mar 10, 2021

Hello @iusehooks !
I have started to work on this issue today.
Do you want to run the tests on a specific (demo?) website or on a test page running in local?

Thanks in advance.

@iusehooks
Copy link
Owner Author

Hi @Loriage ,

It should run using cypress cli.

we should create a new scripts:

 "scripts": {
     "cypress": "cypress run"
 }

no need for running in a website. Hope it helped.

@Loriage
Copy link

Loriage commented Mar 10, 2021

Hi,

Of course for the new script! My question is: Should I run the test on a demo website/page. Usetheform is a node module if I have well understand, not a react application itself. So if I don't misunderstand, cypress is a webpage tester, no?

@iusehooks
Copy link
Owner Author

Hi @Loriage,

I got what you meant now. Tests should run locally.

Thanks.

@Loriage
Copy link

Loriage commented Mar 19, 2021

Hello @iusehooks,

I'm facing an issue when I'm trying to run a react app with the content of the repo as module.
Here the error:

src/usetheform/hooks/useField.js
Line 465:27: React Hook "useRef" is called in function "getInitialValue" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter react-hooks/rules-of-hooks
Line 466:29: React Hook "useRef" is called in function "getInitialValue" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter react-hooks/rules-of-hooks

Any ideas?

Thanks.

@iusehooks
Copy link
Owner Author

Hi @Loriage,

may you copy and paste some code example?

Thanks.

@Loriage
Copy link

Loriage commented Mar 19, 2021

@iusehooks Of course!

./testers/App.js:

import { Form, Input, useValidation } from "./usetheform";

const preventNegativeNumber = (next, prev) => (next <= 0 ? 0 : next);
const required = (value) =>
    value && value.trim() !== "" ? undefined : "Required";

export default function App() {
  const onChange = (formState) => console.log("ON_CHANGE : ", formState);
  const onSubmit = (formState) => console.log("ON_SUBMIT : ", formState);

  const [status, validation] = useValidation([required]);

  return (
    <Form onSubmit={onSubmit} onChange={onChange}>
      <Input name="firstname" type="text" touched {...validation} />
      {status.error && <span>{status.error}</span>}
      <Input name="lastname" type="text" />
      <Input name="age" type="number" value={18} reducers={preventNegativeNumber} />
      <button type="submit">Submit</button>
    </Form>
  );
}```

@iusehooks
Copy link
Owner Author

Would you also please take a screen shoot of the project structure folders in your IDE?

@Loriage
Copy link

Loriage commented Mar 19, 2021

Here my installation script:
#!/bin/env sh cp -r src/ testers/src/usetheform \ && cd testers \ && npm start

So basically, I copy-paste the sourcefiles of usetheform to my react app, loading it as module and run the app.

Thanks.

@Loriage
Copy link

Loriage commented Mar 19, 2021

Yes of course
image
image

@Loriage
Copy link

Loriage commented Mar 19, 2021

testers/usrc/usetheform/ is a copy of src/

@iusehooks
Copy link
Owner Author

iusehooks commented Mar 19, 2021

Would you please try to run in your local npm run build command and than copy and paste the /build/index.js file into src folder and rename it as usetheform.js, so you can remove the usetheform folder.

A codesandbox example: https://codesandbox.io/s/still-hooks-tzodd

@Loriage
Copy link

Loriage commented Mar 19, 2021

Seems working a very short time but display this error 0.5second after:
image

@iusehooks
Copy link
Owner Author

would you please start a clean project downloading it from: https://codesandbox.io/s/still-hooks-tzodd ?

@Loriage
Copy link

Loriage commented Mar 19, 2021

Uhm, facing prettier error now:
image

@Loriage
Copy link

Loriage commented Mar 19, 2021

The issue is how to launch a testable react app inside the usetheform directory without facing conflict between the repository and the test app.

@iusehooks
Copy link
Owner Author

iusehooks commented Mar 19, 2021

I think you do not need to use creare-react-app.

I would suggest you to look into the folder named examples and take inspiration from it.

You can excute the command "npm run dev" and than you may create a new .html file inside the folder named examples, then you are ok to start writing tests in cypress. A web server runs at http://localhost:3000/{yourfile}.html

hope it helped.

@Loriage
Copy link

Loriage commented Mar 19, 2021

Working, thanks. I'll continue my tests!

@iusehooks
Copy link
Owner Author

Hi @Loriage,

which approach did you go for?

If you like the library may you please give a github star to it? It helps the project to grow.

Thanks.

@Loriage
Copy link

Loriage commented Mar 20, 2021

Hi @iusehooks,
I'll made my tests on the dev web server

@Loriage
Copy link

Loriage commented Mar 20, 2021

Hello @iusehooks !

First PR here: #33

Waiting for your feedback!

@Khemendra-Bhardwaj
Copy link

Hey there, is it open so I can start working on this issue.

@Ansh1372
Copy link

Ansh1372 commented May 2, 2023

Hey I'm new to open source contribution can you asign this challenge that can I enhance my skill...

@karu19961j
Copy link

Hey I am new to open source, is this still open I just worked on cypress for some other project have a good understanding on this would like to help :)

@m-truong
Copy link

m-truong commented Aug 4, 2023

Hello @iusehooks ,

I found this from GoodFirstIssues, and this project seems very interesting to me, is this still open?

I’m actually just working on adding Cypress to my company’s NestJS backend server with GraphQL.

I’m eager to help contribute and add Cypress to this project ᕦ(ò_óˇ)ᕤ . Please assign this issue to me? Thanks!

@iusehooks

@MayankMaloo192
Copy link

Hey @iusehooks is this issue still open? I want to contribute to this issue .
Can you please assign it to me.

@AliSinaYOusofi
Copy link

Hi
Is the issue still open ?

@MuhammadAwaisGondal
Copy link

Hey There, I am new to open source and I found this on GoodFirstIssues so can I give it a try?
Thank you

@AshwinNema
Copy link
Contributor

AshwinNema commented Mar 7, 2024

Hi ,
I am new to open source. I am interested in solving this issue. Can it be assigned to me?

@AshwinNema
Copy link
Contributor

Hi @iusehooks,

Can I take up this issue?

@AshwinNema
Copy link
Contributor

Hi @iusehooks,

I have added remaining tests in my PR. Please let me know if anything has to be changed.

@m-truong
Copy link

Hey ~ i've been busy with work,

But can I get this reassigned to me to complete the cypress suite?

@SiddheshTambe45
Copy link

SiddheshTambe45 commented Sep 30, 2024

Hi! I'd like to work on this issue. Could I be assigned to it?
I see that you'd like to add Cypress and write some automation tests. Could you clarify what specific areas or components of the project you'd like to focus on for the initial tests? Any particular use cases or workflows you have in mind?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests