@auxcode/auxta 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -36,9 +36,13 @@ npm i
36
36
  # Default 1000
37
37
  "timeout": 1000,
38
38
  # The credentials of the user that uploads the tests to the site
39
- "email": "",
40
- "password": "",
41
- "token": ""
39
+ "email": "string",
40
+ "password": "string",
41
+ "token": "string"
42
+ # Screen width and height used in the testing
43
+ # Allows testing from mobile devices screens
44
+ "screenWidth": 1920,
45
+ "screenHeight": 1080,
42
46
  }
43
47
 
44
48
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auxcode/auxta",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "",
5
5
  "main": "src/AuxTA.ts",
6
6
  "scripts": {
@@ -16,6 +16,8 @@ export function setupConfig(jsonConfig: any) {
16
16
  if (!jsonConfig.suitesList) throw new Error("suitesList");
17
17
  config.suitesList = jsonConfig.suitesList;
18
18
  if (jsonConfig.timeout) config.timeout = jsonConfig.timeout;
19
+ if (jsonConfig.screenWidth) config.screenWidth = jsonConfig.screenWidth;
20
+ if (jsonConfig.screenHeight) config.screenHeight = jsonConfig.screenHeight;
19
21
  }
20
22
 
21
23
  export let config = {
@@ -26,6 +28,8 @@ export let config = {
26
28
  netlifyPath: "",
27
29
  digitalProduct: "",
28
30
  token: "",
31
+ screenWidth: 1920,
32
+ screenHeight: 1080,
29
33
  timeout: 10000,
30
34
  suitesList: [],
31
35
  auxtaCredentials: {
@@ -14,17 +14,23 @@ export class Puppeteer {
14
14
  private browser!: puppeteer_core.Browser;
15
15
 
16
16
  public async startBrowser() {
17
+ let args = [
18
+ '--start-maximized',
19
+ '--no-sandbox',
20
+ '--disable-setuid-sandbox',
21
+ '--disable-dev-shm-usage',
22
+ '--single-process'
23
+ ];
24
+ if (process.env.ENVIRONMENT != 'LOCAL')
25
+ args.push(`--window-size=${config.screenWidth},${config.screenHeight}`)
17
26
  this.browser = await chromium.puppeteer.launch({
18
27
  executablePath: process.env.NODE_ENV !== 'production' ? undefined : await chromium.executablePath,
19
- args: [
20
- '--start-maximized',
21
- '--no-sandbox',
22
- '--disable-setuid-sandbox',
23
- '--disable-dev-shm-usage',
24
- '--single-process'
25
- ],
26
- defaultViewport: null,
27
- // Return back to headless for commit
28
+ args,
29
+ defaultViewport: process.env.ENVIRONMENT == 'LOCAL' ? null : {
30
+ width: config.screenWidth,
31
+ height: config.screenHeight
32
+ },
33
+ // Return back to headless for netlify
28
34
  headless: process.env.ENVIRONMENT == 'LOCAL' ? false : chromium.headless
29
35
  });
30
36
  this.defaultPage = (await this.browser.pages())[0];