angular / protractor-accessibility-plugin

Runs a set of accessibility audits
MIT License
268 stars 37 forks source link

Incompatibility with protractor 4.0.10 #12

Closed evilaliv3 closed 8 years ago

evilaliv3 commented 8 years ago

While working on GlobaLeaks i just found that the current release of protractor-accessibility-plugin is no more compatible with protractor 4.0.10

[17:14:23] I/direct - Using ChromeDriver directly...
[17:14:23] I/launcher - Running 1 instances of WebDriver
Started
.

1 spec, 0 failures
Finished in 1.128 seconds

[17:14:26] I/plugins -       Fail:  protractor-accessibility-plugin Plugin Tests 
[17:14:26] E/plugins -      Failure during teardown: browser.executeScript_ is not a function
[17:14:26] E/plugins -      TypeError: browser.executeScript_ is not a function
            at runChromeDevTools (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor-accessibility-plugin/index.js:167:18)
            at Object.teardown (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor-accessibility-plugin/index.js:61:17)
            at Plugins.safeCallPluginFun (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/built/plugins.js:208:45)
            at /home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/built/plugins.js:246:36
            at Array.forEach (native)
            at Plugins.teardown (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/built/plugins.js:244:25)
            at /home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/built/runner.js:359:28
            at _fulfilled (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/q/q.js:834:54)
            at self.promiseDispatch.done (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/q/q.js:863:30)
            at Promise.promise.promiseDispatch (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/q/q.js:796:13)
            at /home/evilaliv3/Devel/GlobaLeaks/client/node_modules/q/q.js:556:49
            at runSingle (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/q/q.js:137:13)
            at flush (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/q/q.js:125:13)
            at _combinedTickCallback (internal/process/next_tick.js:67:7)
            at process._tickCallback (internal/process/next_tick.js:98:9)

\cc @juliemr @sjelin @cnishina

evilaliv3 commented 8 years ago

@contolini @mgiambalvo : i think we should iterate a little bit on this patch.

what you edited would make the plugin work with >=4.0.10 and only that, since the commit where this api has been changed is the following: https://github.com/angular/protractor/commit/456bc96033ff7f3c8963cce8c52d88cae6495cec

it would be important at least to have an if/else detection of the name of the function so to allow compatibility with boy protractor<4.0.10 and protractor>=4.0.10

@sjelin @juliemr what do you suggest? maybe that it would be worth it to keep retrocompatibility inside protractor in order to not impact on the projects that are still using the old API name? with this github search you can take a look to what is currently impacted: https://github.com/search?utf8=%E2%9C%93&q=browser.executeScript_&type=Code&ref=searchresults

heathkit commented 8 years ago

browser.executeScript_ was a private method. We shouldn't have been using it in this plugin, but we do reserve the right to change private APIs as needed.

Your search was a bit broad, it looks like there are only 79 instances of calls to browser.executeScript_. They all seem to be cases where people have either forked or copied Protractor into their own repo. I don't see any instances of calls to executeScript_ from non-Protractor code.

I'd prefer to just land the patch as is, and make it clear that the next published version of this plugin will require protractor >= 4.0.10. I'm also planning on setting up CI for the official plugins so we can catch issues like this more proactively.

evilaliv3 commented 8 years ago

good to go so! waiting for the new package to be issued! :)

contolini commented 8 years ago

For sanity's sake it might be worth having this plugin's versioning sync with protractor's (i.e. bump protractor-accessibility-plugin's major version to 4 when it starts requiring version 4 of protractor's API).

evilaliv3 commented 8 years ago

@sjelin: i see on npm a version 0.2.0 but i do not see this repository having any tag and still presenting the 0.1.1 as declared version in the file package.json.

how is this possible? could you release the package including this fix?

FJLopezGarcia commented 7 years ago

Same issue here.. Do you know the root cause, any update???

"protractor": "^4.0.13",
"protractor-accessibility-plugin": "^0.3.0",

