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

[e2e] Update playwright eslint plugin #7581

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

unlikelyzero
Copy link
Collaborator

@unlikelyzero unlikelyzero commented Mar 12, 2024

Closes #7307

Describe your changes:

  • updates the eslint-playwright-plugin package
  • updates the default rules

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this a notable change that will require a special callout in the release notes? For example, will this break compatibility with existing APIs or projects that consume these plugins?

Author Checklist

  • Changes address original issue?
  • Tests included and/or updated with changes?
  • Has this been smoke tested?
  • Have you associated this PR with a type: label? Note: this is not necessarily the same as the original issue.
  • Have you associated a milestone with this PR? Note: leave blank if unsure.
  • Is this a breaking change to be called out in the release notes?
  • Testing instructions included in associated issue OR is this a dependency/testcase change?

Reviewer Checklist

  • Changes appear to address issue?
  • Reviewer has tested changes by following the provided instructions?
  • Changes appear not to be breaking changes?
  • Appropriate automated tests included?
  • Code style and in-line documentation are appropriate?

@unlikelyzero unlikelyzero added the type:maintenance tests, chores, or project maintenance label Mar 12, 2024
@unlikelyzero unlikelyzero added this to the Target:4.0.0 milestone Mar 12, 2024
@unlikelyzero unlikelyzero requested a review from ozyx March 12, 2024 02:01
Copy link

codecov bot commented Mar 12, 2024

Codecov Report

Attention: Patch coverage is 53.84615% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 54.95%. Comparing base (8c2558b) to head (349be42).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7581      +/-   ##
==========================================
- Coverage   55.64%   54.95%   -0.70%     
==========================================
  Files         672      672              
  Lines       26996    26996              
  Branches     2626     2626              
==========================================
- Hits        15023    14836     -187     
- Misses      11254    11441     +187     
  Partials      719      719              
Flag Coverage Δ
e2e-full 23.70% <ø> (-18.16%) ⬇️
e2e-stable 58.66% <ø> (-0.94%) ⬇️
unit 48.52% <53.84%> (ø)
Files Coverage Δ
src/plugins/gauge/components/GaugeComponent.vue 62.06% <ø> (ø)
src/ui/layout/MctTree.vue 25.81% <ø> (ø)
.../plugins/notebook/components/NotebookComponent.vue 17.84% <80.00%> (ø)
src/plugins/plot/MctPlot.vue 36.25% <60.00%> (ø)
src/api/tooltips/components/TooltipComponent.vue 0.00% <0.00%> (ø)

... and 26 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c2558b...349be42. Read the comment docs.

Copy link
Member

@ozyx ozyx left a comment

Choose a reason for hiding this comment

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

Got some comments.

Do you think we should keep some of the repeat offenders as warnings for now and fix them over time?

