Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Autofill password import] Misc fixes #1184

Merged
merged 25 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2ab15e9
fix: supported path
dbajpeyi Oct 31, 2024
b079299
feat: add a more resilient animation
dbajpeyi Oct 31, 2024
b3ade5c
fixme: hardcode some offsets
dbajpeyi Nov 1, 2024
ccdb9ce
chore: lint-fix
dbajpeyi Nov 1, 2024
7a69964
fix: use calc
dbajpeyi Nov 1, 2024
38f843d
feat: use overlay to style elements
dbajpeyi Nov 4, 2024
6dde0cd
Merge branch 'main' into dbajpeyi/fix/supported-paths
dbajpeyi Nov 4, 2024
474a9aa
style: lint fix
dbajpeyi Nov 4, 2024
100aa6b
Merge branch 'dbajpeyi/fix/supported-paths' of github.com:duckduckgo/…
dbajpeyi Nov 4, 2024
e19c1a9
Merge branch 'main' into dbajpeyi/fix/supported-paths
dbajpeyi Nov 5, 2024
05f8244
chore: add some comments
dbajpeyi Nov 5, 2024
8ad828f
Merge branch 'dbajpeyi/fix/supported-paths' of github.com:duckduckgo/…
dbajpeyi Nov 5, 2024
39d938b
fix: remove offset
dbajpeyi Nov 5, 2024
f0c047a
chore: PR comments
dbajpeyi Nov 5, 2024
db41b3b
test: update for expecting overlay
dbajpeyi Nov 5, 2024
71aed62
fix: domcontentloaded event instead of timeout
dbajpeyi Nov 5, 2024
7d4a3af
Merge branch 'main' into dbajpeyi/fix/supported-paths
dbajpeyi Nov 5, 2024
da4ccee
feat: refactor for scroll
dbajpeyi Nov 5, 2024
019e259
Merge branch 'main' into dbajpeyi/fix/supported-paths
dbajpeyi Nov 5, 2024
b1fd8f0
chore: merge main, run eslint
dbajpeyi Nov 7, 2024
12b3e53
refactor: add state
dbajpeyi Nov 7, 2024
5236240
refactor: store domloaded promise
dbajpeyi Nov 7, 2024
f0bd874
fix: remove overlay early
dbajpeyi Nov 7, 2024
17a23e5
fix: account for slow inejction
dbajpeyi Nov 7, 2024
4e23fb3
Merge branch 'main' into dbajpeyi/fix/supported-paths
dbajpeyi Nov 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions injected/integration-test/autofill-password-import.spec.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import { test } from '@playwright/test';
import { test, expect } from '@playwright/test';
import { readFileSync } from 'fs';
import { mockAndroidMessaging, wrapWebkitScripts } from '@duckduckgo/messaging/lib/test-utils.mjs';
import { perPlatform } from './type-helpers.mjs';
import { OVERLAY_ID } from '../src/features/autofill-password-import';

test('Password import feature', async ({ page }, testInfo) => {
const passwordImportFeature = AutofillPasswordImportSpec.create(page, testInfo);
await passwordImportFeature.enabled();
await passwordImportFeature.navigate();
const didAnimatePasswordOptions = passwordImportFeature.waitForAnimation('a[aria-label="Password options"]');
await passwordImportFeature.clickOnElement('Home page');
await didAnimatePasswordOptions;
await passwordImportFeature.waitForAnimation();

const didAnimateSignin = passwordImportFeature.waitForAnimation('a[aria-label="Sign in"]');
await passwordImportFeature.clickOnElement('Signin page');
await didAnimateSignin;
await passwordImportFeature.waitForAnimation();

const didAnimateExport = passwordImportFeature.waitForAnimation('button[aria-label="Export"]');
await passwordImportFeature.clickOnElement('Export page');
await didAnimateExport;
await passwordImportFeature.waitForAnimation();

// Test unsupported path
await passwordImportFeature.clickOnElement('Unsupported page');
const overlay = page.locator(`#${OVERLAY_ID}`);
await expect(overlay).not.toBeVisible();
});

export class AutofillPasswordImportSpec {
Expand Down Expand Up @@ -91,17 +94,10 @@ export class AutofillPasswordImportSpec {

/**
* Helper to assert that an element is animating
* @param {string} selector
*/
async waitForAnimation(selector) {
const locator = this.page.locator(selector);
return await locator.evaluate((el) => {
if (el != null) {
return el.getAnimations().some((animation) => animation.playState === 'running');
} else {
return false;
}
}, selector);
async waitForAnimation() {
const locator = this.page.locator(`#${OVERLAY_ID}`);
await expect(locator).toBeVisible();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,21 @@
<a aria-label="Sign in">Sign in</a>
</div>
<div id="home" class="page">
<a aria-label="Password options">Password options</a>
<a aria-label="Password options" style="border-radius: 100%;">PO</a>
</div>
<div id="options" class="page">
<button aria-label="Export">Export</button>
<button aria-label="Export" style="border-radius: 100%;">EP</button>
</div>
<div id="unsupported" class="page">
<button aria-label="Unsupported">Unsupported path</button>
</div>

<script>
const routes = {
'/intro': document.getElementById('intro'),
'/': document.getElementById('home'),
'/options': document.getElementById('options')
'/options': document.getElementById('options'),
'/unsupported': document.getElementById('unsupported'),
};

function navigate(path) {
Expand All @@ -68,6 +72,7 @@
<button onclick="navigate('/intro')">Signin page</button>
<button onclick="navigate('/')">Home page</button>
<button onclick="navigate('/options')">Export page</button>
<button onclick="navigate('/unsupported')">Unsupported page</button>
</nav>
`);
</script>
Expand Down
Loading
Loading