Skip to content

Commit

Permalink
updates to pptr script. natcap#851
Browse files Browse the repository at this point in the history
  • Loading branch information
davemfish committed Mar 10, 2023
1 parent 3f63182 commit 7b8b2b8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions workbench/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"functions": "never"
}],
"import/no-extraneous-dependencies": [error, { devDependencies: true }],
"jest/valid-expect": ["error", { "maxArgs": 2 }],
"linebreak-style": ["off", ],
"max-classes-per-file": ["error", 2],
"object-shorthand": ["error", "never"],
Expand Down
8 changes: 4 additions & 4 deletions workbench/electron-builder-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ const config = {
from: '../dist/invest',
to: 'invest',
},
// {
// from: '../dist/userguide',
// to: 'documentation',
// },
{
from: '../dist/userguide',
to: 'documentation',
},
{
from: 'resources/storage_token.txt',
to: 'storage_token.txt',
Expand Down
22 changes: 14 additions & 8 deletions workbench/tests/binary_tests/puppet.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ beforeEach(() => {
});

test('Run a real invest model', async () => {
const { findByText, findByLabelText, findByRole } = queries;
const { findByText, findByRole } = queries;
// On GHA MacOS, we seem to have to wait a long time for the browser
// to be ready. Maybe related to https://github.com/natcap/invest-workbench/issues/158
await waitFor(() => {
Expand Down Expand Up @@ -230,8 +230,8 @@ test('Run a real invest model', async () => {
await page.screenshot({ path: `${SCREENSHOT_PREFIX}6-run-canceled.png` });
}, 240000); // >2x the sum of all the max timeouts within this test

test.only('Check local userguide links', async () => {
const { findByText, findAllByRole, findByRole, getByText } = queries;
test('Check local userguide links', async () => {
const { findByText, findAllByRole, findByRole, } = queries;
// On GHA MacOS, we seem to have to wait a long time for the browser
// to be ready. Maybe related to https://github.com/natcap/invest-workbench/issues/158
await waitFor(() => {
Expand Down Expand Up @@ -259,20 +259,26 @@ test.only('Check local userguide links', async () => {
const btn = modelButtons[i];
await btn.click();
const link = await findByText(doc, "User's Guide");
await page.waitForTimeout(300); // link.click() not working w/o this pause
const hrefHandle = await link.getProperty('href');
const hrefValue = await hrefHandle.jsonValue();
link.click();
await link.click();
const ugTarget = await BROWSER.waitForTarget(
(target) => target.url() === hrefValue
);
const ugPage = await ugTarget.page();
const ugDoc = await getDocument(ugPage);
expect(getByText(ugDoc, 'Table of Contents')).toBeInTheDocument();
ugPage.close();
try {
await findByText(ugDoc, 'Table of Contents');
} catch {
throw new Error(`${hrefValue} not found`);
}

await ugPage.close();
const tab = await page.waitForSelector('.nav-item');
const closeTabBtn = await findByRole(tab, 'button');
closeTabBtn.click();
await page.waitForTimeout(1000);
await closeTabBtn.click();
await page.waitForTimeout(300);
}
});

Expand Down

0 comments on commit 7b8b2b8

Please sign in to comment.