Skip to content

Commit

Permalink
Flatten e2e test utils (#6164)
Browse files Browse the repository at this point in the history
npm workspaces doesn't seem to handle nested packages very well. To get
our repo ready for workspaces this PR moves the e2e test utils to be a
sibling of the samples rather than a parent
  • Loading branch information
tnorling authored Jun 27, 2023
1 parent 5cd5987 commit 533afa1
Show file tree
Hide file tree
Showing 109 changed files with 765 additions and 5,751 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/msal-angular-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ jobs:
run: npm run build:all

- name: Install Test Tools
working-directory: samples
run: npm ci
working-directory: samples/e2eTestUtils
run: npm install

- name: Install ${{ matrix.sample }}
working-directory: samples/msal-angular-v3-samples/${{ matrix.sample }}
Expand Down
13 changes: 2 additions & 11 deletions .github/workflows/msal-browser-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,10 @@ jobs:
RUNNING_NODE_CI: 1
run: npm ci

- name: Restore node_modules for test tools
uses: actions/cache@v3
id: test-tools-cache
with:
path: |
samples/node_modules
samples/.cache/puppeteer
key: ${{ runner.os }}-browser-test-tools-${{ hashFiles('samples/package-lock.json') }}

- name: Install Test Tools
if: steps.test-tools-cache.outputs.cache-hit != 'true'
working-directory: samples
run: npm ci
working-directory: samples/e2eTestUtils
run: npm install

- name: Restore node_modules for sample
uses: actions/cache@v3
Expand Down
33 changes: 8 additions & 25 deletions .github/workflows/msal-node-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,13 @@ jobs:
run: npx lerna --scope @azure/msal-node --scope @azure/msal-common bootstrap

- name: Build Package
working-directory: samples/msal-node-samples
run: npm run build:package

- name: Restore node_modules for test tools
if: matrix.node == '10' || matrix.node == '12'
uses: actions/cache@v3
id: test-tools-cache
with:
path: |
samples/node_modules
samples/.cache/puppeteer
key: ${{ runner.os }}-node-test-tools-${{ matrix.node }}-${{ hashFiles('samples/package-lock.json') }}
working-directory: lib/msal-node
run: npm run build:all

- name: Install Test Tools
if: steps.test-tools-cache.outputs.cache-hit != 'true'
working-directory: samples
run: npm ci
working-directory: samples/e2eTestUtils
run: npm install

- name: Restore node_modules for sample
uses: actions/cache@v3
Expand Down Expand Up @@ -160,20 +150,13 @@ jobs:
run: npm ci

- name: Build Package
working-directory: samples/msal-node-samples
run: npm run build:package

- name: Restore node_modules for test tools
uses: actions/cache@v3
id: test-tools-cache
with:
path: samples/node_modules
key: ${{ runner.os }}-node-test-tools-${{ hashFiles('samples/package-lock.json') }}
working-directory: lib/msal-node
run: npm run build:all

- name: Install Test Tools
if: steps.test-tools-cache.outputs.cache-hit != 'true'
working-directory: samples
run: npm ci
working-directory: samples/e2eTestUtils
run: npm install
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
PLAYWRIGHT_BROWSERS_PATH: 0
Expand Down
13 changes: 2 additions & 11 deletions .github/workflows/msal-react-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,10 @@ jobs:
working-directory: lib/msal-react
run: npm run build:all

- name: Restore node_modules for test tools
uses: actions/cache@v3
id: test-tools-cache
with:
path: |
samples/node_modules
samples/.cache/puppeteer
key: ${{ runner.os }}-react-e2e-${{ hashFiles('samples/package-lock.json') }}

- name: Install Test Tools
if: steps.test-tools-cache.outputs.cache-hit != 'true'
working-directory: samples
run: npm ci
working-directory: samples/e2eTestUtils
run: npm install

- name: Restore node_modules for sample
uses: actions/cache@v3
Expand Down
5 changes: 0 additions & 5 deletions samples/.puppeteerrc.cjs

This file was deleted.

186 changes: 0 additions & 186 deletions samples/e2eTestUtils/TestUtils.ts

This file was deleted.

27 changes: 13 additions & 14 deletions samples/package.json → samples/e2eTestUtils/package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
{
"name": "msal-js-samples",
"name": "e2e-test-utils",
"version": "0.0.1",
"license": "MIT",
"private": true,
"scripts": {
"test": "jest",
"test:agc": "jest --testMatch [ '**/test/**/*agc*.spec.ts' ]"
},
"dependencies": {
"axios": "^1.4.0",
"typescript": "^4.9.5"
},
"devDependencies": {
"@azure/identity": "^3.1.2",
"@azure/keyvault-secrets": "^4.3.0",
"@types/jest": "^29.5.1",
"dotenv": "^8.2.0",
"find-process": "^1.4.4",
"jest": "^29.5.0",
"axios": "^1.4.0",
"find-process": "^1.4.4"
},
"devDependencies": {
"typescript": "^4.9.5"
},
"peerDependencies": {
"playwright-core": "^1.31.1",
"puppeteer": "^20.1.2",
"ts-jest": "^29.1.0"
"puppeteer": "^20.7.2",
"jest": "^29.5.0",
"@azure/msal-browser": "^3.0.0-beta.0",
"@azure/msal-common": "^14.0.0-beta.0",
"@azure/msal-node": "^2.0.0-beta.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as puppeteer from "puppeteer";

import { LabConfig } from "./LabConfig";
import { Configuration } from "../../lib/msal-browser";
import { ServerTelemetryEntity } from "../../lib/msal-common";
import { Configuration } from "@azure/msal-browser";
import { ServerTelemetryEntity } from "@azure/msal-common";

export type tokenMap = {
idTokens: string[],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import fs from "fs";
import { IdTokenEntity } from "../../lib/msal-common/src/cache/entities/IdTokenEntity";
import { AccessTokenEntity } from "../../lib/msal-common/src/cache/entities/AccessTokenEntity";
import { RefreshTokenEntity } from "../../lib/msal-common/src/cache/entities/RefreshTokenEntity";

import { IdTokenEntity, AccessTokenEntity, RefreshTokenEntity } from "@azure/msal-common";
import { InMemoryCache, internals } from "@azure/msal-node";

export type tokenMap = {
Expand Down
Loading

0 comments on commit 533afa1

Please sign in to comment.