Problem/Motivation

It seems like #3059356: [Security] Update yarn packages to fix 19 vulnerabilities by updating nightwatch broke the functionality to write logs to the file system after test run.

Proposed resolution

Write logs when test case has enabled this functionality.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3084698

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lauriii created an issue. See original summary.

lauriii’s picture

Status: Active » Needs review
StatusFileSize
new2.78 KB

lauriii credited tedbow.

lauriii’s picture

Worked on this with @tedbow.

wim leers’s picture

Is a failing test-only patch possible here?

wim leers’s picture

Title: Nightwatch log messages not getting written » [regression] Nightwatch log messages not getting written
lauriii’s picture

StatusFileSize
new2.85 KB
new635 bytes

#5: We don't really have test coverage for the Nightwatch setup. Maybe we should open a follow-up to see if we could add something?

wim leers’s picture

Any advice for how a reviewer and core committer should assess this?

lauriii’s picture

To check if this works, you can see if files are getting generated into /core/reports/nightwatch/consoleLogs folder while running tests.

wim leers’s picture

So: manual testing is how a reviewer can RTBC it and how a core committer can confirm it?

lauriii’s picture

That's what I'd recommend. Maybe we could open a follow-up for adding test coverage to this?

wim leers’s picture

I'd love to be the reviewer to RTBC this, but I literally have never succeeded in running Nightwatch tests on my local system. Functional JavaScript tests do work fine.

I did create that follow-up: #3086720: Add explicit test coverage for the logging of Nightwatch testing.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

gregatp’s picture

Issue tags: -JavaScript +JavaScript, +GCWPoland2020, +ContributionWeekend2020
StatusFileSize
new2.75 KB

Patch reroll

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new144 bytes

The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

nikhil_110’s picture

StatusFileSize
new2.55 KB

Attached patch against Drupal 10.1.x

Patch #14 is not applied for Drupal 10.1.x so Inter-diff file is not added.

Checking patch core/tests/Drupal/Nightwatch/Commands/drupalLogAndEnd.js...
Checking patch core/tests/Drupal/Nightwatch/Tests/loginTest.js...
error: while searching for:
      .drupalRelativeURL('/admin/reports')
      .waitForElementVisible('body', 1000)
      .assert.containsText('h1', 'Reports')
      .assert.noDeprecationErrors();
  },
};

error: patch failed: core/tests/Drupal/Nightwatch/Tests/loginTest.js:19
error: core/tests/Drupal/Nightwatch/Tests/loginTest.js: patch does not apply
Checking patch core/tests/Drupal/Nightwatch/Tests/statesTest.js...
error: while searching for:
      .drupalRelativeURL('/form-test/javascript-states-form')
      .waitForElementVisible('body', 1000)
      .waitForElementNotVisible('input[name="textfield"]', 1000)
      .assert.noDeprecationErrors();
  },
};

error: patch failed: core/tests/Drupal/Nightwatch/Tests/statesTest.js:19
error: core/tests/Drupal/Nightwatch/Tests/statesTest.js: patch does not apply
Checking patch core/tests/Drupal/Nightwatch/globals.js...
error: while searching for:

export const drupalDbPrefix = null;
export const drupalSitePath = null;

module.exports = {
  before: done => {

error: patch failed: core/tests/Drupal/Nightwatch/globals.js:14
error: core/tests/Drupal/Nightwatch/globals.js: patch does not apply

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

wim leers’s picture

Priority: Normal » Major
Related issues: +#3371963: Update Nightwatch to 3.x
spokje’s picture

Assigned: Unassigned » spokje
Parent issue: » #3401044: [META] Improve nightwatch testing
spokje’s picture

spokje’s picture

Title: [regression] Nightwatch log messages not getting written » Add console logs to all Nightwatch tests
Category: Bug report » Task
Priority: Major » Normal

I applied the consoleLog fix to the first commit in the MR and then reversed it in the second commit.

I compared the consoleLogs from the artifacts of both Nightwatch GitLab CI jobs and besides some timestamps they are exactly equal.
So, as far as I can see, there's currently no problem with the consoleLogs and there's no need for a fix.

However it is a good idea to add consoleLogs to as much Nightwatch tests as possible, so I'm going to repurpose this issue for that cause.

spokje’s picture

Assigned: spokje » Unassigned

So I think the approach taken in core/modules/toolbar/tests/src/Nightwatch/Tests/toolbarApiTest.js should be the one to go for IMHO.

Sadly since logAndEnd works with the _global_ test hooks, which means the afterEach in there will only run after each testsuite instead of each single test, this isn't going to work with altering logAndEnd.

I'll leave that for somebody else, I've tried real hard to learn to love Nightwatch, but it's just not happening for me.
I'm going to leave it alone and spend my time on other stuff in core.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.