Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: add e2e tests for basic template and workspace flow #5637

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

Merged
merged 11 commits into from
Jan 10, 2023

Conversation

presleyp
Copy link
Contributor

@presleyp presleyp commented Jan 9, 2023

Fixes #5238

  • create template
  • create workspace
  • start and stop workspace

@presleyp presleyp requested a review from a team as a code owner January 9, 2023 21:23
@presleyp presleyp requested review from Kira-Pilot and removed request for a team January 9, 2023 21:23
@socket-security
Copy link

Socket Security Pull Request Report

Dependency issues detected. If you merge this pull request, you will not be alerted to the instances of these issues again.

📜 Install scripts

Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.

Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.

Package Script field Source
[email protected] (added) install site/package.json
😵‍💫 Bin script confusion

This package has multiple bin scripts with the same name. This can cause non-deterministic behavior when installing or could be a sign of a supply chain attack

Consider removing one of the conflicting packages. Packages should only export bin scripts with their name

Package Bin script Source
[email protected] (added) playwright site/package.json
Pull request report summary
Issue Status
Install scripts ⚠️ 1 issue
Native code ✅ 0 issues
Bin script confusion ⚠️ 1 issue
Bin script shell injection ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ✅ 0 issues
Protestware/Troll package ✅ 0 issues
Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore [email protected] [email protected]

⚠️ Please accept the latest app permissions to ensure bot commands work properly. Accept the new permissions here.

Powered by socket.dev

value: string,
): Promise<void> => {
await page.fill(`text=${label}`, value)
}
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason we made helpers for these? They seem to wrap fairly trivial built-in methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To address this comment and the one about the constant: previously, we wrote Playwright tests with POMs, so for each page, you'd have a file with a class and methods. I started doing that here and it felt too heavy since the current plan isn't to write many e2e tests. (Although after seeing how pleasant they were to debug, I'm reconsidering that!) So instead, I just dumped everything I would normally have put in the class into these few helpers. But I agree that it's not that much easier to read and write than just inlining everything.

Copy link
Member

Choose a reason for hiding this comment

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

As someone who isn't familiar with playwright, I appreciate them and makes test-authoring seem a bit easier. No strong opinions though!

@@ -0,0 +1,39 @@
import { test } from "@playwright/test"
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps the file name basicFlow.spec.ts could be more descriptive?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, we discussed having one long test instead of several short ones since e2e tests tend to build on each other, and so I didn't have something really specific to name it. But again, now that I'm feeling more positive on e2e tests, we should probably talk as a team about whether we want to do more of them.

submitCreateWorkspace: "Create workspace",
stopWorkspace: "Stop",
startWorkspace: "Start",
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I would decouple this page-specific constant from the test for that page.

@Kira-Pilot
Copy link
Member

Super cool! I feel like I learned a bit about Playwright reading through this. Would be a great FE topic, i.e. should we be writing E2E tests for each feature? What does the organization of the E2E testing folder look like?

Co-authored-by: Ben Potter <[email protected]>
@presleyp
Copy link
Contributor Author

Just noting for posterity about the Socket concerns: one is about the fact that playwright has an install script. It's had that before so I don't think it's an issue. The other is about the bin script. It says there are two scripts or two packages, but there's only one listed, so I'm not sure what's wrong. The bin script attack pattern is to name the bin script something other than the package name, but the bin script is correctly named playwright. The script itself just exports the cli module. The problem might be that it's defined in both playwright and playwright-core.

@presleyp presleyp merged commit 56a69b7 into main Jan 10, 2023
@presleyp presleyp deleted the e2e-setup/presleyp branch January 10, 2023 17:30
@github-actions github-actions bot locked and limited conversation to collaborators Jan 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

frontend e2e tests against "create workspace" flow
3 participants