Skip to content

Commit

Permalink
Fix browser tests for iframed message parts
Browse files Browse the repository at this point in the history
  • Loading branch information
pabzm committed Jul 23, 2024
1 parent b41ca30 commit d6a17b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
15 changes: 10 additions & 5 deletions tests/Browser/Mail/PreviewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ public function testPreview()
->assertSeeIn('#remote-objects-message', 'To protect your privacy remote resources have been blocked.');

// Images
$this->assertMatchesRegularExpression('/action=get/', $browser->attribute('p#v1attached > img', 'src'));
$this->assertMatchesRegularExpression('/blocked/', $browser->attribute('p#v1remote > img', 'src'));
$browser->withinFrame('#message-htmlpart1', function ($browser) {
$this->assertMatchesRegularExpression('/action=get/', $browser->attribute('p#attached > img', 'src'));
$this->assertMatchesRegularExpression('/blocked/', $browser->attribute('p#remote > img', 'src'));
});

// Attachments list
$browser->assertMissing('#attachment-list');
Expand Down Expand Up @@ -151,9 +153,7 @@ public function testPreviewMorelink()
$browser->withinFrame('#messagecontframe', static function ($browser) {
$browser->waitFor('img.contactphoto');

$browser->assertSeeIn('.subject', 'Lines')
->assertSeeIn('.message-part div.pre', 'Plain text message body.')
->assertVisible('.message-part div.pre .sig');
$browser->assertSeeIn('.subject', 'Lines');

$browser->assertMissing('.header-headers')
->click('a.headers-details')
Expand All @@ -163,6 +163,11 @@ public function testPreviewMorelink()
->assertDontSeeIn('.header.cc', 'test11@domain.tld')
->assertSeeIn('.header.cc a.morelink', '2 more...')
->click('.header.cc a.morelink');

$browser->withinFrame('#message-part1', static function ($browser) {
$browser->assertSeeIn('div.pre', 'Plain text message body.')
->assertVisible('div.pre .sig');
});
});

$browser->with(new Dialog(), static function ($browser) {
Expand Down
8 changes: 6 additions & 2 deletions tests/Browser/Mail/PrintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,14 @@ public function testPrint()
]);
});

// Check iframed body.
$browser->withinFrame('#message-part1', static function ($browser) {
$browser->assertSeeIn('div.pre', 'Plain text message body.')
->assertVisible('div.pre .sig');
});
// Check headers.
$browser->assertVisible('img.contactphoto')
->assertSeeIn('.subject', 'Lines')
->assertSeeIn('.message-part div.pre', 'Plain text message body.')
->assertVisible('.message-part div.pre .sig')
// Tests "more recipients" link
->with('.header-headers .header.cc', static function ($browser) {
$browser->assertSee('test10@domain.tld')
Expand Down

0 comments on commit d6a17b3

Please sign in to comment.