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

Some integration tests are broken, and github actions actually tests zero of them so this is not detected #5376

Open
hlovdal opened this issue Jan 17, 2022 · 6 comments

Comments

@hlovdal
Copy link

hlovdal commented Jan 17, 2022

This started by trying to run the integration tests locally, however despite whatever problems I might have setting up a working testing environment, I found that there must be some inherent problems with at least one of the tests. Picking the smallest and simplest file, tests/xPostLinks.js, I cannot see how this possibly can pass.

The test was added in 2016 and it tests that some element on the page contains the phrase "x-posted". I am sure that the page did contain the text the tests expect back then, but today the page does not in any way contain text that resembles the text that the test is expecting:

$ head -8 tests/xPostLinks.js
module.exports = {
        'basic functionality': browser => {
                browser
                        .url('https://en.reddit.com/r/RESIntegrationTests/comments/5lc3yw/test_xpost_links_xpost_renhancement/')
                        .waitForElementVisible('#thing_t3_5lc3yw')
                        .assert.containsText('#thing_t3_5lc3yw .tagline', 'x-posted from /r/Enhancement')
                        .end();
        },
$ wget https://en.reddit.com/r/RESIntegrationTests/comments/5lc3yw/test_xpost_links_xpost_renhancement/ -O en.html
--2022-01-17 16:55:55--  https://en.reddit.com/r/RESIntegrationTests/comments/5lc3yw/test_xpost_links_xpost_renhancement/
Resolving en.reddit.com (en.reddit.com)... 151.101.121.140
Connecting to en.reddit.com (en.reddit.com)|151.101.121.140|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 53091 (52K) [text/html]
Saving to: ‘en.html’

en.html                         100%[======================================================>]  51,85K  --.-KB/s    in 0,08s

2022-01-17 16:55:56 (666 KB/s) - ‘en.html’ saved [53091/53091]

$ sed -i 's/>/>\n/g' en.html
$ grep x-posted en.html
$ sed -n '/thing_t3_5lc3yw/,$p' en.html | sed -n '/tagline/,$p' | head
<p class="tagline ">
submitted&#32;<time title="Sat Dec 31 22:38:53 2016 UTC" datetime="2016-12-31T22:38:53+00:00" class="live-timestamp">
5 years ago</time>
&#32;by&#32;<a href="https://en.reddit.com/user/erikdesjardins" class="author may-blank id-t2_9288u" >
erikdesjardins</a>
<span class="userattrs">
</span>
<span class="awardings-bar" data-subredditpath="/r/RESIntegrationTests/" >
</span>
</p>
$

So am I missing anything?

Looking into the latest github action run as of writing this the test job is green, however looking into the "Run yarn integration chrome --retries 2 && yarn integration-only firefox --retries 2" steps it contains at the bottom after the long (~800 lines) build section the following:

$ nightwatch --env chrome --retries 2

- Connecting to ondemand.saucelabs.com on port 80...

- Connecting to ondemand.saucelabs.com on port 80...

- Connecting to ondemand.saucelabs.com on port 80...

- Connecting to ondemand.saucelabs.com on port 80...

- Connecting to ondemand.saucelabs.com on port 80...

⚠ Error connecting to ondemand.saucelabs.com on port 80.
View results: https://saucelabs.com/tests/undefined/

⚠ Error connecting to ondemand.saucelabs.com on port 80.
View results: https://saucelabs.com/tests/undefined/

⚠ Error connecting to ondemand.saucelabs.com on port 80.
View results: https://saucelabs.com/tests/undefined/
...

OK. 0 tests passed (19.254s)
Done in 111.21s.
yarn run v1.22.17
$ nightwatch --env firefox --retries 2
...

⚠ Error connecting to ondemand.saucelabs.com on port 80.
View results: https://saucelabs.com/tests/undefined/

OK. 0 tests passed (17.537s)
Done in 18.30s.

so that test job both fails to run any of the integration tests and also fails to detect this as a failure. This is obviously a different problem than integration tests expecting missing text to be present, but it masks detecting them.

@BenMcGarry you have been doing a lot of work with the pipelines recently, I assume you are capable and interested in looking into this?

(I found no other existing issue related to this. The code is the latest, one commit after v5.22.8)

@BenMcGarry
Copy link
Collaborator

Yeah, since travis-ci.org shut us out the tests appear to have all fallen over. I tried over the weekend to get them running again but didnt work.

Im looking at moving them over to browserstacks since it has better intergration with nightwatch.

For the moment in the pipelines intergration tests have been disabled, and I couldnt get them to run locally either.

@BenMcGarry
Copy link
Collaborator

Related discussion in PR comments: #5371

@BenMcGarry
Copy link
Collaborator

Turns out I didnt disable it in pipeline.. so going to do it now.

@hlovdal
Copy link
Author

hlovdal commented Jan 17, 2022

Thanks, then it's not just me having problems. I am manly interested in getting the integration tests running locally. Web development is annoying in that things get outdated so fast.

I started on Fedora 35 and I did not get the tests to run there, so thinking it possibly might be a bit on the too new side, I also installed an VM with ubuntu 21.04 (which has nodejs version 12.22.8 which is just one version too old to be supported by some dependency, so I downloaded 12.22.9 to override with).

However this environment also fails. Do you have any recommendation on what you would expect to have highest chance of success? As new as possible with everything (like using the newer nightwatch 2 beta), stay as old as possible or somewhere in between?

@BenMcGarry
Copy link
Collaborator

All of the intergration tests requires RES to be active on the browser, so with the grep above the reason x-post isnt seen as its a clean pull of the page. While I was trying to get it working I did notice that firefox had issues loading RES into the browser, whereas chrome didnt have an issue. Were you trying to get them running in Firefox?

image
Would be the element it looks for in the tests/xPostLinks.js test. The elements in the test are all present from a manual check just now.

Even then, Chrome was throwing some strange errors. I can try have a look this weekend to see if its possible to give them some life with a quick fix rather than having to rebuild them.

@hlovdal
Copy link
Author

hlovdal commented Jan 18, 2022

Ah, that makes sense. The tests failed, and then when I opened the url in the plain firefox inside the newly created VM (I have not even installed noscript and ublock origin) the text was missing and I did not connect the dots. The text is there on my main browser with RES installed.

I managed to get nightwatch 2.0.0-beta.2 to launch tests individually with running npx nightwatch --env firefox tests/xPostlink.js which then successfully launches the browser, but then the test fails because the addon is not loaded. The same for chrome.

This is running against npx selenium-standalone install && npx selenium-standalone start which outputs:

Selenium started
21:06:19.945 INFO [LocalDistributor.newSession] - Session request received by the distributor: 
 [Capabilities {browserName: firefox, moz:firefoxOptions: {profile: UEsDBAoAAAAAAMioMlROvAkUAQE...}}, Capabilities {browserName: firefox}, Capabilities {browserName: firefox, firefox_profile: UEsDBAoAAAAAAMioMlROvAkUAQE..., name: X Post Links, version: dev}]
1642536380140   geckodriver     INFO    Listening on 127.0.0.1:54514
1642536381468   mozrunner::runner       INFO    Running command: "/usr/bin/firefox" "--marionette" "-no-remote" "-profile" "/tmp/rust_mozprofileK3jkbP"
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
1642536382762   Marionette      INFO    Marionette enabled
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at /tmp/rust_mozprofileK3jkbP/search.json.mozlz4", (void 0)))
1642536385219   Marionette      INFO    Listening on port 32815
21:06:25.363 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
21:06:25.485 INFO [LocalDistributor.newSession] - Session created by the distributor. Id: 49893adf-ec11-4f8a-a812-4f63bafafa6a, Caps: Capabilities {acceptInsecureCerts: false, browserName: firefox, browserVersion: 95.0.2, moz:accessibilityChecks: false, moz:buildID: 20211220141501, moz:geckodriverVersion: 0.30.0, moz:headless: false, moz:processID: 2322755, moz:profile: /tmp/rust_mozprofileK3jkbP, moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platformName: linux, platformVersion: 5.15.12-200.fc35.x86_64, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
ATTENTION: default value of option mesa_glthread overridden by environment.
JavaScript warning: https://www.redditstatic.com/reddit-init.en.bzioPNo_3po.js, line 8: WEBGL_debug_renderer_info is deprecated in Firefox and will be removed. Please use RENDERER.
1642536413046   Marionette      INFO    Stopped listening on port 32815
21:06:53.848 INFO [LocalSessionMap.lambda$new$0] - Deleted session from local session map, Id: 49893adf-ec11-4f8a-a812-4f63bafafa6a

I do not know if there is something output missing from the above?

According to this issue marionette supports loading addons with some InstallAddon API. Do I need to somehow invoke that first when running tests individually with nightwatch? Actually testing yarn run integration exhibits the same behaviour, the windows load without the RES addon installed, so this is not a run tests individually issue.

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

No branches or pull requests

2 participants