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

seeInField in textarea #2921

Closed
artyfarty opened this issue Mar 24, 2016 · 4 comments
Closed

seeInField in textarea #2921

artyfarty opened this issue Mar 24, 2016 · 4 comments
Labels

Comments

@artyfarty
Copy link
Contributor

@artyfarty artyfarty commented Mar 24, 2016

Am i misunderstanding something or is seeInField for textarea broken?

case 'textarea':
default:
$currentValues[] = $el->getAttribute('value');
break;

                case 'textarea':
                default:
                    $currentValues[] = $el->getAttribute('value');
                    break;

Shouldn't it be getText() for textarea? In our 2.1.7 and 2.1.6 function looks like this:

protected function proceedSeeInField(array $elements, $value)
    {
        ...
        $currentValues = [];
        if (is_bool($value)) {
            $currentValues = [false];
        }
        foreach ($elements as $el) {
            if ($el->getTagName() === 'textarea') {
                $currentValues[] = $el->getAttribute('value');
            } ...

The same $el->getAttribute('value') explicitly stated for textarea. And well, our tests were failed until i've changed it to getText(). I can submit a PR, but maybe i'm missing something?

Also, i'm having trouble finding that version of a method in 2.1 branch. Oh. here's the commit 4d2a7c2#diff-b69c529efcc6368b5c564f8b36665a22

@artyfarty
Copy link
Contributor Author

@artyfarty artyfarty commented Mar 24, 2016

Oh. I found the ticket #2464. Well, it's broken back now. Or i am seriously missing something

@artyfarty
Copy link
Contributor Author

@artyfarty artyfarty commented Mar 24, 2016

For the record, we are using selenium webdriver with chromedriver. Maybe chromedriver and firefox behaves differently

@nsanden
Copy link
Contributor

@nsanden nsanden commented Mar 24, 2016

Working fine for me with chromedriver

$I = new AcceptanceTester($scenario);
$I->fillField('#box', 'This is a test.');
$I->seeInField('#box', 'This is a test.');

OK (1 test, 1 assertion)

Codeception version 2.1.6
chromedriver 2.20
chrome 49
selenium-server-standalone-2.48.2

@artyfarty
Copy link
Contributor Author

@artyfarty artyfarty commented Mar 24, 2016

I've found the difference.

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<textarea id="ta" name="foo" rows="3">bar baz
</textarea>
</body>
</html>

getText works, getAttribute does not.

getText doc states:

Get the visible (i.e. not hidden by CSS) innerText of this element, including sub-elements, without any leading or trailing whitespace.

getAttribute('value') does not trim whitespaces though.

I'm not sure that seeInField should actually trim whitespaces, but it did previously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.