' Executed 9 of 9 specs SUCCESS in 23 secs. [10:11:28] I/plugins - Fail: protractor-accessibility-plugin Plugin Tests [10:11:28] E/plugins - Failure during teardown: unknown error: Cannot read property 'collectIdRefs' of null (Session info: chrome=55.0.2883.95) (Driver info: chromedriver=2.26.436421 (6c1a3ab469ad86fd49c8d97ede4a6b96a49ca5f6),platform=Mac OS X 10.10.5 x86_64) [10:11:28] E/plugins - WebDriverError: unknown error: Cannot read property 'collectIdRefs' of null (Session info: chrome=55.0.2883.95) (Driver info: chromedriver=2.26.436421 (6c1a3ab469ad86fd49c8d97ede4a6b96a49ca5f6),platform=Mac OS X 10.10.5 x86_64) at WebDriverError (/Users/myuser/Documents/GIT/Join2/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:5) at Object.checkLegacyResponse (/Users/myuser/Documents/GIT/Join2/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:639:15) at parseHttpResponse (/Users/myuser/Documents/GIT/Join2/node_modules/protractor/nodemodules/selenium-webdriver/http/index.js:538:13) at client.send.then.response (/Users/myuser/Documents/GIT/Join2/node_modules/protractor/nodemodules/selenium-webdriver/http/index.js:472:11) at ManagedPromise.invokeCallback (/Users/myuser/Documents/GIT/Join2/node_modules/protractor/nodemodules/selenium-webdriver/lib/promise.js:1379:14) at TaskQueue.execute (/Users/myuser/Documents/GIT/Join2/node_modules/protractor/nodemodules/selenium-webdriver/lib/promise.js:2913:14) at TaskQueue.executeNext (/Users/myuser/Documents/GIT/Join2/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21) at asyncRun (/Users/myuser/Documents/GIT/Join2/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2820:25) at /Users/myuser/Documents/GIT/Join2/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7 at process._tickCallback (internal/process/next_tick.js:103:7) From: Task: a11y developer tool rules at Driver.schedule (/Users/myuser/Documents/GIT/Join2/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:377:17) at ProtractorBrowser.executeScriptWithDescription (/Users/myuser/Documents/GIT/Join2/node_modules/protractor/built/browser.js:210:28) at runChromeDevTools (/Users/myuser/Documents/GIT/Join2/node_modules/protractor-accessibility-plugin/index.js:172:18) at Object.teardown (/Users/myuser/Documents/GIT/Join2/node_modules/protractor-accessibility-plugin/index.js:66:17) at resolver (/Users/myuser/Documents/GIT/Join2/node_modules/protractor/built/plugins.js:197:49) at Function.promise (/Users/myuser/Documents/GIT/Join2/node_modules/q/q.js:682:9) at Plugins.safeCallPluginFun (/Users/myuser/Documents/GIT/Join2/node_modules/protractor/built/plugins.js:209:49) at /Users/myuser/Documents/GIT/Join2/node_modules/protractor/built/plugins.js:221:30 at Array.map (native) at Plugins.teardown (/Users/myuser/Documents/GIT/Join2/node_modules/protractor/built/plugins.js:220:18) [10:11:28] I/launcher - 0 instance(s) of WebDriver still running [10:11:28] I/launcher - chrome #01 failed 1 test(s) [10:11:28] I/launcher - overall: 1 failed spec(s) [10:11:28] E/launcher - Process exited with error code 1 '

jamsea commented 7 years ago

@FJLopezGarcia whats your protractor.config.js look like? I'm running into the same problem as you, if I remove my auditConfiguration for chromeA11YDevTools everything works, I'm guessing something's changed, I'm working on a fix now.

Here's my current configuration that's breaking:

      {
        chromeA11YDevTools: {
            treatWarningsAsFailures: false,
            auditConfiguration: {
                auditRulesToRun: [
                    "audioWithoutControls",
                    "badAriaAttributeValue",
                    "badAriaRole",
                    "imagesWithoutAltText",
                    "linkWithUnclearPurpose",
                    "mainRoleOnInappropriateElement",
                    "nonExistentAriaLabelledbyElement",
                    "pageWithoutTitle",
                    "requiredAriaAttributeMissing",
                    "unfocusableElementsWithOnClick",
                    "videoWithoutCaptions"
                ],
                auditRulesToSkip: [
                    "controlsWithoutLabel",
                    "lowContrastElements",
                    "elementsWithMeaningfulBackgroundImage",
                    "focusableElementNotVisibleAndNotAriaHidden"
                ],
                showUnsupportedRulesWarning: false,
                // Ignore controls without label on react-select boxes
                // Ignore <video> / ticket opened with Adobe to fix
                rules_: {
                    controlsWithoutLabel: {
                        "ignore": [".Select-control", ".form-control", "video"]
                    }
                }
            }
        }