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

Create login script to be run before every page test #215

Open
lechinoix opened this issue Jul 16, 2020 · 5 comments
Open

Create login script to be run before every page test #215

lechinoix opened this issue Jul 16, 2020 · 5 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed javascript Pull requests that update Javascript code python Pull requests that update Python code

Comments

@lechinoix
Copy link

Feature Description

For applications with login, it would be nice to have a script stored in database to be run before each page test.

Use Case

When you have a login page, you need to create one specific script for each page, which is not robust and error prone

@fargito
Copy link
Contributor

fargito commented Jul 30, 2020

We could create a initScript that is a factorization of the login script before authenticated pages. That way, projects would not have to put all their pages in a single script.

For the project, it would be a third type of possible analysis :

  • Page
  • Script
  • AuthenticatedPage

For every AuthenticatedPage, the user should only have to set the url.

When running an audit for an AuthenticatedPage, the initScript should be used but not measured. Then the only measured step should be the navigate https://my-url.com step

The result should then be formatted and presented to the user just as the result of an audit for a page

@fargito
Copy link
Contributor

fargito commented Jul 30, 2020

Backend part

  • Create a StartupScript model with a script field and linked with a foreign key to a Project ;
  • add a startup_script nullable field on Page ;
  • in tasks.py, before launching an audit, check if the page has a startup_script ;
  • in this case, append the url of the Page at then end of the startup_script script and set logData 0 before the login part and logData 1 before the navigate http://url
  • create a format_wpt_json_results_for_authenticated_page function to transform the results of the audit just as plain page results and save them in the database.

@fargito
Copy link
Contributor

fargito commented Jul 30, 2020

Frontend part

  • Add an interface to create startup scripts in the Project Admin (reuse the components to create scripts).
  • Provide clean samples of authentication processes ?
  • Create a route to get/save/delete startup scripts
  • On the create/edit page interface, add a nullable dropdown to choose a startup script linked with the page

@fargito
Copy link
Contributor

fargito commented Jul 30, 2020

Docs

  • update docs, and clearly specify the authenticated pages will be run as scripts on Webpagetest, and not as plain pages, even though the results may be presented as those of a page

@fargito fargito pinned this issue Jul 30, 2020
@fargito fargito added enhancement New feature or request help wanted Extra attention is needed javascript Pull requests that update Javascript code python Pull requests that update Python code labels Jul 30, 2020
@lechinoix lechinoix self-assigned this Aug 21, 2020
@lechinoix
Copy link
Author

lechinoix commented Aug 21, 2020

@fargito I'll work on a Pull Request this afternoon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed javascript Pull requests that update Javascript code python Pull requests that update Python code
Projects
None yet
Development

No branches or pull requests

2 participants