Skip to content

Commit 5f2012c

Browse files
authored
Update integration tests and package versions (#211)
* Update gas-types-detailed package * Update LICENSE * update node versions and macos versions in workflows * add NODE_OPTIONS env: max_old_space_size=4096 * support new log-in flow
1 parent 7a26c69 commit 5f2012c

9 files changed

+111
-22
lines changed

.github/workflows/integration-tests-basic.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ jobs:
99
runs-on: ${{ matrix.os }}
1010
strategy:
1111
matrix:
12-
os: [macos-10.15, macos-latest, windows-latest]
12+
os: [macos-11, macos-latest, windows-latest]
1313
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
14-
node-version: [12, 14, 16]
14+
node-version: [14, 16, 18]
1515
timeout-minutes: 8
1616
steps:
1717
- uses: actions/checkout@v2
@@ -21,9 +21,9 @@ jobs:
2121
node-version: ${{ matrix.node-version }}
2222
- name: Install packages [npm ci]
2323
run: npm ci
24-
- name: Allow installing cert in Mac OS Big Sur
24+
- name: Allow running mkcert on Mac
2525
run: sudo security authorizationdb write com.apple.trust-settings.admin allow
26-
if: matrix.os == 'macOS-latest'
26+
if: runner.os == 'MacOS'
2727
- name: Install mkcert
2828
run: brew install mkcert
2929
if: runner.os == 'MacOS'

.github/workflows/integration-tests-extended.yaml

+7-5
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
runs-on: ${{ matrix.os }}
99
strategy:
1010
matrix:
11-
os: [macos-10.15, macos-latest, windows-latest]
11+
os: [macos-11, macos-latest, windows-latest]
1212
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
13-
node-version: [12, 14, 16]
13+
node-version: [14, 16, 18]
1414
timeout-minutes: 11
1515
steps:
1616
- uses: actions/checkout@v2
@@ -20,9 +20,9 @@ jobs:
2020
node-version: ${{ matrix.node-version }}
2121
- name: Install packages [npm ci]
2222
run: npm ci
23-
- name: Allow installing cert in Mac OS Big Sur
23+
- name: Allow running mkcert on Mac
2424
run: sudo security authorizationdb write com.apple.trust-settings.admin allow
25-
if: matrix.os == 'macOS-latest'
25+
if: runner.os == 'MacOS'
2626
- name: Install mkcert
2727
run: brew install mkcert
2828
if: runner.os == 'MacOS'
@@ -32,7 +32,7 @@ jobs:
3232
- name: Install https cert [npm setup:https]
3333
run: npm run setup:https
3434
if: runner.os == 'MacOS'
35-
- run: |
35+
- run: |
3636
mkdir certs
3737
.\test\generate-cert.ps1
3838
shell: pwsh
@@ -67,6 +67,8 @@ jobs:
6767
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
6868
- name: Build and deploy dev setup [npm run deploy:dev]
6969
run: npm run deploy:dev
70+
env:
71+
NODE_OPTIONS: '--max_old_space_size=4096'
7072
- name: Run integration tests
7173
run: npm run test:integration:extended
7274
shell: bash

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Elisha Nuchi
3+
Copyright (c) 2024 Elisha Nuchi
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<img width="400" src="https://i.imgur.com/83Y7bWN.png" alt="React & Google Apps Script logos"></a>
44
</p>
55
<p align="center"><i>
6-
Update 2023: Now with support for React v18 and React Fast Refresh
6+
With support for React v18 and React Fast Refresh
77
</i></p>
88

99
<div align="center">

package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"eslint-plugin-standard": "^5.0.0",
9090
"gas-client": "^1.1.1",
9191
"gas-lib": "^2.0.4",
92-
"gas-types-detailed": "^1.1.0",
92+
"gas-types-detailed": "^1.1.2",
9393
"gas-webpack-plugin": "^2.2.2",
9494
"html-webpack-plugin": "^5.5.0",
9595
"jest": "^28.1.1",
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/* eslint-disable */
2+
3+
/**
4+
* Reference: https://github.com/americanexpress/jest-image-snapshot/blob/main/examples/image-reporter.js
5+
*
6+
* To enable this image reporter, add it to your `jest.config.js` "reporters" definition:
7+
* "reporters": [ "default", "<rootDir>/image-reporter.js" ]
8+
*
9+
* Note: Image Reporter may not work with jest's --forceExit flag
10+
*
11+
* Note: If image reporter doesn't work in pipeline can try running as standalone script
12+
* by creating a separate script file and running like this:
13+
* "test:integration": "jest test/local-development.test || node test/utils/image-reporter-standalone.js"
14+
*/
15+
16+
const fs = require('fs');
17+
const AWS = require('aws-sdk/global');
18+
const S3 = require('aws-sdk/clients/s3'); // this is needed
19+
require('dotenv').config();
20+
21+
const UPLOAD_BUCKET = process.env.S3_BUCKET_NAME;
22+
23+
if (
24+
!process.env.S3_BUCKET_NAME ||
25+
!process.env.AWS_SECRET_ACCESS_KEY ||
26+
!process.env.AWS_ACCESS_KEY_ID
27+
) {
28+
console.log('Missing env variables. Skipping upload of image diff files.');
29+
}
30+
31+
AWS.config.update({
32+
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
33+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
34+
});
35+
36+
const s3 = new AWS.S3({ apiVersion: '2006-03-01' });
37+
38+
const targetDirectories = [
39+
'./test/__image_snapshots__/',
40+
'./test/__image_snapshots__/__diff_output__/',
41+
];
42+
targetDirectories.forEach((targetDirectory) => {
43+
fs.readdirSync(targetDirectory, { withFileTypes: true }).forEach((dirent) => {
44+
if (!dirent.isFile()) return;
45+
const path = `images/${dirent.name}`;
46+
const params = {
47+
Body: fs.readFileSync(`${targetDirectory}/${dirent.name}`),
48+
Bucket: UPLOAD_BUCKET,
49+
Key: path,
50+
ContentType: 'image/png',
51+
};
52+
s3.putObject(params, (err) => {
53+
if (err) {
54+
console.log(err, err.stack);
55+
} else {
56+
console.log(
57+
`Uploaded file to https://${UPLOAD_BUCKET}.s3.amazonaws.com/${path}`
58+
);
59+
}
60+
});
61+
});
62+
});

test/utils/image-reporter.js

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ require('dotenv').config();
2020

2121
const UPLOAD_BUCKET = process.env.S3_BUCKET_NAME;
2222

23+
AWS.config.update({
24+
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
25+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
26+
});
27+
2328
const s3 = new AWS.S3({ apiVersion: '2006-03-01' });
2429

2530
class ImageReporter {

test/utils/open-addon.js

+23-3
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,39 @@ const openAddon = async (page) => {
3434
process.env.TEST_RECOVERY_EMAIL
3535
); // type recovery email
3636
await page.waitForTimeout(6000);
37-
await page.click('button'); // click "next" button
37+
await page.click('div[data-primary-action-label] button'); // click "next" button
3838
await page.waitForTimeout(5000);
3939
}
4040

41+
if (
42+
await page.evaluate(
43+
() =>
44+
document.querySelector('h1#headingText') &&
45+
document
46+
.querySelector('h1#headingText')
47+
.innerText.includes('implify your sign')
48+
)
49+
) {
50+
try {
51+
await page.click(
52+
'div[data-secondary-action-label] > div > div:nth-child(2) button'
53+
);
54+
await page.waitForTimeout(6000);
55+
} catch {
56+
// eslint-disable-next-line no-console
57+
console.log('The "Simplify your sign-in" page isn\'t shown');
58+
}
59+
}
60+
4161
await page.waitForSelector(
42-
'div.menu-button.goog-control.goog-inline-block:nth-child(11)',
62+
'div.menu-button.goog-control.goog-inline-block:nth-child(10)',
4363
{ visible: true }
4464
);
4565

4666
// open new addon menubar item
4767
await page.evaluate(() => {
4868
const addOnMenuButton = document.querySelector(
49-
'div.menu-button.goog-control.goog-inline-block:nth-child(11)'
69+
'div.menu-button.goog-control.goog-inline-block:nth-child(10)'
5070
);
5171
addOnMenuButton.dispatchEvent(
5272
new MouseEvent('mousedown', { bubbles: true })

0 commit comments

Comments
 (0)