|
| 1 | +const puppeteer = require('puppeteer'); // v23.0.0 or later |
| 2 | + |
| 3 | +(async () => { |
| 4 | + const browser = await puppeteer.launch(); |
| 5 | + const page = await browser.newPage(); |
| 6 | + const timeout = 5000; |
| 7 | + page.setDefaultTimeout(timeout); |
| 8 | + |
| 9 | + { |
| 10 | + const targetPage = page; |
| 11 | + await targetPage.setViewport({ |
| 12 | + width: 802, |
| 13 | + height: 633 |
| 14 | + }) |
| 15 | + } |
| 16 | + { |
| 17 | + const targetPage = page; |
| 18 | + await targetPage.goto('http://localhost:5173/'); |
| 19 | + } |
| 20 | + { |
| 21 | + const targetPage = page; |
| 22 | + await puppeteer.Locator.race([ |
| 23 | + targetPage.locator('::-p-aria(new) >>>> ::-p-aria([role=\\"button\\"])'), |
| 24 | + targetPage.locator('nav button'), |
| 25 | + targetPage.locator('::-p-xpath(//*[@id=\\"root\\"]/div/nav/a/button)'), |
| 26 | + targetPage.locator(':scope >>> nav button') |
| 27 | + ]) |
| 28 | + .setTimeout(timeout) |
| 29 | + .click({ |
| 30 | + offset: { |
| 31 | + x: 29, |
| 32 | + y: 26, |
| 33 | + }, |
| 34 | + }); |
| 35 | + } |
| 36 | + { |
| 37 | + const targetPage = page; |
| 38 | + await puppeteer.Locator.race([ |
| 39 | + targetPage.locator('::-p-aria(editor) >>>> ::-p-aria([role=\\"paragraph\\"])'), |
| 40 | + targetPage.locator('p'), |
| 41 | + targetPage.locator('::-p-xpath(//*[@id=\\"root\\"]/div/div/div[2]/div[1]/div/div/div/div[1]/div/p)'), |
| 42 | + targetPage.locator(':scope >>> p') |
| 43 | + ]) |
| 44 | + .setTimeout(timeout) |
| 45 | + .click({ |
| 46 | + offset: { |
| 47 | + x: 113.875, |
| 48 | + y: 13, |
| 49 | + }, |
| 50 | + }); |
| 51 | + } |
| 52 | + { |
| 53 | + const targetPage = page; |
| 54 | + await puppeteer.Locator.race([ |
| 55 | + targetPage.locator('div.flex-col > div.grid > div > div > div > div:nth-of-type(1) > div'), |
| 56 | + targetPage.locator('::-p-xpath(//*[@id=\\"root\\"]/div/div/div[2]/div[1]/div/div/div/div[1]/div)'), |
| 57 | + targetPage.locator(':scope >>> div.flex-col > div.grid > div > div > div > div:nth-of-type(1) > div') |
| 58 | + ]) |
| 59 | + .setTimeout(timeout) |
| 60 | + .fill('cypress content'); |
| 61 | + } |
| 62 | + { |
| 63 | + const targetPage = page; |
| 64 | + await puppeteer.Locator.race([ |
| 65 | + targetPage.locator('html'), |
| 66 | + targetPage.locator('::-p-xpath(/html)'), |
| 67 | + targetPage.locator(':scope >>> html') |
| 68 | + ]) |
| 69 | + .setTimeout(timeout) |
| 70 | + .click({ |
| 71 | + offset: { |
| 72 | + x: 681, |
| 73 | + y: 325, |
| 74 | + }, |
| 75 | + }); |
| 76 | + } |
| 77 | + { |
| 78 | + const targetPage = page; |
| 79 | + await puppeteer.Locator.race([ |
| 80 | + targetPage.locator('::-p-aria(# simple)'), |
| 81 | + targetPage.locator('div:nth-of-type(8)'), |
| 82 | + targetPage.locator('::-p-xpath(//*[@id=\\"radix-_r_f_\\"]/div[2]/div[8])'), |
| 83 | + targetPage.locator(':scope >>> div:nth-of-type(8)'), |
| 84 | + targetPage.locator('::-p-text(# simple)') |
| 85 | + ]) |
| 86 | + .setTimeout(timeout) |
| 87 | + .click({ |
| 88 | + offset: { |
| 89 | + x: 84, |
| 90 | + y: 17, |
| 91 | + }, |
| 92 | + }); |
| 93 | + } |
| 94 | + { |
| 95 | + const targetPage = page; |
| 96 | + await puppeteer.Locator.race([ |
| 97 | + targetPage.locator('div.flex-col'), |
| 98 | + targetPage.locator('::-p-xpath(//*[@id=\\"root\\"]/div/div/div[2])'), |
| 99 | + targetPage.locator(':scope >>> div.flex-col'), |
| 100 | + targetPage.locator('::-p-text(cypress contentPFont size→← TableTag#simple)') |
| 101 | + ]) |
| 102 | + .setTimeout(timeout) |
| 103 | + .click({ |
| 104 | + offset: { |
| 105 | + x: 389.875, |
| 106 | + y: 314, |
| 107 | + }, |
| 108 | + }); |
| 109 | + } |
| 110 | + { |
| 111 | + const targetPage = page; |
| 112 | + await puppeteer.Locator.race([ |
| 113 | + targetPage.locator('::-p-aria([role=\\"link\\"]) >>>> ::-p-aria([role=\\"button\\"])'), |
| 114 | + targetPage.locator('a > button'), |
| 115 | + targetPage.locator('::-p-xpath(//*[@id=\\"root\\"]/div/div/div[1]/a/button)'), |
| 116 | + targetPage.locator(':scope >>> a > button') |
| 117 | + ]) |
| 118 | + .setTimeout(timeout) |
| 119 | + .click({ |
| 120 | + offset: { |
| 121 | + x: 14.875, |
| 122 | + y: 13, |
| 123 | + }, |
| 124 | + }); |
| 125 | + } |
| 126 | + |
| 127 | + await browser.close(); |
| 128 | + |
| 129 | +})().catch(err => { |
| 130 | + console.error(err); |
| 131 | + process.exit(1); |
| 132 | +}); |
0 commit comments