Skip to content

Conversation

@junkuncz
Copy link
Contributor

@junkuncz junkuncz commented Jul 3, 2024

No description provided.

@junkuncz junkuncz changed the title feat: LDP-2540: Adds helper for Drupal logout feat: LDP-2540: Drupal logout helper function Jul 3, 2024
// Logout has a confirmation page since Drupal 10.3.
await page.locator('input[value="Log out"]').click();
},

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a (drush) command, so it does not belong in drupal-commands.js.
It should be in test-methods.js, probably close to iLoginAs() -- and probably named iLogOut. (I don't necessarily agree with the naming, but at least it's consistent?(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right... I was "blind". Moved it to the correct place and renamed.

await expect(page.locator('form.user-login-form')).toBeVisible;
await page.locator('input[name="name"]').fill(username);
await page.locator('input[name="pass"]').fill(process.env.APP_SECRET);
await page.locator('input[value="Log in"]').click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly related to the Drupal Logout, but this seemed a good time to do some refactoring of ILogInAs.

The extra expect() doesn't really add anything, because if we are already logged in, the fill() would also fail.
It's just that the expect() likely generates a better error message.
(Also, I felt I needed to do something, while removing the first line from all the following constructions in the tests:

    await helpers.IShouldNotBeLoggedIn(page);
    await helpers.ILogInAs([page, 'dru_editor']);

)

@rmuit rmuit changed the title feat: LDP-2540: Drupal logout helper function feat: LDP-2540: Drupal logout helper function (D10.3+) Jul 24, 2024
@rmuit rmuit merged commit b14ebbc into 1.x Jul 24, 2024
@rmuit rmuit deleted the feature/LDP-2540 branch July 24, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants