seeInField in textarea #2921

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

Comments

Projects
None yet
3 participants
@artyfarty
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@artyfarty

artyfarty Mar 24, 2016

Contributor

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

Contributor

artyfarty commented Mar 24, 2016

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

@artyfarty

This comment has been minimized.

Show comment
Hide comment
@artyfarty

artyfarty Mar 24, 2016

Contributor

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

Contributor

artyfarty commented Mar 24, 2016

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

@nsanden

This comment has been minimized.

Show comment
Hide comment
@nsanden

nsanden Mar 24, 2016

Contributor

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@artyfarty

artyfarty Mar 24, 2016

Contributor

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.

Contributor

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