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

Implement RAC Style Library into Aurora #683

Open
wants to merge 104 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
2b47cc7
remove uploads by user, fix #658
HaSistrunk May 16, 2024
f1c5eeb
remove org recent transfer table
HaSistrunk May 16, 2024
c23bebc
Merge branch 'development' into issue-667
HaSistrunk Sep 18, 2024
0fdd9cc
consolidate navigation into header nav
HaSistrunk Sep 18, 2024
ac34501
use standard public RAC footer
HaSistrunk Sep 18, 2024
bf2ad3a
add skip link
HaSistrunk Sep 19, 2024
13df807
remove vendor scripts and styles
HaSistrunk Sep 20, 2024
25528ef
update datatables and /transfers table
HaSistrunk Sep 20, 2024
7b5ea1e
use html progress element for progress bars
HaSistrunk Sep 20, 2024
23afbca
be explicit about which datatables styles are local
HaSistrunk Sep 20, 2024
d8419f4
improve button layout on /transfers page
HaSistrunk Sep 20, 2024
e2ee349
update search input and pagination styles
HaSistrunk Sep 20, 2024
747a647
initial rac styles implementation for transfer detail page
HaSistrunk Sep 21, 2024
01fec19
replace appraise details modal with table link to transfer details page
HaSistrunk Sep 22, 2024
198b7fb
add secondary footer with Aurora docs links + simplify header link text
HaSistrunk Sep 23, 2024
ae0ee57
improve pattern to get transfer detail url for appraise table
HaSistrunk Sep 23, 2024
eb7a5a9
remove appraise details test
HaSistrunk Sep 24, 2024
05ff41d
standardize datatables and remove unnecessary configs that match data…
HaSistrunk Sep 24, 2024
0900266
update title layouts, remove accession and appraisal queue transfer t…
HaSistrunk Sep 24, 2024
b41a827
update appraisal queue styles
HaSistrunk Sep 24, 2024
0e7c141
prevent label text wrapping in table btns + set page max width
HaSistrunk Sep 25, 2024
acabca0
add link to appraisal queue to improve ux for appraisers viewing tran…
HaSistrunk Sep 25, 2024
bbe2e70
implement tablist for accessioning queue
HaSistrunk Sep 26, 2024
82d3a24
simplify users page to one datatable
HaSistrunk Sep 26, 2024
0f478c4
implement styles for user detail page
HaSistrunk Sep 26, 2024
041067f
remove browseable api+schema and update header navigation menus
HaSistrunk Sep 27, 2024
2dce2d8
linting and readme change for browseable api updates
HaSistrunk Sep 30, 2024
0e924c9
implement styles for orgs and users pages
HaSistrunk Sep 30, 2024
db1f41c
implement accession form styles
HaSistrunk Oct 2, 2024
ce22838
use RAC style library alert colors + make all alerts dismissible
HaSistrunk Oct 2, 2024
76e0c52
add alert when AS resource is added + update messages.html for alert …
HaSistrunk Oct 2, 2024
a8491ad
implement add/edit orgs and users
HaSistrunk Oct 9, 2024
e18352c
update login pages layout + styles, but not yet form validation
HaSistrunk Oct 9, 2024
1f99ab0
cleanup password change form
HaSistrunk Oct 10, 2024
4d2045e
implement styles for bag-it view page
HaSistrunk Oct 10, 2024
8ee70f9
Merge branch 'development' into issue-667
HaSistrunk Oct 10, 2024
32cd1b2
Merge branch 'development' into issue-667
HaSistrunk Oct 10, 2024
9efff9b
implement rights statement view styles
HaSistrunk Oct 11, 2024
375a916
use local font and cleanup login and header nav styles
HaSistrunk Oct 15, 2024
9b102a5
Merge branch 'issue-667' of https://github.com/RockefellerArchiveCent…
HaSistrunk Oct 15, 2024
fd06ce2
adjust table fixedHeader to no fixed site header
HaSistrunk Oct 15, 2024
f321e03
update bag-it profile creation form
HaSistrunk Oct 22, 2024
305ff73
linting
HaSistrunk Oct 23, 2024
2dc656a
troubleshoot dynamic form input and label indices
HaSistrunk Oct 23, 2024
0847e82
implement styles for create rights form
HaSistrunk Oct 23, 2024
d8470e6
revert model changes for bagit forms (still need updates for change f…
HaSistrunk Oct 24, 2024
82fa7b9
implement micromodal and add appraisal modals
HaSistrunk Oct 24, 2024
96a13cc
cleanup
HaSistrunk Oct 24, 2024
2294e9d
implement micromodals for orgs page
HaSistrunk Oct 25, 2024
30a12a9
Simplify/update dashboard
HaSistrunk Oct 28, 2024
d362cdd
improve transfer details page + cleanup
HaSistrunk Oct 28, 2024
9d18fe5
implement responsive tables correctly and limit fixedHeaders in datat…
HaSistrunk Oct 29, 2024
ee67074
cleanup table styling and remove pointer row links for a11y
HaSistrunk Oct 29, 2024
385ecf3
add homepage signposts and remove paragraphs from header links
HaSistrunk Oct 29, 2024
e0a79e0
add more responsive cta button styles
HaSistrunk Oct 29, 2024
cdd2d48
use consistent login/password reset form widths
HaSistrunk Oct 30, 2024
206255e
cleanup and reorder styles
HaSistrunk Oct 30, 2024
a134c44
remove unused sources and add rac assets to CSP settings
HaSistrunk Oct 30, 2024
2b3ec60
enable closing alert messages in script
HaSistrunk Oct 30, 2024
fe676e1
implement focus management with DOM deletion and debug delete script
HaSistrunk Oct 30, 2024
cbd2a54
remove moment.js
HaSistrunk Nov 1, 2024
8061c74
remove statesave on transfers datatable
HaSistrunk Nov 1, 2024
3020150
expand dashboard transfer status info, fix #555
HaSistrunk Nov 1, 2024
7636fa4
remove unused filesize script
HaSistrunk Nov 5, 2024
13d623d
add styles for form errors + style todos
HaSistrunk Nov 14, 2024
1022c66
improve UI clarity and cleanup
HaSistrunk Nov 15, 2024
e1eda64
bagit form troubleshooting
HaSistrunk Nov 15, 2024
18949e7
update password change form layout
HaSistrunk Nov 15, 2024
3d2c343
use only a single formset
helrond Nov 16, 2024
b6cfe63
implement backstopjs with login.js script
HaSistrunk Nov 20, 2024
bb00930
add backstopjs reference imgs
HaSistrunk Nov 20, 2024
1bab0ca
convert field relationships
helrond Nov 20, 2024
49c976e
update data fixtures to align with model changes
helrond Nov 20, 2024
108f369
get rid of nested formsets
helrond Nov 20, 2024
2cbddf3
simplify views
helrond Nov 20, 2024
9df1c9a
remove unneeded model
helrond Nov 20, 2024
f147aa0
update bagit profile serializer
helrond Nov 20, 2024
022da58
initial changes to templates
helrond Nov 20, 2024
7441088
Merge branch 'issue-667' of github.com:RockefellerArchiveCenter/auror…
helrond Nov 20, 2024
acf1e30
remove fields used in data migration
helrond Nov 20, 2024
ab070f0
add bag_info_formset back in
helrond Nov 21, 2024
5961ded
fix header title spacing + match nav links to h1s
HaSistrunk Nov 21, 2024
4878a7f
implement accession details page styles
HaSistrunk Nov 21, 2024
dee3b98
replace tablist with new saved accessions page
HaSistrunk Nov 21, 2024
ddc33fb
Merge branch 'development' into issue-667
HaSistrunk Nov 21, 2024
5eb5812
linting and merge commit cleanup
HaSistrunk Nov 21, 2024
8e1f34c
update fieldset templates with legends and help text
HaSistrunk Nov 25, 2024
03430db
add initial bagit form values, fix #668
HaSistrunk Nov 25, 2024
8524c79
add user and org names to page titles and remove excess cards
HaSistrunk Nov 25, 2024
d1d39ae
add missed modal title
HaSistrunk Nov 25, 2024
aca4296
improve layout for bagit version badge
HaSistrunk Nov 25, 2024
7ef7fda
linting
HaSistrunk Nov 25, 2024
8641adf
user referrer in URL for conditional transfer details back buttons
HaSistrunk Nov 25, 2024
d359d2c
add 0.96 bagitversion to setup_objects.py
HaSistrunk Nov 25, 2024
b17cb4a
fix object name in template to show bagit versions accepted in details
HaSistrunk Nov 25, 2024
819fd4a
don't hide delete button in form to improve ux of editing existing ba…
HaSistrunk Nov 26, 2024
faabd64
include more detailed error message when bagit form submission fails
HaSistrunk Nov 26, 2024
d5e8652
update backstop to include accessioning UIs
HaSistrunk Nov 26, 2024
7ba6c78
update bagitprofile test to remove formsets
HaSistrunk Nov 26, 2024
51d1380
remove duplicate data from test
HaSistrunk Nov 26, 2024
990cd80
improve form error messages in rights form, fix #664
HaSistrunk Nov 26, 2024
be02831
remove table column sort for size, fix #646
HaSistrunk Nov 26, 2024
77be9e1
delete unused css
HaSistrunk Nov 26, 2024
d1f026f
add accessioning status badge colors
HaSistrunk Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ local_settings.py
db.sqlite3
media
config.py

# BackstopJS
/node_modules
backstop_data/html_report/
bitmaps_test/
32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $ docker-compose exec web import_sample_data

If you'd like to transfer your own bags, note that bags must be serialized as either a TAR (compressed or uncompressed) or ZIP file.

If you'er using S3 storage (see [Transferring digital records](#transferring-digital-records)), you'll need to upload a bag to an S3 bucket configured as an upload bucket for one of your organizations.
If you're using Amazon S3 storage (see [Transferring digital records](#transferring-digital-records)), you'll need to upload a bag to an S3 bucket configured as an upload bucket for one of your organizations.

If you're using local storage you can then transfer those bags by SFTPing them into the local container using the credentials below:
- Protocol: `SFTP`
Expand Down Expand Up @@ -100,30 +100,25 @@ At a high level, transfers are processed as follows:
- Relevant PREMIS rights statements are assigned to transfers (see Organization
Management section for details).

### Disabling S3 Storage
### Disabling Amazon S3 Storage

By default, Aurora is configured to use [Amazon S3](https://aws.amazon.com/s3/) to
store uploaded and validated transfers.
By default, Aurora is configured to use [Amazon S3](https://aws.amazon.com/s3/) to store uploaded and validated transfers.

If you don't want to use S3, you can configure Aurora to use the local file system
instead:
If you don't want to use S3, you can configure Aurora to use the local file system instead:

1. Set the `S3_USE` config value to `False`.
2. Ensure that the `TRANSFER_UPLOADS_ROOT` is properly set and that the filepath
specified there exists and is writable by Aurora.s

## API

Aurora comes with a RESTful API, built using the Django Rest Framework. In addition to interacting with the API via your favorite command-line client, you can also use the browsable API interface available in the application.
Aurora comes with a RESTful API, built using the Django Rest Framework, accessible via any command-line client.

### Authentication

#### Using OAuth

In order to make requests against the Aurora API when using an OAuth provider, you
will first need to add an application to your OAuth provider, then make a request
against the provider's token endpoint using the client credentials flow. The token
returned from the provider should then be attached as a Bearer token to requests.
In order to make requests against the Aurora API when using an OAuth provider, you will first need to add an application to your OAuth provider, then make a request against the provider's token endpoint using the client credentials flow. The token returned from the provider should then be attached as a Bearer token to requests.

The [`ElectronBonder` library](https://github.com/RockefellerArchiveCenter/electronbonder)
contains code which demonstrates this flow (see the `authorize_oauth` method in
Expand Down Expand Up @@ -153,10 +148,23 @@ contains code which demonstrates this flow (see the `authorize` method in

## Django Admin Configuration

Aurora comes with the default [Django admin site](https://docs.djangoproject.com/en/1.11/ref/contrib/admin/). Only users with superuser privileges are able to view this interface, which can be accessed by clicking on the profile menu and selecting "Administration".
Aurora comes with the default [Django admin site](https://docs.djangoproject.com/en/1.11/ref/contrib/admin/). Only users with superuser privileges are able to view this interface, available via the "Admin" navigation menu.

In addition to allowing for the manual creation and deletion of certain objects, this interface also allows authorized users to edit system values which are used by the application, including the human-readable strings associated with Bag Log Codes. Care should be taken when making changes in the Django admin interface, particularly the creation or deletion of objects, since they can have unintended consequences.

## Visual Regression Testing

The repository includes [BackstopJS](https://github.com/garris/BackstopJS) to test visual changes to the site by comparing a set of reference images for different screen sizes. Anytime the CSS styles are changed, use BackstopJS to test locally:

1. Follow the [installation instructions](#installation) to run the Aurora app locally.
2. Add sample data and accessions by running: `docker compose exec web python manage.py loaddata complete`
3. With Aurora running in Docker, open another terminal and run the BackstopJS tests: `yarn backstop-test`.
4. Review the results in the browser and look at the diff of any failed tests.
5. To update the reference image files with the results of the last test images use: `yarn backstop-approve`. Subsequent tests will be compared against these updated reference files.
6. Commit any updated reference images to the repository so that future tests will be compared against the most recent images.

To add or update reference images, edit the scenarios in `backstop.json` and run `yarn backstop-reference`.

## Contributing

Aurora is an open source project and we welcome contributions! If you want to fix a bug, or have an idea of how to enhance the application, the process looks like this:
Expand Down
34 changes: 7 additions & 27 deletions aurora/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@
WSGI_APPLICATION = "aurora.wsgi.application"

REST_FRAMEWORK = {
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination",
"PAGE_SIZE": 50,
"DEFAULT_AUTHENTICATION_CLASSES": (
# "rest_framework_jwt.authentication.JSONWebTokenAuthentication",
"bag_transfer.authentication.CognitoAppAuthentication",
"rest_framework.authentication.SessionAuthentication",
),
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
)
}

# Database
Expand Down Expand Up @@ -164,10 +165,10 @@

# Content Security Policy
CSP_DEFAULT_SRC = ("'self'", 'https://rockarch.matomo.cloud/')
CSP_IMG_SRC = ("'self'")
CSP_STYLE_SRC = ("'self'", "'unsafe-inline'", 'https://cdnjs.cloudflare.com/', 'https://fonts.googleapis.com/')
CSP_SCRIPT_SRC = ("'self'", "'unsafe-inline'", "'unsafe-eval'", 'https://cdnjs.cloudflare.com/', 'https://oss.maxcdn.com/', 'https://cdn.matomo.cloud/', 'https://cdn.datatables.net/')
CSP_FONT_SRC = ("'self'", 'https://fonts.gstatic.com', 'https://cdnjs.cloudflare.com/')
CSP_IMG_SRC = ("'self'", 'https://assets.rockarch.org/')
CSP_STYLE_SRC = ("'self'", "'unsafe-inline'", 'https://assets.rockarch.org/')
CSP_SCRIPT_SRC = ("'self'", "'unsafe-inline'", "'unsafe-eval'", 'https://cdn.matomo.cloud/', 'https://cdn.datatables.net/')
CSP_FONT_SRC = ("'self'", 'https://assets.rockarch.org/')

# Transfer settings
S3_USE = config.S3_USE
Expand Down Expand Up @@ -227,27 +228,6 @@
# Matomo Analytics configs
MTM_ID = config.MTM_ID

# List of colors used in dashboard for record types
RECORD_TYPE_COLORS = [
"#f56954",
"#00a65a",
"#f39c12",
"#00c0ef",
"#3c8dbc",
"#d2d6de",
"#f56954",
"#00a65a",
"#f39c12",
"#00c0ef",
"#3c8dbc",
"#d2d6de",
"#f56954",
"#00a65a",
"#f39c12",
"#00c0ef",
"#3c8dbc",
"#d2d6de",
]

DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'

Expand Down
166 changes: 166 additions & 0 deletions backstop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
{
"id": "backstop_default",
"viewports": [
{
"label": "phone",
"width": 320,
"height": 480
},
{
"label": "tablet",
"width": 1024,
"height": 768
},
{
"label": "desktop",
"width": 1920,
"height": 1080
}
],
"onBeforeScript": "puppet/onBefore.js",
"onReadyScript": "puppet/onReady.js",
"scenarios": [
{
"label": "Login",
"url": "http://localhost:8000/login/"
},
{
"label": "Reset Password",
"url": "http://localhost:8000/reset-password/"
},
{
"label": "Dashboard",
"url": "http://localhost:8000/app/",
"onBeforeScript": "puppet/login.js"
},
{
"label": "All Transfers",
"url": "http://localhost:8000/app/transfers/",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Transfer Detail",
"url": "http://localhost:8000/app/transfers/2",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Appraise",
"url": "http://localhost:8000/app/appraise/",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Appraise Modal",
"url": "http://localhost:8000/app/appraise/",
"clickSelector": ".appraisal-note",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Accessioning Queue",
"url": "http://localhost:8000/app/accession/",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Saved Accessions",
"url": "http://localhost:8000/app/accession/saved",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Accession Details",
"url": "http://localhost:8000/app/accession/3",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Organizations",
"url": "http://localhost:8000/app/orgs",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Add Organization",
"url": "http://localhost:8000/app/orgs/add",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Organization Admin",
"url": "http://localhost:8000/app/orgs/1",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Organization Admin Modal",
"url": "http://localhost:8000/app/orgs/1",
"clickSelector": ".object-delete-button",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Organization Admin Transfer Settings",
"url": "http://localhost:8000/app/orgs/1",
"clickSelector": "#show-transfer-settings",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Edit BagIt Profile",
"url": "http://localhost:8000/app/bagit-profiles/1/edit/",
"onBeforeScript": "puppet/login.js"
},
{
"label": "View BagIt Profile",
"url": "http://localhost:8000/app/bagit-profiles/1/",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Edit Rights",
"url": "http://localhost:8000/app/rights/1/edit",
"onBeforeScript": "puppet/login.js"
},
{
"label": "View Rights",
"url": "http://localhost:8000/app/rights/1/",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Users",
"url": "http://localhost:8000/app/users/",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Add User",
"url": "http://localhost:8000/app/users/add/",
"onBeforeScript": "puppet/login.js"
},
{
"label": "User Details",
"url": "http://localhost:8000/app/users/5/",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Edit User",
"url": "http://localhost:8000/app/users/5/edit/",
"onBeforeScript": "puppet/login.js"
},
{
"label": "User Profile",
"url": "http://localhost:8000/app/users/1/",
"onBeforeScript": "puppet/login.js"
},
{
"label": "Change Password",
"url": "http://localhost:8000/app/users/change-password/",
"onBeforeScript": "puppet/login.js"
}
],
"paths": {
"bitmaps_reference": "backstop_data/bitmaps_reference",
"bitmaps_test": "backstop_data/bitmaps_test",
"engine_scripts": "backstop_data/engine_scripts",
"html_report": "backstop_data/html_report",
"ci_report": "backstop_data/ci_report"
},
"report": ["browser"],
"engine": "puppeteer",
"engineOptions": {
"args": ["--no-sandbox"]
},
"asyncCaptureLimit": 1,
"asyncCompareLimit": 50,
"debug": false,
"debugWindow": false
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions backstop_data/engine_scripts/cookies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"domain": ".www.yourdomain.com",
"path": "/",
"name": "yourCookieName",
"value": "yourCookieValue",
"expirationDate": 1798790400,
"hostOnly": false,
"httpOnly": false,
"secure": false,
"session": false,
"sameSite": "Lax"
}
]
Binary file added backstop_data/engine_scripts/imageStub.jpg
43 changes: 43 additions & 0 deletions backstop_data/engine_scripts/playwright/clickAndHoverHelper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
module.exports = async (page, scenario) => {
const hoverSelector = scenario.hoverSelectors || scenario.hoverSelector;
const clickSelector = scenario.clickSelectors || scenario.clickSelector;
const keyPressSelector = scenario.keyPressSelectors || scenario.keyPressSelector;
const scrollToSelector = scenario.scrollToSelector;
const postInteractionWait = scenario.postInteractionWait; // selector [str] | ms [int]

if (keyPressSelector) {
for (const keyPressSelectorItem of [].concat(keyPressSelector)) {
await page.waitForSelector(keyPressSelectorItem.selector);
await page.type(keyPressSelectorItem.selector, keyPressSelectorItem.keyPress);
}
}

if (hoverSelector) {
for (const hoverSelectorIndex of [].concat(hoverSelector)) {
await page.waitForSelector(hoverSelectorIndex);
await page.hover(hoverSelectorIndex);
}
}

if (clickSelector) {
for (const clickSelectorIndex of [].concat(clickSelector)) {
await page.waitForSelector(clickSelectorIndex);
await page.click(clickSelectorIndex);
}
}

if (postInteractionWait) {
if (parseInt(postInteractionWait) > 0) {
await page.waitForTimeout(postInteractionWait);
} else {
await page.waitForSelector(postInteractionWait);
}
}

if (scrollToSelector) {
await page.waitForSelector(scrollToSelector);
await page.evaluate(scrollToSelector => {
document.querySelector(scrollToSelector).scrollIntoView();
}, scrollToSelector);
}
};
31 changes: 31 additions & 0 deletions backstop_data/engine_scripts/playwright/interceptImages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* INTERCEPT IMAGES
* Listen to all requests. If a request matches IMAGE_URL_RE
* then stub the image with data from IMAGE_STUB_URL
*
* Use this in an onBefore script E.G.
```
module.exports = async function(page, scenario) {
require('./interceptImages')(page, scenario);
}
```
*
*/

const fs = require('fs');
const path = require('path');

const IMAGE_URL_RE = /\.gif|\.jpg|\.png/i;
const IMAGE_STUB_URL = path.resolve(__dirname, '../../imageStub.jpg');
const IMAGE_DATA_BUFFER = fs.readFileSync(IMAGE_STUB_URL);
const HEADERS_STUB = {};

module.exports = async function (page, scenario) {
page.route(IMAGE_URL_RE, route => {
route.fulfill({
body: IMAGE_DATA_BUFFER,
headers: HEADERS_STUB,
status: 200
});
});
};
Loading