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

append a base element to force the baseURI of the FakeWindow #40218

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,7 @@ describes.fakeWin(
expect(resolver.getAnchorDomain_(anchor)).to.equal('test.com');
});

// TODO(#40214): fix flaky test.
it.skip('removes // protocol', () => {
it('removes // protocol', () => {
const anchor = helpers.createAnchor('//test.com/');
expect(resolver.getAnchorDomain_(anchor)).to.equal('test.com');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ describes.endtoend(
await expect(player);
});

// TODO(#40214): fix flaky test.
it.skip('loads and displays first story on page load when player is visible in viewport', async () => {
it('loads and displays first story on page load when player is visible in viewport', async () => {
const shadowHost = await controller.findElement(
'div.i-amphtml-story-player-shadow-root-intermediary'
);
Expand Down
3 changes: 1 addition & 2 deletions extensions/amp-video/0.1/test/test-flexible-bitrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ describes.fakeWin('amp-video flexible-bitrate', {}, (env) => {
expect(currentBitrates(v0)[0]).to.equal(1000);
});

// TODO(#40214): fix flaky test.
it.skip('should observe lower bandwidth on next sort', () => {
it('should observe lower bandwidth on next sort', () => {
const m = getManager('4g');
const v0 = getVideo([4000, 1000, 3000, 2000]);
v0.id = 'v0';
Expand Down
8 changes: 8 additions & 0 deletions testing/fake-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ export class FakeWindow {
// Document.
/** @const {!HTMLDocument} */
this.document = self.document.implementation.createHTMLDocument('');
// NOTE: There was a change between chrome 119 and 120 where the above
// self.document.implementation.createHTMLDocument no longer inherits
// the baseURI of self.document. We explicitly set and force it thru
// a `<base>` element.
const base = this.document.createElement('base');
base.href = self.document.baseURI;
this.document.head.appendChild(base);
erwinmombay marked this conversation as resolved.
Show resolved Hide resolved

Object.defineProperty(this.document, 'defaultView', {
get: () => this,
});
Expand Down
Loading