mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-28 23:28:16 +02:00
Add some integration tests using puppeteer and Jasmine
* run with `gulp integrationtest`
This commit is contained in:
parent
b194c820bf
commit
5b42ac364a
6 changed files with 326 additions and 47 deletions
63
test/integration/annotation_spec.js
Normal file
63
test/integration/annotation_spec.js
Normal file
|
@ -0,0 +1,63 @@
|
|||
/* Copyright 2020 Mozilla Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("Annotation highlight", () => {
|
||||
describe("annotation-highlight.pdf", () => {
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await Promise.all(
|
||||
global.integrationSessions.map(async session => {
|
||||
const page = await session.browser.newPage();
|
||||
await page.goto(
|
||||
`${global.integrationBaseUrl}?file=/test/pdfs/annotation-highlight.pdf`
|
||||
);
|
||||
await page.bringToFront();
|
||||
await page.waitForSelector("[data-annotation-id='19R']", {
|
||||
timeout: 0,
|
||||
});
|
||||
return page;
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await Promise.all(
|
||||
pages.map(async page => {
|
||||
await page.close();
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it("must show a popup on mouseover", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async page => {
|
||||
let hidden = await page.$eval(
|
||||
"[data-annotation-id='21R']",
|
||||
el => el.hidden
|
||||
);
|
||||
expect(hidden).toEqual(true);
|
||||
await page.hover("[data-annotation-id='19R']");
|
||||
await page.waitForTimeout(100);
|
||||
hidden = await page.$eval(
|
||||
"[data-annotation-id='21R']",
|
||||
el => el.hidden
|
||||
);
|
||||
expect(hidden).toEqual(false);
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue