Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/follow-redirects-1…
Browse files Browse the repository at this point in the history
….15.6
  • Loading branch information
Aleksey28 authored Mar 29, 2024
2 parents 07d7ada + f87553c commit f2a7a8d
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 18 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/check-security-alerts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,15 @@ jobs:
const securityChecker = new SecurityChecker(github, context, '${{secrets.SECURITY_ISSUE_REPO}}');
await securityChecker.check();
keepalive-job:
name: Keepalive Workflow
if: ${{ always() }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: gautamkrishnar/keepalive-workflow@v2
with:
gh_token: ${{ secrets.ACTIVE_TOKEN }}
14 changes: 13 additions & 1 deletion .github/workflows/handle-stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,16 @@ jobs:
days-before-stale: 180
days-before-close: 10
exempt-issue-labels: "AREA: docs,FREQUENCY: critical,FREQUENCY: level 2,HELP WANTED,!IMPORTANT!,STATE: Need clarification,STATE: Need response,STATE: won't fix,support center"
exempt-pr-labels: "AREA: docs,FREQUENCY: critical,FREQUENCY: level 2,HELP WANTED,!IMPORTANT!,STATE: Need clarification,STATE: Need response,STATE: won't fix,support center"
exempt-pr-labels: "AREA: docs,FREQUENCY: critical,FREQUENCY: level 2,HELP WANTED,!IMPORTANT!,STATE: Need clarification,STATE: Need response,STATE: won't fix,support center"

keepalive-job:
name: Keepalive Workflow
if: ${{ always() }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: gautamkrishnar/keepalive-workflow@v2
with:
gh_token: ${{ secrets.ACTIVE_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
export const CONTAINERIZED_CHROME_FLAGS = ['--no-sandbox', '--disable-dev-shm-usage'];

export function buildChromeArgs ({ config, cdpPort, platformArgs, tempProfileDir, isContainerized, isNativeAutomation }) {
export function buildChromeArgs ({ config, cdpPort, platformArgs, tempProfileDir, isContainerized, isNativeAutomation, browserName }) {
const headlessMode = ['chrome', 'chromium'].includes(browserName) ? '--headless=new' : '--headless';

let chromeArgs = []
.concat(
cdpPort ? [`--remote-debugging-port=${cdpPort}`] : [],
!config.userProfile ? [`--user-data-dir=${tempProfileDir.path}`] : [],
config.headless ? ['--headless'] : [],
config.headless ? [headlessMode] : [],
config.userArgs ? [config.userArgs] : [],
// NOTE: we need to prevent new window blocking for multiple windows in Native Automation
isNativeAutomation ? ['--disable-popup-blocking'] : [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function start (pageUrl, { browserName, config, cdpPort, tempProfil
const chromeInfo = await browserTools.getBrowserInfo(config.path || browserName);
const chromeOpenParameters = Object.assign({}, chromeInfo);

chromeOpenParameters.cmd = buildChromeArgs({ config, cdpPort, platformArgs: chromeOpenParameters.cmd, tempProfileDir, isContainerized, isNativeAutomation });
chromeOpenParameters.cmd = buildChromeArgs({ config, cdpPort, platformArgs: chromeOpenParameters.cmd, tempProfileDir, isContainerized, isNativeAutomation, browserName });

await browserStarter.startBrowser(chromeOpenParameters, pageUrl);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ const getWindowDimensionsInfo = ClientFunction(() => {
};
});

const isHeadlessChrome = ClientFunction(() => {
return /HeadlessChrome/.test(window.navigator.userAgent);
});

const INITIAL_SIZE = 500;

fixture `Maximize Window`
Expand All @@ -29,9 +33,18 @@ fixture `Maximize Window`

test('Maximize window', async t => {
await t.maximizeWindow();
const isHeadless = await isHeadlessChrome();

const dimensions = await getWindowDimensionsInfo();

expect(dimensions.outerWidth).to.be.at.least(dimensions.availableWidth);
expect(dimensions.outerHeight).to.be.at.least(dimensions.availableHeight);
// HACK: headless outerWidth/Height and availHeight/Width are random and different
// that is why we check with innerWidth/Height
if (isHeadless) {
expect(dimensions.innerWidth).to.be.at.least(dimensions.availableWidth);
expect(dimensions.innerHeight).to.be.at.least(dimensions.availableHeight);
}
else {
expect(dimensions.outerWidth).to.be.at.least(dimensions.availableWidth);
expect(dimensions.outerHeight).to.be.at.least(dimensions.availableHeight);
}
});
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const routes = {
main: 'http://one-dummy-url.com',
get: 'http://one-dummy-url.com/get',
post: 'http://one-dummy-url.com/post',
another: 'https://another-dummy-url.com',
main: 'http://one-dummy-url.com',
get: 'http://one-dummy-url.com/get',
post: 'http://one-dummy-url.com/post',
another: 'https://another-dummy-url.com',
secureMain: 'https://secure-dummy-url.com',
secureGet: 'https://secure-dummy-url.com/get',
};

export default routes;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const testPageMarkup = `
<button onclick="sendRequest()">Send request</button>
<script>
function sendRequest() {
fetch('${DUMMY_URLS.get}')
fetch('${DUMMY_URLS.secureGet}')
.then(res => {
return res.text();
})
Expand All @@ -23,9 +23,9 @@ const testPageMarkup = `
`;

const requestMock = RequestMock()
.onRequestTo(DUMMY_URLS.main)
.onRequestTo(DUMMY_URLS.secureMain)
.respond(testPageMarkup)
.onRequestTo(DUMMY_URLS.get)
.onRequestTo(DUMMY_URLS.secureGet)
.respond('Data from mocked fetch request')
.onRequestTo(DUMMY_URLS.another)
.respond();
Expand All @@ -36,7 +36,7 @@ test
.requestHooks(requestMock)
('Basic', async t => {
await t
.navigateTo(DUMMY_URLS.main)
.navigateTo(DUMMY_URLS.secureMain)
.expect(Selector('h1').textContent).eql('Mocked page')
.click('button')
.expect(Selector('h2').textContent).eql('Data from mocked fetch request')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { RequestMock } from 'testcafe';
import DUMMY_URLS from '../../common/mock-routes.js';

const mock = RequestMock()
.onRequestTo(DUMMY_URLS.get)
.onRequestTo(DUMMY_URLS.secureGet)
.respond(() => {
throw new Error('Error in the "respond" method');
});
Expand All @@ -11,5 +11,5 @@ fixture `Fixture`
.requestHooks(mock);

test('test', async t => {
await t.navigateTo(DUMMY_URLS.get);
await t.navigateTo(DUMMY_URLS.secureGet);
});
4 changes: 2 additions & 2 deletions test/functional/fixtures/regression/gh-3456/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ const assertionHelper = require('../../../assertion-helper.js');
const SCREENSHOTS_PATH = path.resolve(assertionHelper.SCREENSHOTS_PATH);

if (config.useLocalBrowsers) {
describe('[Regression](GH-3456) Should process --window-size arg in Headless mode ', function () {
describe.skip('[Regression](GH-3456) Should process --window-size arg in Headless mode ', function () {
it(':headless', () => {
const browsers = [
'chrome:headless --window-size=501,602',
'chrome --headless --window-size=501,602',
'chrome --headless=new --window-size=501,602',
];

return createTestCafe('127.0.0.1', 1335, 1336)
Expand Down

0 comments on commit f2a7a8d

Please sign in to comment.