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

Playwright tests - stage 1 - login with email and password test #8988

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

BOHEUS
Copy link
Contributor

@BOHEUS BOHEUS commented Dec 9, 2024

Scenario: #8469 (comment)

To launch this test, yarn playwright test --project Authentication must be used in packages/twenty-e2e-testing directory (for some reason when launching this test from IDE, be Webstorm or VSCode, it won't fetch the data from .env)

Copy link

github-actions bot commented Dec 9, 2024

Fails
🚫

node failed.

Log

�[31mError: �[39m RequestError [HttpError]: You have exceeded a secondary rate limit. Please wait a few minutes before you try again. If you reach out to GitHub Support for help, please include the request ID 33C7:14CFFF:CCD386:1981FC8:675AB59E.
    at /home/runner/work/twenty/twenty/node_modules/�[4m@octokit�[24m/request/dist-node/index.js:86:21
�[90m    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)�[39m {
  status: �[33m403�[39m,
  response: {
    url: �[32m'https://api.github.com/search/issues?q=is%3Apr%20author%3ABOHEUS%20is%3Aclosed%20repo%3Atwentyhq%2Ftwenty&per_page=2&page=1'�[39m,
    status: �[33m403�[39m,
    headers: {
      �[32m'access-control-allow-origin'�[39m: �[32m'*'�[39m,
      �[32m'access-control-expose-headers'�[39m: �[32m'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset'�[39m,
      connection: �[32m'close'�[39m,
      �[32m'content-encoding'�[39m: �[32m'gzip'�[39m,
      �[32m'content-security-policy'�[39m: �[32m"default-src 'none'"�[39m,
      �[32m'content-type'�[39m: �[32m'application/json; charset=utf-8'�[39m,
      date: �[32m'Thu, 12 Dec 2024 10:06:22 GMT'�[39m,
      �[32m'referrer-policy'�[39m: �[32m'origin-when-cross-origin, strict-origin-when-cross-origin'�[39m,
      server: �[32m'github.com'�[39m,
      �[32m'strict-transport-security'�[39m: �[32m'max-age=31536000; includeSubdomains; preload'�[39m,
      �[32m'transfer-encoding'�[39m: �[32m'chunked'�[39m,
      vary: �[32m'Accept-Encoding, Accept, X-Requested-With'�[39m,
      �[32m'x-content-type-options'�[39m: �[32m'nosniff'�[39m,
      �[32m'x-frame-options'�[39m: �[32m'deny'�[39m,
      �[32m'x-github-api-version-selected'�[39m: �[32m'2022-11-28'�[39m,
      �[32m'x-github-media-type'�[39m: �[32m'github.v3; format=json'�[39m,
      �[32m'x-github-request-id'�[39m: �[32m'33C7:14CFFF:CCD386:1981FC8:675AB59E'�[39m,
      �[32m'x-ratelimit-limit'�[39m: �[32m'30'�[39m,
      �[32m'x-ratelimit-remaining'�[39m: �[32m'30'�[39m,
      �[32m'x-ratelimit-reset'�[39m: �[32m'1733998042'�[39m,
      �[32m'x-ratelimit-resource'�[39m: �[32m'search'�[39m,
      �[32m'x-ratelimit-used'�[39m: �[32m'1'�[39m,
      �[32m'x-xss-protection'�[39m: �[32m'0'�[39m
    },
    data: {
      documentation_url: �[32m'https://docs.github.com/free-pro-team@latest/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits'�[39m,
      message: �[32m'You have exceeded a secondary rate limit. Please wait a few minutes before you try again. If you reach out to GitHub Support for help, please include the request ID 33C7:14CFFF:CCD386:1981FC8:675AB59E.'�[39m
    }
  },
  request: {
    method: �[32m'GET'�[39m,
    url: �[32m'https://api.github.com/search/issues?q=is%3Apr%20author%3ABOHEUS%20is%3Aclosed%20repo%3Atwentyhq%2Ftwenty&per_page=2&page=1'�[39m,
    headers: {
      accept: �[32m'application/vnd.github.v3+json'�[39m,
      �[32m'user-agent'�[39m: �[32m'octokit-rest.js/18.12.0 octokit-core.js/3.6.0 Node.js/18.20.5 (linux; x64)'�[39m,
      authorization: �[32m'token [REDACTED]'�[39m
    },
    request: { hook: �[36m[Function: bound bound register]�[39m }
  }
}
danger-results://tmp/danger-results-2aadd8fc.json

Generated by 🚫 dangerJS against e648817

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR introduces the initial authentication testing framework using Playwright, implementing email/password login functionality with Page Object Model (POM) pattern and environment configuration.

  • Added tests/authentication/login.spec.ts implementing basic email/password login test with environment variables
  • Modified playwright.config.ts to set single worker execution and added dedicated "Authentication" project configuration
  • Created comprehensive loginPage.ts POM with locators and methods for all login-related UI elements
  • Updated FRONTEND_BASE_URL in .env.example to use app.localhost:3001 and added test credential examples

💡 (3/5) Reply to the bot's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!

4 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile

@BOHEUS
Copy link
Contributor Author

BOHEUS commented Dec 9, 2024

Also, this test is written with multi workspace feature active so it may not work in CI

Copy link
Contributor

@Devessier Devessier left a comment

Choose a reason for hiding this comment

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

Thank you for your work! I wrote a few questions. Let's discuss them before merging so I don't lose track of the subject 😄

Comment on lines +59 to +62
{
name: 'Authentication',
testMatch: /authentication\/.*\.spec\.ts/,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm unsure about the use of Playwright projects here. To me, this feature is useful to run projects on different environments. Wouldn't it be more straightforward to run authentication tests by specifying the path to the folder where you extracted them? What do you thin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use projects to split tests by things being tested, I can change it to tags inside tests so there won't be need to use projects for them but I'll think about it

@@ -1,5 +1,5 @@
# Note that provide always without trailing forward slash to have expected behaviour
FRONTEND_BASE_URL=http://localhost:3001
FRONTEND_BASE_URL=http://app.localhost:3001
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did we change the URL to this? Maybe I missed something.

Copy link
Contributor Author

@BOHEUS BOHEUS Dec 11, 2024

Choose a reason for hiding this comment

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

@Devessier it's because of multiworkspace feature now, if I type localhost:3001 it's redirected to app.localhost:3001 so I changed it as there's no need to check redirection in my opinion

@Devessier
Copy link
Contributor

Thanks for your explanations, @BOHEUS. We can merge.

@Devessier Devessier merged commit 182ebb6 into twentyhq:main Dec 12, 2024
17 checks passed
@BOHEUS BOHEUS deleted the 8469_login_test branch December 14, 2024 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🔖 Planned
Development

Successfully merging this pull request may close these issues.

3 participants