@@ -4,7 +4,8 @@ module.exports = {
browser: true,
es6: true,
jasmine: true,
amd: true
amd: true,
Copy link
Member

Choose a reason for hiding this comment

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

i think we can set this to false or remove it altogether

@@ -4,7 +4,8 @@ module.exports = {
browser: true,
es6: true,
jasmine: true,
amd: true
amd: true,
node: true
Copy link
Member

Choose a reason for hiding this comment

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

nice

ref="tooltip-wrapper"
class="c-menu c-tooltip-wrapper"
:style="toolTipLocationStyle"
role="tooltip"
Copy link
Member

Choose a reason for hiding this comment

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

hah

Comment on lines +401 to +410
1. Use [user-facing locators](https://playwright.dev/docs/best-practices#use-locators) (Now a eslint rule!)

```js
page.getByRole('button', { name: 'Create' } )
```
Instead of
```js
page.locator('.c-create-button')
```
Note: `page.locator()` can be used in performance tests as xk6-browser does not yet support the new `page.getBy` pattern and css lookups can be [1.5x faster](https://serpapi.com/blog/css-selectors-faster-than-getbyrole-playwright/)
Copy link
Member

Choose a reason for hiding this comment

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

suggestion:

  1. Prefer using user-facing locators for better readability and maintainability:
// Recommended
page.getByRole('button', { name: 'Create' })

Instead of the less intuitive:

// Not recommended
page.locator('.c-create-button')

Note: In performance tests, page.locator() may still be used as xk6-browser lacks support for the page.getBy pattern. Additionally, CSS selectors can be up to 1.5x faster than role-based selectors.

@@ -84,7 +84,7 @@ test.describe('Plot Tagging Performance', () => {
await setRealTimeMode(page);

// Search for Science
await page.getByRole('searchbox', { name: 'Search Input' });
await page.getByRole('searchbox', { name: 'Search Input' }).click();
Copy link
Member

Choose a reason for hiding this comment

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

huh. do we need this line at all?

test('display layout with plots of swgs, alphanumerics, and condition sets, ', async ({
page
}) => {
test('display layout with plots of swgs, alphanumerics, and condition sets', async ({ page }) => {
Copy link
Member

Choose a reason for hiding this comment

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

ahhhhh

@@ -141,7 +141,7 @@ test.describe('Notebook Tests with CouchDB @couchdb', () => {
// 4) The shared worker event from 👆 POST request
notebookElementsRequests = [];
await nbUtils.enterTextEntry(page, 'Fourth Entry');
page.waitForLoadState('networkidle');
page.waitForLoadState('domcontentloaded');
Copy link
Member

Choose a reason for hiding this comment

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

i don't know if these are necessarily 1 to 1 here. The networkidles serve a purpose. I think maybe we need to wait for network events specifically to complete? We should just leave these as warnings for now

@@ -152,7 +152,7 @@ test.describe('ExportAsJSON Disabled Actions', () => {
test.describe('ExportAsJSON ProgressBar @couchdb', () => {
let folder;
test.beforeEach(async ({ page }) => {
await page.goto('./', { waitUntil: 'networkidle' });
await page.goto('./', { waitUntil: 'domcontentloaded' });
Copy link
Member

Choose a reason for hiding this comment

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

i worry about this breaking the couchdb tests

@@ -531,7 +531,7 @@ test.describe('Example Imagery in Flexible layout', () => {

// Click text=OK
await Promise.all([
page.waitForNavigation({ waitUntil: 'networkidle' }),
page.waitForNavigation({ waitUntil: 'domcontentloaded' }),
Copy link
Member

Choose a reason for hiding this comment

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

intellisense says this is deprecated

@@ -150,6 +151,7 @@ module.exports = {
'error',
{
cases: {
camelCase: true,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i'm not sure exactly why the robot added this

Copy link
Member

Choose a reason for hiding this comment

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

yeah we need to remove this. it's supposed to enforce vue files only i think

@@ -85,6 +85,7 @@
v-for="(treeItem, index) in visibleItems"
:key="`${treeItem.navigationPath}-${index}-${treeItem.object.name}`"
:node="treeItem"
draggable="true"
Copy link
Member

Choose a reason for hiding this comment

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

this needs to be bound or it gets registered as a string

:draggable="true"

@click="back()"
></button>
<button
class="c-button icon-reset"
title="Reset pan/zoom"
title="Reset pan and zoom"
aria-label="Reset pan and zoom"
Copy link
Member

Choose a reason for hiding this comment

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

I just fixed this on another branch / PR

@@ -98,12 +98,14 @@
v-if="selectedPage && !selectedPage.isLocked"
:aria-disabled="activeTransaction"
class="c-notebook__drag-area icon-plus"
aria-dropeffect="link"
aria-labelledby="newEntryLabel"
Copy link
Member

Choose a reason for hiding this comment

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

seems like more of a description than a label but /shrug

:title="gaugeTitle"
:aria-label="`${domainObject.name}`"
Copy link
Member

Choose a reason for hiding this comment

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

not gauge title?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Gauge title isn't meaningful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:maintenance tests, chores, or project maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[e2e] Update eslint guidelines to disallow page.locator in favor of web-first locators like page.getByRole
2 participants