test: change page load strategy to improve integration tests

This commit is contained in:
Andy O'Neill 2023-04-11 09:05:06 -04:00
parent edd0bef52f
commit 374f75bdee
2 changed files with 5 additions and 1 deletions

View file

@ -4,7 +4,8 @@ const SeleniumHelper = require('./selenium-helpers.js');
const {
clickText,
buildDriver
buildDriver,
findText
} = new SeleniumHelper();
let rootUrl = process.env.ROOT_URL || 'https://scratch.ly';
@ -20,6 +21,7 @@ describe('www-integration footer links', () => {
beforeEach(async () => {
await driver.get(rootUrl);
await findText('Create stories, games, and animations');
});
afterAll(async () => await driver.quit());

View file

@ -1,4 +1,5 @@
const webdriver = require('selenium-webdriver');
const {PageLoadStrategy} = require('selenium-webdriver/lib/capabilities');
const bindAll = require('lodash.bindall');
require('chromedriver');
const chromedriverVersion = require('chromedriver').version;
@ -60,6 +61,7 @@ class SeleniumHelper {
args.push('--no-sandbox');
}
chromeCapabilities.set('chromeOptions', {args});
chromeCapabilities.setPageLoadStrategy(PageLoadStrategy.EAGER);
let driver = new webdriver.Builder()
.forBrowser('chrome')
.withCapabilities(chromeCapabilities)