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

Not possible to type text in PrimeReact number input #8194

Closed
wombatka opened this issue May 20, 2024 · 7 comments
Closed

Not possible to type text in PrimeReact number input #8194

wombatka opened this issue May 20, 2024 · 7 comments
Assignees
Labels
TYPE: bug The described behavior is considered as wrong (bug).

Comments

@wombatka
Copy link

What is your Scenario?

I cannot type text into number input

What is the Current behavior?

Nothing is typed when use t.typeText

What is the Expected behavior?

Text should be typed

What is the public URL of the test page? (attach your complete example)

import {Selector, t} from "testcafe";
fixture example

test("not possible to type in number field", async t => {
await t.navigateTo("https://primereact.org/inputnumber/");
const input = Selector("#integeronly");
await t.typeText(input, "1234", {replace: true});
await t.expect(input.value).eql("1234")
})

What is your TestCafe test code?

import {Selector, t} from "testcafe";
fixture example

test("not possible to type in number field", async t => {
await t.navigateTo("https://primereact.org/inputnumber/");
const input = Selector("#integeronly");
await t.typeText(input, "1234", {replace: true});
await t.expect(input.value).eql("1234")
})

Your complete configuration file

package.json:
{
"name": "testcafeexamples",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "npm test"
},
"author": "",
"license": "ISC",
"dependencies": {
"testcafe": "^3.6.0"
}
}

Your complete test report

  • Chrome 124.0.0.0 / Ubuntu 22.04

example
✖ not possible to type in number field

  1. AssertionError: expected '42,723' to deeply equal '1234'

    • expected - actual

    -42,723
    +1234

    Browser: Chrome 124.0.0.0 / Ubuntu 22.04

    3 |
    4 |test("not possible to type in number field", async t => {
    5 | await t.navigateTo("https://primereact.org/inputnumber/");
    6 | const input = Selector("#integeronly");
    7 | await t.typeText(input, "1234", {replace: true});

    8 | await t.expect(input.value).eql("1234")
    9 |})

    at (/home/asia/testcafeExamples/index.js:8:33)
    at asyncGeneratorStep (/home/asia/testcafeExamples/index.js:1:38)
    at _next (/home/asia/testcafeExamples/index.js:1:38)

1/1 failed (8s)

Process finished with exit code 1

AssertionError: expected '42,723' to deeply equal '1234'

  • expected - actual

-42,723
+1234

Screenshots

No response

Steps to Reproduce

  1. run the above test
  2. Not ok text is not typed

TestCafe version

3.6.0

Node.js version

21.7.1

Command-line arguments

npm test

Browser name(s) and version(s)

Chrome 124

Platform(s) and version(s)

Ubuntu 22.04.2 LTS

Other

No response

@wombatka wombatka added the TYPE: bug The described behavior is considered as wrong (bug). label May 20, 2024
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label May 20, 2024
@Bayheck Bayheck added STATE: Issue accepted An issue has been reproduced. and removed STATE: Need response An issue that requires a response or attention from the team. labels May 23, 2024
Copy link

We appreciate you taking the time to share information about this issue. We reproduced the bug and added this ticket to our internal task queue. We'll update this thread once we have news.

@github-actions github-actions bot removed the STATE: Issue accepted An issue has been reproduced. label May 23, 2024
@wombatka
Copy link
Author

I would appreciate if someone could come up with some workaround. I tried different approaches and could not come up with any working solution,

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label May 23, 2024
@idzmag
Copy link

idzmag commented May 24, 2024

I would appreciate if someone could come up with some workaround. I tried different approaches and could not come up with any working solution,

the only workaround I was able to come up with is

await t.dispatchEvent(numberInput, 'keydown', { key: '1', code: 'Digit1' })
await t.dispatchEvent(numberInput, 'keyup', { key: '1', code: 'Digit1' })
await t.dispatchEvent(numberInput, 'keydown', { key: '2', code: 'Digit2' })
await t.dispatchEvent(numberInput, 'keyup', { key: '2', code: 'Digit2' })
await t.dispatchEvent(numberInput, 'keydown', { key: '3', code: 'Digit3' })
await t.dispatchEvent(numberInput, 'keyup', { key: '3', code: 'Digit3' })

because t.typeText(numberInput, "123", {paste: true}) doesn't trigger any input/change event in this particular use case, so it just changes the view but doesn't update the state

@wombatka
Copy link
Author

@idzmag thank's for the workaround! I used it in example and works

test("not possible to type in number field", async t => {
await t.navigateTo("https://primereact.org/inputnumber/");
const input = Selector("#integeronly");
await t.selectText(input).pressKey("delete");
for(const letter of '1,234') {
await t.dispatchEvent(input, 'keydown', { key: letter, code: Digit${letter} });
}
await t.expect(input.value).eql("1,234")
})

@Bayheck Bayheck removed the STATE: Need response An issue that requires a response or attention from the team. label May 27, 2024
@anthonyferroHU
Copy link

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label May 30, 2024
@Bayheck
Copy link
Collaborator

Bayheck commented May 31, 2024

Hello @anthonyferroHU, it seems you encountered a different issue. Please create a separate ticket using this template and also share a Minimal Working Example in that ticket so that the TestCafe team can research the issue and help you. We do not ask you to share your source code but a reproducible minimal example that we can run on our end.

@Bayheck
Copy link
Collaborator

Bayheck commented May 31, 2024

This issue is a rare case scenario that has a workaround. A potential fix is quite complex and thus has a low priority at present. This means that we don’t have immediate plans to work on this task, and I will close it for a while.

@Bayheck Bayheck closed this as completed May 31, 2024
@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

4 participants