Merge pull request #13355 from calixteman/fix_integration_test2

Fix some integration tests
This commit is contained in:
Tim van der Meij 2021-05-08 18:41:29 +02:00 committed by GitHub
commit a6f324dcc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -72,6 +72,10 @@ describe("Checkbox annotation", () => {
pages.map(async ([browserName, page]) => { pages.map(async ([browserName, page]) => {
for (const selector of selectors) { for (const selector of selectors) {
await page.click(selector); await page.click(selector);
await page.waitForFunction(
`document.querySelector("${selector} > :first-child").checked`
);
for (const otherSelector of selectors) { for (const otherSelector of selectors) {
const checked = await page.$eval( const checked = await page.$eval(
`${otherSelector} > :first-child`, `${otherSelector} > :first-child`,

View File

@ -67,6 +67,10 @@ describe("Interaction", () => {
await page.type("#\\34 16R", "3.14159", { delay: 200 }); await page.type("#\\34 16R", "3.14159", { delay: 200 });
await page.click("#\\34 19R"); await page.click("#\\34 19R");
await page.waitForFunction(
`getComputedStyle(document.querySelector("#\\\\34 27R")).visibility !== "hidden"`
);
visibility = await page.$eval( visibility = await page.$eval(
"#\\34 27R", "#\\34 27R",
el => getComputedStyle(el).visibility el => getComputedStyle(el).visibility
@ -80,6 +84,10 @@ describe("Interaction", () => {
// and leave it // and leave it
await page.click("#\\34 19R"); await page.click("#\\34 19R");
await page.waitForFunction(
`getComputedStyle(document.querySelector("#\\\\34 27R")).visibility !== "visible"`
);
visibility = await page.$eval( visibility = await page.$eval(
"#\\34 27R", "#\\34 27R",
el => getComputedStyle(el).visibility el => getComputedStyle(el).visibility
@ -531,6 +539,7 @@ describe("Interaction", () => {
await Promise.all( await Promise.all(
pages.map(async ([browserName, page]) => { pages.map(async ([browserName, page]) => {
for (const num of [7, 6, 4, 3, 2, 1]) { for (const num of [7, 6, 4, 3, 2, 1]) {
await clearInput(page, "#\\33 3R");
await page.click(`option[value=Export${num}]`); await page.click(`option[value=Export${num}]`);
await page.waitForFunction( await page.waitForFunction(
`document.querySelector("#\\\\33 3R").value !== ""` `document.querySelector("#\\\\33 3R").value !== ""`
@ -560,6 +569,7 @@ describe("Interaction", () => {
); );
for (const num of [7, 6, 4, 3, 2, 1]) { for (const num of [7, 6, 4, 3, 2, 1]) {
await clearInput(page, "#\\33 3R");
await page.click(`option[value=Export${num}]`); await page.click(`option[value=Export${num}]`);
await page.waitForFunction( await page.waitForFunction(
`document.querySelector("#\\\\33 3R").value !== ""` `document.querySelector("#\\\\33 3R").value !== ""`
@ -579,6 +589,7 @@ describe("Interaction", () => {
let len = 6; let len = 6;
for (const num of [1, 3, 5, 6, 431, -1, 0]) { for (const num of [1, 3, 5, 6, 431, -1, 0]) {
++len; ++len;
await clearInput(page, "#\\33 3R");
await clearInput(page, "#\\33 9R"); await clearInput(page, "#\\33 9R");
await page.type("#\\33 9R", `${num},Insert${num},Tresni${num}`, { await page.type("#\\33 9R", `${num},Insert${num},Tresni${num}`, {
delay: 10, delay: 10,
@ -611,6 +622,7 @@ describe("Interaction", () => {
pages.map(async ([browserName, page]) => { pages.map(async ([browserName, page]) => {
let len = 6; let len = 6;
// Click on Restore button. // Click on Restore button.
await clearInput(page, "#\\33 3R");
await page.click("[data-annotation-id='37R']"); await page.click("[data-annotation-id='37R']");
await page.waitForFunction( await page.waitForFunction(
`document.querySelector("#\\\\33 0R").children.length === ${len}` `document.querySelector("#\\\\33 0R").children.length === ${len}`