This change disables formatting for a few files with too many changes,
for some tests, and for a few HTML elements where a
`white-space:pre-wrap` CSS rule made whitespace significant.
It also updates the eslint rules to use gts except for rules the
codebase doesn't follow yet, and gts's use of eslint-plugin-prettier.
And make it the default formatter in the devcontainer.
I removed the pylint and yapf extensions, which Ruff replaces, and I
added a pyproject.toml to hold Ruff configuration.
I also added a .vscode/extensions.json to recommend the same list of
extensions to people who don't use devcontainers.
* Playwright db run on port different from 15606
Background:
When the playwright tests were created, it was only tested for users that
did not use the devcontainer. The devcontainer starts a database up for
users automatically which occupies port 15606. The playwright tests spin
up a clean database. But previously fails in devcontainers because the
port 15606 is occupied.
This change:
Modifies the base database used in both devcontainer and playwright docker compose files
to allow the DB_PORT to be configured. The devcontainer will continue to
spin up a database at 15606. The playwright tests will create a database
on port 15607. This prevents the conflict on devcontainer.
This also benefits non-devcontainer users because previously they had to
manually shut down their local emulators so that the playwright database
could run.
* use DATASTORE_EMULATOR_HOST if provided, else use default
`npm run` runs commands in `sh`, which is dash rather than bash. Dash is
strictly POSIX, and `source` is a POSIX extension.
I believe that's the bug the extra `npm run setup` in the
postCreateCommand was working around, so I've removed it.
* Add helpful tools and extensions to the devcontainer.
* Remove deprecated linting and formatting settings.
* Add configuration to the new extensions, and remove the custom pylint install that's redundant with the bundled version inside its extension.
* Initial install of playwright visual tests
* Close to working.
* who knows...
* after updates
* Extend devcontainer docker compose file for playwright (#3192)
* Extend devcontainer docker compose file for playwright
Create another docker compose file for playwright.
That new one extends the existing docker compose
Should be able to run:
`npm run pwtests`
* adjust gh action
* adjust gh action
* remove volumes
* add timeout
* fix volumes
* Fix docker compose environment
* ignore stuff and volume mounting
* Attempting to login reliably
* Auto cleanups.
* Finally starting to work
* Thought it was getting better, but maybe not
* Seems reliable now
* Higher success rate
* Add test of entering feature name. Remove new feature page content test.
* Add playwright-report dir to Dockerfile.
* Comment out mkdir -p /work/playwright-report line.
* Update screenshots.
* Increasing timeout for entering feature name
* try running as user (#3248)
* try running as user
* again
* try
* change volume ownership
* tidy up
* Adjust login process to be more reliable.
* Add 5 second delay before first test runs.
* Wait longer for first login.
* Add auto-logout during login if already logged in
* Screenshot after login click
* Add testName to screenshots. Upload artifacts. Fix form method="POST".
* Add doc to README for Updating the test_html_rendering files.
* Maybe increase chance of login.
* Add a couple more delays.
* Repeat auto-logout during login until no longer logged in, before logging in again.
* Add some more delays.
* Use loginButton.click(). Add delay before after-click screenshot.
* Add console info an errors to login process.
* Capture console messages, relay to terminal.
* Capture console messages properly.
* Add some more console messages during login.
* Ignore error on jsonValue.
* Reduce most delays. Add more logs. Add top-level playwright call.
* More logging to figure out why login fails
* More logging to detect if ever logged in.
* Add more logging to each stage of testing
* Use history.replaceState before changing location.
* Use location.reload() after a timeout.
* After login, just load home page.
* Add playwright-report to artifacts.
* Turn off playwright-report during CI
* Log response after login
* Only log first response after request that should log in.
* Look for 'currentuser/permissions' request/response.
* Delay after mock_login and before reload of home page
* Comment out header and cookie logs.
* Act like logged when in DEV_MODE and login attempted.
* Fix mock mock login.
* Undo fake mock_login.
* rearrange docker (#3265)
* Updates after changes by James.
* Fix previous updates.
* Remove pwtests-shutdown from "stop" command.
* Remove pwtest from client-src/elements. (moved to packages/playwright/tests)
* update paths for run.sh
* Add pwtests-shutdown to top-level stop command.
* Remove "playwright" from ./wait-for-app.sh
* Add logging of user login status.
* add playwright_display for debugging
* add server debugging
* Remove extra "/__screenshots__" in path.
* Update the path for test-results artifacts in the playwright.yml
* add health checks
* fix action
* fix run.sh
* Add beforeAll method, disabled.
* add dsadmin
* Add top level pwtests command, not working yet.
* cleanup and undo changes
* use transactions
* always reuse server
* temp: limit the workers
* Partial cleanup. Reduce timeouts and delays a bit.
* More cleanup. Reduce timeout/delay.
* Update the correct README file. Update html rendering tests.
* Remove unnecessary changes.
* set script-shell to fix source not found and call npm run setup (#3292)
* set script-shell to fix source not found and call npm run setup
There has always been `source: not found` in the previous CI jobs
The tests previously worked because
npm run deps installs the requirements into the default environment and not the virtual environment.
And since we actually did not call `source` correctly, it was okay because
the default environment had the packages installed.
The problem started to arise because we started to call `source`
correctly in some places but not all places. This fixes by setting the
shell consistently whenever we call `source`
More info:
https://morgan.cugerone.com/blog/troubleshooting-source-not-found-when-in-the-context-of-package-json-scripts/
* do each separately
* Revert "do each separately"
This reverts commit 4fc75f7407.
* do ci job
* consistent to the right datastore mode
* verbose
* kill the emulator
* remove verbose
* Reenable Google login
* Finish reenabling Google signin button. Add margin for Firefox.
* Only show Google signin if playwright is not active
* Preserve url on login. Use default num of workers. Retry tests in CI
* Some updates after comments
* optimize docker changes
* Rename account-indicator. Shorten some delays.
* revert the workers
* Make playwright.yml push and pull_request triggers be like others.
* Use getByTestId instead of locator with data-testid.
---------
Co-authored-by: James C Scott III <jcscottiii@users.noreply.github.com>
Co-authored-by: James Scott <jamescscott@google.com>
* Manual changes to support using openapi
.devcontainer/Dockerfile
- Install java in devcontainer
.devcontainer/devcontainer.json
- Make devcontainer automatically install VSCode OpenAPI plugin mentioned in #2769
- Make devcontainer automatically install VSCode plugin for Lit
client-src/elements/chromedash-app.js
- Use the generated client in the frontend.
- Leverage lit-labs/context to provide the client.
- Docs about context and use-cases: https://lit.dev/docs/data/context/
client-src/elements/chromedash-app_test.js
- Add tests for the changes in client-src/elements/chromedash-app.js
client-src/contexts/openapi-context.js
- Declare a context for the openapi client.
framework/basehandlers.py
- add do_put function. previously, all other HTTP verbs had a `do_<verb>` version except PUT.
- Add put function that uses defensive_jsonify. This enables XSSI for PUT requests.
- This needed change is safe to do because the only route using PUT is the admin/blink page which I am migrating into the SPA.
gulpfile.babel.js
- Fix usage of rollupBabel. Previously, @rollup/plugin-node-resolve's default export was named rollupBabel. Which is the wrong package. Fixed to use @rollup/plugin-babel
- Using the correct parameters to rollupBabel from https://www.npmjs.com/package/@rollup/plugin-babel
- Add client-src/contexts/*.js to lint and watch targets
- Add custom onwarn for rollup that comes from using the generated frontend code. Check comment for explanation
package.json
- Add lit-labs/context. Needed for changes in client-src/contexts/openapi-context.js
- Tell NPM to use the generated javascript changes via the `workspaces` key.
- Instead of adding as a dependency like [I initially did here](ccd5c8e71b (diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R101)), rather keep the "dependencies" only for ones pulled from npm remotely.
- workspaces are meant more for packages that comes from the filesystem
- Docs: https://docs.npmjs.com/cli/v9/using-npm/workspaces?v=true
requirements.txt
- Tell pip to install the python package.
package-lock.json
- Generated changes from adding context and workspaces.
* revert accidental Werkzeug upgrade
* fix devcontainer
* Remove context & failed attempt at global
changes:
- Remove the context
- Move the openapi client to js-src
- modify gulp task to:
- ignore the test file
- add the openapi-client to the rollup task instead of the js task since it is a es6 module (because it has an import / require statement)
- Attempt to construct the object in the spa template. It failed to work at load time. More details below:
When trying to call my exported class at page load like the regular client, I get a not defined error.
There are thoughts about this:
- https://stackoverflow.com/a/75026222
- https://stackoverflow.com/a/53630402
- https://stackoverflow.com/a/69888825
This commit serves as an attempt to try it out
Turns out, script type "module" is automatically set to defer and cannot be disabled.
* add new rollup for cjs for openapi client
* add more tests
* fix middleware
Recently, when running `npm run clean-setup` in the container,
it has not been installing the packages in the virtual environment.
Instead, it has been installing in the default Python environment. We
will need to call npm run setup again once the environment has been
activated.
This problem hasn't been reported for local development setups.
This is a workaround to not mess up the local development setup.
By running npm run setup again, the container doesn't need to download
the packages again. The packages are cached and are just copied over. So
it doesn't increase setup time that much.
* Migrate from node 12 to node 18
* update all packages from npm outdated
* next round of updates
* fix most vulnerabilities
* remaining vulnerabilites
* remove unused dependencies