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

Update Test page content and add test case for TOC scrollable indicator #155

Merged
merged 1 commit into from Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile.database
Expand Up @@ -2,7 +2,7 @@ FROM mariadb:10.6.7

COPY src/seedDb.sh /docker-entrypoint-initdb.d/

ARG database="database_2022-10-07_10-53-14-0600(MDT).tar.gz"
ARG database="database_2023-01-11_12-42-02-0600(CST).tar.gz"
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome job!


RUN apt-get update && apt-get install -y \
curl \
Expand Down
9 changes: 9 additions & 0 deletions configDesktop.js
Expand Up @@ -45,6 +45,15 @@ const tests = [
path: '/wiki/Test',
selectors: [ 'html' ]
},
{
label: 'Test expanded scrolled TOC (#vector-2022, #sidebar-closed, #scroll-toc)',
path: '/wiki/Test',
selectors: [ 'viewport' ],
viewports: [
VIEWPORT_DESKTOP,
VIEWPORT_DESKTOP_WIDE
]
},
{
label: 'Special:BlankPage (#vector-2022, #sidebar-open)',
path: '/wiki/Special:BlankPage'
Expand Down
4 changes: 4 additions & 0 deletions src/engine-scripts/puppet/onReady.js
Expand Up @@ -26,6 +26,10 @@ module.exports = async ( page, scenario ) => {
await require( './collapsedTocState' )( page, hashtags );
}

if ( hashtags.includes( '#scroll-toc' ) ) {
await require( './scrollToc.js' )( page );
}

// These only apply to Minerva
if ( hashtags.includes( '#minerva' ) ) {
await require( './minerva/mainMenuState' )( page, hashtags );
Expand Down
13 changes: 13 additions & 0 deletions src/engine-scripts/puppet/scrollToc.js
@@ -0,0 +1,13 @@
module.exports = async ( page ) => {
await page.evaluate( () => {
const tocElement = document.getElementById( 'vector-toc' );
const tocToggleBtns = tocElement.querySelectorAll( '.vector-toc-toggle' );
for ( const btn of tocToggleBtns ) {
btn.click();
}
tocElement.scrollBy( 0, tocElement.scrollHeight );
// Scroll up 30px from the bottom of the TOC to allow the scrollable indicator to show
tocElement.scrollBy( 0, -30 );
Copy link
Contributor

Choose a reason for hiding this comment

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

We might need to wait a number of frames after the scroll as I noticed that one test failed for me because it seems that the new scroll position hadn't been painted yet [1]

Screen Shot 2023-01-13 at 3 36 32 PM

return true;
} );
};