tests(devtools): sync web tests (#14061)

This commit is contained in:
Adam Raine 2022-05-27 19:11:43 -07:00 коммит произвёл GitHub
Родитель 525116472f
Коммит 220d9cf3e9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
18 изменённых файлов: 67 добавлений и 75 удалений

4
.github/workflows/devtools.yml поставляемый
Просмотреть файл

@ -51,8 +51,8 @@ jobs:
# 3) every change to file in Lighthouse repo important to running these tests.
#
# The number is how many times this hash key was manually updated to break the cache.
key: ${{ runner.os }}-3-${{ env.WEEK_OF_THE_YEAR }}-${{ hashFiles('cdt-test-hash.txt') }}
restore-keys: ${{ runner.os }}-
key: ${{ runner.os }}-5-${{ env.WEEK_OF_THE_YEAR }}-${{ hashFiles('cdt-test-hash.txt') }}
restore-keys: ${{ runner.os }}-5
- name: Set GHA_DEVTOOLS_CACHE_HIT
if: steps.devtools-cache.outputs.cache-hit == 'true'
run: echo "GHA_DEVTOOLS_CACHE_HIT=1" >> $GITHUB_ENV

Просмотреть файл

@ -11,16 +11,14 @@
const containerElement = LighthouseTestRunner.getContainerElement();
const ensureDisabledNames = ['Accessibility', 'Best practices', 'SEO', 'Progressive Web App'];
for (const checkboxName of ensureDisabledNames) {
const checkboxes = Array.from(containerElement.querySelectorAll('.checkbox'));
for (const checkbox of checkboxes) {
if (checkbox.textElement.textContent !== checkboxName) {
continue;
}
const checkboxes = Array.from(containerElement.querySelectorAll('.checkbox'));
for (const checkbox of checkboxes) {
if (!ensureDisabledNames.includes(checkbox.textElement.textContent)) {
continue;
}
if (checkbox.checkboxElement.checked) {
checkbox.checkboxElement.click();
}
if (checkbox.checkboxElement.checked) {
checkbox.checkboxElement.click();
}
}

Просмотреть файл

@ -15,16 +15,14 @@
const containerElement = LighthouseTestRunner.getContainerElement();
const ensureDisabledNames = ['Accessibility', 'Best practices', 'SEO', 'Progressive Web App'];
for (const checkboxName of ensureDisabledNames) {
const checkboxes = Array.from(containerElement.querySelectorAll('.checkbox'));
for (const checkbox of checkboxes) {
if (checkbox.textElement.textContent !== checkboxName) {
continue;
}
const checkboxes = Array.from(containerElement.querySelectorAll('.checkbox'));
for (const checkbox of checkboxes) {
if (!ensureDisabledNames.includes(checkbox.textElement.textContent)) {
continue;
}
if (checkbox.checkboxElement.checked) {
checkbox.checkboxElement.click();
}
if (checkbox.checkboxElement.checked) {
checkbox.checkboxElement.click();
}
}

Просмотреть файл

@ -10,12 +10,17 @@
await TestRunner.showPanel('lighthouse');
const dialogElement = LighthouseTestRunner.getContainerElement();
dialogElement.querySelector('input[name="lighthouse.device_type"][value="desktop"]').click();
// Turn off simulated throttling.
dialogElement.querySelector('.lighthouse-settings-pane > div')
.shadowRoot.querySelectorAll('span')[2]
.shadowRoot.querySelector('input')
.click();
const select = dialogElement.querySelector('.lighthouse-settings-pane .toolbar')
.shadowRoot.querySelector('select')
select.querySelector('option[value="devtools"]').selected = true;
// Change event is not emitted automatically when updating select element programatically.
select.dispatchEvent(new Event('change'));
// Use desktop environment
dialogElement.querySelector('input[name="lighthouse.device_type"][value="desktop"]').click();
LighthouseTestRunner.dumpStartAuditState();
LighthouseTestRunner.getRunButton().click();

Просмотреть файл

@ -11,16 +11,14 @@
const containerElement = LighthouseTestRunner.getContainerElement();
const ensureDisabledNames = ['Accessibility', 'Best practices', 'SEO', 'Progressive Web App'];
for (const checkboxName of ensureDisabledNames) {
const checkboxes = Array.from(containerElement.querySelectorAll('.checkbox'));
for (const checkbox of checkboxes) {
if (checkbox.textElement.textContent !== checkboxName) {
continue;
}
const checkboxes = Array.from(containerElement.querySelectorAll('.checkbox'));
for (const checkbox of checkboxes) {
if (!ensureDisabledNames.includes(checkbox.textElement.textContent)) {
continue;
}
if (checkbox.checkboxElement.checked) {
checkbox.checkboxElement.click();
}
if (checkbox.checkboxElement.checked) {
checkbox.checkboxElement.click();
}
}

Просмотреть файл

@ -11,16 +11,14 @@
const containerElement = LighthouseTestRunner.getContainerElement();
const ensureDisabledNames = ['Performance', 'Accessibility', 'Best practices', 'SEO'];
for (const checkboxName of ensureDisabledNames) {
const checkboxes = Array.from(containerElement.querySelectorAll('.checkbox'));
for (const checkbox of checkboxes) {
if (checkbox.textElement.textContent !== checkboxName) {
continue;
}
const checkboxes = Array.from(containerElement.querySelectorAll('.checkbox'));
for (const checkbox of checkboxes) {
if (!ensureDisabledNames.includes(checkbox.textElement.textContent)) {
continue;
}
if (checkbox.checkboxElement.checked) {
checkbox.checkboxElement.click();
}
if (checkbox.checkboxElement.checked) {
checkbox.checkboxElement.click();
}
}

Просмотреть файл

@ -23,22 +23,19 @@
LighthouseTestRunner.openStartAudit();
const containerElement = LighthouseTestRunner.getContainerElement();
const ensureDisabledNames = ['Performance', 'Accessibility', 'Best practices', 'SEO', 'Progressive Web App'];
for (const checkboxName of ensureDisabledNames) {
const checkboxes = Array.from(containerElement.querySelectorAll('.checkbox'));
for (const checkbox of checkboxes) {
if (checkbox.textElement.textContent !== checkboxName) {
continue;
}
const checkboxes = Array.from(containerElement.querySelectorAll('.checkbox'));
for (const checkbox of checkboxes) {
if (!ensureDisabledNames.includes(checkbox.textElement.textContent)) {
continue;
}
if (checkbox.checkboxElement.checked) {
checkbox.checkboxElement.click();
}
if (checkbox.checkboxElement.checked) {
checkbox.checkboxElement.click();
}
}
LighthouseTestRunner.dumpStartAuditState();
TestRunner.addResult('\n\n**Allows audit with a single category**');
const checkboxes = Array.from(containerElement.querySelectorAll('.checkbox'));
for (const checkbox of checkboxes) {
if (checkbox.textElement.textContent !== 'Performance') {
continue;

Просмотреть файл

@ -11,16 +11,14 @@
const containerElement = LighthouseTestRunner.getContainerElement();
const ensureDisabledNames = ['Accessibility', 'Best practices', 'SEO', 'Progressive Web App'];
for (const checkboxName of ensureDisabledNames) {
const checkboxes = Array.from(containerElement.querySelectorAll('.checkbox'));
for (const checkbox of checkboxes) {
if (checkbox.textElement.textContent !== checkboxName) {
continue;
}
const checkboxes = Array.from(containerElement.querySelectorAll('.checkbox'));
for (const checkbox of checkboxes) {
if (!ensureDisabledNames.includes(checkbox.textElement.textContent)) {
continue;
}
if (checkbox.checkboxElement.checked) {
checkbox.checkboxElement.click();
}
if (checkbox.checkboxElement.checked) {
checkbox.checkboxElement.click();
}
}

Просмотреть файл

@ -10,7 +10,7 @@ Tests that Lighthouse block requests specified in DevTools BlockedURLsPane.
[ ] Publisher Ads
[x] Legacy navigation
[x] Clear storage
[x] Simulated throttling
Throttling method: simulate
Analyze page load: enabled visible
Requests made: http://127.0.0.1:8000/devtools/lighthouse/resources/lighthouse-basic.html

Просмотреть файл

@ -10,7 +10,7 @@ Tests that Lighthouse panel displays a warning when important data may affect pe
[ ] Publisher Ads
[x] Legacy navigation
[x] Clear storage
[x] Simulated throttling
Throttling method: simulate
Analyze page load: enabled visible
Warning Text: There may be stored data affecting loading performance in these locations: Web SQL, IndexedDB. Audit this page in an incognito window to prevent those resources from affecting your scores.

Просмотреть файл

@ -10,7 +10,7 @@ Tests that mobile emulation works.
[ ] Publisher Ads
[x] Legacy navigation
[x] Clear storage
[x] Simulated throttling
Throttling method: simulate
Analyze page load: enabled visible
=============== Lighthouse Results ===============

Просмотреть файл

@ -10,7 +10,7 @@ Tests that lighthouse panel passes flags.
[ ] Publisher Ads
[x] Legacy navigation
[x] Clear storage
[ ] Simulated throttling
Throttling method: devtools
Analyze page load: enabled visible
=============== Lighthouse Results ===============

Просмотреть файл

@ -10,7 +10,7 @@ Tests that Lighthouse report is translated.
[ ] Publisher Ads
[x] Legacy navigation
[x] Clear storage
[x] Simulated throttling
Throttling method: simulate
Analyze page load: enabled visible
resolved to locale es

Просмотреть файл

@ -10,7 +10,7 @@ Tests that audits panel works when only the pwa category is selected.
[ ] Publisher Ads
[x] Legacy navigation
[x] Clear storage
[x] Simulated throttling
Throttling method: simulate
Analyze page load: enabled visible
=============== Audits run ===============

Просмотреть файл

@ -13,7 +13,7 @@ Tests that audits panel prevents run of unauditable pages.
[ ] Publisher Ads
[x] Legacy navigation
[x] Clear storage
[x] Simulated throttling
Throttling method: simulate
Help text: At least one category must be selected.
Analyze page load: disabled visible
@ -29,7 +29,7 @@ Analyze page load: disabled visible
[ ] Publisher Ads
[x] Legacy navigation
[x] Clear storage
[x] Simulated throttling
Throttling method: simulate
Analyze page load: enabled visible
@ -44,7 +44,7 @@ Analyze page load: enabled visible
[ ] Publisher Ads
[x] Legacy navigation
[x] Clear storage
[x] Simulated throttling
Throttling method: simulate
Analyze page load: enabled visible
@ -60,7 +60,7 @@ URL: about:blank
[ ] Publisher Ads
[x] Legacy navigation
[x] Clear storage
[x] Simulated throttling
Throttling method: simulate
Help text: Can only audit HTTP/HTTPS pages and Chrome extensions. Navigate to a different page to start an audit.
Analyze page load: disabled visible

Просмотреть файл

@ -10,7 +10,7 @@ Tests that navigation mode works correctly.
[x] Publisher Ads
[ ] Legacy navigation
[x] Clear storage
[x] Simulated throttling
Throttling method: simulate
Analyze page load: enabled visible
=============== Lighthouse Status Updates ===============

Просмотреть файл

@ -10,7 +10,7 @@ Tests that audits panel works.
[x] Publisher Ads
[x] Legacy navigation
[x] Clear storage
[x] Simulated throttling
Throttling method: simulate
Analyze page load: enabled visible
=============== Lighthouse Status Updates ===============

Просмотреть файл

@ -10,7 +10,7 @@ Tests that audits panel renders View Trace button.
[ ] Publisher Ads
[x] Legacy navigation
[x] Clear storage
[x] Simulated throttling
Throttling method: simulate
Analyze page load: enabled visible
=============== Audits run ===============