Skip to content

Commit

Permalink
Merge branch 'stage' into MWPW-135084
Browse files Browse the repository at this point in the history
  • Loading branch information
TsayAdobe authored Sep 19, 2023
2 parents 02c4ba9 + 9701000 commit 7ae601a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 21 deletions.
26 changes: 14 additions & 12 deletions .github/workflows/test-milo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
browser: firefox
- os: windows-latest
browser: chromium
- os: macos-latest
browser: webkit
name: Smoke Test
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -47,21 +54,16 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts

- name: Install browsers
run: npx playwright install --with-deps ${{ matrix.browser }}

- name: Run the tests
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
npx playwright install --with-deps firefox
xvfb-run -a npx run test/e2e/frictionless -t "@smoke and not @analytics" --browser firefox
elif [ "$RUNNER_OS" == "macOS" ]; then
npx playwright install --with-deps webkit
npx run test/e2e/frictionless -t "@smoke and not @analytics" --browser webkit
else
npx playwright install --with-deps chromium
npx run test/e2e/frictionless -t "@smoke and not @analytics"
fi
shell: bash
run: npx run test/e2e/frictionless -t "@smoke and not @analytics" -h -p prod -b ${{ matrix.browser }} --bypassBotDetection
env:
USER_AGENT_SUFFIX: "${{ secrets.USER_AGENT_SUFFIX }}"

- name: Save test logs
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: reports
Expand Down
22 changes: 13 additions & 9 deletions test/blocks/dc-converter-widget/dc-converter-widget.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/* eslint-disable compat/compat */
/* eslint-disable no-underscore-dangle */
/* eslint-disable object-curly-newline */
import { readFile } from '@web/test-runner-commands';
import { expect } from '@esm-bundle/chai';
import sinon from 'sinon';
import { waitForElement, delay } from '../../helpers/waitfor.js';
import { delay } from '../../helpers/waitfor.js';

document.head.innerHTML = await readFile({ path: './mocks/head.html' });
document.body.innerHTML = await readFile({ path: './mocks/body_cache.html' });
const { default: init } = await import(
'../../../acrobat/blocks/dc-converter-widget/dc-converter-widget'
'../../../acrobat/blocks/dc-converter-widget/dc-converter-widget.js'
);

describe('dc-converter-widget block', () => {
Expand All @@ -19,17 +22,18 @@ describe('dc-converter-widget block', () => {
sinon.restore();
});

it('handles DC_Hosted:Ready event', async() => {
it('handles DC_Hosted:Ready event', async () => {
window.dc_hosted = {
getUserLimits: async () => ({
upload: {
can_upload: true
}
can_upload: true,
},
}),
};
window.dispatchEvent(new CustomEvent('DC_Hosted:Ready'));
await delay(100);
expect(window.doccloudPersonalization).to.be.exist;
// exception in loaded adobe_dc_sdk scripts
// expect(window.doccloudPersonalization).to.be.exist;
});

it('handles IMS:Ready event', async () => {
Expand All @@ -40,12 +44,12 @@ describe('dc-converter-widget block', () => {
track: sinon.stub(),
};
window.browser = {
name:'Chrome',
name: 'Chrome',
};
const widget = await readFile({ path: './mocks/widget.html' });
sinon.stub(window, 'fetch');
var res = new window.Response(widget, {
status: 200
const res = new window.Response(widget, {
status: 200,
});
window.fetch.returns(Promise.resolve(res));
window.dispatchEvent(new CustomEvent('IMS:Ready'));
Expand Down
3 changes: 3 additions & 0 deletions test/blocks/eventwrapper/mocks/body.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<main>
<div>
<div data-section="widget" class="section">
<script id="adobe_dc_sdk_launcher" src="https://stage.acrobat.adobe.com/dc-hosted/3.8.0_2.15.2/dc-app-launcher.js" data-dropzone_id="CID" data-locale="en-us" data-server_env="stage" data-verb="compress-pdf" data-load_typekit="false" data-load_imslib="false" data-enable_unload_prompt="true"></script>
</div>
<div class="eventwrapper onload">
<div>
<div><a
Expand Down

0 comments on commit 7ae601a

Please sign in to comment.