Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e1ad8a6

Browse files
update readme
1 parent 3698f5f commit e1ad8a6

File tree

5 files changed

+292
-198
lines changed

5 files changed

+292
-198
lines changed

‎HTML-CSS/Star-Rating.md

Lines changed: 0 additions & 189 deletions
This file was deleted.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
/**
2+
* @name Alibaba product search
3+
* @desc Searches Alibaba.com for a product and checks if the results show up
4+
*/
5+
const puppeteer = require('puppeteer')
6+
7+
8+
// the site you want a styleguide for
9+
const URL = "https://google.com/";
10+
11+
const delaySecond = async (time) => await new Promise(res => setTimeout(res, 1000 * time));
12+
13+
14+
const headless = true;
15+
16+
const defaultViewport = {
17+
width: 1080,
18+
height: 800,
19+
deviceScaleFactor: 1,
20+
}
21+
22+
let chromeSettings = {
23+
timeout: 0,
24+
headless: headless,
25+
devtools: false,
26+
27+
// if this is different on your machine, goto chrome://version/ and find the path.
28+
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
29+
defaultViewport: defaultViewport
30+
};
31+
32+
let edgeSettings = {
33+
timeout: 0,
34+
headless: headless,
35+
devtools: false,
36+
// if this is different on your machine, goto edge://version/ and find the path.
37+
// executablePath: 'C:\\Users\\joe\\AppData\\Local\\Microsoft\\Edge SxS\\Application\\msedge.exe'
38+
executablePath: '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',
39+
defaultViewport: defaultViewport
40+
};
41+
42+
let fireSettings = {
43+
args: [
44+
'--ignore-certificate-errors',
45+
'--enable-features=NetworkService',
46+
],
47+
product: 'firefox',
48+
// executablePath:'/Applications/Firefox.app/Contents/MacOS/firefox',
49+
// executablePath: "C:\\Program Files\\Mozilla Firefox\\firefox.exe
50+
// executablePath: 'C:\\Users\\joe\\AppData\\Local\\Microsoft\\Edge SxS\\Application\\msedge.exe',
51+
timeout: 0,
52+
headless: headless,
53+
devtools: false,
54+
defaultViewport: defaultViewport
55+
};
56+
57+
58+
59+
beforeAll(async () => {
60+
// chrome = await puppeteer.launch(chromeSettings)
61+
// chrome_page = await chrome.newPage()
62+
63+
// edge = await puppeteer.launch(edgeSettings)
64+
// edge_page = await edge.newPage()
65+
66+
// firefox = puppeteer.launch(fireSettings)
67+
// fire_page = await firefox.newPage()
68+
})
69+
70+
describe('Open the website in Chrome, FireFox and Chrome-Edge', () => {
71+
72+
test('Should open a website with chrome', async () => {
73+
let browser = await puppeteer.launch(chromeSettings)
74+
try {
75+
let page = await browser.newPage()
76+
let site = await page.goto(URL)
77+
let screenshot = await page.screenshot({
78+
path: './Browsers/Chrome.png',
79+
fullPage: true
80+
})
81+
let img = await page.waitForSelector('#hplogo')
82+
83+
// await Promise.all([browser,page,site,screenshot,img]);
84+
expect(img).toBeTruthy()
85+
86+
} catch (error) {
87+
console.error(`Chrome`,error)
88+
return Promise.reject(error);
89+
}
90+
await browser.close();
91+
}, 10000)
92+
93+
test('Should open a website with chrome-EDGE', async () => {
94+
let browser = await puppeteer.launch(edgeSettings)
95+
try {
96+
let page = await browser.newPage()
97+
let site = await page.goto(URL)
98+
let screenshot = await page.screenshot({
99+
path: './Browsers/Edge.png',
100+
fullPage: true
101+
})
102+
// Download btn should appear
103+
let img = await page.waitForSelector('#hplogo')
104+
// const downloadBTN = await page.$(downloadSelector)
105+
expect(img).toBeTruthy()
106+
} catch (error) {
107+
console.error(`EDGE`,error)
108+
return Promise.reject(error);
109+
}
110+
await browser.close()
111+
}, 10000)
112+
113+
114+
115+
116+
afterAll(async () => {
117+
// await browser.close()
118+
})
119+
})
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
2+
3+
### Table of Contents
4+
5+
- [app][1]
6+
- [HTML][2]
7+
- [Parameters][3]
8+
- [Examples][4]
9+
- [use][5]
10+
11+
## app
12+
13+
SimpleExpress.js
14+
15+
**Meta**
16+
17+
- **author**: Jane Smith &lt;jsmith@example.com>
18+
19+
## HTML
20+
21+
### Parameters
22+
23+
- `header` **[string][6]** is intended to accept the client `<script>`, `<style>`, `<link>` or `<meta>` tags.
24+
- `body` **[string][6]** is intented to accept html as an arguement.
25+
- `footer` **[string][6]** is intended to accept the client `<script>` or any other html you would want at the end of your document.
26+
27+
### Examples
28+
29+
```javascript
30+
<!DOCTYPE html>
31+
<html lang="en">
32+
<head>
33+
<meta charset="UTF-8">
34+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
35+
<title>Document</title>
36+
<link rel="stylesheet" href="./public/style.css">
37+
</head>
38+
<body>
39+
<h1>Hello World</h1>
40+
<script src="./public/alert.js"></script>
41+
</body>
42+
</html>
43+
```
44+
45+
Returns **[string][6]** this should be proper html.
46+
47+
## use
48+
49+
[1]: #app
50+
51+
[2]: #html
52+
53+
[3]: #parameters
54+
55+
[4]: #examples
56+
57+
[5]: #use
58+
59+
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /