Skip to content

Commit

Permalink
Updating to latest E2E test utils. Using clickButton instead of our o…
Browse files Browse the repository at this point in the history
…wn custom, which will scroll down if not in view.
  • Loading branch information
brianhogg committed Dec 9, 2024
1 parent 3f9e3b0 commit 5b0e235
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 33 deletions.
64 changes: 42 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/llms-e2e-test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"main": "src/index.js",
"dependencies": {
"@wordpress/e2e-test-utils": "^7.0.0",
"@wordpress/e2e-test-utils": "^11.13.0",
"css-xpath": "^1.0.0",
"semver": "^7.3.5"
},
Expand Down
2 changes: 0 additions & 2 deletions packages/llms-e2e-test-utils/src/click.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @return {void}
*/
export async function click( selector ) {
const target = await page.$( selector );
target.scrollIntoView();
await page.waitForSelector( selector );
await page.$eval( selector, ( el ) => el.click() );
}
20 changes: 12 additions & 8 deletions packages/llms-e2e-test-utils/src/run-setup-wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { findElementByText } from './find-element-by-text';
import { wpVersionCompare } from './wp-version-compare';
import { dismissEditorWelcomeGuide } from './dismiss-editor-welcome-guide';

import { visitAdminPage } from '@wordpress/e2e-test-utils';
import { visitAdminPage, clickButton } from '@wordpress/e2e-test-utils';

/**
* Retrieve the Setup Wizard Page Title.
Expand Down Expand Up @@ -78,22 +78,26 @@ export async function runSetupWizard( {
} else if ( coursesToImport ) {
// Import courses.

console.log('taking before screenshot');
await page.screenshot({
path: 'screenshots/before-selecting-courses-setup-wizard.jpg'
});

// Select specified courses.
for ( const courseTitle of coursesToImport ) {
await clickElementByText( courseTitle, 'h3' );
}

console.log('taking after screenshot');
await page.screenshot({
path: 'screenshots/after-selecting-courses-setup-wizard.jpg'
});

await clickAndWait( '.llms-setup-actions .llms-button-primary' );
await clickButton( 'Import Courses' );

await page.screenshot({
path: 'screenshots/after-clicked-import-button.jpg'
});

await page.waitForNavigation();

await page.screenshot({
path: 'screenshots/after-setup-wizard-navigation.jpg'
});

if ( 1 === coursesToImport.length ) {
// Single course imported.
Expand Down

0 comments on commit 5b0e235

Please sign in to comment.