Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

Cut the browser suite and run CI in parallel shards (#389)

Paulo Castellanoa878ee41f4a0
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index f4e9630ae..c34d9515b 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -22,12 +22,14 @@ env:
jobs:
tests:
- name: Tests (${{ matrix.name }})
+ name: Tests (${{ matrix.name }} ${{ matrix.shard }}/2)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
+ name: [PostgreSQL, MySQL]
+ shard: [1, 2]
include:
- name: PostgreSQL
connection: pgsql
@@ -87,7 +89,7 @@ jobs:
env:
DB_PORT: ${{ job.services.database.ports[matrix.port] }}
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
- run: php artisan test --compact --parallel
+ run: ./vendor/bin/pest --compact --parallel --shard=${{ matrix.shard }}/2
- name: Show logged warnings of failed tests
if: failure()
@@ -104,12 +106,12 @@ jobs:
run: '[ "${{ needs.tests.result }}" = "success" ]'
browser:
- name: Browser (${{ matrix.shard }}/5)
+ name: Browser (${{ matrix.shard }}/3)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
- shard: [1, 2, 3, 4, 5]
+ shard: [1, 2, 3]
services:
postgres:
@@ -150,14 +152,26 @@ jobs:
- name: Build assets
run: npm run build
+ - name: Cache Playwright browsers
+ id: playwright-cache
+ uses: actions/cache@v6
+ with:
+ path: ~/.cache/ms-playwright
+ key: ${{ runner.os }}-playwright-${{ hashFiles('package-lock.json') }}
+
- name: Install Playwright browsers
+ if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps chromium
+ - name: Install Playwright system dependencies
+ if: steps.playwright-cache.outputs.cache-hit == 'true'
+ run: npx playwright install-deps chromium
+
- name: Run browser tests
env:
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
- run: php artisan test tests/Browser --compact --shard=${{ matrix.shard }}/5
+ run: ./vendor/bin/pest tests/Browser --compact --parallel --processes=3 --shard=${{ matrix.shard }}/3
- name: Upload Playwright artifacts
if: failure()
diff --git a/AGENTS.md b/AGENTS.md
index 09f6c426e..c66a636f6 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -244,8 +244,9 @@ Every lang string is rendered in all 16 locales, and the longest one decides the
- When adding or changing a key, check the longest translations (French, German, Ukrainian, Russian, Polish and Portuguese usually run longest) against the slot, and shorten the copy in that locale rather than letting it wrap. A shorter natural phrase beats a literal one (`Ajustes do workspace`, not `Configurações do workspace`).
- Never fix a wrap by truncating the text or widening one locale's layout; the label has to stay readable everywhere.
-- Cover dense menus with a browser test that renders every `Locale` case and fails on wrapped items — `tests/Browser/SidebarMenuTest.php` ("no sidebar menu item wraps onto a second line in any language") is the pattern.
-- A settings page description (the line under the page title in `SettingsLayout`) stays on one line in every locale, next to the header action. When adding a settings page with a description, add it to the dataset in `tests/Browser/SettingsDescriptionTest.php`, which measures all 16 translations in place.
+- A settings page description (the line under the page title in `SettingsLayout`) stays on one line in every locale, next to the header action.
+- Single-line copy is guarded by `tests/Feature/SingleLineCopyTest.php`, which fails when any locale's translation of a watched key gets longer than its budget in `tests/fixtures/single-line-copy.php`. When adding a button, tab, menu item or badge label, add its key there with the length of its longest translation; raise a budget only after checking the slot still fits.
+- Do not write browser tests that measure whether a label wraps (pixel widths, line counts, `Locale::cases()` loops over rendered text). They depend on the machine's fonts and fail differently on CI and locally; they were replaced by the length test in October 2026 (owner decision).
## AI agents (`app/Ai/Agents`)
@@ -824,7 +825,7 @@ Browser tests live in `tests/Browser` and run on `pestphp/pest-plugin-browser` d
- **Never `sleep()` in a browser test.** The HTTP server that serves the page runs inside the same PHP process (an Amp loop that only ticks while Pest awaits Playwright), so a blocking `sleep()` starves every asset request: the page stays blank, the Vue app never mounts, and screenshots come out empty. Poll from the page with `$page->script(...)` (as the `waitFor*TestId()` helpers do) — that keeps the loop running.
- `BrowserTestCase` sets `$fakesVite = false` on purpose: these tests load real built assets, so faking Vite blanks the app.
- End page assertions with `->assertNoJavaScriptErrors()`.
-- CI runs them in five shards, each serially (`php artisan test tests/Browser --compact --shard=N/5`), against `npm run build` output, so keep them independent of a running dev server and of each other. Several tests still fail on timing under `--parallel`, so do not parallelise a shard until they are fixed; when you do, use `./vendor/bin/pest --parallel`, never `php artisan test --parallel`, which does not start the Playwright server.
+- CI runs them in three shards, each in parallel with three processes (`./vendor/bin/pest tests/Browser --compact --parallel --processes=3 --shard=N/3`), leaving a CPU of the 4-vCPU runner to the database and the app server, against `npm run build` output, so keep them independent of a running dev server and of each other. Run them in parallel through `./vendor/bin/pest`, never `php artisan test --parallel`, which does not start the Playwright server. A test that only passes alone has a race: wait for the state you assert (poll the DOM or the database) instead of assuming timing.
## Array Data Access
diff --git a/tests/Browser/AuthLanguageSwitcherTest.php b/tests/Browser/AuthLanguageSwitcherTest.php
index 0326a36b8..cfe79bc37 100644
--- a/tests/Browser/AuthLanguageSwitcherTest.php
+++ b/tests/Browser/AuthLanguageSwitcherTest.php
@@ -26,7 +26,7 @@ test('every logged-out auth screen offers the language switcher', function (stri
waitForAuthLanguageTestId($page, 'language-picker-trigger');
$page->assertVisible('@language-picker-trigger')->assertNoJavaScriptErrors();
-})->with(['login', 'register', 'password.request', 'password.reset']);
+})->with(['login']);
test('the switcher is hidden once the visitor is authenticated', function () {
$this->actingAs(User::factory()->create());
diff --git a/tests/Browser/AuthLegalLinksTest.php b/tests/Browser/AuthLegalLinksTest.php
index a3609cbf2..7bce898ad 100644
--- a/tests/Browser/AuthLegalLinksTest.php
+++ b/tests/Browser/AuthLegalLinksTest.php
@@ -2,24 +2,6 @@
declare(strict_types=1);
-test('the login screen shows the legal sentence to a logged out visitor', function () {
- visit(route('login'))
- ->assertVisible('@legal-links')
- ->assertSeeLink('Terms of Service')
- ->assertSeeLink('Privacy Policy')
- ->assertNoJavaScriptErrors();
-});
-
-test('the register screen shows the legal sentence to a logged out visitor', function () {
- config(['trypost.self_hosted' => false]);
-
- visit(route('register'))
- ->assertVisible('@legal-links')
- ->assertSeeLink('Terms of Service')
- ->assertSeeLink('Privacy Policy')
- ->assertNoJavaScriptErrors();
-});
-
test('the register screen shows the email form open next to the social buttons', function () {
config(['trypost.self_hosted' => false, 'trypost.google_auth_enabled' => true]);
diff --git a/tests/Browser/AuthReviewsTest.php b/tests/Browser/AuthReviewsTest.php
index 4931d630d..d3293e70f 100644
--- a/tests/Browser/AuthReviewsTest.php
+++ b/tests/Browser/AuthReviewsTest.php
@@ -2,14 +2,6 @@
declare(strict_types=1);
-test('the login screen shows the customer reviews to a logged out visitor', function () {
- visit(route('login'))
- ->assertVisible('@auth-reviews')
- ->assertVisible('@auth-reviews-g2-link')
- ->assertSee('Loved by people who publish every day')
- ->assertNoJavaScriptErrors();
-});
-
test('every review renders once for readers and once for the marquee loop', function () {
$page = visit(route('login'));
@@ -61,7 +53,6 @@ test('the reviews panel sits beside login and register only', function (string $
$page->assertNoJavaScriptErrors();
})->with([
['login', true],
- ['register', true],
['password.request', false],
]);
@@ -84,4 +75,4 @@ test('the auth column keeps a 16px gutter without overflow on phones', function
JS);
expect($layout)->toBe(['overflow' => false, 'left' => 16, 'right' => 16, 'height' => 32]);
-})->with(['login', 'register', 'password.request']);
+})->with(['login']);
diff --git a/tests/Browser/AuthTitlesTest.php b/tests/Browser/AuthTitlesTest.php
index 238badeec..5c862f2de 100644
--- a/tests/Browser/AuthTitlesTest.php
+++ b/tests/Browser/AuthTitlesTest.php
@@ -2,8 +2,6 @@
declare(strict_types=1);
-use App\Enums\User\Locale;
-
function waitForAuthTitlesTestId(mixed $page, string $testId): void
{
$page->script(<<<JS
@@ -86,73 +84,3 @@ test('typing a password ticks each requirement', function () {
$page->assertAttribute('@password-requirement-min', 'data-met', 'true')
->assertNoJavaScriptErrors();
});
-
-test('the register page lists the same requirements outside production', function (string $environment) {
- app()->detectEnvironment(fn (): string => $environment);
-
- $page = visit(route('register'));
- waitForAuthTitlesTestId($page, 'password-requirements');
-
- $page->assertSeeIn('@password-requirement-min', 'At least 12 characters')
- ->assertVisible('@password-requirement-mixed_case')
- ->assertVisible('@password-requirement-number')
- ->assertVisible('@password-requirement-symbol')
- ->assertNoJavaScriptErrors();
-})->with(['testing', 'local']);
-
-test('the auth title fits one line on a phone in every language', function (string $route, string $key) {
- $page = visit(route($route))->resize(390, 844);
- waitForAuthTitlesTestId($page, 'auth-title');
-
- $translations = collect(Locale::cases())
- ->mapWithKeys(fn (Locale $locale): array => [$locale->value => __($key, [], $locale->value)])
- ->all();
-
- $json = json_encode($translations, JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $wrapped = $page->script(<<<JS
- (() => {
- const translations = {$json};
- const element = document.querySelector('[data-testid="auth-title"]');
- const lineHeight = parseFloat(getComputedStyle(element).lineHeight);
- return Object.entries(translations)
- .filter(([, text]) => {
- element.textContent = text;
- return Math.round(element.getBoundingClientRect().height / lineHeight) > 1;
- })
- .map(([locale]) => locale);
- })()
- JS);
-
- expect($wrapped)->toBe([]);
-})->with([
- 'login' => ['login', 'auth.login.title'],
- 'register' => ['register', 'auth.register.title'],
-]);
-
-test('every password requirement fits one line on a phone in every language', function () {
- $page = visit(route('register'))->resize(390, 844);
- waitForAuthTitlesTestId($page, 'password-requirements');
-
- $translations = collect(Locale::cases())
- ->flatMap(fn (Locale $locale): array => collect(['min', 'mixed_case', 'number', 'symbol'])
- ->map(fn (string $key): string => __("auth.register.password_requirements.{$key}", ['count' => 12], $locale->value))
- ->all())
- ->all();
-
- $json = json_encode($translations, JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $wrapped = $page->script(<<<JS
- (() => {
- const translations = {$json};
- const element = document.querySelector('[data-testid="password-requirement-min"] span:last-child');
- const lineHeight = parseFloat(getComputedStyle(element).lineHeight);
- return translations.filter((text) => {
- element.textContent = text;
- return Math.round(element.getBoundingClientRect().height / lineHeight) > 1;
- });
- })()
- JS);
-
- expect($wrapped)->toBe([]);
-});
diff --git a/tests/Browser/BillingPageTest.php b/tests/Browser/BillingPageTest.php
index 9b0a9fe9d..c1200ec51 100644
--- a/tests/Browser/BillingPageTest.php
+++ b/tests/Browser/BillingPageTest.php
@@ -76,26 +76,6 @@ test('the billing page shows the current plan and changes plans in a dialog', fu
->assertNoJavaScriptErrors();
});
-test('the billing page does not scroll horizontally on a phone', function () {
- config(['trypost.self_hosted' => false]);
-
- $this->actingAs(billingPageOwner());
-
- $page = visit(route('app.billing.index'))->resize(390, 844);
- waitForBillingPageTestId($page, 'billing-current-plan');
-
- $overflow = fn (): bool => $page->script('document.documentElement.scrollWidth > document.documentElement.clientWidth');
-
- expect($overflow())->toBeFalse();
-
- $page->click('@billing-change-plan');
- waitForBillingPageTestId($page, 'plan-card-workspaces');
-
- expect($overflow())->toBeFalse();
-
- $page->assertNoJavaScriptErrors();
-});
-
test('self-hosted settings show neither an account nor a billing item', function () {
config(['trypost.self_hosted' => true]);
diff --git a/tests/Browser/CalendarPageTest.php b/tests/Browser/CalendarPageTest.php
index 9855e062b..e2683690a 100644
--- a/tests/Browser/CalendarPageTest.php
+++ b/tests/Browser/CalendarPageTest.php
@@ -4,10 +4,8 @@ declare(strict_types=1);
use App\Enums\Post\ScheduleMode;
use App\Enums\Post\Status as PostStatus;
-use App\Enums\PostPlatform\Status as PostPlatformStatus;
use App\Enums\SocialAccount\Platform;
use App\Enums\User\Locale;
-use App\Enums\User\TimeFormat;
use App\Jobs\Analytics\BootstrapAccountAnalytics;
use App\Jobs\Analytics\CollectAccountDailySnapshot;
use App\Models\AnalyticsPublication;
@@ -180,43 +178,6 @@ test('the calendar honours the channels filter and the display time zone', funct
$page->assertNoJavaScriptErrors();
});
-test('the channel calendar is scoped to the channel and links back to its list', function () {
- [$user, $linkedin, $x] = calendarPageSetup();
- $weekStart = now('UTC')->startOfWeek()->addWeek();
- $day = $weekStart->copy()->addDays(2);
-
- $linkedinPost = calendarPagePost($linkedin, $day->copy()->setTime(10, 0));
- $xPost = calendarPagePost($x, $day->copy()->setTime(10, 0));
-
- $this->actingAs($user);
-
- $page = visit(route('app.channels.calendar', ['account' => $linkedin, 'view' => 'week', 'week' => $weekStart->format('Y-m-d')]));
- waitForCalendarTestId($page, "calendar-post-{$linkedinPost->id}");
-
- $page->assertMissing("@calendar-post-{$xPost->id}")
- ->assertSeeIn('@header-title', $linkedin->display_name);
-
- expect($page->script('new URL(document.querySelector(\'[data-testid="schedule-view-list"]\').href).pathname'))
- ->toBe(parse_url(route('app.channels.publish', $linkedin), PHP_URL_PATH));
-
- $page->assertNoJavaScriptErrors();
-});
-
-test('the view menu offers only week and month', function () {
- [$user] = calendarPageSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.calendar', ['view' => 'month']));
- waitForCalendarTestId($page, 'calendar-view-trigger');
- $page->click('@calendar-view-trigger');
- waitForCalendarTestId($page, 'calendar-view-week');
-
- $page->assertVisible('@calendar-view-week')
- ->assertVisible('@calendar-view-month')
- ->assertMissing('@calendar-view-day')
- ->assertNoJavaScriptErrors();
-});
-
test('an overflowing week hour expands in place', function () {
[$user, $linkedin, $x] = calendarPageSetup();
$weekStart = now('UTC')->startOfWeek()->addWeek();
@@ -276,12 +237,12 @@ test('the no date panel slides open and closed, pushing the calendar aside gradu
$page = visit(route('app.calendar', ['view' => 'month']))->resize(1280, 900);
waitForCalendarTestId($page, 'calendar-no-date');
- $sample = <<<'JS'
+ $sample = fn (int $settled): string => <<<JS
(async () => {
const widths = [];
document.querySelector('[data-testid="calendar-no-date"]').click();
const started = performance.now();
- while (performance.now() - started < 500) {
+ while (performance.now() - started < 3000 && (performance.now() - started < 500 || widths.at(-1) !== {$settled})) {
await new Promise((resolve) => requestAnimationFrame(resolve));
widths.push(Math.round(document.querySelector('[data-testid="calendar-undated-slide"]')?.getBoundingClientRect().width ?? 0));
}
@@ -289,11 +250,11 @@ test('the no date panel slides open and closed, pushing the calendar aside gradu
})()
JS;
- $opening = $page->script($sample);
+ $opening = $page->script($sample(360));
expect(collect($opening)->contains(fn (int $width) => $width > 0 && $width < 360))->toBeTrue()
->and(end($opening))->toBe(360);
- $closing = $page->script($sample);
+ $closing = $page->script($sample(0));
expect(collect($closing)->contains(fn (int $width) => $width > 0 && $width < 360))->toBeTrue()
->and(end($closing))->toBe(0);
@@ -401,34 +362,6 @@ test('show posting times renders empty slots in the week and month views', funct
$month->assertNoJavaScriptErrors();
});
-test('an imported post shows in the hour it was published', function () {
- [$user, $linkedin, $x] = calendarPageSetup();
- $user->update(['time_format' => TimeFormat::TwentyFourHour]);
- $weekStart = now('UTC')->startOfWeek()->addWeek();
- $day = $weekStart->copy()->addDays(1);
- $dayKey = $day->format('Y-m-d');
-
- $post = Post::factory()->imported()->create([
- 'workspace_id' => $x->workspace_id,
- 'published_at' => $day->copy()->setTime(16, 40),
- ]);
- PostPlatform::factory()->published()->create([
- 'post_id' => $post->id,
- 'social_account_id' => $x->id,
- 'platform' => $x->platform,
- 'status' => PostPlatformStatus::Published,
- ]);
-
- $this->actingAs($user);
-
- $page = visit(route('app.calendar', ['view' => 'week', 'week' => $weekStart->format('Y-m-d')]));
- waitForCalendarTestId($page, "calendar-post-{$post->id}");
-
- expect(calendarChipSlot($page, $post))->toBe("calendar-slot-{$dayKey}-16");
- $page->assertSeeIn("@calendar-post-{$post->id}", '16:40');
- $page->assertNoJavaScriptErrors();
-});
-
test('clicking a scheduled post chip in the month view opens its timeline card in a popover', function () {
[$user, $linkedin] = calendarPageSetup();
$at = now('UTC')->addMonthNoOverflow()->startOfMonth()->addDays(10)->setTime(10, 0);
@@ -549,26 +482,6 @@ test('a published post popover shows its metrics, go to post and the sent menu',
->assertNoJavaScriptErrors();
});
-test('a week view post card shows its network icon, time and plain text', function () {
- [$user, $linkedin] = calendarPageSetup();
- $weekStart = now('UTC')->startOfWeek()->addWeek();
- $post = calendarPagePost($linkedin, $weekStart->copy()->addDays(2)->setTime(11, 0));
- $post->update(['content' => '<p>Week text visible</p>']);
-
- $this->actingAs($user);
-
- $page = visit(route('app.calendar', ['view' => 'week', 'week' => $weekStart->format('Y-m-d')]));
- waitForCalendarTestId($page, "calendar-post-{$post->id}");
-
- $page->assertSeeIn("@calendar-post-text-{$post->id}", 'Week text visible')
- ->assertDontSeeIn("@calendar-post-{$post->id}", '<p>');
-
- expect($page->script("(() => { const chip = document.querySelector('[data-testid=\"calendar-post-{$post->id}\"]'); return [chip.querySelector('svg') !== null, chip.querySelector('img') === null]; })()"))
- ->toBe([true, true]);
-
- $page->assertNoJavaScriptErrors();
-});
-
test('an overflowing month day expands and collapses back', function () {
[$user, $linkedin] = calendarPageSetup();
$day = now('UTC')->addMonthNoOverflow()->startOfMonth()->addDays(12);
@@ -686,40 +599,6 @@ test('on a phone the month shows its weeks in columns with the posts of each day
->assertNoJavaScriptErrors();
});
-test('on a phone a free posting slot in the week opens the composer at that instant', function () {
- [$user, $linkedin] = calendarPageSetup();
- $schedule = PostingSchedule::empty();
-
- foreach (range(0, 6) as $weekday) {
- $schedule = $schedule->withTime($weekday, '15:00');
- }
-
- $linkedin->update(['posting_schedule' => $schedule]);
-
- $weekStart = now('UTC')->startOfWeek()->addWeek();
- $day = $weekStart->copy()->addDays(2);
- $slotKey = "{$linkedin->id}-{$day->copy()->setTime(15, 0)->getTimestamp()}";
-
- $this->actingAs($user);
-
- $page = visit(route('app.calendar', ['view' => 'week', 'week' => $weekStart->format('Y-m-d')]))->resize(390, 844);
- $page->script('window.localStorage.clear()');
- $page->refresh();
- waitForCalendarTestId($page, "calendar-posting-slot-{$slotKey}");
-
- $page->click("@calendar-posting-slot-{$slotKey}");
- waitForCalendarTestId($page, "composer-caption-{$linkedin->id}");
- $page->fill("@composer-caption-{$linkedin->id}", 'From a phone slot');
- waitForCalendarTestId($page, 'composer-submit');
- $page->click('@composer-submit');
- waitForCalendarCondition($page, '!document.querySelector(\'[data-testid="post-composer-dialog"]\')');
- $post = Post::query()->where('workspace_id', $linkedin->workspace_id)->sole();
-
- expect($post->scheduled_at->equalTo($day->copy()->setTime(15, 0)))->toBeTrue()
- ->and($post->schedule_mode)->toBe(ScheduleMode::Queue);
- $page->assertNoJavaScriptErrors();
-});
-
test('on a phone, tapping a post in the month opens its details directly', function () {
[$user, $linkedin] = calendarPageSetup();
$at = now('UTC')->addMonthNoOverflow()->startOfMonth()->addDays(10)->setTime(12, 0);
diff --git a/tests/Browser/ChannelGridTest.php b/tests/Browser/ChannelGridTest.php
index 33d136ad0..5cd4eb610 100644
--- a/tests/Browser/ChannelGridTest.php
+++ b/tests/Browser/ChannelGridTest.php
@@ -161,17 +161,6 @@ test('the grid sits under the shared channel header, which stays put while the g
$page->assertNoJavaScriptErrors();
});
-test('the grid button carries no note on the list page', function () {
- $this->actingAs($this->user);
-
- $page = visit(route('app.channels.publish', $this->instagram));
- waitForChannelGridTestId($page, 'schedule-view-grid');
-
- $page->hover('@schedule-view-grid')
- ->assertMissing('@schedule-view-grid-note')
- ->assertNoJavaScriptErrors();
-});
-
test('the grid keeps the schedule view switch and the new post button', function () {
channelGridBrowserPost($this->instagram, '2026-09-01 10:00:00', ContentType::InstagramFeed, [channelGridImage()]);
@@ -221,75 +210,6 @@ test('clicking a carousel tile opens its media in the lightbox', function () {
->assertNoJavaScriptErrors();
});
-test('the grid shows an empty state without published posts', function () {
- $this->actingAs($this->user);
-
- $page = visit(route('app.channels.grid', $this->instagram));
- waitForChannelGridTestId($page, 'empty-state');
-
- $page->assertVisible('@empty-state')
- ->assertMissing('@channel-grid')
- ->assertNoJavaScriptErrors();
-});
-
-test('other channels and all channels offer no grid view', function () {
- $linkedin = SocialAccount::factory()->create([
- 'workspace_id' => $this->user->current_workspace_id,
- 'platform' => Platform::LinkedIn,
- ]);
-
- $this->actingAs($this->user);
-
- $page = visit(route('app.channels.publish', $linkedin));
- waitForChannelGridTestId($page, 'schedule-view-list');
-
- $page->assertVisible('@schedule-view-list')
- ->assertMissing('@schedule-view-grid');
-
- $page = visit(route('app.posts.index'));
- waitForChannelGridTestId($page, 'schedule-view-list');
-
- $page->assertVisible('@schedule-view-list')
- ->assertMissing('@schedule-view-grid')
- ->assertNoJavaScriptErrors();
-});
-
-test('no schedule view label wraps onto a second line in any language', function () {
- $wrapped = [];
-
- foreach (Locale::cases() as $locale) {
- $this->user->update(['locale' => $locale]);
- $this->actingAs($this->user->fresh());
-
- $page = visit(route('app.channels.publish', $this->instagram));
- waitForChannelGridTestId($page, 'schedule-view-grid');
-
- $lines = $page->script(<<<'JS'
- [...document.querySelectorAll('[data-testid^="schedule-view-"]')]
- .map((item) => {
- const walker = document.createTreeWalker(item, NodeFilter.SHOW_TEXT);
- let lineCount = 0;
- while (walker.nextNode()) {
- if (!walker.currentNode.textContent.trim()) continue;
- const range = document.createRange();
- range.selectNodeContents(walker.currentNode);
- const tops = new Set([...range.getClientRects()].filter((rect) => rect.width > 0).map((rect) => Math.round(rect.top)));
- lineCount = Math.max(lineCount, tops.size);
- }
- return [item.textContent.trim(), lineCount];
- })
- .filter(([, lineCount]) => lineCount > 1)
- .map(([text]) => text)
- JS);
-
- foreach ($lines as $text) {
- $wrapped[] = "{$locale->value}: {$text}";
- }
- }
-
- expect($wrapped)->toBe([]);
-});
-
test('the grid tooltip shows the sent time in the user zone, not the browser zone', function () {
$this->user->update(['timezone' => 'Asia/Tokyo']);
$reel = channelGridBrowserPost($this->instagram, '2026-09-20 10:00:00', ContentType::InstagramReel, [
diff --git a/tests/Browser/ChannelInsightsFiltersTest.php b/tests/Browser/ChannelInsightsFiltersTest.php
index f59adb938..adbe88b0a 100644
--- a/tests/Browser/ChannelInsightsFiltersTest.php
+++ b/tests/Browser/ChannelInsightsFiltersTest.php
@@ -127,31 +127,6 @@ test('the post type filter lists this platform types and narrows the URL and the
->assertNoJavaScriptErrors();
});
-test('the label filter narrows the publications and clear all resets it', function () {
- $page = visit(route('app.channels.insights', $this->instagram));
- waitForInsightsFilterTestId($page, 'insights-label-filter');
-
- $page->click('@insights-label-filter');
- waitForInsightsFilterTestId($page, "insights-label-option-{$this->label->id}");
-
- $page->click("@insights-label-option-{$this->label->id}");
- waitForInsightsFilterScript($page, 'document.querySelectorAll("#insights-posts-body tr").length === 1 && document.querySelector("[data-testid=insights-card-posts] .font-heading").textContent.trim() === "1"');
-
- $page->assertScript('Array.from(new URLSearchParams(location.search)).filter(([key]) => key.startsWith("labels[")).map(([, value]) => value).join(",")', $this->label->id)
- ->assertPresent("@insights-posts-row-{$this->reel->id}")
- ->assertScript('document.querySelector("[data-testid=insights-card-posts] .font-heading").textContent.trim()', '1')
- ->click('@insights-label-untagged-checkbox');
- waitForInsightsFilterScript($page, 'document.querySelectorAll("#insights-posts-body tr").length === 3');
-
- $page->assertScript('new URLSearchParams(location.search).get("untagged")', '1')
- ->click('@insights-label-clear');
- waitForInsightsFilterScript($page, '!location.search.includes("labels") && !location.search.includes("untagged")');
-
- $page->assertScript('location.search.includes("labels")', false)
- ->assertScript('document.querySelectorAll("#insights-posts-body tr").length', 3)
- ->assertNoJavaScriptErrors();
-});
-
test('history navigation re-syncs the label filter with the page', function () {
$page = visit(route('app.channels.insights', $this->instagram));
waitForInsightsFilterTestId($page, 'insights-label-filter');
diff --git a/tests/Browser/ChannelInsightsTest.php b/tests/Browser/ChannelInsightsTest.php
index 220049ab1..352c394dc 100644
--- a/tests/Browser/ChannelInsightsTest.php
+++ b/tests/Browser/ChannelInsightsTest.php
@@ -119,27 +119,6 @@ beforeEach(function () {
$this->actingAs($this->user);
});
-test('an Instagram channel shows only the metrics it reports', function () {
- $page = visit(route('app.channels.insights', $this->instagram));
- waitForChannelInsightsTestId($page, 'insights-card-views');
-
- $page->assertVisible('@insights-card-views')
- ->assertVisible('@insights-card-reactions')
- ->assertMissing('@insights-card-saves')
- ->assertVisible("@insights-posts-row-{$this->mostReactions->id}")
- ->assertScript('document.querySelector("[data-testid=insights-range-30d]")?.getAttribute("aria-pressed")', 'true')
- ->assertPresent('@insights-range-caption')
- ->assertNoJavaScriptErrors();
-});
-
-test('the channel insights page offers exactly 7 days, 30 days, month to date and custom', function () {
- $page = visit(route('app.channels.insights', ['account' => $this->instagram]));
- waitForChannelInsightsTestId($page, 'insights-range-7d');
-
- $page->assertScript('Array.from(document.querySelectorAll("[data-testid^=insights-range-]")).map((element) => element.dataset.testid).filter((id) => ["insights-range-7d", "insights-range-30d", "insights-range-mtd", "insights-range-last_month", "insights-range-custom"].includes(id)).join(",")', 'insights-range-7d,insights-range-30d,insights-range-mtd,insights-range-custom')
- ->assertNoJavaScriptErrors();
-});
-
test('a range preset reloads the page with that range and keeps the table state', function () {
$page = visit(route('app.channels.insights', ['account' => $this->instagram, 'sort' => 'views', 'period' => 'previous']));
waitForChannelInsightsTestId($page, 'insights-range-7d');
@@ -153,56 +132,6 @@ test('a range preset reloads the page with that range and keeps the table state'
->assertNoJavaScriptErrors();
});
-test('sorting by views puts the most viewed publication first', function () {
- $page = visit(route('app.channels.insights', $this->instagram));
- waitForChannelInsightsTestId($page, 'insights-sort-views');
-
- $page->assertScript('document.querySelector("#insights-posts-body tr")?.dataset.testid', "insights-posts-row-{$this->mostReactions->id}")
- ->click('@insights-sort-views');
- waitForChannelInsightsScript($page, "document.querySelector('#insights-posts-body tr')?.dataset.testid === 'insights-posts-row-{$this->mostViews->id}' && new URLSearchParams(location.search).get('sort') === 'views'");
-
- $page->assertScript('document.querySelector("#insights-posts-body tr")?.dataset.testid', "insights-posts-row-{$this->mostViews->id}")
- ->assertScript('new URLSearchParams(location.search).get("sort")', 'views')
- ->assertScript('document.querySelectorAll("#insights-posts-body tr").length', 2)
- ->assertNoJavaScriptErrors();
-});
-
-test('the previous period lists publications from the previous range', function () {
- $page = visit(route('app.channels.insights', $this->instagram));
- waitForChannelInsightsTestId($page, 'insights-period-previous');
-
- $page->click('@insights-period-previous');
- waitForChannelInsightsScript($page, "Boolean(document.querySelector('[data-testid=\"insights-posts-row-{$this->previous->id}\"]')) && !document.querySelector('[data-testid=\"insights-posts-row-{$this->mostReactions->id}\"]') && new URLSearchParams(location.search).get('period') === 'previous'");
-
- $page->assertVisible("@insights-posts-row-{$this->previous->id}")
- ->assertMissing("@insights-posts-row-{$this->mostReactions->id}")
- ->assertScript('new URLSearchParams(location.search).get("period")', 'previous')
- ->assertNoJavaScriptErrors();
-});
-
-test('a LinkedIn channel explains that the network has no analytics', function () {
- $linkedin = SocialAccount::factory()->linkedin()->create(['workspace_id' => $this->user->current_workspace_id]);
-
- $page = visit(route('app.channels.insights', $linkedin));
- waitForChannelInsightsTestId($page, 'insights-unsupported');
-
- $page->assertVisible('@insights-unsupported')
- ->assertMissing('@insights-range-presets')
- ->assertNoJavaScriptErrors();
-});
-
-test('the sidebar insights link opens the channel insights page', function () {
- $page = visit(route('app.channels.publish', $this->instagram));
- waitForChannelInsightsTestId($page, "sidebar-channel-{$this->instagram->id}-insights");
-
- $page->click("@sidebar-channel-{$this->instagram->id}-insights");
- waitForChannelInsightsTestId($page, 'insights-card-views');
-
- $page->assertScript('location.pathname', parse_url(route('app.channels.insights', $this->instagram), PHP_URL_PATH))
- ->assertVisible('@channel-insights')
- ->assertNoJavaScriptErrors();
-});
-
test('finishing the import refreshes the available metrics and the publication table', function () {
$fresh = SocialAccount::factory()->create([
'workspace_id' => $this->user->current_workspace_id,
@@ -289,22 +218,6 @@ test('a publication with a TryPost post opens the post details on the insights p
->assertNoJavaScriptErrors();
});
-test('a publication without a TryPost post opens its details on the insights page', function () {
- $this->mostViews->update(['excerpt' => 'Posted straight on Instagram', 'permalink' => 'https://www.instagram.com/p/most-views/']);
-
- $page = visit(route('app.channels.insights', $this->instagram));
- waitForChannelInsightsTestId($page, "insights-posts-link-{$this->mostViews->id}");
- $path = $page->script('location.pathname');
-
- $page->click("@insights-posts-link-{$this->mostViews->id}");
- waitForChannelInsightsTestId($page, "publication-details-{$this->mostViews->id}");
-
- $page->assertSeeIn("@publication-details-text-{$this->mostViews->id}", 'Posted straight on Instagram')
- ->assertAttribute("@publication-details-view-{$this->mostViews->id}", 'href', 'https://www.instagram.com/p/most-views/')
- ->assertScript('location.pathname', $path)
- ->assertNoJavaScriptErrors();
-});
-
test('on a phone the channel insights range presets collapse into a dropdown', function () {
$page = visit(route('app.channels.insights', ['account' => $this->instagram]))->resize(390, 844);
waitForChannelInsightsTestId($page, 'insights-range-mobile-trigger');
@@ -324,14 +237,6 @@ test('on a phone the channel insights range presets collapse into a dropdown', f
->assertNoJavaScriptErrors();
});
-test('on desktop the channel insights range keeps the segmented control', function () {
- $page = visit(route('app.channels.insights', ['account' => $this->instagram]));
- waitForChannelInsightsTestId($page, 'insights-range-7d');
-
- $page->assertScript('document.querySelector("[data-testid=insights-range-mobile-trigger]").getBoundingClientRect().height', 0)
- ->assertNoJavaScriptErrors();
-});
-
test('the channel insights header sticks under the channel header with a divider like the workspace insights', function () {
$today = CarbonImmutable::today('UTC');
@@ -385,53 +290,3 @@ test('the per post table shows ten posts per page with numbered pages kept in th
$page->assertAttribute('@insights-posts-page-1', 'aria-current', 'page')
->assertNoJavaScriptErrors();
});
-
-test('a sort or period change goes back to the first page', function () {
- $today = CarbonImmutable::today('UTC');
-
- foreach (range(1, 11) as $index) {
- channelInsightsBrowserPublication($this->instagram, $today->subDays(1 + $index % 20)->setTime(9, $index), [
- 'reactions_count' => $index,
- 'comments_count' => 0,
- 'views_count' => 200 + $index,
- ]);
- }
-
- $page = visit(route('app.channels.insights', ['account' => $this->instagram, 'page' => 2]));
- waitForChannelInsightsTestId($page, 'insights-posts-pagination');
-
- $page->assertAttribute('@insights-posts-page-2', 'aria-current', 'page')
- ->click('@insights-sort-views');
- waitForChannelInsightsScript($page, 'new URLSearchParams(location.search).get("sort") === "views" && document.querySelectorAll("#insights-posts-body tr").length === 10');
-
- $page->assertScript('new URLSearchParams(location.search).has("page")', false)
- ->assertAttribute('@insights-posts-page-1', 'aria-current', 'page')
- ->click('@insights-posts-page-2');
- waitForChannelInsightsScript($page, 'new URLSearchParams(location.search).get("page") === "2"');
-
- $page->click('@insights-period-previous');
- waitForChannelInsightsScript($page, 'new URLSearchParams(location.search).get("period") === "previous"');
-
- $page->assertScript('new URLSearchParams(location.search).has("page")', false)
- ->assertMissing('@insights-posts-pagination')
- ->assertVisible("@insights-posts-row-{$this->previous->id}")
- ->assertNoJavaScriptErrors();
-});
-
-test('a row shows its type and offers its actions', function () {
- $reel = channelInsightsBrowserPublication($this->instagram, CarbonImmutable::today('UTC')->subDays(3)->setTime(10, 0), ['reactions_count' => 1]);
- $reel->update(['content_type' => 'reel', 'permalink' => 'https://www.instagram.com/reel/abc/']);
-
- $page = visit(route('app.channels.insights', $this->instagram));
- waitForChannelInsightsTestId($page, "insights-posts-actions-{$reel->id}");
-
- $page->assertSeeIn("@insights-posts-type-{$reel->id}", 'Reel')
- ->assertVisible("@insights-posts-type-icon-{$reel->id}")
- ->click("@insights-posts-actions-{$reel->id}");
- waitForChannelInsightsTestId($page, "insights-posts-open-{$reel->id}");
-
- $page->assertAttribute("@insights-posts-open-{$reel->id}", 'href', 'https://www.instagram.com/reel/abc/')
- ->assertVisible("@insights-posts-copy-{$reel->id}")
- ->assertVisible("@insights-posts-details-{$reel->id}")
- ->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/ChannelMediaIssueTest.php b/tests/Browser/ChannelMediaIssueTest.php
index a07e2a353..4434fa542 100644
--- a/tests/Browser/ChannelMediaIssueTest.php
+++ b/tests/Browser/ChannelMediaIssueTest.php
@@ -13,55 +13,11 @@ use App\Models\User;
use App\Models\Workspace;
use Illuminate\Support\Facades\Storage;
-/**
- * A post carrying a PDF with one deselected X channel. X never accepts a
- * document, so the channel has a media issue before the user touches it.
- */
-function seedChannelMediaIssuePost(): PostPlatform
-{
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create(['user_id' => $user->id]);
- $workspace->members()->attach($user->id, membershipPivot('member'));
- $user->update(['current_workspace_id' => $workspace->id]);
-
- $account = SocialAccount::factory()->x()->create(['workspace_id' => $workspace->id]);
-
- $post = Post::factory()->create([
- 'workspace_id' => $workspace->id,
- 'user_id' => $user->id,
- 'content' => 'hello',
- 'media' => [[
- 'id' => 'd1',
- 'type' => 'document',
- 'mime_type' => 'application/pdf',
- 'path' => 'uploads/deck.pdf',
- 'url' => 'https://cdn.test/deck.pdf',
- 'size' => 1024,
- ]],
- ]);
-
- $postPlatform = PostPlatform::factory()->create([
- 'post_id' => $post->id,
- 'social_account_id' => $account->id,
- 'platform' => Platform::X,
- 'content_type' => ContentType::XPost,
- ]);
-
- test()->actingAs($user);
-
- return $postPlatform;
-}
-
function waitForChannelIssueTestId(mixed $page, string $testId): void
{
waitForChannelIssueCondition($page, $testId, 'el.getBoundingClientRect().height > 0');
}
-function waitForChannelIssuePressed(mixed $page, string $testId): void
-{
- waitForChannelIssueCondition($page, $testId, "el.getAttribute('aria-pressed') === 'true'");
-}
-
/**
* Polls from the page (never sleep(): the test's HTTP server only ticks while
* Pest awaits Playwright) until the element exists and `$condition` holds.
@@ -80,17 +36,6 @@ function waitForChannelIssueCondition(mixed $page, string $testId, string $condi
JS);
}
-test('an independent channel draft with incompatible media remains editable', function () {
- $postPlatform = seedChannelMediaIssuePost();
-
- $page = visit(route('app.posts.edit', $postPlatform->post));
- waitForChannelIssueTestId($page, 'post-composer-dialog');
-
- $page->assertVisible('@post-composer-dialog')
- ->assertVisible('@composer-customization')
- ->assertNoJavaScriptErrors();
-});
-
test('an Instagram media warning links to the network limits', function () {
[$post] = seedInstagramFeedImagePost(size: 9 * 1024 * 1024);
@@ -174,27 +119,8 @@ test('Facebook has no aspect ratio selector and accepts an image of any ratio',
->assertNoJavaScriptErrors();
})->with([
'very tall' => [800, 3200],
- 'very wide' => [3200, 800],
]);
-test('Instagram feed without a saved aspect ratio uses the original image', function () {
- [$post, $postPlatform] = seedInstagramFeedImagePost([]);
-
- $page = visit(route('app.posts.edit', $post));
- waitForChannelIssueTestId($page, "channel-{$postPlatform->id}");
-
- $page->assertMissing('@instagram-aspect-original')
- ->assertVisible('@instagram-image-aspect-issue-0')
- ->assertDisabled('@composer-submit')
- ->assertNoJavaScriptErrors();
-
- waitForChannelIssueTestId($page, 'instagram-feed-media');
-
- $heightToWidth = $page->script('(() => { const frame = document.querySelector("[data-testid=instagram-feed-media]"); const rect = frame.getBoundingClientRect(); return rect.height / rect.width; })()');
-
- expect(abs($heightToWidth - 1600 / 1080))->toBeLessThan(0.01);
-});
-
test('saving an Instagram post stores no global aspect ratio', function () {
[$post, $postPlatform] = seedInstagramFeedImagePost([], ['width' => 1080, 'height' => 1350], imageCount: 1);
$asset = Media::factory()->ownedByPost($post)->create([
@@ -237,16 +163,6 @@ test('Instagram original preview falls back to square when image dimensions are
expect(abs($heightToWidth - 1.0))->toBeLessThan(0.01);
});
-test('Instagram feed still enforces image size limits', function () {
- [$post] = seedInstagramFeedImagePost(size: 9 * 1024 * 1024);
-
- $page = visit(route('app.posts.edit', $post));
- waitForChannelIssueTestId($page, 'media-rules-warning');
-
- $page->assertPresent('@media-rules-warning')
- ->assertNoJavaScriptErrors();
-});
-
test('supported Instagram original image keeps its own aspect and can publish', function (int $height) {
[$post] = seedInstagramFeedImagePost(imageMeta: ['width' => 1080, 'height' => $height]);
@@ -257,7 +173,6 @@ test('supported Instagram original image keeps its own aspect and can publish',
->assertEnabled('@composer-submit')
->assertNoJavaScriptErrors();
})->with([
- '4:5' => [1350],
'3:4, accepted by the Graph API although its docs still say 4:5' => [1440],
]);
diff --git a/tests/Browser/ChannelMetricsCardTest.php b/tests/Browser/ChannelMetricsCardTest.php
index eeb8e8f63..216810530 100644
--- a/tests/Browser/ChannelMetricsCardTest.php
+++ b/tests/Browser/ChannelMetricsCardTest.php
@@ -3,7 +3,6 @@
declare(strict_types=1);
use App\Enums\SocialAccount\Platform;
-use App\Enums\User\Locale;
use App\Jobs\Analytics\BootstrapAccountAnalytics;
use App\Jobs\Analytics\CollectAccountDailySnapshot;
use App\Models\AnalyticsAccountDailySnapshot;
@@ -132,16 +131,17 @@ test('the metrics card loads after the page and opens on content impact', functi
->assertScript('document.querySelectorAll("[data-testid=insights-metrics-bar]").length > 0', true)
->assertScript('document.querySelectorAll("[data-testid=insights-metrics-chart] svg").length > 0', true)
->assertMissing('@followers-bar')
- ->assertMissing('@posts-chart-bar')
- ->assertNoJavaScriptErrors();
-});
+ ->assertMissing('@posts-chart-bar');
-test('the performance per post table comes before the metrics card', function () {
- $page = visit(route('app.channels.insights', $this->instagram));
- waitForMetricsCardTestId($page, 'insights-metrics-chart');
waitForMetricsCardTestId($page, 'insights-posts');
$page->assertScript('Boolean(document.querySelector("[data-testid=insights-posts]").compareDocumentPosition(document.querySelector("[data-testid=insights-metrics]")) & Node.DOCUMENT_POSITION_FOLLOWING)', true)
+ ->assertScript(<<<'JS'
+ [...document.querySelectorAll('[data-testid="insights-metrics-controls"] button, [data-testid="insights-metrics-modes"] button')]
+ .map((button) => [button.classList.contains('h-7'), Math.round(button.getBoundingClientRect().height)])
+ .every(([small, height]) => small && height === 28)
+ JS, true)
+ ->assertScript('document.querySelectorAll("[data-testid=insights-metrics-controls] button, [data-testid=insights-metrics-modes] button").length', 9)
->assertNoJavaScriptErrors();
});
@@ -194,19 +194,6 @@ test('the metric menu lists the channel metrics and switches the chart to one me
->assertNoJavaScriptErrors();
});
-test('every control of the metrics card is a small button', function () {
- $page = visit(route('app.channels.insights', $this->instagram));
- waitForMetricsCardTestId($page, 'insights-metrics-chart');
-
- $page->assertScript(<<<'JS'
- [...document.querySelectorAll('[data-testid="insights-metrics-controls"] button, [data-testid="insights-metrics-modes"] button')]
- .map((button) => [button.classList.contains('h-7'), Math.round(button.getBoundingClientRect().height)])
- .every(([small, height]) => small && height === 28)
- JS, true)
- ->assertScript('document.querySelectorAll("[data-testid=insights-metrics-controls] button, [data-testid=insights-metrics-modes] button").length', 9)
- ->assertNoJavaScriptErrors();
-});
-
test('the follower growth rate preset draws the last twelve months and ignores the filters', function () {
$page = visit(route('app.channels.insights', ['account' => $this->instagram, 'range' => '7d']));
waitForMetricsCardTestId($page, 'insights-preset-follower_growth_rate');
@@ -229,24 +216,7 @@ test('the follower growth rate preset draws the last twelve months and ignores t
->assertNoJavaScriptErrors();
});
-test('presets swap the chart series', function () {
- $page = visit(route('app.channels.insights', $this->instagram));
- waitForMetricsCardTestId($page, 'insights-preset-audience_growth');
-
- $page->click('@insights-preset-audience_growth');
- waitForMetricsCardTestId($page, 'insights-metrics-legend-net_followers');
- $page->assertVisible('@insights-metrics-legend-followers')
- ->assertMissing('@insights-metrics-legend-posts')
- ->assertAttribute('@insights-preset-audience_growth', 'aria-pressed', 'true');
-
- $page->click('@insights-preset-visibility');
- waitForMetricsCardTestId($page, 'insights-metrics-legend-profile_visits');
- $page->assertSeeIn('@insights-metrics-legend-profile_visits-value', '18')
- ->assertVisible('@insights-metrics-legend-followers')
- ->assertNoJavaScriptErrors();
-});
-
-test('the selected preset and period survive a filter change', function () {
+test('presets swap the chart series and the selected preset and period survive a filter change', function () {
$page = visit(route('app.channels.insights', $this->instagram));
waitForMetricsCardTestId($page, 'insights-preset-audience_growth');
@@ -257,13 +227,18 @@ test('the selected preset and period survive a filter change', function () {
$page->click('@insights-post-type-filter');
waitForMetricsCardTestId($page, 'insights-post-type-option-instagram_reel');
$page->click('@insights-post-type-option-instagram_reel');
- waitForMetricsCardScript($page, 'new URLSearchParams(location.search).getAll("types[]").includes("instagram_reel") && document.querySelector("[data-testid=insights-metrics-chart]")');
- waitForMetricsCardTestId($page, 'insights-metrics-legend-net_followers-previous');
+ waitForMetricsCardScript($page, 'new URLSearchParams(location.search).getAll("types[]").includes("instagram_reel") && document.querySelector("[data-testid=insights-metrics-chart]") && document.querySelector("[data-testid=insights-preset-audience_growth]")?.getAttribute("aria-pressed") === "true" && document.querySelector("[data-testid=insights-metrics-mode-both]")?.getAttribute("aria-pressed") === "true" && document.querySelector("[data-testid=insights-metrics-legend-net_followers-previous]")');
$page->assertScript('decodeURIComponent(location.search).includes("instagram_reel")', true)
->assertAttribute('@insights-preset-audience_growth', 'aria-pressed', 'true')
->assertAttribute('@insights-metrics-mode-both', 'aria-pressed', 'true')
->assertVisible('@insights-metrics-legend-net_followers-previous')
+ ->assertVisible('@insights-metrics-legend-followers')
+ ->assertMissing('@insights-metrics-legend-posts');
+
+ $page->click('@insights-preset-visibility');
+ waitForMetricsCardTestId($page, 'insights-metrics-legend-profile_visits');
+ $page->assertVisible('@insights-metrics-legend-followers')
->assertNoJavaScriptErrors();
});
@@ -278,43 +253,6 @@ test('a one-day range still draws the posts of that day', function () {
->assertNoJavaScriptErrors();
});
-test('the column chooser keeps the sorted column', function () {
- $page = visit(route('app.channels.insights', ['account' => $this->instagram, 'sort' => 'views']));
- waitForMetricsCardTestId($page, 'insights-columns-trigger');
-
- $page->click('@insights-columns-trigger');
- waitForMetricsCardTestId($page, 'insights-column-views');
-
- $page->assertAttribute('@insights-column-views', 'data-disabled', '')
- ->click('@insights-column-reach');
- waitForMetricsCardScript($page, '!document.querySelector("[data-testid=insights-sort-reach]")');
-
- $page->assertVisible('@insights-sort-views')
- ->assertNoJavaScriptErrors();
-});
-
-test('an X channel offers its impressions and hides profile visits, visibility and the growth rate', function () {
- $x = SocialAccount::factory()->create(['workspace_id' => $this->instagram->workspace_id, 'platform' => Platform::X]);
- metricsCardPublication($x, CarbonImmutable::today('UTC')->subDays(3)->setTime(10, 0), ['impressions_count' => 500]);
-
- $page = visit(route('app.channels.insights', $x));
- waitForMetricsCardTestId($page, 'insights-preset-content_impact');
-
- $page->assertMissing('@insights-preset-visibility')
- ->assertMissing('@insights-preset-follower_growth_rate')
- ->assertVisible('@insights-preset-audience_growth')
- ->click('@insights-metric-menu');
- waitForMetricsCardTestId($page, 'insights-metric-option-impressions');
-
- $page->assertScript('[...document.querySelectorAll("[data-testid^=insights-metric-option-]:not([data-testid$=-check])")].map((item) => item.dataset.testid.replace("insights-metric-option-", "")).join(",")', 'followers,impressions,posts,net_followers')
- ->click('@insights-metric-option-impressions');
- waitForMetricsCardTestId($page, 'insights-metrics-legend-impressions');
-
- $page->assertSeeIn('@insights-metric-primary', 'Impressions')
- ->assertSeeIn('@insights-metrics-legend-impressions-value', '500')
- ->assertNoJavaScriptErrors();
-});
-
test('the mode toggle shows the comparison period and both periods', function () {
$page = visit(route('app.channels.insights', $this->instagram));
waitForMetricsCardTestId($page, 'insights-metrics-mode-both');
@@ -367,22 +305,6 @@ test('the insight banner reads the selected chart against the previous period',
->assertNoJavaScriptErrors();
});
-test('a channel without follower history explains the empty audience chart', function () {
- $fresh = SocialAccount::factory()->create(['workspace_id' => $this->instagram->workspace_id, 'platform' => Platform::Instagram]);
- metricsCardPublication($fresh, CarbonImmutable::today('UTC')->subDays(3)->setTime(10, 0), ['reach_count' => 10]);
-
- $page = visit(route('app.channels.insights', $fresh));
- waitForMetricsCardTestId($page, 'insights-preset-audience_growth');
-
- $page->click('@insights-preset-audience_growth');
- waitForMetricsCardTestId($page, 'insights-metrics-no-history');
-
- $page->assertVisible('@insights-metrics-no-history')
- ->assertMissing('@insights-metrics-chart')
- ->assertMissing('@insights-metrics-insight')
- ->assertNoJavaScriptErrors();
-});
-
test('on a phone the presets wrap and the mode toggle sits under the legend', function () {
$page = visit(route('app.channels.insights', $this->instagram))->resize(390, 844);
waitForMetricsCardTestId($page, 'insights-metrics-chart');
@@ -431,42 +353,3 @@ test('the column chooser hides and adds columns and remembers the choice', funct
->assertVisible('@insights-sort-reactions')
->assertNoJavaScriptErrors();
});
-
-test('no metrics control wraps onto a second line in any language', function () {
- $wrapped = [];
-
- foreach (Locale::cases() as $locale) {
- $this->user->update(['locale' => $locale]);
- $this->actingAs($this->user->fresh());
-
- $page = visit(route('app.channels.insights', $this->instagram));
- waitForMetricsCardTestId($page, 'insights-metrics-chart');
- waitForMetricsCardScript($page, '!document.querySelector("[data-testid=insights-metrics]")?.textContent.includes("analytics.")');
-
- $lines = $page->script(<<<'JS'
- [...document.querySelectorAll('[data-testid="insights-metrics-controls"] button, [data-testid^="insights-metrics-mode-"], [data-testid^="insights-metrics-legend-"] > span:first-child, [data-testid^="insights-posts-page-"]')]
- .map((item) => {
- const walker = document.createTreeWalker(item, NodeFilter.SHOW_TEXT);
- let lineCount = 0;
- while (walker.nextNode()) {
- if (!walker.currentNode.textContent.trim()) continue;
- const range = document.createRange();
- range.selectNodeContents(walker.currentNode);
- const tops = new Set([...range.getClientRects()].filter((rect) => rect.width > 0).map((rect) => Math.round(rect.top)));
- lineCount = Math.max(lineCount, tops.size);
- }
- const card = document.querySelector('[data-testid="insights-metrics"]').getBoundingClientRect();
- const overflows = item.scrollWidth > item.clientWidth + 1 || item.getBoundingClientRect().right > card.right + 1;
- return [item.textContent.trim(), lineCount > 1 || overflows];
- })
- .filter(([, broken]) => broken)
- .map(([text]) => text)
- JS);
-
- foreach ($lines as $text) {
- $wrapped[] = "{$locale->value}: {$text}";
- }
- }
-
- expect($wrapped)->toBe([]);
-});
diff --git a/tests/Browser/ChannelPostingGoalTest.php b/tests/Browser/ChannelPostingGoalTest.php
index 140c18c23..6f11dd673 100644
--- a/tests/Browser/ChannelPostingGoalTest.php
+++ b/tests/Browser/ChannelPostingGoalTest.php
@@ -59,7 +59,7 @@ function connectPostingGoalChannel(string $did = 'did:plc:goal-new', array $quer
waitForPostingGoalTestId($page, 'connect-finish');
$page->click('@connect-finish');
- expect(postingGoalPollFor($page, '/^\\/channels\\/[^\\/]+\\/publish$/.test(window.location.pathname)', 200))->toBeTrue();
+ expect(postingGoalPollFor($page, '/^\\/channels\\/[^\\/]+\\/publish$/.test(window.location.pathname)', 600))->toBeTrue();
$channel = SocialAccount::query()->where('platform_user_id', $did)->sole();
@@ -115,22 +115,6 @@ test('customize goes to the channel settings page', function () {
$page->assertVisible('@channel-settings-page')->assertNoJavaScriptErrors();
});
-test('a reconnect does not open the goal flow', function () {
- [$user, $channel] = postingGoalSetup();
- $this->actingAs($user);
- $bluesky = SocialAccount::factory()->bluesky()->create([
- 'workspace_id' => $channel->workspace_id,
- 'platform_user_id' => 'did:plc:goal-existing',
- ]);
-
- [$page] = connectPostingGoalChannel('did:plc:goal-existing', ['reconnect' => $bluesky->id]);
-
- expect(postingGoalPollFor($page, 'document.querySelector(\'[data-testid="goal-flow"]\')', 20))->toBeFalse()
- ->and($bluesky->fresh()->access_token)->toBe('access-token');
-
- $page->assertNoJavaScriptErrors();
-});
-
function postingGoalPollFor(mixed $page, string $condition, int $attempts = 120): bool
{
return (bool) $page->script(<<<JS
@@ -190,9 +174,8 @@ test('the goal step matches the wide card layout with right-side radios', functi
$page->assertNoJavaScriptErrors();
});
-test('on a phone the goal step shows a full-width Next above the help in every language', function (Locale $locale) {
+test('on a phone the goal step shows a full-width Next above the help', function () {
[$user, $channel] = postingGoalSetup();
- $user->update(['locale' => $locale]);
$this->actingAs($user);
[$page, $channel] = connectPostingGoalChannel();
@@ -221,8 +204,9 @@ test('on a phone the goal step shows a full-width Next above the help in every l
JS);
expect($layout)->toBe(['nextAlignedWithOptions' => true, 'nextAboveHelp' => true, 'helpInside' => true, 'footerBorder' => '0px', 'perWeekOnOneLine' => true]);
+
$page->assertNoJavaScriptErrors();
-})->with(fn () => array_map(fn (Locale $locale) => [$locale], Locale::cases()));
+});
test('on a phone the recommended step stacks Done, Customize and Change goal in full width', function () {
[$user, $channel] = postingGoalSetup();
@@ -379,49 +363,3 @@ function fakeBlueskyIdentity(string $did): void
]),
]);
}
-
-test('a new channel connected through the confirmation page lands in the goal flow', function () {
- [$user] = postingGoalSetup();
- $this->actingAs($user);
-
- [$page, $channel] = connectPostingGoalChannel();
- waitForPostingGoalTestId($page, 'goal-flow');
-
- expect($channel->workspace_id)->toBe($user->current_workspace_id);
-
- $page->assertVisible('@goal-flow')
- ->assertDontSee('Account connected!')
- ->assertNoJavaScriptErrors();
-});
-
-test('the goal description fits on one line in every language', function () {
- [$user, $channel] = postingGoalSetup();
- $this->actingAs($user);
-
- [$page, $channel] = connectPostingGoalChannel();
- waitForPostingGoalTestId($page, 'goal-description');
-
- $translations = collect(Locale::cases())
- ->mapWithKeys(fn (Locale $locale): array => [$locale->value => __('channels.goal_dialog.description', [], $locale->value)])
- ->all();
-
- $json = json_encode($translations, JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $wrapped = $page->script(<<<JS
- (() => {
- const translations = {$json};
- const element = document.querySelector('[data-testid="goal-description"]');
- const available = element.getBoundingClientRect().width;
- element.style.whiteSpace = 'nowrap';
- element.style.display = 'inline-block';
- return Object.entries(translations)
- .filter(([, text]) => {
- element.textContent = text;
- return element.getBoundingClientRect().width * 1.04 > available;
- })
- .map(([locale, text]) => locale + ': ' + text);
- })()
- JS);
-
- expect($wrapped)->toBe([]);
-});
diff --git a/tests/Browser/ChannelReorderTest.php b/tests/Browser/ChannelReorderTest.php
index 3765958cd..9135ff902 100644
--- a/tests/Browser/ChannelReorderTest.php
+++ b/tests/Browser/ChannelReorderTest.php
@@ -67,29 +67,6 @@ function channelReorderDomOrder(mixed $page, string $prefix, array $channels): a
JS);
}
-test('dragging a channel in the sidebar persists the order and the settings page shows it', function () {
- [$user, [$first, $second, $third]] = channelReorderSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'));
- waitForChannelReorderTestId($page, "sidebar-channel-{$third->id}");
- $page->hover("@sidebar-channel-row-{$third->id}");
- $page->drag("@sidebar-channel-handle-{$third->id}", "@sidebar-channel-row-{$first->id}");
- waitForChannelReorderDatabase($page, fn (): bool => $third->refresh()->position < $second->refresh()->position);
-
- expect($third->refresh()->position)->toBeLessThan($second->refresh()->position)
- ->and(channelReorderDomOrder($page, 'sidebar-channel-row-', [$first, $second, $third]))
- ->toBe($user->currentWorkspace->socialAccounts()->pluck('id')->all());
- $page->assertNoJavaScriptErrors();
-
- $settings = visit(route('app.workspace.channels'));
- waitForChannelReorderTestId($settings, "channel-row-{$third->id}");
-
- expect(channelReorderDomOrder($settings, 'channel-list-row-', [$first, $second, $third]))
- ->toBe($user->currentWorkspace->socialAccounts()->pluck('id')->all());
- $settings->assertNoJavaScriptErrors();
-});
-
test('dragging a channel on the settings page persists the order', function () {
[$user, [$first, $second, $third]] = channelReorderSetup();
$this->actingAs($user);
diff --git a/tests/Browser/ChannelSettingsPageTest.php b/tests/Browser/ChannelSettingsPageTest.php
index 5e69d8d25..4eaaec109 100644
--- a/tests/Browser/ChannelSettingsPageTest.php
+++ b/tests/Browser/ChannelSettingsPageTest.php
@@ -6,7 +6,6 @@ use App\Actions\Post\Queue\ReflowChannelQueue;
use App\Enums\Post\QueuePosition;
use App\Enums\Post\ScheduleMode;
use App\Enums\Post\Status as PostStatus;
-use App\Enums\User\Locale;
use App\Enums\User\TimeFormat;
use App\Enums\User\WeekStart;
use App\Models\Post;
@@ -266,18 +265,6 @@ test('meet my posting goal is disabled with a hint once the goal is met', functi
$page->assertNoJavaScriptErrors();
});
-test('meet my posting goal stays enabled below the goal', function () {
- [$user, $channel] = channelSettingsPageSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.channels.settings', $channel));
- waitForChannelSettingsPageTestId($page, 'schedule-generate');
- $page->click('@schedule-generate');
- waitForChannelSettingsPageTestId($page, 'schedule-generate-goal');
-
- $page->assertAttributeMissing('@schedule-generate-goal', 'data-disabled')->assertNoJavaScriptErrors();
-});
-
test('the schedule grid follows the week start and the 12-hour clock', function () {
[$user, $channel] = channelSettingsPageSetup(PostingSchedule::empty()->withTime(0, '14:30'));
$user->update(['week_starts_on' => WeekStart::Sunday, 'time_format' => TimeFormat::TwelveHour]);
@@ -292,20 +279,6 @@ test('the schedule grid follows the week start and the 12-hour clock', function
->assertNoJavaScriptErrors();
});
-test('the schedule grid starts on Monday on a 24-hour clock by default', function () {
- [$user, $channel] = channelSettingsPageSetup(PostingSchedule::empty()->withTime(0, '14:30'));
- $user->update(['time_format' => TimeFormat::TwentyFourHour]);
- $this->actingAs($user);
-
- $page = visit(route('app.channels.settings', $channel));
- waitForChannelSettingsPageTestId($page, 'schedule-day-0-time-1430-hour');
-
- $page->assertScript("document.querySelector('[data-testid^=\"schedule-day-\"]').dataset.testid", 'schedule-day-1')
- ->assertSeeIn('@schedule-day-0-time-1430-hour', '14')
- ->assertMissing('@schedule-day-0-time-1430-meridiem')
- ->assertNoJavaScriptErrors();
-});
-
test('the channel time zone picker suggests the browser time zone first', function () {
[$user, $channel] = channelSettingsPageSetup();
$this->actingAs($user);
@@ -318,7 +291,7 @@ test('the channel time zone picker suggests the browser time zone first', functi
$page->assertVisible('@channel-timezone-detected')->assertNoJavaScriptErrors();
});
-test('changing the time zone asks first, cancel keeps the old zone', function () {
+test('changing the time zone asks first and cancel and escape keep the old zone', function () {
[$user, $channel] = channelSettingsPageSetup();
$this->actingAs($user);
@@ -332,24 +305,17 @@ test('changing the time zone asks first, cancel keeps the old zone', function ()
->click('@channel-timezone-confirm-cancel');
$page->script('(async () => { for (let i = 0; i < 100; i++) { if (!document.querySelector(\'[data-testid="channel-timezone-confirm-dialog"]\')) return; await new Promise((r) => setTimeout(r, 50)); } })();');
- $page->assertSeeIn('@channel-timezone-trigger', 'UTC')->assertNoJavaScriptErrors();
+ $page->assertSeeIn('@channel-timezone-trigger', 'UTC');
expect($channel->fresh()->timezone)->toBe('UTC');
-});
-
-test('escape dismisses the confirmation and saves nothing', function () {
- [$user, $channel] = channelSettingsPageSetup();
- $this->actingAs($user);
- $page = visit(route('app.channels.settings', $channel));
chooseChannelSettingsTimezone($page, 'Warsaw', 'Europe-Warsaw');
waitForChannelSettingsPageTestId($page, 'channel-timezone-confirm-cancel');
$page->keys('@channel-timezone-confirm-cancel', 'Escape');
$page->script('(async () => { for (let i = 0; i < 100; i++) { if (!document.querySelector(\'[data-testid="channel-timezone-confirm-dialog"]\')) return; await new Promise((r) => setTimeout(r, 50)); } })();');
-
- chooseChannelSettingsTimezone($page, 'Warsaw', 'Europe-Warsaw');
- waitForChannelSettingsPageTestId($page, 'channel-timezone-confirm-dialog');
- $page->assertVisible('@channel-timezone-confirm-dialog')->assertNoJavaScriptErrors();
+ $page->assertMissing('@channel-timezone-confirm-dialog');
expect($channel->fresh()->timezone)->toBe('UTC');
+
+ $page->assertNoJavaScriptErrors();
});
test('confirming the time zone saves it and reflows the queue into the new zone slots', function () {
@@ -381,29 +347,6 @@ test('confirming the time zone saves it and reflows the queue into the new zone
$page->assertNoJavaScriptErrors();
});
-test('the time zone confirmation buttons fit on one line in every language', function () {
- [$user, $channel] = channelSettingsPageSetup();
- $this->actingAs($user);
- $problems = [];
-
- foreach (Locale::cases() as $locale) {
- $user->update(['locale' => $locale]);
- $page = visit(route('app.channels.settings', $channel));
- chooseChannelSettingsTimezone($page, 'Warsaw', 'Europe-Warsaw');
- waitForChannelSettingsPageTestId($page, 'channel-timezone-confirm-submit');
-
- foreach (['channel-timezone-confirm-cancel', 'channel-timezone-confirm-submit'] as $button) {
- $lines = $page->script("(() => { const range = document.createRange(); range.selectNodeContents(document.querySelector('[data-testid=\"{$button}\"]')); return new Set([...range.getClientRects()].filter((rect) => rect.width > 0).map((rect) => Math.round(rect.top))).size; })()");
-
- if ($lines > 1) {
- $problems[] = "{$locale->value}: {$button}";
- }
- }
- }
-
- expect($problems)->toBe([]);
-});
-
test('on a phone the schedule stacks one day per row in week-start order without horizontal scroll', function () {
[$user, $channel] = channelSettingsPageSetup(PostingSchedule::empty()->withTime(1, '09:42')->withTime(0, '14:30'));
$user->update(['week_starts_on' => WeekStart::Sunday, 'time_format' => TimeFormat::TwelveHour]);
@@ -454,16 +397,3 @@ test('on a phone toggling a day, adding and removing a time persist', function (
$page->assertScript('document.documentElement.scrollWidth <= window.innerWidth', true)
->assertNoJavaScriptErrors();
});
-
-test('on a wide screen an empty day column shows the empty state', function () {
- [$user, $channel] = channelSettingsPageSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.channels.settings', $channel))->resize(1800, 900);
- waitForChannelSettingsPageTestId($page, 'schedule-day-1-time-0942');
-
- $page->assertVisible('@schedule-day-2-empty')
- ->assertSeeIn('@schedule-day-2-empty', 'No posting times')
- ->assertScript('document.querySelector(\'[data-testid="schedule-day-1"]\').getBoundingClientRect().top === document.querySelector(\'[data-testid="schedule-day-2"]\').getBoundingClientRect().top', true)
- ->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/ChannelsSettingsTest.php b/tests/Browser/ChannelsSettingsTest.php
index 06f35fb49..6610665d8 100644
--- a/tests/Browser/ChannelsSettingsTest.php
+++ b/tests/Browser/ChannelsSettingsTest.php
@@ -82,40 +82,6 @@ test('disconnecting a channel asks for the translated disconnect keyword, not th
expect(SocialAccount::find($channel->id))->toBeNull();
});
-test('a lost connection offers reconnect on the row', function () {
- $user = channelsSettingsAdmin();
- $channel = SocialAccount::factory()->linkedin()->tokenExpired()->create(['workspace_id' => $user->current_workspace_id]);
- $this->actingAs($user);
-
- $page = visit(route('app.workspace.channels'));
- waitForChannelsSettingsTestId($page, "channel-reconnect-{$channel->id}");
-
- $page->assertVisible("@channel-reconnect-{$channel->id}")->assertNoJavaScriptErrors();
-});
-
-test('a channel without a display name shows its username', function () {
- $user = channelsSettingsAdmin();
- $channel = SocialAccount::factory()->linkedin()->create([
- 'workspace_id' => $user->current_workspace_id,
- 'display_name' => null,
- 'avatar_url' => null,
- 'username' => 'fallback-handle',
- ]);
- $this->actingAs($user);
-
- $page = visit(route('app.workspace.channels'));
- waitForChannelsSettingsTestId($page, "channel-name-{$channel->id}");
-
- expect($page->script("document.querySelector('[data-testid=\"channel-name-{$channel->id}\"]').textContent.trim()"))
- ->toBe('fallback-handle');
-
- $page = visit(route('app.posts.index'));
- waitForChannelsSettingsTestId($page, "sidebar-channel-{$channel->id}");
- expect($page->script("document.querySelector('[data-testid=\"sidebar-channel-{$channel->id}\"]').textContent"))
- ->toContain('fallback-handle');
- $page->assertNoJavaScriptErrors();
-});
-
test('an empty workspace shows only the centered illustration with a connect button', function () {
$this->actingAs(channelsSettingsAdmin());
@@ -142,27 +108,6 @@ test('an empty workspace shows only the centered illustration with a connect but
$page->assertVisible('@connect-channel-dialog')->assertNoJavaScriptErrors();
});
-test('a workspace with channels keeps the header and the list at the top', function () {
- $user = channelsSettingsAdmin();
- SocialAccount::factory()->linkedin()->count(12)->create(['workspace_id' => $user->current_workspace_id]);
- $this->actingAs($user);
-
- $page = visit(route('app.workspace.channels'));
- waitForChannelsSettingsTestId($page, 'header-title');
-
- expect($page->script(<<<'JS'
- (() => {
- const scroller = document.querySelector('[data-testid="app-layout-scroller"]');
- const top = document.querySelector('[data-testid="header-title"]').getBoundingClientRect().top - scroller.getBoundingClientRect().top;
- const scrolls = scroller.scrollHeight > scroller.clientHeight;
- scroller.scrollTop = scroller.scrollHeight;
- return [document.querySelector('[data-testid="settings-centered"]') === null, document.querySelector('[data-testid="channels-empty"]') === null, top < 120, scrolls, scroller.scrollTop > 0];
- })()
- JS))->toBe([true, true, true, true, true]);
-
- $page->assertVisible('@channels-connect')->assertNoJavaScriptErrors();
-});
-
test('a channel with a lost connection shows the disconnected dot in the list and the channel header', function () {
$user = channelsSettingsAdmin();
$lost = SocialAccount::factory()->linkedin()->tokenExpired()->create(['workspace_id' => $user->current_workspace_id]);
@@ -234,23 +179,3 @@ test('the disconnect dialog shows the keyword with a copy button, like the other
expect($page->script('window.__copied'))->toBe($keyword);
$page->assertNoJavaScriptErrors();
});
-
-test('the disconnect keyword still confirms with spaces around it', function () {
- $user = channelsSettingsAdmin();
- $channel = SocialAccount::factory()->linkedin()->create(['workspace_id' => $user->current_workspace_id]);
- $this->actingAs($user);
-
- $page = visit(route('app.workspace.channels'));
- waitForChannelsSettingsTestId($page, "channel-row-{$channel->id}");
-
- $page->click("@channel-menu-{$channel->id}");
- waitForChannelsSettingsTestId($page, "channel-disconnect-{$channel->id}");
-
- $page->click("@channel-disconnect-{$channel->id}")
- ->fill('@confirm-delete-input', ' '.__('channels.disconnect_modal.keyword').' ')
- ->click('@confirm-delete-action')
- ->assertMissing('@confirm-delete-modal')
- ->assertNoJavaScriptErrors();
-
- expect(SocialAccount::find($channel->id))->toBeNull();
-});
diff --git a/tests/Browser/CommandPaletteTest.php b/tests/Browser/CommandPaletteTest.php
index dc89ad3bf..b89096aea 100644
--- a/tests/Browser/CommandPaletteTest.php
+++ b/tests/Browser/CommandPaletteTest.php
@@ -200,20 +200,6 @@ test('selecting a channel opens its publish page and it shows up under recent',
->assertNoJavaScriptErrors();
});
-test('create new post opens the composer', function () {
- $this->actingAs(commandPaletteUser('admin'));
-
- $page = visit(route('app.posts.index'));
- openCommandPalette($page);
-
- $page->click('@command-palette-item-action-create-post');
- waitForCommandPaletteTestId($page, 'post-composer-dialog');
-
- $page->assertVisible('@post-composer-dialog')
- ->assertMissing('@command-palette')
- ->assertNoJavaScriptErrors();
-});
-
test('invite and connect open their dialogs for admins', function () {
$this->actingAs(commandPaletteUser('admin'));
@@ -236,19 +222,6 @@ test('invite and connect open their dialogs for admins', function () {
$page->assertVisible('@connect-channel-dialog')->assertNoJavaScriptErrors();
});
-test('members who need approval can create but not invite or connect', function () {
- $this->actingAs(commandPaletteUser('approval'));
-
- $page = visit(route('app.posts.index'));
- openCommandPalette($page);
-
- $page->assertVisible('@command-palette-item-nav-publish')
- ->assertVisible('@command-palette-item-action-create-post')
- ->assertMissing('@command-palette-item-action-invite-member')
- ->assertMissing('@command-palette-item-action-connect-channel')
- ->assertNoJavaScriptErrors();
-});
-
test('members can create but not invite or connect', function () {
$this->actingAs(commandPaletteUser('member'));
@@ -262,20 +235,6 @@ test('members can create but not invite or connect', function () {
->assertNoJavaScriptErrors();
});
-test('the sidebar channels search button opens the palette', function () {
- $user = commandPaletteUser('admin');
- SocialAccount::factory()->linkedin()->create(['workspace_id' => $user->current_workspace_id]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'));
- waitForCommandPaletteTestId($page, 'sidebar-channels-label');
-
- $page->hover('@sidebar-channels-label')->hover('@sidebar-channels-search')->click('@sidebar-channels-search');
- waitForCommandPaletteTestId($page, 'command-palette-input');
-
- $page->assertVisible('@command-palette')->assertNoJavaScriptErrors();
-});
-
test('the shortcut does not open the palette over the post composer', function () {
$this->actingAs(commandPaletteUser('admin'));
diff --git a/tests/Browser/ComposerApprovalTest.php b/tests/Browser/ComposerApprovalTest.php
index 1ff98a3ae..15ddcf726 100644
--- a/tests/Browser/ComposerApprovalTest.php
+++ b/tests/Browser/ComposerApprovalTest.php
@@ -105,21 +105,6 @@ test('a requester never sees publish now and requests approval for the queue', f
$page->assertNoJavaScriptErrors();
});
-test('a requester whose default is publish now starts on the queue', function () {
- [, $channel, $requester] = composerApprovalSetup(DefaultPostAction::Now);
- $this->actingAs($requester);
-
- $page = visit(route('app.posts.create'));
- waitForComposerApprovalTestId($page, 'composer-add-account');
- $page->click('@composer-add-account')
- ->click("@composer-account-option-{$channel->id}")
- ->fill("@composer-caption-{$channel->id}", 'Default now');
- waitForComposerApprovalTestId($page, 'composer-submit');
-
- expect($page->script('document.querySelector("[data-testid=composer-submit]").dataset.scheduleMode'))->toBe('next');
- $page->assertNoJavaScriptErrors();
-});
-
test('editing a pending queue request starts on its stored position', function () {
[$workspace, $channel, $requester] = composerApprovalSetup();
$post = CreatePosts::execute($workspace, $requester, [
@@ -166,7 +151,7 @@ test('owners and admins keep publish now and their default action', function (st
->assertVisible('@composer-schedule-now')
->assertVisible('@composer-schedule-next')
->assertNoJavaScriptErrors();
-})->with(['owner', 'admin']);
+})->with(['admin']);
test('editing a pending custom time request starts on custom with its date', function () {
[$workspace, $channel, $requester] = composerApprovalSetup();
diff --git a/tests/Browser/ComposerAutosaveTest.php b/tests/Browser/ComposerAutosaveTest.php
index 1e3fe6cc3..32578a49d 100644
--- a/tests/Browser/ComposerAutosaveTest.php
+++ b/tests/Browser/ComposerAutosaveTest.php
@@ -287,33 +287,6 @@ test('an idea opened as a post neither prompts nor overwrites the unfinished pos
->assertNoJavaScriptErrors();
});
-test('a custom date still in the future is restored with its mode', function () {
- [$user, $workspace, $account] = composerAutosaveWorkspace();
- $user->update(['timezone' => 'UTC']);
- $account->update(['timezone' => 'UTC']);
- $at = now('UTC')->addDays(3);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'));
- $key = composerAutosaveKeyFor($user, $workspace);
- seedComposerAutosave($page, $key, [
- 'content' => 'Planned post',
- 'accountIds' => [$account->id],
- 'scheduleMode' => 'custom',
- 'scheduledAt' => $at->format('Y-m-d\TH:i'),
- ]);
-
- openComposerForAutosave($page);
- waitForComposerAutosaveTestId($page, 'composer-resume-dialog');
- $page->click('@composer-resume-confirm');
- waitForComposerAutosaveTestId($page, 'composer-submit');
- waitForComposerAutosaveCondition($page, "JSON.parse(localStorage.getItem('{$key}') ?? 'null')?.scheduledAt !== '{$at->format('Y-m-d\TH:i')}'");
-
- expect($page->script('document.querySelector("[data-testid=composer-submit]").dataset.scheduleMode'))->toBe('custom')
- ->and($page->script("JSON.parse(localStorage.getItem('{$key}')).scheduledAt"))->toBe($at->format('Y-m-d\TH:i:00P'));
- $page->assertNoJavaScriptErrors();
-});
-
test('a custom date already in the past falls back to the default mode', function () {
[$user, $workspace, $account] = composerAutosaveWorkspace();
$this->actingAs($user);
@@ -444,39 +417,6 @@ test('a restored custom time keeps its moment in the channel zone', function ()
$page->assertNoJavaScriptErrors();
});
-test('a custom time is kept as its instant, so a later zone change does not move it', function () {
- [$user, $workspace, $account] = composerAutosaveWorkspace();
- $user->update(['timezone' => 'Asia/Tokyo', 'time_format' => TimeFormat::TwentyFourHour]);
- $account->update(['timezone' => 'America/Sao_Paulo']);
- $instant = now('UTC')->addDays(3)->setTime(13, 0);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'));
- $key = composerAutosaveKeyFor($user, $workspace);
- seedComposerAutosave($page, $key, [
- 'content' => 'Saved as an instant',
- 'accountIds' => [$account->id],
- 'scheduleMode' => 'custom',
- 'scheduledAt' => $instant->format('Y-m-d\TH:i:00\Z'),
- ]);
-
- openComposerForAutosave($page);
- waitForComposerAutosaveTestId($page, 'composer-resume-dialog');
- $page->click('@composer-resume-confirm');
- waitForComposerAutosaveTestId($page, 'composer-submit');
-
- $local = $instant->copy()->setTimezone('America/Sao_Paulo');
- expect(trim((string) $page->script('document.querySelector("[data-testid=composer-schedule-trigger]").textContent')))
- ->toBe($local->format($local->year === now()->year ? 'M j' : 'M j, Y').', '.$local->format('H:i'));
-
- $page->click('@composer-submit');
- waitForComposerAutosaveCondition($page, '!document.querySelector(\'[data-testid="post-composer-dialog"]\')');
-
- expect(Post::query()->where('workspace_id', $workspace->id)->sole()->scheduled_at->toIso8601String())
- ->toBe($instant->toIso8601String());
- $page->assertNoJavaScriptErrors();
-});
-
test('an unfinished post from the old shared editor restores one card per network with its own text', function () {
[$user, $workspace, $linkedin] = composerAutosaveWorkspace();
$x = SocialAccount::factory()->x()->create(['workspace_id' => $workspace->id]);
@@ -506,29 +446,6 @@ test('an unfinished post from the old shared editor restores one card per networ
->assertNoJavaScriptErrors();
});
-test('an unfinished post with two networks and no per-network text resumes on the shared step', function () {
- [$user, $workspace, $linkedin] = composerAutosaveWorkspace();
- $x = SocialAccount::factory()->x()->create(['workspace_id' => $workspace->id]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'));
- $key = composerAutosaveKeyFor($user, $workspace);
- seedComposerAutosave($page, $key, [
- 'content' => 'Still shared',
- 'accountIds' => [$linkedin->id, $x->id],
- ]);
-
- openComposerForAutosave($page);
- waitForComposerAutosaveTestId($page, 'composer-resume-dialog');
- $page->click('@composer-resume-confirm');
- waitForComposerAutosaveTestId($page, 'composer-next');
-
- $page->assertValue('@composer-base-content', 'Still shared')
- ->assertMissing('@composer-customization')
- ->assertMissing('@composer-back')
- ->assertNoJavaScriptErrors();
-});
-
/**
* @return array<string, string|null>
*/
@@ -539,44 +456,6 @@ function composerAutosaveSavedContents(Workspace $workspace): array
->all();
}
-test('two pages of one network that disagree in an unfinished post restore the first page text', function () {
- [$user, $workspace] = composerAutosaveWorkspace();
- [$first, $second] = SocialAccount::factory()->facebook()->count(2)->create(['workspace_id' => $workspace->id])->all();
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'));
- $key = composerAutosaveKeyFor($user, $workspace);
- seedComposerAutosave($page, $key, [
- 'content' => 'Shared text',
- 'accountIds' => [$first->id, $second->id],
- 'overrides' => [
- $first->id => ['content' => 'First page text'],
- $second->id => ['content' => 'Second page text'],
- ],
- ]);
-
- openComposerForAutosave($page);
- waitForComposerAutosaveTestId($page, 'composer-resume-dialog');
- $page->click('@composer-resume-confirm');
- waitForComposerAutosaveTestId($page, "composer-caption-{$first->id}");
-
- waitForComposerAutosaveCondition($page, "JSON.parse(localStorage.getItem('{$key}') ?? 'null')?.content === 'First page text'");
- expect($page->script("JSON.parse(localStorage.getItem('{$key}')).overrides"))->toEqual([
- $first->id => [],
- $second->id => [],
- ]);
- $page->assertValue("@composer-caption-{$first->id}", 'First page text')
- ->assertMissing("@composer-caption-{$second->id}")
- ->assertNoJavaScriptErrors()
- ->click('@composer-save-draft');
- waitForComposerAutosaveCondition($page, '!document.querySelector(\'[data-testid="post-composer-dialog"]\')');
-
- expect(composerAutosaveSavedContents($workspace))->toEqual([
- $first->id => 'First page text',
- $second->id => 'First page text',
- ]);
-});
-
test('two pages of one network restore the text of the page that owns one', function () {
[$user, $workspace] = composerAutosaveWorkspace();
[$first, $second] = SocialAccount::factory()->facebook()->count(2)->create(['workspace_id' => $workspace->id])->all();
diff --git a/tests/Browser/ComposerChannelSettingsTest.php b/tests/Browser/ComposerChannelSettingsTest.php
index b27504d37..c0d638e4f 100644
--- a/tests/Browser/ComposerChannelSettingsTest.php
+++ b/tests/Browser/ComposerChannelSettingsTest.php
@@ -6,9 +6,7 @@ use App\Dto\MediaItem;
use App\Enums\Post\Status;
use App\Enums\PostPlatform\ContentType;
use App\Enums\SocialAccount\Platform;
-use App\Enums\User\Locale;
use App\Enums\User\TimeFormat;
-use App\Enums\YouTube\Category;
use App\Models\Media;
use App\Models\Post;
use App\Models\PostPlatform;
@@ -79,6 +77,11 @@ function waitForChannelSettingsTestId(mixed $page, string $testId): void
);
}
+function waitForChannelSettingsClosedMenu(mixed $page): void
+{
+ waitForChannelSettingsCondition($page, "!document.querySelector('[role=\"listbox\"]')");
+}
+
function fakeChannelSettingsApis(): void
{
$boards = [
@@ -257,29 +260,6 @@ test('the pinterest board picker searches, refreshes and creates boards', functi
expect(data_get($postPlatform->fresh()->meta, 'board_id'))->toBe('board_3');
});
-test('the pinterest board picker shows the reconnect error when pinterest refuses the board', function () {
- Http::fake([
- config('trypost.platforms.pinterest.api').'/boards*' => fn (Request $request) => $request->method() === 'POST'
- ? Http::response(['code' => 3, 'message' => 'Not authorized'], 403)
- : Http::response(['items' => [['id' => 'board_1', 'name' => 'Disney']]]),
- '*' => Http::response([], 200),
- ]);
- $postPlatform = seedChannelSettingsPost(Platform::Pinterest, ContentType::PinterestPin);
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1280, 900);
- waitForChannelSettingsTestId($page, 'pinterest-board-trigger');
- $page->click('@pinterest-board-trigger');
- waitForChannelSettingsTestId($page, 'pinterest-board-new-name');
-
- $page->fill('@pinterest-board-new-name', 'Recipes')
- ->click('@pinterest-board-create');
- waitForChannelSettingsTestId($page, 'pinterest-board-create-error');
-
- $page->assertSeeIn('@pinterest-board-create-error', __('posts.form.pinterest.boards_reconnect'))
- ->assertMissing('@pinterest-board-selected')
- ->assertNoJavaScriptErrors();
-});
-
test('the google business card picks its type in the header and lists the fields in the reference order', function () {
fakeChannelSettingsApis();
$postPlatform = seedChannelSettingsPost(Platform::GoogleBusiness, ContentType::GoogleBusinessPost);
@@ -430,12 +410,17 @@ test('the youtube card saves its fields in the reference order with the AI label
->fill('@youtube-title', 'Explicit title')
->click('@youtube-category');
waitForChannelSettingsTestId($page, 'youtube-category-27');
- $page->click('@youtube-category-27')->click('@youtube-privacy');
+ $page->click('@youtube-category-27');
+ waitForChannelSettingsClosedMenu($page);
+ $page->click('@youtube-privacy');
waitForChannelSettingsTestId($page, 'youtube-privacy-unlisted');
- $page->click('@youtube-privacy-unlisted')->click('@youtube-license');
+ $page->click('@youtube-privacy-unlisted');
+ waitForChannelSettingsClosedMenu($page);
+ $page->click('@youtube-license');
waitForChannelSettingsTestId($page, 'youtube-license-creativeCommon');
- $page->click('@youtube-license-creativeCommon')
- ->click('@youtube-notify-subscribers')
+ $page->click('@youtube-license-creativeCommon');
+ waitForChannelSettingsClosedMenu($page);
+ $page->click('@youtube-notify-subscribers')
->click('@youtube-made-for-kids')
->click('@youtube-ai-generated')
->assertDontSeeIn('@youtube-preview', 'Explicit title')
@@ -454,24 +439,6 @@ test('the youtube card saves its fields in the reference order with the AI label
]);
});
-test('the youtube category lists the 15 backend categories in order with people and blogs by default', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::YouTube, ContentType::YouTubeShort);
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1280, 900);
- waitForChannelSettingsTestId($page, 'youtube-category');
-
- $page->assertSeeIn('@youtube-category', __(Category::DEFAULT->labelKey()))
- ->click('@youtube-category');
- waitForChannelSettingsTestId($page, 'youtube-category-'.Category::TravelAndEvents->value);
-
- expect($page->script(<<<'JS'
- [...document.querySelectorAll('[data-testid^="youtube-category-"]')]
- .map((node) => [node.dataset.testid.replace('youtube-category-', ''), node.textContent.trim()])
- JS))->toBe(array_map(fn (Category $category): array => [$category->value, __($category->labelKey())], Category::cases()));
- $page->assertNoJavaScriptErrors();
-});
-
test('the tiktok AI label is the last row and saves is_aigc', function () {
fakeChannelSettingsApis();
$postPlatform = seedChannelSettingsPost(Platform::TikTok, ContentType::TikTokVideo);
@@ -532,25 +499,6 @@ test('google business seeds event dates in the user time zone and an offer drops
]);
});
-test('the youtube card shows its single short type as a checked radio and a single-type network shows none', function () {
- fakeChannelSettingsApis();
- $youtube = seedChannelSettingsPost(Platform::YouTube, ContentType::YouTubeShort);
-
- $page = visit(route('app.posts.edit', $youtube->post))->resize(1280, 900);
- waitForChannelSettingsTestId($page, "composer-type-{$youtube->social_account_id}-youtube_short");
-
- expect($page->script("document.querySelector('[data-testid=\"composer-type-{$youtube->social_account_id}-youtube_short\"]').getAttribute('data-state')"))->toBe('checked');
- $page->assertSeeIn("@composer-type-{$youtube->social_account_id}", 'Short')
- ->assertNoJavaScriptErrors();
-
- $linkedin = seedChannelSettingsPost(Platform::LinkedIn, ContentType::LinkedInPost);
- $page = visit(route('app.posts.edit', $linkedin->post))->resize(1280, 900);
- waitForChannelSettingsTestId($page, 'composer-customization');
- $page->assertMissing("@composer-type-{$linkedin->social_account_id}")
- ->assertMissing("@composer-type-{$linkedin->social_account_id}-linkedin_post")
- ->assertNoJavaScriptErrors();
-});
-
test('the instagram card shows share to feed on reels, the AI label last and on every type', function () {
fakeChannelSettingsApis();
$postPlatform = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramReel);
@@ -631,42 +579,6 @@ test('the instagram card counts hashtags down to five and warns past the limit',
->assertNoJavaScriptErrors();
});
-test('an instagram story is not blocked by the hashtag limit while a feed post is', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramStory);
- $id = $postPlatform->social_account_id;
- $image = Media::factory()->temporaryUpload($postPlatform->post->workspace)->create(['mime_type' => 'image/png', 'meta' => ['width' => 1080, 'height' => 1920]]);
- $postPlatform->post->update(['content' => 'Launch #a #b #c #d #e #f', 'media' => [MediaItem::fromMedia($image)->toArray()]]);
- $blocked = "document.querySelector('[data-testid=\"composer-submit\"]').getAttribute('aria-disabled') === 'true'";
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1280, 900);
- waitForChannelSettingsTestId($page, "composer-{$id}-media-item-0");
-
- expect($page->script($blocked))->toBeFalse();
-
- $page->click("@composer-type-{$id}-instagram_feed");
- waitForChannelSettingsTestId($page, "composer-hashtag-warning-{$id}");
-
- expect($page->script($blocked))->toBeTrue();
- $page->assertNoJavaScriptErrors();
-});
-
-test('the main post counter counts an emoji as one character', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::Mastodon, ContentType::MastodonPost);
- $id = $postPlatform->social_account_id;
- $limit = Platform::Mastodon->maxContentLength();
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1280, 900);
- waitForChannelSettingsTestId($page, "composer-char-count-{$id}");
-
- $page->fill("@composer-caption-{$id}", '😀😀😀');
- waitForChannelSettingsCondition($page, "document.querySelector('[data-testid=\"composer-char-count-{$id}\"]')?.textContent.trim() === '".($limit - 3)."'");
-
- $page->assertSeeIn("@composer-char-count-{$id}", (string) ($limit - 3))
- ->assertNoJavaScriptErrors();
-});
-
test('the mastodon content warning counts against the post', function () {
fakeChannelSettingsApis();
$postPlatform = seedChannelSettingsPost(Platform::Mastodon, ContentType::MastodonPost);
@@ -686,20 +598,6 @@ test('the mastodon content warning counts against the post', function () {
expect($postPlatform->fresh()->meta)->toEqual(['spoiler_text' => 'Spoilers']);
});
-test('the mastodon content warning is counted in code points', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::Mastodon, ContentType::MastodonPost);
- $id = $postPlatform->social_account_id;
- $limit = Platform::Mastodon->maxContentLength();
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1280, 900);
- waitForChannelSettingsTestId($page, 'mastodon-content-warning');
-
- $page->fill('@mastodon-content-warning', '😀😀')
- ->assertSeeIn("@composer-char-count-{$id}", (string) ($limit - mb_strlen('Channel settings') - 2))
- ->assertNoJavaScriptErrors();
-});
-
test('the threads card offers a topic and a ghost post drops the topic and the media tray', function () {
fakeChannelSettingsApis();
config(['services.unsplash.access_key' => 'test-unsplash-key']);
@@ -729,29 +627,6 @@ test('the threads card offers a topic and a ghost post drops the topic and the m
expect($postPlatform->fresh()->meta)->toEqual(['topic_tag' => 'laravel']);
});
-test('ghost post is disabled while the threads card has media', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::Threads, ContentType::ThreadsPost);
- $id = $postPlatform->social_account_id;
- $ghost = "composer-type-{$id}-threads_ghost_post";
- $image = Media::factory()->temporaryUpload($postPlatform->post->workspace)->create(['mime_type' => 'image/png']);
- $postPlatform->post->update(['content' => 'With a photo', 'media' => [MediaItem::fromMedia($image)->toArray()]]);
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1280, 900);
- waitForChannelSettingsTestId($page, "composer-{$id}-media-item-0");
-
- expect($page->script("document.querySelector('[data-testid=\"{$ghost}\"]').disabled"))->toBeTrue();
- $page->hover("@{$ghost}-label");
- waitForChannelSettingsTestId($page, "{$ghost}-reason");
- $page->assertSeeIn("@{$ghost}-reason", "Ghost Posts don't support attachments");
-
- $page->click("@composer-{$id}-remove-0");
- waitForChannelSettingsCondition($page, "!document.querySelector('[data-testid=\"{$ghost}\"]').disabled");
-
- $page->click("@{$ghost}")
- ->assertNoJavaScriptErrors();
-});
-
test('a threads card with a link card can switch to a ghost post, which keeps the link and drops the card', function () {
$url = 'https://93.184.216.34/article';
Http::fake([
@@ -778,43 +653,6 @@ test('a threads card with a link card can switch to a ghost post, which keeps th
expect($postPlatform->fresh()->content_type)->toBe(ContentType::ThreadsGhostPost);
});
-test('the threads preview shows a ghost post as a dashed bubble that expires in 24 hours', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::Threads, ContentType::ThreadsPost);
- $id = $postPlatform->social_account_id;
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1280, 900);
- waitForChannelSettingsTestId($page, 'threads-preview');
- $page->assertMissing('@threads-ghost-bubble')
- ->click("@composer-type-{$id}-threads_ghost_post");
- waitForChannelSettingsTestId($page, 'threads-ghost-bubble');
-
- $page->assertSeeIn('@threads-ghost-bubble', 'Channel settings')
- ->assertSeeIn('@threads-ghost-expiry', '24h left')
- ->click("@composer-type-{$id}-threads_post");
- waitForChannelSettingsCondition($page, "!document.querySelector('[data-testid=\"threads-ghost-bubble\"]')");
- $page->assertMissing('@threads-ghost-bubble')
- ->assertNoJavaScriptErrors();
-});
-
-test('a ghost post that got media shows it on the card with a text only warning until it is removed', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::Threads, ContentType::ThreadsGhostPost);
- $id = $postPlatform->social_account_id;
- $image = Media::factory()->temporaryUpload($postPlatform->post->workspace)->create(['mime_type' => 'image/png']);
- $postPlatform->post->update(['media' => [MediaItem::fromMedia($image)->toArray()]]);
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1280, 900);
- waitForChannelSettingsTestId($page, "composer-text-only-warning-{$id}");
-
- $page->assertSeeIn("@composer-text-only-warning-{$id}", __('posts.form.warnings.text_only'))
- ->assertPresent("@composer-{$id}-media-item-0")
- ->click("@composer-{$id}-remove-0");
- waitForChannelSettingsCondition($page, "!document.querySelector('[data-testid=\"composer-text-only-warning-{$id}\"]')");
- $page->assertMissing("@composer-{$id}-dropzone")
- ->assertNoJavaScriptErrors();
-});
-
test('a bluesky thread starts from the toolbar and stacks its replies under the post', function () {
fakeChannelSettingsApis();
$postPlatform = seedChannelSettingsPost(Platform::Bluesky, ContentType::BlueskyPost);
@@ -847,52 +685,6 @@ test('a bluesky thread starts from the toolbar and stacks its replies under the
expect($postPlatform->fresh()->meta)->toEqual(['thread_replies' => [['text' => 'Third post', 'media' => []]]]);
});
-test('a mastodon thread reply counts the content warning against its own limit', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::Mastodon, ContentType::MastodonPost);
- $postPlatform->update(['meta' => ['spoiler_text' => 'Spoilers']]);
- $id = $postPlatform->social_account_id;
- $limit = Platform::Mastodon->maxContentLength();
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1280, 900);
- waitForChannelSettingsTestId($page, 'thread-start');
-
- $page->click('@thread-start');
- waitForChannelSettingsTestId($page, 'thread-reply-0');
- $page->fill('@thread-reply-0', 'Reply')
- ->assertSeeIn("@composer-char-count-{$id}", (string) ($limit - mb_strlen('Spoilers') - mb_strlen('Reply')))
- ->assertSeeIn('@preview-thread-reply-0', 'Spoilers')
- ->assertNoJavaScriptErrors();
-});
-
-test('start thread is not offered on networks that cannot chain', function (Platform $platform, ContentType $contentType) {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost($platform, $contentType);
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1280, 900);
- waitForChannelSettingsTestId($page, 'composer-customization');
- $page->assertMissing('@thread-start')->assertNoJavaScriptErrors();
-})->with([
- 'threads' => [Platform::Threads, ContentType::ThreadsPost],
-]);
-
-test('a thread reply counts emoji as one character each like the server', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::Bluesky, ContentType::BlueskyPost);
- $id = $postPlatform->social_account_id;
- $reply = str_repeat('😀', 160);
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1280, 900);
- waitForChannelSettingsTestId($page, 'thread-start');
- $page->click('@thread-start');
- waitForChannelSettingsTestId($page, 'thread-reply-0');
- $page->fill('@thread-reply-0', $reply)
- ->assertSeeIn("@composer-char-count-{$id}", (string) (Platform::Bluesky->maxContentLength() - 160));
-
- expect($page->script('document.querySelector(\'[data-testid="composer-submit"]\').getAttribute(\'aria-disabled\')'))->toBeNull();
- $page->assertNoJavaScriptErrors();
-});
-
test('a thread reply of invisible characters is empty like on the server', function () {
fakeChannelSettingsApis();
$postPlatform = seedChannelSettingsPost(Platform::Bluesky, ContentType::BlueskyPost);
@@ -933,26 +725,6 @@ test('a server error on a thread reply shows under that reply', function () {
->assertNoJavaScriptErrors();
});
-test('editing a post that already has a thread shows its replies', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::Bluesky, ContentType::BlueskyPost);
- $postPlatform->update(['meta' => ['thread_replies' => ['First reply', 'Second reply']]]);
- $id = $postPlatform->social_account_id;
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1280, 900);
- waitForChannelSettingsTestId($page, 'thread-reply-collapsed-1');
-
- $page->assertSeeIn('@thread-reply-collapsed-0', 'First reply')
- ->assertSeeIn('@thread-reply-collapsed-1', 'Second reply')
- ->assertVisible("@composer-caption-{$id}")
- ->assertVisible('@thread-add-reply')
- ->assertMissing('@thread-start')
- ->assertSeeIn('@preview-thread', 'Second reply');
-
- expect($page->script('!!document.querySelector(\'[data-testid="preview-thread"] [data-testid="preview-thread-reply-1"]\')'))->toBeTrue();
- $page->assertNoJavaScriptErrors();
-});
-
test('a thread reply shows its own media under it and keeps it on save', function () {
fakeChannelSettingsApis();
$postPlatform = seedChannelSettingsPost(Platform::X, ContentType::XPost);
@@ -1080,53 +852,6 @@ test('shift enter opens the next post of an x thread and backspace on an empty p
->assertNoJavaScriptErrors();
});
-test('thread posts stack right under each other and show their whole text', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::X, ContentType::XPost);
- $postPlatform->socialAccount->update(['meta' => ['x_subscription_type' => 'Premium']]);
- $long = str_repeat('Officia dolore magna in officia consectetur quis proident. ', 8);
- $postPlatform->update(['meta' => ['thread_replies' => [$long, 'abc']]]);
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1440, 1000);
- waitForChannelSettingsTestId($page, 'thread-reply-collapsed-1');
- $page->click('@thread-reply-collapsed-1');
- waitForChannelSettingsTestId($page, 'thread-reply-1');
-
- $layout = $page->script(<<<'JS'
- (() => {
- const first = document.querySelector('[data-testid="thread-reply-collapsed-0"]');
- const second = document.querySelector('[data-testid="thread-reply-1"]');
- return {
- gap: Math.round(second.closest('li').getBoundingClientRect().top - first.closest('li').getBoundingClientRect().bottom),
- truncated: first.scrollWidth > first.clientWidth || getComputedStyle(first).textOverflow === 'ellipsis',
- wraps: first.getBoundingClientRect().height > 40,
- };
- })()
- JS);
-
- expect($layout)->toBe(['gap' => 16, 'truncated' => false, 'wraps' => true]);
-
- $id = $postPlatform->social_account_id;
- $page->assertVisible("@composer-{$id}-thread-connector")
- ->assertVisible('@thread-connector-0')
- ->assertMissing('@thread-connector-1');
-
- $page->click("@composer-{$id}-caption-collapsed");
- waitForChannelSettingsTestId($page, "composer-caption-{$id}");
-
- expect($page->script(<<<JS
- (() => {
- const toolbar = document.querySelector('[id="composer-{$id}-root-toolbar"]');
- const firstReply = document.querySelector('[data-testid="thread-reply-collapsed-0"]').closest('li');
- return {
- toolbarFollowsPost: toolbar.contains(document.querySelector('[data-testid="composer-{$id}-toolbar"]')),
- gap: Math.round(firstReply.getBoundingClientRect().top - toolbar.getBoundingClientRect().bottom),
- };
- })()
- JS))->toBe(['toolbarFollowsPost' => true, 'gap' => 16]);
- $page->assertNoJavaScriptErrors();
-});
-
test('arrow keys move between the posts of a thread from the end and the start of each one', function () {
fakeChannelSettingsApis();
$postPlatform = seedChannelSettingsPost(Platform::X, ContentType::XPost);
@@ -1162,27 +887,6 @@ test('arrow keys move between the posts of a thread from the end and the start o
$page->assertNoJavaScriptErrors();
});
-test('only the active post of a thread shows the drop zone', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::X, ContentType::XPost);
- $postPlatform->post->update(['content' => 'Root']);
- $postPlatform->update(['meta' => ['thread_replies' => ['First reply', 'Second reply']]]);
- $id = $postPlatform->social_account_id;
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1440, 1000);
- waitForChannelSettingsTestId($page, "composer-{$id}-dropzone");
-
- $page->assertMissing("@composer-{$id}-reply-0-dropzone")
- ->assertMissing("@composer-{$id}-reply-1-dropzone");
-
- $page->click('@thread-reply-collapsed-1');
- waitForChannelSettingsTestId($page, "composer-{$id}-reply-1-dropzone");
-
- $page->assertMissing("@composer-{$id}-dropzone")
- ->assertMissing("@composer-{$id}-reply-0-dropzone")
- ->assertNoJavaScriptErrors();
-});
-
test('the preview scrolls to the thread post being edited', function () {
fakeChannelSettingsApis();
$postPlatform = seedChannelSettingsPost(Platform::X, ContentType::XPost);
@@ -1220,30 +924,6 @@ test('editing a scheduled post offers to move it back to drafts', function () {
$page->assertNoJavaScriptErrors();
});
-test('editing a draft keeps the save draft action', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::X, ContentType::XPost);
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1440, 1000);
- waitForChannelSettingsTestId($page, 'composer-save-draft');
-
- $page->assertSeeIn('@composer-save-draft', __('posts.composer.save_draft'))
- ->assertNoJavaScriptErrors();
-});
-
-test('the x preview shows the verified badge next to the name', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::X, ContentType::XPost);
- $postPlatform->socialAccount->update(['meta' => ['x_verified_type' => 'blue']]);
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1440, 1000);
- waitForChannelSettingsTestId($page, 'preview-verified');
-
- $page->assertAttribute('@preview-verified', 'data-verified', 'blue')
- ->assertAttribute('@preview-verified', 'aria-label', __('channels.verified.blue'))
- ->assertNoJavaScriptErrors();
-});
-
test('the google business preview shows no verified badge', function () {
fakeChannelSettingsApis();
$postPlatform = seedChannelSettingsPost(Platform::GoogleBusiness, ContentType::GoogleBusinessPost);
@@ -1273,7 +953,7 @@ test('a youtube video with neither text nor a title warns in its card until a ti
->assertNoJavaScriptErrors();
});
-test('the tiktok settings label fits on one line in every language, interactions read as full sentences and the compliance text lines up with the fields', function () {
+test('the tiktok interactions read as full sentences and the compliance text lines up with the fields', function () {
fakeChannelSettingsApis();
$postPlatform = seedChannelSettingsPost(Platform::TikTok, ContentType::TikTokVideo);
@@ -1295,37 +975,6 @@ test('the tiktok settings label fits on one line in every language, interactions
})()
JS))->toBe(['aligned' => true, 'gap' => true]);
- $translations = collect(['privacy_level'])
- ->mapWithKeys(fn (string $key): array => [$key => collect(Locale::cases())
- ->mapWithKeys(fn (Locale $locale): array => [$locale->value => __("posts.form.tiktok.{$key}", [], $locale->value)])
- ->all()])
- ->all();
- $current = json_encode(['privacy_level' => __('posts.form.tiktok.privacy_level')], JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
- $json = json_encode($translations, JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $wrapped = $page->script(<<<JS
- (() => {
- const current = {$current};
- const translations = {$json};
- const labels = [...document.querySelectorAll('[data-testid="channel-settings-row"] > label, [data-testid="channel-settings-row"] > span')];
- return Object.entries(translations).flatMap(([key, texts]) => {
- const element = labels.find((label) => label.textContent.trim() === current[key]);
- if (!element) return [key + ': label not found'];
- const available = parseFloat(getComputedStyle(element.parentElement).gridTemplateColumns.split(' ')[0]);
- element.style.whiteSpace = 'nowrap';
- element.style.display = 'inline-block';
- element.style.justifySelf = 'start';
- return Object.entries(texts)
- .filter(([, text]) => {
- element.textContent = text;
- return element.getBoundingClientRect().width * 1.04 > available;
- })
- .map(([locale, text]) => key + ' ' + locale + ': ' + text);
- });
- })()
- JS);
-
- expect($wrapped)->toBe([]);
$page->assertNoJavaScriptErrors();
});
@@ -1412,23 +1061,6 @@ test('the tiktok preview shows a photo on black, with no blurred fill around it'
$page->assertNoJavaScriptErrors();
});
-test('the google business button select is sized to its options, not the full row', function () {
- fakeChannelSettingsApis();
- $postPlatform = seedChannelSettingsPost(Platform::GoogleBusiness, ContentType::GoogleBusinessPost);
-
- $page = visit(route('app.posts.edit', $postPlatform->post))->resize(1440, 1000);
- waitForChannelSettingsTestId($page, 'google-business-cta');
-
- expect($page->script(<<<'JS'
- (() => {
- const trigger = document.querySelector('[data-testid="google-business-cta"]').getBoundingClientRect();
- const row = document.querySelector('[data-testid="google-business-cta"]').closest('[data-testid="channel-settings-row"]').lastElementChild.getBoundingClientRect();
- return trigger.width < row.width / 2;
- })()
- JS))->toBeTrue();
- $page->assertNoJavaScriptErrors();
-});
-
test('the google business event times follow the user clock and pick from a list', function (TimeFormat $format, string $typed, string $shown, string $typedShown) {
fakeChannelSettingsApis();
$postPlatform = seedChannelSettingsPost(Platform::GoogleBusiness, ContentType::GoogleBusinessPost);
@@ -1461,7 +1093,6 @@ test('the google business event times follow the user clock and pick from a list
->and(data_get($postPlatform->fresh()->meta, 'event.end_time'))->toBe('21:00');
})->with([
'12h' => [TimeFormat::TwelveHour, '9 pm', '6:30 PM', '9:00 PM'],
- '24h' => [TimeFormat::TwentyFourHour, '21', '18:30', '21:00'],
]);
test('the facebook preview lays several photos out as the feed collage, not stacked', function (int $count, array $spans, ?string $more) {
@@ -1487,10 +1118,7 @@ test('the facebook preview lays several photos out as the feed collage, not stac
expect($layout)->toBe(['spans' => $spans, 'more' => $more]);
$page->assertNoJavaScriptErrors();
})->with([
- 'two side by side' => [2, [3, 3], null],
'three, one big on top' => [3, [6, 3, 3], null],
- 'four in a square' => [4, [3, 3, 3, 3], null],
- 'five: two over three' => [5, [3, 3, 2, 2, 2], null],
'seven: +2 on the last tile' => [7, [3, 3, 2, 2, 2], '+2'],
]);
@@ -1535,5 +1163,4 @@ test('every character counter in the composer shares one design', function (Plat
$page->assertNoJavaScriptErrors();
})->with([
'characters left' => [Platform::X, ContentType::XPost, 'composer-char-count-{id}'],
- 'hashtags left' => [Platform::Instagram, ContentType::InstagramFeed, 'composer-hashtags-remaining-{id}'],
]);
diff --git a/tests/Browser/ComposerMediaSourcesTest.php b/tests/Browser/ComposerMediaSourcesTest.php
index 7d4467b1d..8006075fa 100644
--- a/tests/Browser/ComposerMediaSourcesTest.php
+++ b/tests/Browser/ComposerMediaSourcesTest.php
@@ -70,25 +70,6 @@ function chooseComposerMediaSource(mixed $page, string $prefix, string $source):
$page->click("@media-source-{$source}");
}
-test('with no media source enabled the media button still offers the upload', function () {
- config()->set([
- 'services.unsplash.access_key' => null,
- 'services.google_media.client_id' => null,
- 'services.google_media.api_key' => null,
- 'services.google_media.app_id' => null,
- 'services.canva.client_id' => null,
- 'services.canva.client_secret' => null,
- ]);
-
- $page = openComposerForMediaSources($this);
- $page->click('@composer-base-media-source-menu');
- waitForComposerMediaSourcesTestId($page, 'composer-base-media-source-list');
-
- expect($page->script("Array.from(document.querySelectorAll('[data-testid=\"composer-base-media-source-list\"] [data-testid^=\"media-source-\"]')).map((item) => item.dataset.testid)"))
- ->toBe(['media-source-upload']);
- $page->assertNoJavaScriptErrors();
-});
-
/**
* @return array<string, mixed>
*/
@@ -224,7 +205,6 @@ test('upload from computer in the media menu opens the file picker', function (s
$page->assertNoJavaScriptErrors();
})->with([
'post composer' => ['app.posts.create', 'composer-base'],
- 'idea editor' => ['app.create.ideas.create', 'idea-editor'],
]);
test('picking an unsplash photo from the menu adds a tile and credits the photographer', function () {
@@ -287,27 +267,6 @@ test('an unsplash outage shows an error instead of an empty result', function ()
->assertNoJavaScriptErrors();
});
-test('the idea editor picks an unsplash photo into its tray', function () {
- enableOnlyUnsplashForMediaSources();
-
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create(['user_id' => $user->id, 'account_id' => $user->account_id]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
- $this->actingAs($user);
-
- $page = visit(route('app.create.ideas.create'));
- waitForComposerMediaSourcesTestId($page, 'idea-editor-media-source-menu');
- chooseComposerMediaSource($page, 'idea-editor', 'unsplash');
- waitForComposerMediaSourcesTestId($page, 'unsplash-photo-0');
- $page->click('@unsplash-photo-0');
- waitForComposerMediaSourcesTestId($page, 'idea-media-item');
-
- $page->assertPresent('@idea-media-item')
- ->assertNoJavaScriptErrors();
-});
-
function enableOnlyGoogleDriveForMediaSources(): string
{
config()->set([
@@ -473,24 +432,6 @@ function assertGoogleDriveImportForMediaSources(mixed $page, string $api): void
&& $request->hasHeader('Authorization', 'Bearer server-drive-token'));
}
-test('picking a google drive file adds a tile to the shared tray', function () {
- $api = enableOnlyGoogleDriveForMediaSources();
-
- $page = openComposerForMediaSources($this);
- waitForComposerMediaSourcesTestId($page, 'composer-base-media-source-menu');
-
- stubGoogleDriveForMediaSources($page);
- chooseComposerMediaSource($page, 'composer-base', 'google_drive');
- finishGoogleDriveSignIn($page);
- waitForComposerMediaSourcesTestId($page, 'composer-media-item');
-
- $page->assertPresent('@composer-media-item')
- ->assertNoJavaScriptErrors();
-
- assertGoogleDriveImportForMediaSources($page, $api);
- expect(Cache::has('google-media-return:'.User::query()->sole()->id.':'.googleDriveSignInNonce($page)))->toBeFalse();
-});
-
test('picking a google drive file in a single channel adds a tile to that channel tray', function () {
$api = enableOnlyGoogleDriveForMediaSources();
@@ -523,6 +464,7 @@ test('the drive picker can be clicked, focused and typed in over the composer di
waitForComposerMediaSourcesTestId($page, 'composer-base-media-source-menu');
stubGoogleDriveForMediaSources($page, holdOpen: true);
chooseComposerMediaSource($page, 'composer-base', 'google_drive');
+ waitForComposerMediaSourcesCondition($page, "!document.querySelector('[data-testid=\"composer-base-media-source-list\"]')");
finishGoogleDriveSignIn($page);
waitForComposerMediaSourcesTestId($page, 'drive-picker-search');
waitForComposerMediaSourcesCondition($page, "document.activeElement?.dataset?.testid === 'drive-picker-search'");
@@ -576,22 +518,6 @@ test('a failed google drive sign-in opens no picker and shows the popup message'
->and(Media::query()->count())->toBe(0);
});
-test('a blocked google drive popup says so and asks the server for nothing', function () {
- enableOnlyGoogleDriveForMediaSources();
-
- $page = openComposerForMediaSources($this);
- waitForComposerMediaSourcesTestId($page, 'composer-base-media-source-menu');
- stubGoogleDriveForMediaSources($page);
- $page->script('window.open = () => null; true;');
- chooseComposerMediaSource($page, 'composer-base', 'google_drive');
- waitForComposerMediaSourcesCondition($page, "document.body.innerText.includes('Your browser blocked the window')");
-
- $page->assertSee(__('posts.composer.media_sources.errors.popup_blocked'))
- ->assertNotPresent('@composer-media-item')
- ->assertNoJavaScriptErrors();
- expect($page->script('window.__drive.finished.length'))->toBe(0);
-});
-
test('the real sign-in popup, start to callback, hands the drive token to the composer through the broadcast', function () {
$api = enableOnlyGoogleDriveForMediaSources();
config()->set([
diff --git a/tests/Browser/ComposerMediaTrayTest.php b/tests/Browser/ComposerMediaTrayTest.php
index 69aca4c76..1dfb0bc26 100644
--- a/tests/Browser/ComposerMediaTrayTest.php
+++ b/tests/Browser/ComposerMediaTrayTest.php
@@ -2,13 +2,11 @@
declare(strict_types=1);
-use App\Enums\Media\Type as MediaType;
use App\Models\Media;
use App\Models\Post;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
-use App\Support\HeicConverter;
/**
* Poll from the page until `$condition` holds (never sleep(): the test server
@@ -168,23 +166,6 @@ function composerMediaTrayPng(string $name): string
return "new File([base64('{$base64}')], '{$name}', { type: 'image/png' })";
}
-test('the dropzone opens the file dialog, not the library picker', function () {
- [$page] = openComposerMediaTray($this);
-
- $page->script(<<<'JS'
- (() => {
- window.__fileDialogOpened = 0;
- document.querySelector('[data-testid="composer-file-input"]').click = () => { window.__fileDialogOpened++; };
- })();
- JS);
- $page->click('@composer-dropzone');
-
- expect($page->script('window.__fileDialogOpened'))->toBe(1);
- $page->assertMissing('@media-picker-confirm')
- ->assertSee('select a file')
- ->assertNoJavaScriptErrors();
-});
-
test('the toolbar has no plus button and the channel dropzone opens its own file dialog', function () {
[$page, , $account] = openComposerMediaTray($this);
@@ -244,24 +225,6 @@ test('no more than three files upload at once', function () {
$page->assertNoJavaScriptErrors();
});
-test('a file over the image cap becomes an error tile and is never sent', function () {
- [$page] = openComposerMediaTray($this);
- $bytes = MediaType::Image->maxSizeInBytes() + 1;
-
- selectComposerMediaTrayFiles($page, "[new File([new Uint8Array({$bytes})], 'huge.png', { type: 'image/png' })]");
- waitForComposerMediaTrayTestId($page, 'composer-upload-error');
-
- expect($page->script('document.querySelector(\'[data-testid="composer-upload-error"]\').dataset.reason'))->toBe('too_large')
- ->and($page->script('window.__uploads.count'))->toBe(0)
- ->and(Media::count())->toBe(0);
- $page->assertSeeIn('@composer-upload-error', 'huge.png')
- ->assertSeeIn('@composer-upload-error', 'The limit is '.MediaType::Image->maxSizeInMb().' MB')
- ->assertMissing('@composer-upload-retry-0')
- ->click('@composer-upload-remove-0')
- ->assertMissing('@composer-upload-error')
- ->assertNoJavaScriptErrors();
-});
-
test('an unsupported file type becomes an error tile and is never sent', function () {
[$page] = openComposerMediaTray($this);
@@ -324,23 +287,6 @@ test('cancel removes an uploading tile and retry recovers a network failure', fu
expect(Media::where('collection', Media::COLLECTION_UPLOADS)->pluck('original_filename')->all())->toBe(['retry-me.png']);
});
-test('a HEIC photo shows the heic_unavailable error tile and is never sent while the server cannot convert it', function () {
- config(['trypost.media.heic_conversion' => false]);
- HeicConverter::flush();
- [$page] = openComposerMediaTray($this);
-
- expect($page->script('document.querySelector(\'[data-testid="composer-file-input"]\').accept'))->not->toContain('heic');
-
- selectComposerMediaTrayFiles($page, "[new File(['heic-bytes'], 'IMG_0001.HEIC', { type: 'image/heic' })]");
- waitForComposerMediaTrayTestId($page, 'composer-upload-error');
-
- expect($page->script('document.querySelector(\'[data-testid="composer-upload-error"]\').dataset.reason'))->toBe('heic_unavailable')
- ->and($page->script('window.__uploads.count'))->toBe(0);
- $page->assertSeeIn('@composer-upload-error', 'IMG_0001.HEIC')
- ->assertMissing('@composer-upload-retry-0')
- ->assertNoJavaScriptErrors();
-});
-
test('a rejected upload shows the server message without Retry', function () {
[$page] = openComposerMediaTray($this);
@@ -354,21 +300,6 @@ test('a rejected upload shows the server message without Retry', function () {
->assertNoJavaScriptErrors();
});
-test('a failed tile blocks saving until it is retried or removed', function () {
- [$page] = openComposerMediaTray($this, 'fail-first', platform: ['instagram', 'threads'], select: true);
- $page->fill('@composer-base-content', 'Blocked by a failed upload');
-
- selectComposerMediaTrayFiles($page, '['.composerMediaTrayPng('failed.png').']');
- waitForComposerMediaTrayTestId($page, 'composer-upload-error');
-
- expect(composerMediaTrayDisabled($page, 'composer-save-draft'))->toBeTrue();
- $page->assertVisible('@composer-upload-blocked')
- ->click('@composer-upload-remove-0')
- ->assertMissing('@composer-upload-blocked');
- expect(composerMediaTrayDisabled($page, 'composer-save-draft'))->toBeFalse();
- $page->assertNoJavaScriptErrors();
-});
-
test('three uploads run at once across the shared and channel trays, and uploads survive step and channel changes', function () {
[$page, , $first, $accounts] = openComposerMediaTray($this, 'hold', platform: ['instagram', 'threads'], select: true);
$second = $accounts[1];
@@ -509,18 +440,6 @@ test('arrow keys on the drag handle move the tile, keep focus on its handle and
$page->assertNoJavaScriptErrors();
});
-test('in a right-to-left layout ArrowLeft moves the tile towards the end', function () {
- [$page] = openComposerMediaTray($this);
- uploadComposerMediaTrayTiles($page, ['first.png', 'second.png']);
- $page->script("document.documentElement.dir = 'rtl'");
-
- $page->keys('@composer-drag-handle-0', 'ArrowLeft');
- waitForComposerMediaTrayCondition($page, "document.activeElement?.dataset.testid === 'composer-drag-handle-1'");
-
- expect(composerMediaTrayOrder($page))->toBe(['second.png', 'first.png']);
- $page->assertNoJavaScriptErrors();
-});
-
test('a tile is dragged only by its handle and a single tile has no handle', function () {
[$page] = openComposerMediaTray($this);
uploadComposerMediaTrayTiles($page, ['only.png']);
@@ -573,28 +492,6 @@ test('pasting an image into the post content adds an upload and leaves text past
$page->assertNoJavaScriptErrors();
});
-test('a pasted file the tray does not accept becomes an error tile and is never sent', function () {
- [$page] = openComposerMediaTray($this);
-
- expect(pasteIntoComposerMediaTray($page, 'composer-base-content', "[new File(['MZ'], 'setup.exe', { type: 'application/x-msdownload' })]"))->toBeTrue();
- waitForComposerMediaTrayTestId($page, 'composer-upload-error');
-
- expect($page->script('document.querySelector(\'[data-testid="composer-upload-error"]\').dataset.reason'))->toBe('unsupported_type')
- ->and($page->script('window.__uploads.count'))->toBe(0);
- $page->assertSeeIn('@composer-upload-error', 'setup.exe')
- ->assertNoJavaScriptErrors();
-});
-
-test('a clipboard carrying text and an image pastes the text and adds no upload', function () {
- [$page] = openComposerMediaTray($this);
-
- expect(pasteIntoComposerMediaTray($page, 'composer-base-content', '['.composerMediaTrayPng('cells.png').']', 'A1 B1'))->toBeFalse()
- ->and(composerMediaTrayCount($page, 'composer-upload-item'))->toBe(0)
- ->and(composerMediaTrayCount($page, 'composer-media-item'))->toBe(0)
- ->and($page->script('window.__uploads.count'))->toBe(0);
- $page->assertNoJavaScriptErrors();
-});
-
test('pasting an image into a channel caption adds it to that channel tray only', function () {
[$page, , $account] = openComposerMediaTray($this, platform: ['instagram', 'threads'], select: true);
$page->fill('@composer-base-content', 'Shared text');
@@ -613,49 +510,6 @@ test('pasting an image into a channel caption adds it to that channel tray only'
$page->assertNoJavaScriptErrors();
});
-test('while dragging, the tile moves into the slot under the pointer, right-to-left included, and dropping keeps it there', function () {
- [$page] = openComposerMediaTray($this);
- uploadComposerMediaTrayTiles($page, ['first.png', 'second.png']);
- $page->script("document.documentElement.dir = 'rtl'");
- $second = $page->script("document.querySelectorAll('[data-testid=\"composer-media-item\"] img')[1].getAttribute('src')");
-
- $page->script(<<<'JS'
- (() => {
- const source = document.querySelector('[data-testid="composer-media-item-1"]');
- const target = document.querySelector('[data-testid="composer-media-item-0"]');
- const handle = document.querySelector('[data-testid="composer-drag-handle-1"]').getBoundingClientRect();
- const box = target.getBoundingClientRect();
- const point = { clientX: box.right - 4, clientY: box.top + box.height / 2 };
- window.__trayDrag = { source, target, point, dataTransfer: new DataTransfer() };
- const fire = (element, type, at = point) => element.dispatchEvent(new DragEvent(type, { ...at, bubbles: true, cancelable: true, dataTransfer: window.__trayDrag.dataTransfer }));
- window.__trayDrag.fire = fire;
- fire(source, 'dragstart', { clientX: handle.left + handle.width / 2, clientY: handle.top + handle.height / 2 });
- })();
- JS);
- waitForComposerMediaTrayCondition($page, "document.querySelector('[data-testid=\"composer-media-item-1\"]')?.hasAttribute('data-dragging')");
- $page->script(<<<'JS'
- (() => {
- const { fire, target } = window.__trayDrag;
- fire(target, 'dragenter');
- fire(target, 'dragover');
- })();
- JS);
- waitForComposerMediaTrayCondition($page, "document.querySelector('[data-testid=\"composer-media-tray\"] > [data-index]')?.dataset.index === '1'");
- expect($page->script("[...document.querySelectorAll('[data-testid=\"composer-media-tray\"] > [data-index]')].map((tile) => tile.dataset.index)"))->toBe(['1', '0'])
- ->and($page->script("document.querySelector('[data-testid=\"composer-media-item-1\"]').hasAttribute('data-dragging')"))->toBeTrue();
- $page->script(<<<'JS'
- (() => {
- const { fire, source, target } = window.__trayDrag;
- fire(target, 'drop');
- fire(source, 'dragend');
- })();
- JS);
- waitForComposerMediaTrayCondition($page, "document.querySelector('[data-testid=\"composer-media-item\"] img')?.getAttribute('src') === '{$second}'");
-
- expect(composerMediaTrayOrder($page))->toBe(['second.png', 'first.png']);
- $page->assertNoJavaScriptErrors();
-});
-
test('deselecting a channel aborts its uploads, unblocks saving and leaves nothing behind when it is re-selected', function () {
[$page, , $first, $accounts] = openComposerMediaTray($this, 'hold', platform: ['instagram', 'threads'], select: true);
$second = $accounts[1];
@@ -729,24 +583,6 @@ function removeComposerMediaTrayInstagramImage(mixed $test): array
return [$page, $account];
}
-test('removing the only image of an Instagram feed post warns inline and suggests it back', function () {
- [$page, $account] = removeComposerMediaTrayInstagramImage($this);
-
- $page->assertSeeIn("@composer-media-warning-{$account->id}", 'Please include an image or video.')
- ->assertSeeIn("@composer-{$account->id}-suggested-media", 'Suggested media');
- $removedSource = $page->script("document.querySelector('[data-testid=\"composer-{$account->id}-suggested-0\"] img')?.getAttribute('src')");
- expect($removedSource)->toBe(Media::where('collection', Media::COLLECTION_UPLOADS)->sole()->url)
- ->and(composerMediaTrayCount($page, "composer-{$account->id}-media-item"))->toBe(0);
-
- $page->click("@composer-{$account->id}-suggested-0");
- waitForComposerMediaTrayCondition($page, "document.querySelectorAll('[data-testid=\"composer-{$account->id}-media-item\"]').length === 1");
-
- expect($page->script("document.querySelector('[data-testid=\"composer-{$account->id}-media-item\"] img')?.getAttribute('src')"))->toBe($removedSource);
- $page->assertMissing("@composer-media-warning-{$account->id}")
- ->assertMissing("@composer-{$account->id}-suggested-media")
- ->assertNoJavaScriptErrors();
-});
-
test('dismissing suggested media hides the panel until the next removal', function () {
[$page, $account] = removeComposerMediaTrayInstagramImage($this);
@@ -764,40 +600,6 @@ test('dismissing suggested media hides the panel until the next removal', functi
$page->assertNoJavaScriptErrors();
});
-test('suggested media survives step changes and channel switches', function () {
- [$page, , $first, $accounts] = openComposerMediaTray($this, platform: ['instagram', 'threads'], select: true);
- $second = $accounts[1];
-
- selectComposerMediaTrayFiles($page, '['.composerMediaTrayPng('shared.png').']');
- waitForComposerMediaTrayCondition($page, "document.querySelectorAll('[data-testid=\"composer-media-item\"]').length === 1");
- $page->click('@composer-remove-0');
- waitForComposerMediaTrayTestId($page, 'composer-suggested-0');
-
- $page->click('@composer-next');
- waitForComposerMediaTrayTestId($page, "composer-{$first->id}-dropzone");
- $page->assertMissing("@composer-{$first->id}-suggested-0");
-
- selectComposerMediaTrayFiles($page, '['.composerMediaTrayPng('channel.png').']', "composer-{$first->id}");
- waitForComposerMediaTrayCondition($page, "document.querySelectorAll('[data-testid=\"composer-{$first->id}-media-item\"]').length === 1");
- $page->click("@composer-{$first->id}-remove-0");
- waitForComposerMediaTrayTestId($page, "composer-{$first->id}-suggested-0");
-
- $page->click("@composer-account-{$second->id}");
- waitForComposerMediaTrayTestId($page, "composer-{$second->id}-dropzone");
- $page->assertMissing("@composer-{$second->id}-suggested-0");
-
- $page->click("@composer-account-{$first->id}");
- waitForComposerMediaTrayTestId($page, "composer-{$first->id}-suggested-0");
- $page->assertVisible("@composer-{$first->id}-suggested-0");
-
- $page->click('@composer-back');
- waitForComposerMediaTrayTestId($page, 'composer-back-confirm-go');
- $page->click('@composer-back-confirm-go');
- waitForComposerMediaTrayTestId($page, 'composer-suggested-0');
- $page->assertVisible('@composer-suggested-0')
- ->assertNoJavaScriptErrors();
-});
-
/**
* Opens one Instagram feed channel without media, so the primary
* button is blocked by the requires-media issue.
@@ -825,36 +627,6 @@ test('hovering the blocked primary button names the first issue and the channel'
->assertNoJavaScriptErrors();
});
-test('focusing the blocked primary button with the keyboard shows the same tooltip', function () {
- [$page, $account] = openComposerMediaTrayBlockedSubmit($this);
-
- $page->script("document.querySelector('[data-testid=\"composer-submit\"]').focus()");
- waitForComposerMediaTrayTestId($page, 'composer-blocked-tooltip');
-
- $page->assertSeeIn('@composer-blocked-tooltip', "Please include an image or video. ({$account->display_name})");
- expect($page->script("document.activeElement?.getAttribute('data-testid')"))->toBe('composer-submit')
- ->and($page->script("document.getElementById(document.querySelector('[data-testid=\"composer-submit\"]').getAttribute('aria-describedby'))?.textContent?.trim()"))
- ->toContain('Please include an image or video.');
- $page->assertNoJavaScriptErrors();
-});
-
-test('a failed upload in a network card stops blocking once only one network is left', function () {
- [$page, , $first, $accounts] = openComposerMediaTray($this, 'fail-first', platform: ['instagram', 'threads'], select: true);
-
- $page->click('@composer-next');
- waitForComposerMediaTrayTestId($page, "composer-{$first->id}-dropzone");
- selectComposerMediaTrayFiles($page, '['.composerMediaTrayPng('broken.png').']', "composer-{$first->id}");
- waitForComposerMediaTrayTestId($page, "composer-{$first->id}-upload-error");
- expect(composerMediaTrayDisabled($page, 'composer-save-draft'))->toBeTrue();
-
- $page->click("@composer-remove-account-{$accounts[1]->id}");
- waitForComposerMediaTrayCondition($page, "!document.querySelector('[data-testid=\"composer-account-{$accounts[1]->id}\"]')");
-
- expect(composerMediaTrayDisabled($page, 'composer-save-draft'))->toBeFalse();
- $page->assertMissing("@composer-{$first->id}-upload-error")
- ->assertNoJavaScriptErrors();
-});
-
test('an upload still running when customizing shows in every card and lands in a network added afterwards', function () {
[$page, , $first, $accounts] = openComposerMediaTray($this, 'hold', platform: ['instagram', 'threads', 'linkedin']);
[, $second, $linkedin] = $accounts;
@@ -900,24 +672,6 @@ test('an upload that failed before customizing shows in the cards and removing i
$page->assertNoJavaScriptErrors();
});
-test('the toolbar media button box lines up with the left edge of the media tray', function () {
- [$page] = openComposerMediaTray($this);
-
- waitForComposerMediaTrayTestId($page, 'composer-base-media-source-menu');
-
- $offset = $page->script(<<<'JS'
- (() => {
- const icon = document.querySelector('[data-testid="composer-base-media-source-menu"]').getBoundingClientRect();
- const tray = document.querySelector('[data-testid="composer-dropzone"]').getBoundingClientRect();
-
- return Math.round(icon.left - tray.left);
- })()
- JS);
-
- expect($offset)->toBe(0);
- $page->assertNoJavaScriptErrors();
-});
-
test('in a single-network thread the toolbar upload and the reply tray add to the active reply and block saving while in flight', function () {
[$page, , $account] = openComposerMediaTray($this, 'hold', platform: 'x', select: true);
$id = $account->id;
diff --git a/tests/Browser/ComposerMobileTest.php b/tests/Browser/ComposerMobileTest.php
index 10d8125c1..98e4373ba 100644
--- a/tests/Browser/ComposerMobileTest.php
+++ b/tests/Browser/ComposerMobileTest.php
@@ -2,7 +2,6 @@
declare(strict_types=1);
-use App\Enums\User\Locale;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
@@ -115,14 +114,42 @@ function composerMobileTooltipCount(mixed $page): int
return (int) $page->script('document.querySelectorAll(\'[data-slot="tooltip-content"]\').length');
}
-test('at 768px the editor keeps a usable width and network cards do not overflow', function () {
+test('at 768px the header shows icon-only panel buttons, the editor keeps a usable width and network cards do not overflow', function () {
[$user, $workspace] = composerMobileWorkspace();
$x = SocialAccount::factory()->x()->create(['workspace_id' => $workspace->id]);
$tiktok = SocialAccount::factory()->tiktok()->create(['workspace_id' => $workspace->id]);
SocialAccount::factory()->instagram()->create(['workspace_id' => $workspace->id]);
SocialAccount::factory()->youtube()->create(['workspace_id' => $workspace->id]);
+ WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id]);
+
$page = openComposerMobile($this, $user, 768, 1024);
+
+ $header = $page->script(<<<'JS'
+ (() => {
+ const rect = (testId) => document.querySelector(`[data-testid="${testId}"]`).getBoundingClientRect();
+ const labels = rect('composer-tags-trigger');
+ const templates = rect('composer-templates-toggle');
+ const header = document.querySelector('[data-testid="composer-header"]');
+ return {
+ overlap: labels.right > templates.left && labels.top < templates.bottom && templates.top < labels.bottom,
+ templatesWidth: templates.width,
+ eyeHidden: getComputedStyle(document.querySelector('[data-testid="composer-preview-toggle"]')).display === 'none',
+ headerOverflow: header.scrollWidth > header.clientWidth,
+ };
+ })()
+ JS);
+
+ expect($header['overlap'])->toBeFalse()
+ ->and($header['templatesWidth'])->toBeLessThanOrEqual(33)
+ ->and($header['eyeHidden'])->toBeTrue()
+ ->and($header['headerOverflow'])->toBeFalse();
+
+ $page->assertAttribute('@composer-view-edit', 'aria-pressed', 'true')
+ ->assertAttribute('@composer-view-preview', 'aria-pressed', 'false')
+ ->assertAttribute('@composer-templates-toggle', 'aria-pressed', 'false')
+ ->assertAttribute('@composer-ai-assistant', 'aria-pressed', 'false');
+
selectAllComposerMobileChannels($page);
$page->fill('@composer-base-content', 'Launching our new feature today! A longer paragraph of text #launch #saas')
->click('@composer-next');
@@ -159,39 +186,6 @@ test('at 768px the editor keeps a usable width and network cards do not overflow
$page->assertNoJavaScriptErrors();
});
-test('at 768px the header shows icon-only panel buttons and the eye is not active on first open', function () {
- [$user, $workspace] = composerMobileWorkspace();
- WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id]);
-
- $page = openComposerMobile($this, $user, 768, 1024);
-
- $header = $page->script(<<<'JS'
- (() => {
- const rect = (testId) => document.querySelector(`[data-testid="${testId}"]`).getBoundingClientRect();
- const labels = rect('composer-tags-trigger');
- const templates = rect('composer-templates-toggle');
- const header = document.querySelector('[data-testid="composer-header"]');
- return {
- overlap: labels.right > templates.left && labels.top < templates.bottom && templates.top < labels.bottom,
- templatesWidth: templates.width,
- eyeHidden: getComputedStyle(document.querySelector('[data-testid="composer-preview-toggle"]')).display === 'none',
- headerOverflow: header.scrollWidth > header.clientWidth,
- };
- })()
- JS);
-
- expect($header['overlap'])->toBeFalse()
- ->and($header['templatesWidth'])->toBeLessThanOrEqual(33)
- ->and($header['eyeHidden'])->toBeTrue()
- ->and($header['headerOverflow'])->toBeFalse();
-
- $page->assertAttribute('@composer-view-edit', 'aria-pressed', 'true')
- ->assertAttribute('@composer-view-preview', 'aria-pressed', 'false')
- ->assertAttribute('@composer-templates-toggle', 'aria-pressed', 'false')
- ->assertAttribute('@composer-ai-assistant', 'aria-pressed', 'false')
- ->assertNoJavaScriptErrors();
-});
-
test('below lg the edit and preview control switches between the editor and the preview', function () {
[$user, $workspace] = composerMobileWorkspace();
$account = SocialAccount::factory()->x()->create(['workspace_id' => $workspace->id]);
@@ -239,7 +233,7 @@ test('below lg templates and the assistant open as a bottom sheet and closing ke
}
$page->assertNoJavaScriptErrors();
-})->with([[390, 844], [768, 1024]]);
+})->with([[390, 844]]);
test('at 390px the schedule menu, date picker and labels open as bottom sheets inside the viewport', function () {
[$user, $workspace] = composerMobileWorkspace();
@@ -376,32 +370,3 @@ test('at 390px the footer is compact and the channel strip hints at hidden chips
expect($page->script("document.querySelector('[data-testid=\"composer-accounts\"]').hasAttribute('data-overflowing')"))->toBeFalse();
$page->assertNoJavaScriptErrors();
});
-
-test('the edit and preview control fits on one line in every language', function () {
- [$user] = composerMobileWorkspace();
- $wrapped = [];
-
- foreach (Locale::cases() as $locale) {
- $user->update(['locale' => $locale]);
- $page = openComposerMobile($this, $user->fresh(), 390, 844);
- waitForComposerMobileTestId($page, 'composer-view-switch');
-
- $broken = $page->script(<<<'JS'
- [...document.querySelectorAll('[data-testid="composer-view-switch"] button')]
- .filter((button) => {
- const label = button.querySelector('[data-single-line]');
- const range = document.createRange();
- range.selectNodeContents(label);
- const lines = new Set([...range.getClientRects()].filter((rect) => rect.width > 0).map((rect) => Math.round(rect.top)));
- return lines.size > 1 || button.scrollWidth > button.clientWidth;
- })
- .map((button) => button.textContent.trim())
- JS);
-
- foreach ($broken as $text) {
- $wrapped[] = "{$locale->value}: {$text}";
- }
- }
-
- expect($wrapped)->toBe([]);
-});
diff --git a/tests/Browser/ComposerNetworkCardsTest.php b/tests/Browser/ComposerNetworkCardsTest.php
index 55c26a5dd..2a49a9fc0 100644
--- a/tests/Browser/ComposerNetworkCardsTest.php
+++ b/tests/Browser/ComposerNetworkCardsTest.php
@@ -313,33 +313,6 @@ test('a story card hides its caption and keeps the text', function () {
->assertNoJavaScriptErrors();
});
-test('going back and saving a draft saves the shared text on every network', function () {
- [$user, $workspace] = networkCardsWorkspace();
- $x = SocialAccount::factory()->x()->create(['workspace_id' => $workspace->id]);
- $linkedin = SocialAccount::factory()->linkedin()->create(['workspace_id' => $workspace->id]);
- $page = openNetworkCardsComposer($this, $user);
-
- $page->fill('@composer-base-content', 'Shared text')
- ->click('@composer-add-account')
- ->click("@composer-account-option-{$x->id}")
- ->click("@composer-account-option-{$linkedin->id}")
- ->click('@composer-next')
- ->fill("@composer-caption-{$x->id}", 'Only on X')
- ->click('@composer-back')
- ->click('@composer-back-confirm-go');
- waitForNetworkCardsTestId($page, 'composer-base-content');
-
- $page->assertValue('@composer-base-content', 'Shared text')
- ->assertNoJavaScriptErrors()
- ->click('@composer-save-draft');
- waitForNetworkCardsClosed($page);
-
- expect(networkCardsSavedContents($workspace))->toEqual([
- $x->id => 'Shared text',
- $linkedin->id => 'Shared text',
- ]);
-});
-
test('going back drops a thread started on a network card', function () {
[$user, $workspace] = networkCardsWorkspace();
$bluesky = SocialAccount::factory()->bluesky()->create(['workspace_id' => $workspace->id]);
@@ -367,43 +340,3 @@ test('going back drops a thread started on a network card', function () {
->assertValue("@composer-caption-{$bluesky->id}", 'Shared text')
->assertNoJavaScriptErrors();
});
-
-test('the go back confirmation footer follows the dialog footer pattern', function () {
- [$user, $workspace] = networkCardsWorkspace();
- $x = SocialAccount::factory()->x()->create(['workspace_id' => $workspace->id]);
- $linkedin = SocialAccount::factory()->linkedin()->create(['workspace_id' => $workspace->id]);
- $page = openNetworkCardsComposer($this, $user);
-
- $page->fill('@composer-base-content', 'Shared text')
- ->click('@composer-add-account')
- ->click("@composer-account-option-{$x->id}")
- ->click("@composer-account-option-{$linkedin->id}")
- ->click('@composer-next')
- ->fill("@composer-caption-{$x->id}", 'Only on X')
- ->click('@composer-back');
- waitForNetworkCardsTestId($page, 'composer-back-confirm-go');
- $page->script('new Promise((resolve) => setTimeout(resolve, 400))');
-
- expect($page->script(<<<'JS'
- (() => {
- const dialog = document.querySelector('[data-testid="composer-back-confirm"]').getBoundingClientRect();
- const footer = document.querySelector('[data-testid="composer-back-confirm"] [data-slot="alert-dialog-footer"]');
- const box = footer.getBoundingClientRect();
- const probe = document.createElement('div');
- probe.className = 'bg-muted';
- document.body.appendChild(probe);
- const muted = getComputedStyle(probe).backgroundColor;
- probe.remove();
- const cancel = footer.querySelector('[data-testid="composer-back-cancel"]').getBoundingClientRect();
- const confirm = footer.querySelector('[data-testid="composer-back-confirm-go"]').getBoundingClientRect();
- return {
- muted: getComputedStyle(footer).backgroundColor === muted,
- rounded: parseFloat(getComputedStyle(footer).borderTopLeftRadius) > 0,
- insetBottom: Math.round(dialog.bottom - box.bottom),
- cancelFirst: cancel.right <= confirm.left,
- };
- })()
- JS))->toBe(['muted' => true, 'rounded' => true, 'insetBottom' => 8, 'cancelFirst' => true]);
-
- $page->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/ComposerQueueTest.php b/tests/Browser/ComposerQueueTest.php
index 6436bb530..8c3b032b8 100644
--- a/tests/Browser/ComposerQueueTest.php
+++ b/tests/Browser/ComposerQueueTest.php
@@ -200,46 +200,6 @@ test('a queue default falls back when the channel has no posting times', functio
$page->assertNoJavaScriptErrors();
});
-test('a channel without slots disables the queue options, names it in a tooltip and links to its posting times', function () {
- [$user, $workspace] = composerQueueWorkspace();
- $channel = composerQueueChannel($workspace, null);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'));
- composerQueueOpenWith($page, $channel);
-
- $page->click('@composer-schedule-trigger')
- ->assertVisible('@composer-schedule-now')
- ->assertVisible('@composer-schedule-next')
- ->assertVisible('@composer-schedule-top')
- ->assertVisible('@composer-queue-hint')
- ->assertVisible('@composer-queue-manage-slots');
-
- expect($page->script('document.querySelector("[data-testid=composer-schedule-next]").disabled'))->toBeTrue()
- ->and($page->script('document.querySelector("[data-testid=composer-schedule-top]").disabled'))->toBeTrue()
- ->and($page->script('document.querySelector("[data-testid=composer-schedule-now]").disabled'))->toBeFalse();
-
- $page->hover('@composer-schedule-row-next');
- waitForComposerQueuePageTestId($page, 'composer-schedule-blocked-next');
- $name = $channel->display_label ?: $channel->display_name;
- expect(trim((string) $page->script('document.querySelector("[data-testid=composer-schedule-blocked-next]").textContent')))
- ->toStartWith("No posting times for {$name}. Add posting times to use the queue.");
-
- $page->hover('@composer-schedule-custom')->hover('@composer-schedule-default-next');
- $page->script(<<<'JS'
- (async () => {
- for (let attempt = 0; attempt < 100; attempt++) {
- if (document.body.innerText.includes('Set as default posting action: Next available.')
- && document.querySelectorAll('[data-testid^="composer-schedule-blocked-"]').length === 0) return;
- await new Promise((resolve) => setTimeout(resolve, 50));
- }
- })();
- JS);
- $page->assertSee('Set as default posting action: Next available.');
- expect($page->script('document.querySelectorAll("[data-testid^=composer-schedule-blocked-]").length'))->toBe(0);
- $page->assertNoJavaScriptErrors();
-});
-
test('rapid star clicks keep only the last default posting action', function () {
[$user, $workspace] = composerQueueWorkspace();
$channel = composerQueueChannel($workspace, composerQueueSchedule());
@@ -290,27 +250,6 @@ test('rapid star clicks keep only the last default posting action', function ()
$page->assertNoJavaScriptErrors();
});
-test('the schedule menu lists all four options before any channel is selected and keeps the choice', function () {
- [$user, $workspace] = composerQueueWorkspace();
- composerQueueChannel($workspace, composerQueueSchedule());
- $user->update(['default_post_action' => DefaultPostAction::Now]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'));
- waitForComposerQueueTestId($page, 'composer-schedule-trigger');
- $page->click('@composer-schedule-trigger');
- waitForComposerQueuePageTestId($page, 'composer-schedule-custom');
-
- $order = $page->script('[...document.querySelectorAll("[data-testid^=composer-schedule-row-]")].map((row) => row.dataset.testid.replace("composer-schedule-row-", ""))');
- $disabled = $page->script('[...document.querySelectorAll("[data-testid^=composer-schedule-row-]")].map((row) => row.querySelector("button").disabled)');
- expect($order)->toBe(['next', 'top', 'now', 'custom'])
- ->and($disabled)->toBe([false, false, false, false]);
-
- $page->click('@composer-schedule-top');
- expect(trim((string) $page->script('document.querySelector("[data-testid=composer-schedule-trigger]").textContent')))->toBe('Prioritize');
- $page->assertNoJavaScriptErrors();
-});
-
test('the star saves the default posting action without selecting the option', function () {
[$user, $workspace] = composerQueueWorkspace();
$channel = composerQueueChannel($workspace, composerQueueSchedule());
@@ -383,26 +322,6 @@ test('prioritize puts the new post first and moves the queued one back', functio
$page->assertNoJavaScriptErrors();
});
-test('the queue list marks each scheduled post with its schedule mode', function () {
- [$user, $workspace] = composerQueueWorkspace();
- $channel = composerQueueChannel($workspace, composerQueueSchedule());
- $queued = composerQueueSeedPost($user, $workspace, $channel);
- $custom = composerQueueSeedPost($user, $workspace, $channel, [
- 'queue' => null,
- 'scheduled_at' => now()->addDays(3)->toIso8601String(),
- 'content' => 'Custom time',
- ]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'));
- waitForComposerQueuePageTestId($page, "post-schedule-mode-{$custom->id}");
-
- $page->assertVisible("@post-card-{$queued->id}")
- ->assertAttribute("@post-schedule-mode-{$queued->id}", 'data-mode', 'queue')
- ->assertAttribute("@post-schedule-mode-{$custom->id}", 'data-mode', 'custom')
- ->assertNoJavaScriptErrors();
-});
-
test('editing a queued post to a custom time switches its marker to custom', function () {
[$user, $workspace] = composerQueueWorkspace();
$channel = composerQueueChannel($workspace, composerQueueSchedule());
@@ -428,11 +347,7 @@ test('editing a queued post to a custom time switches its marker to custom', fun
expect($queued->refresh()->schedule_mode)->toBe(ScheduleMode::Custom);
- $page = visit(route('app.posts.index'));
- waitForComposerQueuePageTestId($page, "post-schedule-mode-{$queued->id}");
-
- $page->assertAttribute("@post-schedule-mode-{$queued->id}", 'data-mode', 'custom')
- ->assertNoJavaScriptErrors();
+ $page->assertNoJavaScriptErrors();
});
test('recovering an empty-target draft into the queue confirms it with a toast', function () {
@@ -555,55 +470,6 @@ test('picking a day and typing a time schedules a custom date with the user time
$page->assertNoJavaScriptErrors();
});
-test('the time input opens a fifteen minute list that sets the time', function () {
- [$user, $workspace] = composerQueueWorkspace();
- composerQueueChannel($workspace, composerQueueSchedule());
- $user->update(['time_format' => TimeFormat::TwentyFourHour]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'));
- composerScheduleOpenPicker($page);
- $day = composerSchedulePickFutureDay($page);
-
- $page->assertMissing('@composer-schedule-time-list')
- ->click('@composer-schedule-time-input');
- waitForComposerQueuePageTestId($page, 'composer-schedule-time-list');
-
- $options = $page->script('[...document.querySelectorAll("[data-testid^=composer-schedule-time-option-]")].map((option) => option.textContent.trim())');
- expect($options)->toHaveCount(96)
- ->and(array_slice($options, 0, 3))->toBe(['00:00', '00:15', '00:30']);
-
- $page->click('@composer-schedule-time-option-0945')
- ->assertMissing('@composer-schedule-time-list')
- ->assertValue('@composer-schedule-time-input', '09:45')
- ->click('@composer-schedule-time-input');
- waitForComposerQueuePageTestId($page, 'composer-schedule-time-list');
-
- expect($page->script('document.querySelector("[data-testid=composer-schedule-time-option-0945]").getAttribute("aria-selected")'))->toBe('true');
-
- $page->click('@composer-schedule-done');
-
- expect(trim((string) $page->script('document.querySelector("[data-testid=composer-schedule-trigger]").textContent')))
- ->toBe(composerScheduleExpectedLabel($day, '09:45', $user->timezone));
- $page->assertNoJavaScriptErrors();
-});
-
-test('more posting actions returns from the picker to the when menu', function () {
- [$user, $workspace] = composerQueueWorkspace();
- composerQueueChannel($workspace, composerQueueSchedule());
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'));
- composerScheduleOpenPicker($page);
-
- $page->assertMissing('@composer-schedule-row-next')
- ->click('@composer-schedule-more-actions')
- ->assertMissing('@composer-schedule-picker')
- ->assertVisible('@composer-schedule-row-next')
- ->assertVisible('@composer-schedule-custom')
- ->assertNoJavaScriptErrors();
-});
-
test('the picker calendar starts the week on the user preference', function (WeekStart $weekStart, string $firstWeekday, int $dayOfWeek) {
[$user, $workspace] = composerQueueWorkspace();
composerQueueChannel($workspace, composerQueueSchedule());
diff --git a/tests/Browser/ComposerSharedDataTest.php b/tests/Browser/ComposerSharedDataTest.php
index 50f2cb109..94c4b30d0 100644
--- a/tests/Browser/ComposerSharedDataTest.php
+++ b/tests/Browser/ComposerSharedDataTest.php
@@ -131,24 +131,6 @@ test('a new post lists every channel at once and fills the pinterest and tiktok
->assertNoJavaScriptErrors();
});
-test('a new tiktok post offers the privacy levels of the creator info', function () {
- [$user, , , $tiktok] = composerSharedDataSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'));
- waitForComposerSharedDataReady($page, 'composer-add-account');
-
- $page->click('@composer-add-account')
- ->click("@composer-account-option-{$tiktok->id}");
- waitForComposerSharedDataTestId($page, 'tiktok-privacy-level');
-
- $page->click('@tiktok-privacy-level');
- waitForComposerSharedDataCondition($page, "document.querySelectorAll('[role=\"option\"]').length > 0");
-
- expect($page->script("document.querySelectorAll('[role=\"option\"]').length"))->toBe(1);
- $page->assertNoJavaScriptErrors();
-});
-
test('the composer opens again from the sidebar without reading pinterest again', function () {
[$user, , $pinterest] = composerSharedDataSetup();
$this->actingAs($user);
@@ -168,21 +150,6 @@ test('the composer opens again from the sidebar without reading pinterest again'
expect(pinterestBoardListReads())->toBeLessThanOrEqual(1);
});
-test('editing from the list opens the post with its board', function () {
- [$user, $workspace, $pinterest] = composerSharedDataSetup();
- $post = composerSharedDataPost($workspace, $pinterest, ContentType::PinterestPin, ['board_id' => 'board_live']);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'));
- waitForComposerSharedDataTestId($page, "post-edit-{$post->id}");
- $page->click("@post-edit-{$post->id}");
- waitForComposerSharedDataTestId($page, 'pinterest-board-selected');
-
- $page->assertSeeIn('@pinterest-board-selected', 'Live board')
- ->assertNoJavaScriptErrors();
- expect($page->script('new URLSearchParams(location.search).get("edit")'))->toBe($post->id);
-});
-
test('editing from the calendar opens the post with its board', function () {
[$user, $workspace, $pinterest] = composerSharedDataSetup();
$post = composerSharedDataPost($workspace, $pinterest, ContentType::PinterestPin, ['board_id' => 'board_live']);
@@ -201,8 +168,13 @@ test('editing from the calendar opens the post with its board', function () {
function clickComposerSharedDataNewPost(mixed $page): void
{
- $page->click('@sidebar-new');
- waitForComposerSharedDataTestId($page, 'sidebar-new-post');
+ $item = "document.querySelector('[data-testid=\"sidebar-new-post\"]')?.getBoundingClientRect().height > 0";
+
+ for ($attempt = 0; $attempt < 3 && ! $page->script("Boolean({$item})"); $attempt++) {
+ $page->click('@sidebar-new');
+ waitForComposerSharedDataCondition($page, $item);
+ }
+
$page->click('@sidebar-new-post');
}
@@ -386,22 +358,6 @@ test('a network that does not answer holds only its own channel settings', funct
->assertNoJavaScriptErrors();
});
-test('posting slots open while another network is still answering', function () {
- [$user, $workspace, , $tiktok] = composerSharedDataSetup();
- $channel = composerSharedDataSlotChannel($workspace);
- $this->actingAs($user);
-
- $page = visit(route('app.insights'));
- holdComposerSharedDataTikTok($page, $tiktok);
- openComposerFromSidebar($page);
-
- composerSharedDataZoneLabel($page, $channel);
- waitForComposerSharedDataCondition($page, "document.querySelector('[data-testid=\"composer-schedule-slot-1500\"]')?.disabled === false");
-
- expect($page->script('document.querySelector("[data-testid=composer-schedule-slot-1500]").disabled'))->toBeFalse();
- $page->assertNoJavaScriptErrors();
-});
-
test('a failed slot read shows a retry banner and slots open once it loads', function () {
[$user, $workspace] = composerSharedDataSetup();
$channel = composerSharedDataSlotChannel($workspace);
diff --git a/tests/Browser/ComposerSingleChannelTest.php b/tests/Browser/ComposerSingleChannelTest.php
index 24b5ff5b9..663e59b48 100644
--- a/tests/Browser/ComposerSingleChannelTest.php
+++ b/tests/Browser/ComposerSingleChannelTest.php
@@ -131,20 +131,6 @@ test('saving a single channel draft keeps its network fields on the post platfor
->and(data_get($platform->meta, 'title'))->toBe('Launch title');
});
-test('picking youtube after typing the caption pre-fills the title from it', function () {
- [$user, $workspace] = singleChannelComposerWorkspace();
- $youtube = SocialAccount::factory()->youtube()->create(['workspace_id' => $workspace->id]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'));
- waitForSingleChannelComposerTestId($page, 'composer-add-account');
- $page->fill('@composer-base-content', 'Behind the scenes of our launch')
- ->click('@composer-add-account')
- ->click("@composer-account-option-{$youtube->id}")
- ->assertValue('@youtube-title', 'Behind the scenes of our launch')
- ->assertNoJavaScriptErrors();
-});
-
test('the youtube title follows the caption until the title is edited', function () {
[$user, $workspace] = singleChannelComposerWorkspace();
$youtube = SocialAccount::factory()->youtube()->create(['workspace_id' => $workspace->id]);
@@ -235,87 +221,6 @@ test('editing a single channel post opens its own editor', function () {
->assertNoJavaScriptErrors();
});
-test('text only channels start on the shared step and every card starts from the shared text', function () {
- [$user, $workspace] = singleChannelComposerWorkspace();
- $x = SocialAccount::factory()->x()->create(['workspace_id' => $workspace->id]);
- $linkedin = SocialAccount::factory()->linkedin()->create(['workspace_id' => $workspace->id]);
- $facebook = SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::Facebook]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'));
- waitForSingleChannelComposerTestId($page, 'composer-add-account');
- $page->fill('@composer-base-content', 'Shared idea')
- ->click('@composer-add-account')
- ->click("@composer-account-option-{$facebook->id}")
- ->click("@composer-account-option-{$linkedin->id}")
- ->click("@composer-account-option-{$x->id}")
- ->assertValue('@composer-base-content', 'Shared idea')
- ->assertMissing('@composer-customization')
- ->assertSeeIn('@composer-save-draft', 'Save drafts')
- ->assertMissing('@composer-submit')
- ->assertMissing('@composer-back');
- expect($page->script('document.querySelectorAll("[data-testid=composer-preview-card]").length'))->toBe(3);
-
- $page->click('@composer-next');
- waitForSingleChannelComposerTestId($page, "composer-caption-{$x->id}");
- $page->assertValue("@composer-caption-{$x->id}", 'Shared idea')
- ->assertSeeIn("@composer-expand-{$linkedin->id}", 'Shared idea')
- ->assertSeeIn("@composer-expand-{$facebook->id}", 'Shared idea')
- ->assertSeeIn('@composer-submit', 'Publish posts')
- ->assertVisible('@composer-back')
- ->assertMissing('@composer-next')
- ->assertMissing('@composer-base-content');
- expect($page->script('document.querySelectorAll("[data-testid=composer-preview-frame]").length'))->toBe(1);
-
- $page->fill("@composer-caption-{$x->id}", 'Only on X')
- ->assertSeeIn("@composer-expand-{$linkedin->id}", 'Shared idea')
- ->click("@composer-remove-account-{$facebook->id}")
- ->assertValue("@composer-caption-{$x->id}", 'Only on X')
- ->click("@composer-remove-account-{$x->id}")
- ->assertValue("@composer-caption-{$linkedin->id}", 'Shared idea')
- ->assertMissing('@composer-back')
- ->assertNoJavaScriptErrors();
-});
-
-test('shared media keeps the shared step before customizing each network', function () {
- [$user, $workspace] = singleChannelComposerWorkspace();
- $x = SocialAccount::factory()->x()->create(['workspace_id' => $workspace->id]);
- $linkedin = SocialAccount::factory()->linkedin()->create(['workspace_id' => $workspace->id]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'));
- waitForSingleChannelComposerTestId($page, 'composer-add-account');
- $page->fill('@composer-base-content', 'With a picture');
-
- $base64 = base64_encode((string) file_get_contents(base_path('tests/fixtures/crop-quadrants.png')));
- $page->script(<<<JS
- (async () => {
- const input = document.querySelector('[data-testid="composer-file-input"]');
- const bytes = Uint8Array.from(atob('{$base64}'), (character) => character.charCodeAt(0));
- const transfer = new DataTransfer();
- transfer.items.add(new File([bytes], 'shared.png', { type: 'image/png' }));
- input.files = transfer.files;
- input.dispatchEvent(new Event('change', { bubbles: true }));
- for (let attempt = 0; attempt < 100; attempt++) {
- if (document.querySelector('[data-testid="composer-media-item-0"]')) return;
- await new Promise((resolve) => setTimeout(resolve, 100));
- }
- })();
- JS);
-
- $page->click('@composer-add-account')
- ->click("@composer-account-option-{$x->id}")
- ->click("@composer-account-option-{$linkedin->id}")
- ->assertValue('@composer-base-content', 'With a picture')
- ->assertVisible('@composer-media-item-0')
- ->assertVisible('@composer-next')
- ->assertMissing('@composer-customization')
- ->click('@composer-next')
- ->assertVisible('@composer-customization')
- ->assertVisible('@composer-back')
- ->assertNoJavaScriptErrors();
-});
-
test('a channel that needs media keeps the shared step and shows the requirement', function () {
[$user, $workspace] = singleChannelComposerWorkspace();
$x = SocialAccount::factory()->x()->create(['workspace_id' => $workspace->id]);
diff --git a/tests/Browser/ComposerTemplatesTest.php b/tests/Browser/ComposerTemplatesTest.php
index 0af9820f5..a8c4cb443 100644
--- a/tests/Browser/ComposerTemplatesTest.php
+++ b/tests/Browser/ComposerTemplatesTest.php
@@ -110,17 +110,6 @@ test('a library card appends its body after the draft', function () {
->assertNoJavaScriptErrors();
});
-test('the discover filter is an icon-only button', function () {
- [$user] = composerTemplatesSetup();
-
- $page = openComposerTemplates($user);
- waitForComposerTemplatesTestId($page, 'composer-templates-filter');
-
- expect($page->script("document.querySelector('[data-testid=\"composer-templates-filter\"]').innerText.trim()"))->toBe('')
- ->and($page->script("document.querySelector('[data-testid=\"composer-templates-filter\"]').getAttribute('aria-label')"))->toBe(__('create.templates.filter'));
- $page->assertNoJavaScriptErrors();
-});
-
test('the scopes are underline tabs, not pills', function () {
[$user] = composerTemplatesSetup();
@@ -302,25 +291,6 @@ test('edit, duplicate and delete from the panel never touch the draft', function
->assertNoJavaScriptErrors();
});
-test('the empty editor link opens the templates panel', function () {
- [$user] = composerTemplatesSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'));
- waitForComposerTemplatesDialog($page, 'post-composer-dialog');
- waitForComposerTemplatesTestId($page, 'composer-templates-inspire');
-
- $page->assertMissing('@composer-templates-panel')
- ->click('@composer-templates-inspire');
- waitForComposerTemplatesTestId($page, 'composer-templates-panel');
-
- $page->assertVisible('@composer-templates-panel')
- ->assertAttribute('@composer-templates-toggle', 'aria-pressed', 'true')
- ->fill('@composer-base-content', 'Typing')
- ->assertMissing('@composer-templates-inspire')
- ->assertNoJavaScriptErrors();
-});
-
test('at 390px the header fits and every side panel toggle works', function () {
[$user] = composerTemplatesSetup();
$this->actingAs($user);
@@ -387,31 +357,3 @@ test('a failed template load shows an inline error and retry recovers', function
$page->assertMissing('@composer-templates-error')->assertNoJavaScriptErrors();
});
-
-test('the panel tabs are wired to their tabpanel', function () {
- [$user] = composerTemplatesSetup();
-
- $page = openComposerTemplates($user);
-
- $page->assertAttribute('@composer-templates-tab-discover', 'aria-controls', 'composer-templates-tabpanel')
- ->assertAttribute('@composer-templates-list', 'role', 'tabpanel')
- ->assertAttribute('@composer-templates-list', 'aria-labelledby', 'composer-templates-tab-discover')
- ->assertNoJavaScriptErrors();
-});
-
-test('at 390px picking a template returns to the compose view', function () {
- [$user] = composerTemplatesSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'))->resize(390, 844);
- waitForComposerTemplatesDialog($page, 'post-composer-dialog');
- waitForComposerTemplatesTestId($page, 'composer-templates-toggle');
- $page->click('@composer-templates-toggle');
- waitForComposerTemplatesTestId($page, 'composer-template-quick_win');
- $page->click('@composer-template-quick_win');
- waitForComposerTemplatesCondition($page, "!document.querySelector('[data-testid=\"composer-templates-sheet\"]')");
- waitForComposerTemplatesTestId($page, 'composer-base-content');
-
- $page->assertValue('@composer-base-content', __('template_library.quick_win.body'))
- ->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/ComposerTimezoneTest.php b/tests/Browser/ComposerTimezoneTest.php
index 601dffa04..0d911f88e 100644
--- a/tests/Browser/ComposerTimezoneTest.php
+++ b/tests/Browser/ComposerTimezoneTest.php
@@ -163,20 +163,6 @@ test('one channel shows and takes times in its own zone', function () {
$page->assertNoJavaScriptErrors();
});
-test('channels in different zones use the user zone', function () {
- [$user, $workspace] = composerTimezoneWorkspace();
- $saoPaulo = composerTimezoneChannel($workspace, 'America/Sao_Paulo');
- $warsaw = composerTimezoneChannel($workspace, 'Europe/Warsaw');
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'));
- composerTimezoneSelect($page, $saoPaulo, $warsaw);
- composerTimezoneOpenPicker($page);
-
- expect(composerTimezoneZoneLabel($page))->toBe('Asia/Tokyo');
- $page->assertNoJavaScriptErrors();
-});
-
test('changing the channels keeps the picked instant and shows it in the new zone', function () {
[$user, $workspace] = composerTimezoneWorkspace();
$saoPaulo = composerTimezoneChannel($workspace, 'America/Sao_Paulo');
@@ -309,39 +295,6 @@ test('one channel offers its posting slots for the picked day', function () {
$page->assertNoJavaScriptErrors();
});
-test('several channels hide the posting slots', function () {
- [$user, $workspace] = composerTimezoneWorkspace();
- $first = composerTimezoneChannel($workspace, 'America/Sao_Paulo', composerTimezoneSchedule());
- $second = composerTimezoneChannel($workspace, 'America/Sao_Paulo', composerTimezoneSchedule());
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'));
- composerTimezoneSelect($page, $first, $second);
- composerTimezoneOpenPicker($page);
- composerTimezonePickFutureDay($page);
-
- expect(composerTimezoneZoneLabel($page))->toBe('America/Sao Paulo');
- $page->assertMissing('@composer-schedule-slots')->assertNoJavaScriptErrors();
-});
-
-test('past posting slots of today are disabled', function () {
- [$user, $workspace] = composerTimezoneWorkspace();
- $zone = composerTimezoneNoonZone();
- $channel = composerTimezoneChannel($workspace, $zone, PostingSchedule::empty()
- ->withTime(now($zone)->dayOfWeek, '10:00')
- ->withTime(now($zone)->dayOfWeek, '15:00'));
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'));
- composerTimezoneSelect($page, $channel);
- composerTimezoneOpenPicker($page);
- waitForComposerTimezoneTestId($page, 'composer-schedule-slot-1500');
-
- expect($page->script('document.querySelector("[data-testid=composer-schedule-slot-1000]").disabled'))->toBeTrue()
- ->and($page->script('document.querySelector("[data-testid=composer-schedule-slot-1500]").disabled'))->toBeFalse();
- $page->assertNoJavaScriptErrors();
-});
-
test('posting slots already taken by a scheduled post are disabled', function () {
[$user, $workspace] = composerTimezoneWorkspace();
$zone = composerTimezoneNoonZone();
@@ -374,21 +327,6 @@ test('posting slots already taken by a scheduled post are disabled', function ()
$page->assertNoJavaScriptErrors();
});
-test('a day whose posting slots are all past hides them', function () {
- [$user, $workspace] = composerTimezoneWorkspace();
- $zone = composerTimezoneNoonZone();
- $channel = composerTimezoneChannel($workspace, $zone, PostingSchedule::empty()
- ->withTime(now($zone)->dayOfWeek, '09:00')
- ->withTime(now($zone)->dayOfWeek, '10:00'));
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'));
- composerTimezoneSelect($page, $channel);
- composerTimezoneOpenPicker($page);
-
- $page->assertMissing('@composer-schedule-slots')->assertNoJavaScriptErrors();
-});
-
test('the picker marks today in the channel zone, not the browser zone', function () {
[$user, $workspace] = composerTimezoneWorkspace();
$channel = composerTimezoneChannel($workspace, 'Pacific/Pago_Pago');
@@ -430,21 +368,3 @@ test('a calendar hour opens the composer at the same moment, shown in the channe
->toBe($instant->utc()->toIso8601String());
$page->assertNoJavaScriptErrors();
});
-
-test('a calendar day opens the composer at 9:00 of the display zone', function () {
- [$user, $workspace] = composerTimezoneWorkspace();
- $warsaw = composerTimezoneChannel($workspace, 'Europe/Warsaw');
- $day = now('America/Sao_Paulo')->addDays(2)->format('Y-m-d');
- $this->actingAs($user);
-
- $page = visit(route('app.channels.calendar', ['account' => $warsaw->id, 'view' => 'month', 'month' => $day, 'tz' => 'America/Sao_Paulo']));
- waitForComposerTimezoneTestId($page, "calendar-add-{$day}");
- $page->click("@calendar-add-{$day}");
- waitForComposerTimezoneTestId($page, "composer-caption-{$warsaw->id}");
-
- $instant = CarbonImmutable::parse("{$day} 09:00", 'America/Sao_Paulo');
- waitForComposerTimezoneTrigger($page, composerTimezoneLabel($instant->setTimezone('Europe/Warsaw')));
-
- expect(composerTimezoneTrigger($page))->toBe(composerTimezoneLabel($instant->setTimezone('Europe/Warsaw')));
- $page->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/ConnectChannelDialogTest.php b/tests/Browser/ConnectChannelDialogTest.php
index 656c19720..a8ff903e5 100644
--- a/tests/Browser/ConnectChannelDialogTest.php
+++ b/tests/Browser/ConnectChannelDialogTest.php
@@ -213,7 +213,7 @@ function openInstagramConnectStep(): mixed
return $page;
}
-test('the instagram step offers the professional card and the facebook link only, without a logo row', function () {
+test('the instagram step offers the professional card, links its help, opens the facebook requirements and asks before closing', function () {
$this->actingAs(connectDialogAdmin());
$page = openInstagramConnectStep();
@@ -230,23 +230,32 @@ test('the instagram step offers the professional card and the facebook link only
$dialogText = $page->script('document.querySelector(\'[data-testid="connect-channel-dialog"]\').textContent');
expect($dialogText)->not->toContain('Personal')->not->toContain('Notification');
-});
-test('connect to instagram leaves for the instagram login', function () {
- $this->actingAs(connectDialogAdmin());
- stubConnectDialogProviders();
+ $page->click('@instagram-connect-help');
+ waitForConnectDialogTestId($page, 'instagram-connect-help-convert');
- $page = openInstagramConnectStep();
- $page->click('@instagram-connect-standalone');
+ $links = $page->script(<<<'JS'
+ (() => ['account-type', 'convert'].map((key) => {
+ const link = document.querySelector(`[data-testid="instagram-connect-help-${key}"]`);
- expect(connectDialogReachedProvider($page))->toBe('instagram');
- $page->assertMissing('@connect-channel-dialog')->assertNoJavaScriptErrors();
-});
+ return { host: new URL(link.href).host, target: link.target, text: link.textContent.trim() };
+ }))();
+ JS);
-test('the facebook link opens the requirements step without starting oauth and back returns', function () {
- $this->actingAs(connectDialogAdmin());
+ expect($links)->toBe([
+ ['host' => 'help.instagram.com', 'target' => '_blank', 'text' => trans('accounts.instagram_connect.help.account_type')],
+ ['host' => 'help.instagram.com', 'target' => '_blank', 'text' => trans('accounts.instagram_connect.help.convert')],
+ ]);
+ $page->keys('@instagram-connect-help', 'Escape');
+ $page->script(<<<'JS'
+ (async () => {
+ for (let i = 0; i < 100; i++) {
+ if (!document.querySelector('[data-testid="instagram-connect-help-convert"]')) return;
+ await new Promise((r) => setTimeout(r, 50));
+ }
+ })();
+ JS);
- $page = openInstagramConnectStep();
$page->click('@instagram-connect-facebook');
waitForConnectDialogTestId($page, 'instagram-facebook-requirements');
@@ -261,6 +270,37 @@ test('the facebook link opens the requirements step without starting oauth and b
$page->assertVisible('@instagram-connect-professional')
->assertMissing('@instagram-facebook-requirements')
->assertNoJavaScriptErrors();
+
+ $page->click('@dialog-close');
+ waitForConnectDialogTestId($page, 'connect-channel-exit-confirm');
+
+ $page->assertSeeIn('@connect-channel-exit-confirm', trans('channels.dialog.exit_confirm.title', ['network' => 'Instagram']));
+
+ $page->click('@connect-channel-exit-continue');
+ waitForConnectDialogTestId($page, 'instagram-connect-professional');
+
+ $page->assertMissing('@connect-channel-exit-confirm')
+ ->assertVisible('@instagram-connect-professional')
+ ->assertNoJavaScriptErrors();
+
+ $page->click('@dialog-close');
+ waitForConnectDialogTestId($page, 'connect-channel-exit-leave');
+ $page->click('@connect-channel-exit-leave');
+
+ $page->assertMissing('@connect-channel-exit-confirm')
+ ->assertMissing('@connect-channel-dialog')
+ ->assertNoJavaScriptErrors();
+});
+
+test('connect to instagram leaves for the instagram login', function () {
+ $this->actingAs(connectDialogAdmin());
+ stubConnectDialogProviders();
+
+ $page = openInstagramConnectStep();
+ $page->click('@instagram-connect-standalone');
+
+ expect(connectDialogReachedProvider($page))->toBe('instagram');
+ $page->assertMissing('@connect-channel-dialog')->assertNoJavaScriptErrors();
});
test('connect through facebook leaves for the facebook login', function () {
@@ -287,58 +327,6 @@ test('connect through facebook leaves for the facebook login', function () {
$page->assertMissing('@connect-channel-dialog')->assertNoJavaScriptErrors();
});
-test('the instagram help menu links to the instagram help center in a new tab', function () {
- $this->actingAs(connectDialogAdmin());
-
- $page = openInstagramConnectStep();
- $page->click('@instagram-connect-help');
- waitForConnectDialogTestId($page, 'instagram-connect-help-convert');
-
- $links = $page->script(<<<'JS'
- (() => ['account-type', 'convert'].map((key) => {
- const link = document.querySelector(`[data-testid="instagram-connect-help-${key}"]`);
-
- return { host: new URL(link.href).host, target: link.target, text: link.textContent.trim() };
- }))();
- JS);
-
- expect($links)->toBe([
- ['host' => 'help.instagram.com', 'target' => '_blank', 'text' => trans('accounts.instagram_connect.help.account_type')],
- ['host' => 'help.instagram.com', 'target' => '_blank', 'text' => trans('accounts.instagram_connect.help.convert')],
- ]);
- $page->assertNoJavaScriptErrors();
-});
-
-test('closing a later step asks for confirmation and continue keeps the step', function () {
- $this->actingAs(connectDialogAdmin());
-
- $page = openInstagramConnectStep();
- $page->click('@dialog-close');
- waitForConnectDialogTestId($page, 'connect-channel-exit-confirm');
-
- $page->assertSeeIn('@connect-channel-exit-confirm', trans('channels.dialog.exit_confirm.title', ['network' => 'Instagram']));
-
- $page->click('@connect-channel-exit-continue');
- waitForConnectDialogTestId($page, 'instagram-connect-professional');
-
- $page->assertMissing('@connect-channel-exit-confirm')
- ->assertVisible('@instagram-connect-professional')
- ->assertNoJavaScriptErrors();
-});
-
-test('exiting from the confirmation closes the connect dialog', function () {
- $this->actingAs(connectDialogAdmin());
-
- $page = openInstagramConnectStep();
- $page->click('@dialog-close');
- waitForConnectDialogTestId($page, 'connect-channel-exit-leave');
- $page->click('@connect-channel-exit-leave');
-
- $page->assertMissing('@connect-channel-exit-confirm')
- ->assertMissing('@connect-channel-dialog')
- ->assertNoJavaScriptErrors();
-});
-
function openTelegramConnectStep(): mixed
{
$page = visit(route('app.workspace.channels'));
@@ -352,7 +340,7 @@ function openTelegramConnectStep(): mixed
return $page;
}
-test('the telegram step shows no logo row, the steps and the waiting status', function () {
+test('the telegram step shows its instructions, copies and regenerates the command, links the help and asks before closing', function () {
config()->set('trypost.platforms.telegram.bot_username', 'TryPost_Bot');
$this->actingAs(connectDialogAdmin());
@@ -382,13 +370,8 @@ test('the telegram step shows no logo row, the steps and the waiting status', fu
$live = $page->script('document.querySelector(\'[data-testid="telegram-connect-waiting"]\').parentElement.getAttribute("aria-live")');
expect($live)->toBe('polite');
-});
-test('copying the telegram command shows an inline copied state without a toast', function () {
- $this->actingAs(connectDialogAdmin());
-
- $page = openTelegramConnectStep();
- $command = $page->script('document.querySelector(\'[data-testid="telegram-connect-command"]\').textContent.trim()');
+ $copiedCommand = $page->script('document.querySelector(\'[data-testid="telegram-connect-command"]\').textContent.trim()');
$page->click('@telegram-connect-copy');
waitForConnectDialogTestId($page, 'telegram-connect-copied');
@@ -397,14 +380,9 @@ test('copying the telegram command shows an inline copied state without a toast'
->assertMissing('@telegram-connect-copy')
->assertNoJavaScriptErrors();
- expect($page->script('window.__copied'))->toBe([$command])
+ expect($page->script('window.__copied'))->toBe([$copiedCommand])
->and($page->script('document.querySelectorAll("[data-sonner-toast]").length'))->toBe(0);
-});
-
-test('generating a new telegram command replaces the previous one', function () {
- $this->actingAs(connectDialogAdmin());
- $page = openTelegramConnectStep();
$first = $page->script('document.querySelector(\'[data-testid="telegram-connect-command"]\').textContent.trim()');
$page->click('@telegram-connect-regenerate');
@@ -422,12 +400,7 @@ test('generating a new telegram command replaces the previous one', function ()
expect($second)->toStartWith('/connect ')->not->toBe($first);
$page->assertVisible('@telegram-connect-waiting')->assertNoJavaScriptErrors();
-});
-
-test('the telegram help menu links to the official telegram faq in a new tab', function () {
- $this->actingAs(connectDialogAdmin());
- $page = openTelegramConnectStep();
$page->click('@telegram-connect-help');
waitForConnectDialogTestId($page, 'telegram-connect-help-bot-privacy');
@@ -445,17 +418,16 @@ test('the telegram help menu links to the official telegram faq in a new tab', f
['host' => 'telegram.org', 'target' => '_blank', 'text' => trans('accounts.telegram.help.bot_privacy')],
]);
$page->assertNoJavaScriptErrors();
-});
-
-test('escape on the telegram step asks for confirmation too', function () {
- $this->actingAs(connectDialogAdmin());
- $page = visit(route('app.workspace.channels'));
- waitForConnectDialogTestId($page, 'channels-empty-connect');
- $page->click('@channels-empty-connect');
- waitForConnectDialogTestId($page, 'connect-channel-telegram');
- $page->click('@connect-channel-telegram');
- waitForConnectDialogTestId($page, 'connect-channel-back');
+ $page->keys('@telegram-connect-help', 'Escape');
+ $page->script(<<<'JS'
+ (async () => {
+ for (let i = 0; i < 100; i++) {
+ if (!document.querySelector('[data-testid="telegram-connect-help-bot-privacy"]')) return;
+ await new Promise((r) => setTimeout(r, 50));
+ }
+ })();
+ JS);
$page->keys('@connect-channel-back', 'Escape');
waitForConnectDialogTestId($page, 'connect-channel-exit-confirm');
diff --git a/tests/Browser/ConnectConfirmationTest.php b/tests/Browser/ConnectConfirmationTest.php
index b93448dd6..7747d3cd8 100644
--- a/tests/Browser/ConnectConfirmationTest.php
+++ b/tests/Browser/ConnectConfirmationTest.php
@@ -3,8 +3,6 @@
declare(strict_types=1);
use App\Enums\SocialAccount\Platform;
-use App\Enums\User\Locale;
-use App\Enums\User\Theme;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
@@ -112,11 +110,6 @@ function connectConfirmFacebookPages(): void
]);
}
-function connectConfirmFakeXVerify(): void
-{
- Http::fake([config('trypost.platforms.x.api').'/users/me*' => Http::response(['data' => ['id' => 'x-brand']])]);
-}
-
function connectConfirmPath(string $route, mixed ...$parameters): string
{
return (string) parse_url(route($route, ...$parameters), PHP_URL_PATH);
@@ -159,64 +152,6 @@ test('several pages: pick some, select all, and finish on the first connected ch
$page->assertVisible('@goal-flow')->assertNoJavaScriptErrors();
});
-test('one identity is confirmed pre-checked and finishes on its channel page', function () {
- $user = connectConfirmAdmin();
- $this->actingAs($user);
- connectConfirmFakeXVerify();
- stubConnectConfirmProvider('x', 'app.social.x.callback', ['code' => 'code-1', 'state' => 'state-1'], connectConfirmXLogin());
-
- $postsPath = connectConfirmPath('app.posts.index');
- $page = visit(route('app.social.x.connect', ['return_to' => $postsPath]))->resize(1280, 900);
- waitForConnectConfirmTestId($page, 'connect-finish');
-
- $page->assertSeeIn('@connect-title', __('accounts.connect.title_single'))
- ->assertMissing('@connect-select-all')
- ->assertSee('Brand on X')
- ->assertSee(__('accounts.connect.types.profile'));
-
- expect($page->script('document.querySelector(\'[data-testid="connect-finish"]\').disabled'))->toBeFalse();
-
- $page->click('@connect-finish');
-
- waitForConnectConfirmTestId($page, 'goal-flow');
-
- $channel = $user->currentWorkspace->socialAccounts()->sole();
- $channelPath = connectConfirmPath('app.channels.publish', $channel);
-
- expect(connectConfirmPollFor($page, "window.location.pathname === '{$channelPath}'"))->toBeTrue();
-
- expect($channel->platform)->toBe(Platform::X);
- $page->assertVisible('@goal-flow')->assertNoJavaScriptErrors();
-});
-
-test('a reconnect pre-checks the card being reconnected and refreshes it without the goal flow', function () {
- $user = connectConfirmAdmin();
- $account = SocialAccount::factory()->x()->tokenExpired()->create([
- 'workspace_id' => $user->current_workspace_id,
- 'platform_user_id' => 'x-brand',
- ]);
- $this->actingAs($user);
- connectConfirmFakeXVerify();
- stubConnectConfirmProvider('x', 'app.social.x.callback', ['code' => 'code-1'], connectConfirmXLogin());
-
- $page = visit(route('app.social.x.connect', ['reconnect' => $account->id, 'return_to' => connectConfirmPath('app.workspace.channels')]))->resize(1280, 900);
- waitForConnectConfirmTestId($page, 'connect-finish');
-
- $page->assertVisible('[data-testid="connect-identity-checkbox-x:x-brand"]')
- ->assertMissing('[data-testid="connect-identity-connected-x:x-brand"]');
-
- expect($page->script('document.querySelector(\'[data-testid="connect-identity-x:x-brand"]\').dataset.selected'))->toBe('true')
- ->and($page->script('document.querySelector(\'[data-testid="connect-finish"]\').disabled'))->toBeFalse();
-
- $page->click('@connect-finish');
-
- expect(connectConfirmPollFor($page, "window.location.pathname === '".connectConfirmPath('app.channels.publish', $account)."'"))->toBeTrue()
- ->and(connectConfirmPollFor($page, 'document.querySelector(\'[data-testid="goal-flow"]\')', 20))->toBeFalse()
- ->and($account->fresh()->access_token)->toBe('x-access-token');
-
- $page->assertNoJavaScriptErrors();
-});
-
test('pages already connected stay in place, locked, uncounted and skipped by select all', function () {
$user = connectConfirmAdmin();
$connected = SocialAccount::factory()->facebook()->create([
@@ -298,55 +233,6 @@ test('when every page is already connected the list is locked and says so', func
$page->assertNoJavaScriptErrors();
});
-test('the connected label fits on one line on a phone in dark mode in every language', function () {
- $user = connectConfirmAdmin();
- $user->update(['theme' => Theme::Dark]);
- SocialAccount::factory()->facebook()->create([
- 'workspace_id' => $user->current_workspace_id,
- 'platform_user_id' => 'page-2',
- ]);
- $this->actingAs($user);
- connectConfirmFacebookPages();
-
- $page = visit(route('app.social.facebook.connect'))->resize(390, 640);
- waitForConnectConfirmTestId($page, 'connect-identity-connected-facebook:page-2');
-
- $translations = collect(Locale::cases())
- ->mapWithKeys(fn (Locale $locale): array => [$locale->value => __('accounts.connect.connected', [], $locale->value)])
- ->all();
-
- $json = json_encode($translations, JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $result = $page->script(<<<JS
- (() => {
- const labels = {$json};
- const card = document.querySelector('[data-testid="connect-identity-facebook:page-2"]');
- const label = document.querySelector('[data-testid="connect-identity-connected-facebook:page-2"]');
- const text = Array.from(label.childNodes).find((node) => node.nodeType === Node.TEXT_NODE && node.nodeValue.trim() !== '');
- const height = label.getBoundingClientRect().height;
- const failures = Object.entries(labels)
- .filter(([, value]) => {
- text.nodeValue = value;
-
- return label.getBoundingClientRect().height > height + 1
- || label.getBoundingClientRect().right > card.getBoundingClientRect().right
- || card.scrollWidth > card.clientWidth + 1
- || document.documentElement.scrollWidth > window.innerWidth;
- })
- .map(([locale]) => locale);
-
- return {
- dark: document.documentElement.classList.contains('dark'),
- sameColor: getComputedStyle(label).color === getComputedStyle(card).backgroundColor,
- failures,
- };
- })()
- JS);
-
- expect($result)->toBe(['dark' => true, 'sameColor' => false, 'failures' => []]);
- $page->assertNoJavaScriptErrors();
-});
-
test('a cancelled consent shows the cancelled state with try again and back', function () {
$user = connectConfirmAdmin();
$this->actingAs($user);
@@ -370,46 +256,6 @@ test('a cancelled consent shows the cancelled state with try again and back', fu
$page->assertNoJavaScriptErrors();
});
-test('a login without the publish permission asks to connect again', function () {
- $this->actingAs(connectConfirmAdmin());
- stubConnectConfirmProvider('x', 'app.social.x.callback', ['code' => 'code-1'], connectConfirmXLogin(scopes: ['tweet.read', 'users.read']));
-
- $page = visit(route('app.social.x.connect'))->resize(1280, 900);
- waitForConnectConfirmTestId($page, 'connect-state-missing_permission');
-
- $page->assertSee(__('accounts.connect.states.missing_permission.title'))
- ->assertSeeIn('@connect-state-description', __('accounts.connect.states.missing_permission.description'))
- ->assertSeeIn('@connect-retry', __('accounts.connect.actions.connect_again'))
- ->assertNoJavaScriptErrors();
-
- expect(SocialAccount::query()->count())->toBe(0);
-});
-
-test('a confirmation page opened without a pending connection says it expired', function () {
- $this->actingAs(connectConfirmAdmin());
-
- $page = visit(route('app.social.connect.show', Platform::X))->resize(1280, 900);
- waitForConnectConfirmTestId($page, 'connect-state-expired');
-
- $page->assertSee(__('accounts.connect.states.expired.title'))
- ->assertSeeIn('@connect-retry', __('accounts.connect.actions.start_again'))
- ->assertMissing('@connect-finish')
- ->assertNoJavaScriptErrors();
-});
-
-test('a network error shows the generic error with its reason', function () {
- $this->actingAs(connectConfirmAdmin());
- stubConnectConfirmProvider('x', 'app.social.x.callback', ['code' => 'code-1'], null);
-
- $page = visit(route('app.social.x.connect'))->resize(1280, 900);
- waitForConnectConfirmTestId($page, 'connect-state-error');
-
- $page->assertSee(__('accounts.connect.states.error.title'))
- ->assertSeeIn('@connect-state-description', __('accounts.connect.errors.error_connecting'))
- ->assertSeeIn('@connect-retry', __('accounts.connect.actions.try_again'))
- ->assertNoJavaScriptErrors();
-});
-
test('the close button leaves without connecting, back to where the connection started', function () {
$this->actingAs(connectConfirmAdmin());
connectConfirmFacebookPages();
@@ -480,54 +326,6 @@ test('on a phone the cards fill the width and the footer stays in view', functio
$page->assertNoJavaScriptErrors();
});
-test('the header label and footer controls stay on one line in every language', function () {
- $this->actingAs(connectConfirmAdmin());
- connectConfirmFacebookPages();
-
- $page = visit(route('app.social.facebook.connect'))->resize(1280, 900);
- waitForConnectConfirmTestId($page, 'connect-identities');
-
- $slots = [
- 'connect-switch-account-label' => 'accounts.connect.switch.button',
- 'connect-finish' => 'accounts.connect.finish',
- 'connect-help' => 'accounts.connect.help.label',
- 'connect-selected-count' => 'accounts.connect.selected',
- ];
-
- $translations = collect($slots)->map(fn (string $key): array => collect(Locale::cases())
- ->mapWithKeys(fn (Locale $locale): array => [$locale->value => __($key, ['count' => 3], $locale->value)])
- ->all())->all();
-
- $json = json_encode($translations, JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $wrapped = $page->script(<<<JS
- (() => {
- const slots = {$json};
- const failures = [];
-
- for (const [testId, texts] of Object.entries(slots)) {
- const element = document.querySelector('[data-testid="' + testId + '"]');
- const original = element.innerHTML;
- const height = element.getBoundingClientRect().height;
-
- for (const [locale, text] of Object.entries(texts)) {
- element.textContent = text;
- const fits = element.scrollWidth <= element.clientWidth + 1
- && element.getBoundingClientRect().height <= height + 1
- && document.querySelector('[data-testid="connect-footer"]').scrollWidth <= document.querySelector('[data-testid="connect-footer"]').clientWidth + 1;
- if (!fits) failures.push(testId + ' ' + locale + ': ' + text);
- }
-
- element.innerHTML = original;
- }
-
- return failures;
- })()
- JS);
-
- expect($wrapped)->toBe([]);
-});
-
test('the bluesky and mastodon steps use the same page with the TryPost mark next to the network logo', function (string $route, string $platform, string $title, string $hint) {
$this->actingAs(connectConfirmAdmin());
@@ -614,53 +412,6 @@ test('the bluesky and mastodon forms use the standard field layout with hints un
expect($page->script("document.querySelectorAll('[role=\"alert\"], [data-slot=\"alert\"]').length"))->toBe(0);
});
-test('the stop state buttons stay on one line in every language, on a phone and on a desktop', function (int $width) {
- $this->actingAs(connectConfirmAdmin());
- stubConnectConfirmProvider('x', 'app.social.x.callback', ['error' => 'access_denied'], connectConfirmXLogin());
-
- $page = visit(route('app.social.x.connect'))->resize($width, 900);
- waitForConnectConfirmTestId($page, 'connect-state-cancelled');
-
- $slots = [
- 'connect-back' => ['accounts.connect.actions.back'],
- 'connect-retry' => ['accounts.connect.actions.try_again', 'accounts.connect.actions.connect_again', 'accounts.connect.actions.start_again'],
- ];
-
- $translations = collect($slots)->map(fn (array $keys): array => collect(Locale::cases())
- ->flatMap(fn (Locale $locale): array => collect($keys)->mapWithKeys(fn (string $key): array => ["{$locale->value} {$key}" => __($key, [], $locale->value)])->all())
- ->all())->all();
-
- $json = json_encode($translations, JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $wrapped = $page->script(<<<JS
- (() => {
- const slots = {$json};
- const failures = [];
-
- for (const [testId, texts] of Object.entries(slots)) {
- const element = document.querySelector('[data-testid="' + testId + '"]');
- const original = element.innerHTML;
- const height = element.getBoundingClientRect().height;
-
- for (const [label, text] of Object.entries(texts)) {
- element.textContent = text;
- const fits = element.scrollWidth <= element.clientWidth + 1
- && element.getBoundingClientRect().height <= height + 1
- && document.documentElement.scrollWidth <= window.innerWidth;
- if (!fits) failures.push(testId + ' ' + label + ': ' + text);
- }
-
- element.innerHTML = original;
- }
-
- return failures;
- })()
- JS);
-
- expect($wrapped)->toBe([]);
- $page->assertNoJavaScriptErrors();
-})->with(['phone' => 390, 'desktop' => 1280]);
-
test('the fragment a network appends to the callback is gone once the confirmation page shows', function (string $fragment) {
$this->actingAs(connectConfirmAdmin());
stubConnectConfirmProvider('x', 'app.social.x.callback', ['code' => 'code-1'], connectConfirmXLogin(), $fragment);
@@ -671,4 +422,4 @@ test('the fragment a network appends to the callback is gone once the confirmati
expect(connectConfirmPollFor($page, "window.location.hash === '' && !window.location.href.includes('#')"))->toBeTrue();
expect($page->script('window.history.state?.page?.url ?? ""'))->not->toContain('#');
$page->assertNoJavaScriptErrors();
-})->with(['#_', '#_=_']);
+})->with(['#_=_']);
diff --git a/tests/Browser/ConnectSwitchAccountTest.php b/tests/Browser/ConnectSwitchAccountTest.php
index df1953553..12da87c2c 100644
--- a/tests/Browser/ConnectSwitchAccountTest.php
+++ b/tests/Browser/ConnectSwitchAccountTest.php
@@ -2,7 +2,6 @@
declare(strict_types=1);
-use App\Enums\User\Locale;
use App\Models\User;
use App\Models\Workspace;
use Illuminate\Support\Facades\Http;
@@ -190,7 +189,7 @@ test('switch account on bluesky returns to its form with empty fields', function
$page->assertMissing('@connect-switch-state')->assertNoJavaScriptErrors();
});
-test('on a phone switch account shows a short label that fits next to the logos in every language', function () {
+test('on a phone switch account shows a short label next to the logos', function () {
$this->actingAs(switchAccountAdmin());
$parameters = [];
stubSwitchAccountFacebook($parameters);
@@ -198,35 +197,15 @@ test('on a phone switch account shows a short label that fits next to the logos
$page = visit(route('app.social.facebook.connect'))->resize(390, 640);
waitForSwitchAccountTestId($page, 'connect-switch-account');
- $labels = collect(Locale::cases())->mapWithKeys(fn (Locale $locale): array => [
- $locale->value => __('accounts.connect.switch.button_short', [], $locale->value),
- ])->all();
-
- $json = json_encode($labels, JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $failures = $page->script(<<<JS
+ $failures = $page->script(<<<'JS'
(() => {
- const labels = {$json};
- const button = document.querySelector('[data-testid="connect-switch-account"]');
- const short = document.querySelector('[data-testid="connect-switch-account-short"]');
- const full = document.querySelector('[data-testid="connect-switch-account-label"]');
+ const button = document.querySelector('[data-testid="connect-switch-account"]').getBoundingClientRect();
+ const full = document.querySelector('[data-testid="connect-switch-account-label"]').getBoundingClientRect();
const logos = document.querySelector('[data-testid="connect-header-logos"]').getBoundingClientRect();
const failures = [];
- const height = button.getBoundingClientRect().height;
-
- if (full.getBoundingClientRect().width !== 0) failures.push('full label visible');
-
- for (const [locale, text] of Object.entries(labels)) {
- short.textContent = text;
- const rect = button.getBoundingClientRect();
- const fits = rect.left >= 0
- && rect.right <= logos.left
- && button.scrollWidth <= button.clientWidth + 1
- && rect.height <= height + 1;
-
- if (!fits) failures.push(locale);
- }
+ if (full.width !== 0) failures.push('full label visible');
+ if (button.left < 0 || button.right > logos.left) failures.push('overlaps the logos');
if (document.documentElement.scrollWidth > window.innerWidth) failures.push('horizontal scroll');
return failures;
@@ -249,61 +228,3 @@ test('on a phone switch account shows a short label that fits next to the logos
$page->assertNoJavaScriptErrors();
});
-
-test('switch account copy stays on one line in every language', function () {
- $this->actingAs(switchAccountAdmin());
- $parameters = [];
- stubSwitchAccountFacebook($parameters);
-
- $page = visit(route('app.social.facebook.connect'))->resize(1280, 900);
- waitForSwitchAccountTestId($page, 'connect-switch-account');
-
- $translations = fn (string $key, array $replace = []): array => collect(Locale::cases())
- ->mapWithKeys(fn (Locale $locale): array => [$locale->value => __($key, $replace, $locale->value)])
- ->all();
-
- $headerJson = json_encode($translations('accounts.connect.switch.button'), JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $headerFailures = $page->script(<<<JS
- (() => {
- const labels = {$headerJson};
- const button = document.querySelector('[data-testid="connect-switch-account"]');
- const label = document.querySelector('[data-testid="connect-switch-account-label"]');
- const logos = document.querySelector('[data-testid="connect-header-logos"]').getBoundingClientRect();
- const height = label.getBoundingClientRect().height;
-
- return Object.entries(labels)
- .filter(([, text]) => {
- label.textContent = text;
-
- return button.getBoundingClientRect().right > logos.left || label.getBoundingClientRect().height > height + 1;
- })
- .map(([locale]) => locale);
- })()
- JS);
-
- $page->click('@connect-switch-account');
- waitForSwitchAccountTestId($page, 'connect-switch-connect');
-
- $ctaJson = json_encode($translations('accounts.connect.switch.connect', ['network' => 'Google Business Profile']), JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $ctaFailures = $page->script(<<<JS
- (() => {
- const labels = {$ctaJson};
- const cta = document.querySelector('[data-testid="connect-switch-connect"]');
- const footer = document.querySelector('[data-testid="connect-footer"]');
- const height = cta.getBoundingClientRect().height;
-
- return Object.entries(labels)
- .filter(([, text]) => {
- cta.textContent = text;
-
- return cta.getBoundingClientRect().height > height + 1 || footer.scrollWidth > footer.clientWidth + 1;
- })
- .map(([locale]) => locale);
- })()
- JS);
-
- expect($headerFailures)->toBe([])->and($ctaFailures)->toBe([]);
- $page->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/CreateFeedsTest.php b/tests/Browser/CreateFeedsTest.php
index 523e6a986..d81fd5649 100644
--- a/tests/Browser/CreateFeedsTest.php
+++ b/tests/Browser/CreateFeedsTest.php
@@ -114,31 +114,6 @@ beforeEach(function () {
Storage::fake();
});
-test('all feeds lists every item newest first and ends with the caught up line', function () {
- [$user, $workspace] = createFeedsSetup();
- $first = createFeedsFeed($workspace, ['title' => 'First source']);
- $second = createFeedsFeed($workspace, ['title' => 'Second source']);
- $older = createFeedsItem($first, ['published_at' => now()->subDays(2)]);
- $newest = createFeedsItem($second, ['published_at' => now()->subHour()]);
- $middle = createFeedsItem($first, ['published_at' => now()->subDay()]);
- $this->actingAs($user);
-
- $page = visit(route('app.create.feeds.index'));
- waitForCreateFeedsTestId($page, "feed-item-{$newest->id}");
- waitForCreateFeedsTestId($page, 'feeds-caught-up');
-
- $page->assertAttribute('@create-tab-feeds', 'aria-current', 'page')
- ->assertAttribute('@feeds-chip-all', 'aria-current', 'page')
- ->assertVisible('@feeds-last-refreshed')
- ->assertVisible('@feeds-caught-up')
- ->assertMissing('@feeds-scope-menu')
- ->assertNoJavaScriptErrors();
-
- expect($page->script("document.querySelector('[data-testid=\"create-tabs\"]').lastElementChild.dataset.testid"))->toBe('create-tab-feeds')
- ->and($page->script("[...document.querySelectorAll('[data-testid^=\"feed-item-\"]')].filter((el) => el.tagName === 'ARTICLE').map((el) => el.dataset.testid)"))
- ->toBe(["feed-item-{$newest->id}", "feed-item-{$middle->id}", "feed-item-{$older->id}"]);
-});
-
test('a feed chip opens that feed with only its items', function () {
[$user, $workspace] = createFeedsSetup();
$first = createFeedsFeed($workspace);
@@ -191,27 +166,6 @@ test('hovering an item reveals its actions and create post opens the composer wi
->and(Media::query()->count())->toBe(1);
});
-test('create post opens the composer without media when the image cannot be imported', function () {
- Http::fake(['https://93.184.216.34/image.png' => Http::response('nope', 500)]);
- [$user, $workspace] = createFeedsSetup();
- $feed = createFeedsFeed($workspace);
- $item = createFeedsItem($feed, ['title' => 'No image', 'url' => 'https://93.184.216.34/none']);
- $this->actingAs($user);
-
- $page = visit(route('app.create.feeds.index'));
- waitForCreateFeedsTestId($page, "feed-item-{$item->id}");
- $item->update(['image_url' => 'https://93.184.216.34/image.png']);
-
- $page->hover("@feed-item-{$item->id}")->click("@feed-item-create-post-{$item->id}");
- waitForCreateFeedsTestId($page, 'composer-base-content');
-
- $page->assertValue('@composer-base-content', "No image\n\nhttps://93.184.216.34/none")
- ->assertMissing('@composer-media-item')
- ->assertNoJavaScriptErrors();
-
- expect(Media::query()->count())->toBe(0);
-});
-
test('save as idea creates an unassigned idea with the imported image and shows saved without a toast', function () {
Http::fake(['https://93.184.216.34/image.png' => Http::response((string) file_get_contents(base_path('tests/fixtures/1x1.png')), 200, ['Content-Type' => 'image/png'])]);
[$user, $workspace] = createFeedsSetup();
@@ -239,11 +193,6 @@ test('save as idea creates an unassigned idea with the imported image and shows
->and($idea->idea_stage_id)->toBeNull()
->and(data_get($copy->meta, 'copied_from'))->toBe($image->id)
->and(collect($idea->media)->pluck('id')->all())->toBe([$copy->id]);
-
- $ideas = visit(route('app.create.ideas.index'));
- waitForCreateFeedsTestId($ideas, "idea-card-{$idea->id}");
-
- $ideas->assertVisible("@idea-card-{$idea->id}")->assertNoJavaScriptErrors();
});
test('the scope menu renames in a dialog, moves into a collection and back, and deletes with the keyword', function () {
@@ -354,38 +303,6 @@ test('the new menu creates a collection in a dialog and cancel adds nothing', fu
->and(createFeedsToastCount($page))->toBe(0);
});
-test('the collection menu lists its feeds, renames in a dialog and navigates to a feed', function () {
- [$user, $workspace] = createFeedsSetup();
- $collection = RssFeedCollection::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Tech']);
- $inside = createFeedsFeed($workspace, ['title' => 'Inside Feed', 'rss_feed_collection_id' => $collection->id]);
- $outside = createFeedsFeed($workspace, ['title' => 'Outside Feed']);
- $this->actingAs($user);
-
- $page = visit(route('app.create.feeds.collections.show', $collection));
- waitForCreateFeedsTestId($page, 'feeds-scope-menu');
- $page->click('@feeds-scope-menu');
- waitForCreateFeedsTestId($page, 'feeds-collection-menu-feeds');
-
- $page->assertSeeIn('@feeds-collection-menu-feeds', 'Inside Feed')
- ->assertMissing("@feeds-collection-menu-feed-{$outside->id}")
- ->assertVisible('@feeds-add-to-collection');
-
- $page->click("@feeds-collection-menu-feed-{$inside->id}");
- waitForCreateFeedsCondition($page, "window.location.pathname === '".route('app.create.feeds.show', $inside, false)."'");
-
- $page = visit(route('app.create.feeds.collections.show', $collection));
- waitForCreateFeedsTestId($page, 'feeds-scope-menu');
- $page->click('@feeds-scope-menu');
- waitForCreateFeedsTestId($page, 'feeds-rename');
- $page->click('@feeds-rename');
- waitForCreateFeedsDialog($page, 'feeds-rename-dialog');
- $page->type('@feeds-rename-dialog-input', 'Technology')->click('@feeds-rename-dialog-submit');
- waitForCreateFeedsDatabase($page, fn (): bool => $collection->refresh()->name === 'Technology');
-
- expect($collection->refresh()->name)->toBe('Technology');
- $page->assertNoJavaScriptErrors();
-});
-
test('a collection chip opens a dropdown of its feeds and the label opens the collection', function () {
[$user, $workspace] = createFeedsSetup();
$collection = RssFeedCollection::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Tech']);
@@ -765,73 +682,6 @@ test('explore closes with the close button, escape and an outside click wherever
expect(RssFeed::query()->where('url', 'http://93.184.216.34/feed.xml')->sole()->rss_feed_collection_id)->toBe($collection->id);
});
-test('explore opens repeatedly without touching the url and loads the directory behind a skeleton', function () {
- [$user] = createFeedsSetup();
- $this->actingAs($user);
-
- $path = route('app.create.feeds.index', [], false);
- $page = visit(route('app.create.feeds.index'));
- $page->script(<<<'JS'
- (() => {
- window.__createFeedsUrls = [];
- const record = () => window.__createFeedsUrls.push(window.location.pathname + window.location.search);
- const push = history.pushState.bind(history);
- const replace = history.replaceState.bind(history);
- history.pushState = (...args) => { push(...args); record(); };
- history.replaceState = (...args) => { replace(...args); record(); };
- })();
- JS);
-
- foreach (range(1, 2) as $round) {
- openCreateFeedsExploreFromSplitButton($page);
- waitForCreateFeedsTestId($page, 'feeds-explore-grid-favorites');
- $page->assertVisible('@feeds-explore-grid-favorites')->assertMissing('@feeds-explore-loading');
- $page->keys('@feeds-explore-dialog', 'Escape');
- assertCreateFeedsExploreClosed($page, $path);
- }
-
- expect(array_unique($page->script('window.__createFeedsUrls')))->toBe([$path]);
- $page->assertNoJavaScriptErrors();
-});
-
-test('the feeds dialogs mount without accessibility or attribute warnings', function () {
- [$user, $workspace] = createFeedsSetup();
- createFeedsFeed($workspace);
- $this->actingAs($user);
-
- $page = visit(route('app.create.feeds.index'));
- waitForCreateFeedsTestId($page, 'feeds-new-menu');
- $page->script(<<<'JS'
- (() => {
- window.__createFeedsWarnings = [];
- const warn = console.warn;
- console.warn = (...args) => {
- window.__createFeedsWarnings.push(args.map(String).join(' '));
- warn(...args);
- };
- })();
- JS);
-
- $page->click('@feeds-new-menu');
- waitForCreateFeedsTestId($page, 'feeds-new-collection');
- $page->click('@feeds-new-collection');
- waitForCreateFeedsDialog($page, 'feeds-new-collection-dialog');
- $page->click('@feeds-new-collection-dialog-cancel');
- waitForCreateFeedsCondition($page, "!document.querySelector('[data-testid=\"feeds-new-collection-dialog\"]')");
-
- expect($page->script('window.__createFeedsWarnings'))->toBe([]);
-
- $page->click('@feeds-new');
- waitForCreateFeedsDialog($page, 'feeds-add-dialog');
- $page->click('@feeds-add-cancel');
- waitForCreateFeedsCondition($page, "!document.querySelector('[data-testid=\"feeds-add-dialog\"]')");
-
- openCreateFeedsExploreFromSplitButton($page);
-
- expect($page->script('window.__createFeedsWarnings'))->toBe([]);
- $page->assertNoJavaScriptErrors();
-});
-
test('closing explore keeps the item list loading further pages without duplicates', function () {
[$user, $workspace] = createFeedsSetup();
$feed = createFeedsFeed($workspace);
diff --git a/tests/Browser/CreateIdeaEditorTest.php b/tests/Browser/CreateIdeaEditorTest.php
index c728fcfd6..80b0c1973 100644
--- a/tests/Browser/CreateIdeaEditorTest.php
+++ b/tests/Browser/CreateIdeaEditorTest.php
@@ -538,7 +538,6 @@ test('generate ideas shows one idea, generates again and opens it unsaved in the
->assertNoJavaScriptErrors();
})->with([
'desktop' => [null],
- 'phone' => [[390, 844]],
]);
test('generate ideas shows the payment required message inline when AI is denied', function () {
@@ -755,7 +754,7 @@ test('editing an idea image swaps in the edited file and releases the original o
$page->assertNoJavaScriptErrors();
});
-test('the assistant buttons only open the AI sidebar; it closes from its X', function (string $button) {
+test('the assistant buttons only open the AI sidebar; it closes from its X', function () {
[$user, $workspace] = createIdeaEditorSetup();
$idea = createIdeaEditorIdea($workspace, $user, ['title' => 'Saas metrics', 'body' => '']);
$this->actingAs($user);
@@ -763,34 +762,37 @@ test('the assistant buttons only open the AI sidebar; it closes from its X', fun
$page = visit(route('app.create.ideas.show', $idea));
waitForCreateIdeaEditorDialog($page);
- $page->click("@{$button}");
- waitForCreateIdeaEditorTestId($page, 'idea-editor-assistant');
- $page->assertAttribute("@{$button}", 'aria-pressed', 'true')
- ->click("@{$button}");
- $page->script('new Promise((resolve) => setTimeout(resolve, 300))');
-
- $page->assertVisible('@idea-editor-assistant');
-
- expect($page->script(<<<'JS'
- (() => {
- const editor = document.querySelector('[data-testid="idea-editor"]').getBoundingClientRect();
- const assistant = document.querySelector('[data-testid="idea-editor-assistant"]').getBoundingClientRect();
- const close = document.querySelector('[data-testid="idea-editor-assistant-close"]').getBoundingClientRect();
- const dialogClose = document.querySelector('[data-testid="idea-editor"] [data-slot="dialog-close"]').getBoundingClientRect();
- return {
- onTheLeft: Math.round(assistant.left) === Math.round(editor.left),
- closesApart: close.right <= dialogClose.left,
- };
- })()
- JS))->toBe(['onTheLeft' => true, 'closesApart' => true]);
-
- $page->click('@idea-editor-assistant-close');
- waitForCreateIdeaEditorCondition($page, '!document.querySelector(\'[data-testid="idea-editor-assistant"]\')');
+ foreach (['idea-editor-ai', 'idea-editor-use-assistant'] as $button) {
+ $page->click("@{$button}");
+ waitForCreateIdeaEditorTestId($page, 'idea-editor-assistant');
+ $page->assertAttribute("@{$button}", 'aria-pressed', 'true')
+ ->click("@{$button}");
+ $page->script('new Promise((resolve) => setTimeout(resolve, 300))');
+
+ $page->assertVisible('@idea-editor-assistant');
+
+ expect($page->script(<<<'JS'
+ (() => {
+ const editor = document.querySelector('[data-testid="idea-editor"]').getBoundingClientRect();
+ const assistant = document.querySelector('[data-testid="idea-editor-assistant"]').getBoundingClientRect();
+ const close = document.querySelector('[data-testid="idea-editor-assistant-close"]').getBoundingClientRect();
+ const dialogClose = document.querySelector('[data-testid="idea-editor"] [data-slot="dialog-close"]').getBoundingClientRect();
+ return {
+ onTheLeft: Math.round(assistant.left) === Math.round(editor.left),
+ closesApart: close.right <= dialogClose.left,
+ };
+ })()
+ JS))->toBe(['onTheLeft' => true, 'closesApart' => true]);
+
+ $page->click('@idea-editor-assistant-close');
+ waitForCreateIdeaEditorCondition($page, '!document.querySelector(\'[data-testid="idea-editor-assistant"]\')');
+
+ $page->assertMissing('@idea-editor-assistant')
+ ->assertAttribute("@{$button}", 'aria-pressed', 'false');
+ }
- $page->assertMissing('@idea-editor-assistant')
- ->assertAttribute("@{$button}", 'aria-pressed', 'false')
- ->assertNoJavaScriptErrors();
-})->with(['idea-editor-ai', 'idea-editor-use-assistant']);
+ $page->assertNoJavaScriptErrors();
+});
test('on a phone the title and close share the first row and the stage and labels triggers share the second', function (string $locale) {
[$user] = createIdeaEditorSetup();
@@ -818,22 +820,7 @@ test('on a phone the title and close share the first row and the stage and label
JS))->toBe(['titleAndCloseShareRow' => true, 'pickersShareRow' => true, 'pickersBelowTitle' => true, 'noOverflow' => true]);
$page->assertNoJavaScriptErrors();
-})->with(['en', 'de', 'fr', 'uk', 'ru', 'pl', 'pt-BR']);
-
-test('generate ideas opens as a dialog on a phone with cancel before generate', function () {
- [$user] = createIdeaEditorSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.create.ideas.index'))->resize(390, 844);
- waitForCreateIdeaEditorTestId($page, 'ideas-generate');
- $page->click('@ideas-generate');
- waitForCreateIdeaEditorTestId($page, 'ideas-generate-dialog');
-
- expect($page->script("document.querySelector('[data-testid=\"ideas-generate-dialog\"]').getAttribute('role') === 'dialog' && document.querySelector('[data-testid=\"ideas-generate-dialog\"]').dataset.slot === 'dialog-content'"))->toBeTrue();
- expect($page->script("(() => { const c = document.querySelector('[data-testid=\"ideas-generate-cancel\"]'); const s = document.querySelector('[data-testid=\"ideas-generate-submit\"]'); return c.compareDocumentPosition(s) & Node.DOCUMENT_POSITION_FOLLOWING ? true : false; })()"))->toBeTrue();
-
- $page->click('@ideas-generate-cancel')->assertNoJavaScriptErrors();
-});
+})->with(['de']);
test('the generate ideas dialog keeps its footer on screen at 390px in the form and result states', function () {
[$user] = createIdeaEditorSetup();
@@ -858,6 +845,8 @@ test('the generate ideas dialog keeps its footer on screen at 390px in the form
waitForCreateIdeaEditorTestId($page, 'ideas-generate-dialog');
waitForCreateIdeaEditorTestId($page, 'ideas-generate-submit');
+ expect($page->script("document.querySelector('[data-testid=\"ideas-generate-dialog\"]').getAttribute('role') === 'dialog' && document.querySelector('[data-testid=\"ideas-generate-cancel\"]').compareDocumentPosition(document.querySelector('[data-testid=\"ideas-generate-submit\"]')) & Node.DOCUMENT_POSITION_FOLLOWING ? true : false"))->toBeTrue();
+
expect($page->script($footerOnScreen))->toBeTrue();
$page->fill('@ideas-generate-audience', 'Home decor lovers')
diff --git a/tests/Browser/CreateIdeasBoardTest.php b/tests/Browser/CreateIdeasBoardTest.php
index f76a35824..255fd271e 100644
--- a/tests/Browser/CreateIdeasBoardTest.php
+++ b/tests/Browser/CreateIdeasBoardTest.php
@@ -74,11 +74,6 @@ function createIdeasBoardIdea(Workspace $workspace, User $user, ?IdeaStage $stag
]);
}
-function createIdeasBoardColumnIds(mixed $page): array
-{
- return $page->script('[...document.querySelectorAll(\'[data-testid^="idea-column-"]\')].map((el) => el.dataset.testid).filter((id) => /^idea-column-(unassigned|[0-9a-f-]{36})$/.test(id))');
-}
-
function createIdeasBoardMouse(mixed $page, string $method, array $params = []): void
{
$page->script('true');
@@ -160,25 +155,6 @@ function createIdeasBoardIsDropTarget(mixed $page, string $columnKey): bool
return $page->script("document.querySelector('[data-testid=\"idea-column-{$columnKey}\"]').hasAttribute('data-drop-target')");
}
-test('the board shows unassigned first and then the default stages with counts', function () {
- [$user, $workspace, $stages] = createIdeasBoardSetup();
- createIdeasBoardIdea($workspace, $user, null, 0, 'First');
- createIdeasBoardIdea($workspace, $user, null, 1, 'Second');
- $this->actingAs($user);
-
- $page = visit(route('app.create.ideas.index'));
- waitForCreateIdeasBoardTestId($page, 'idea-column-unassigned');
-
- expect(createIdeasBoardColumnIds($page))->toBe([
- 'idea-column-unassigned',
- "idea-column-{$stages['todo']->id}",
- "idea-column-{$stages['in_progress']->id}",
- "idea-column-{$stages['done']->id}",
- ]);
- $page->assertSeeIn('@idea-column-count-unassigned', '2')
- ->assertNoJavaScriptErrors();
-});
-
test('dragging a card onto another in the same column reorders it', function () {
[$user, $workspace, $stages] = createIdeasBoardSetup();
$a = createIdeasBoardIdea($workspace, $user, $stages['todo'], 0, 'Idea A');
@@ -208,24 +184,6 @@ test('dragging a card onto an empty column moves it there', function () {
$page->assertNoJavaScriptErrors();
});
-test('move to stage from the card menu moves the idea', function () {
- [$user, $workspace, $stages] = createIdeasBoardSetup();
- $a = createIdeasBoardIdea($workspace, $user, $stages['todo'], 0, 'Idea A');
- $this->actingAs($user);
-
- $page = visit(route('app.create.ideas.index'));
- waitForCreateIdeasBoardTestId($page, "idea-card-menu-{$a->id}");
- $page->click("@idea-card-menu-{$a->id}");
- waitForCreateIdeasBoardTestId($page, "idea-move-{$a->id}");
- $page->click("@idea-move-{$a->id}");
- waitForCreateIdeasBoardTestId($page, "idea-move-to-{$a->id}-unassigned");
- $page->click("@idea-move-to-{$a->id}-unassigned");
- waitForCreateIdeasBoardDatabase($page, fn (): bool => $a->refresh()->idea_stage_id === null);
-
- expect($a->refresh()->idea_stage_id)->toBeNull();
- $page->assertNoJavaScriptErrors();
-});
-
test('a new stage is created on enter and nothing is created on escape', function () {
[$user, $workspace] = createIdeasBoardSetup();
$this->actingAs($user);
@@ -381,27 +339,6 @@ test('the gallery view lists ideas and filters them by label and stage', functio
->assertNoJavaScriptErrors();
});
-test('duplicating an idea adds a copy right after it', function () {
- [$user, $workspace, $stages] = createIdeasBoardSetup();
- $a = createIdeasBoardIdea($workspace, $user, $stages['todo'], 0, 'Idea A');
- $b = createIdeasBoardIdea($workspace, $user, $stages['todo'], 1, 'Idea B');
- $this->actingAs($user);
-
- $page = visit(route('app.create.ideas.index'));
- waitForCreateIdeasBoardTestId($page, "idea-card-menu-{$a->id}");
- $page->click("@idea-card-menu-{$a->id}");
- waitForCreateIdeasBoardTestId($page, "idea-duplicate-{$a->id}");
- $page->click("@idea-duplicate-{$a->id}");
- waitForCreateIdeasBoardDatabase($page, fn (): bool => Idea::count() === 3);
-
- $copy = Idea::whereNotIn('id', [$a->id, $b->id])->firstOrFail();
- waitForCreateIdeasBoardTestId($page, "idea-card-{$copy->id}");
-
- $order = $page->script("[...document.querySelectorAll('[data-testid=\"idea-column-{$stages['todo']->id}\"] [data-idea-id]')].map((el) => el.dataset.ideaId)");
- expect($order)->toBe([$a->id, $copy->id, $b->id]);
- $page->assertNoJavaScriptErrors();
-});
-
test('a drop made while a move is in flight is applied after the first move completes', function () {
[$user, $workspace, $stages] = createIdeasBoardSetup();
$a = createIdeasBoardIdea($workspace, $user, $stages['todo'], 0, 'Idea A');
@@ -451,53 +388,6 @@ test('a drop made while a move is in flight is applied after the first move comp
$page->assertNoJavaScriptErrors();
});
-test('deleting a stage removes it from the stages filter', function () {
- [$user, $workspace, $stages] = createIdeasBoardSetup();
- createIdeasBoardIdea($workspace, $user, null, 0, 'Loose');
- $this->actingAs($user);
-
- $page = visit(route('app.create.ideas.index', ['view' => 'gallery', 'stages' => [$stages['todo']->id, $stages['done']->id]]));
- waitForCreateIdeasBoardTestId($page, 'ideas-view-board');
- expect($page->script('decodeURIComponent(location.search)'))->toContain($stages['todo']->id);
-
- $page->click('@ideas-view-board');
- waitForCreateIdeasBoardTestId($page, "idea-column-menu-{$stages['todo']->id}");
- $page->click("@idea-column-menu-{$stages['todo']->id}");
- waitForCreateIdeasBoardTestId($page, "idea-stage-delete-{$stages['todo']->id}");
- $page->click("@idea-stage-delete-{$stages['todo']->id}");
- waitForCreateIdeasBoardTestId($page, 'confirm-delete-action');
- $page->assertMissing('@confirm-delete-input')
- ->click('@confirm-delete-action');
- waitForCreateIdeasBoardCondition($page, "!document.querySelector('[data-testid=\"idea-column-{$stages['todo']->id}\"]')");
-
- $page->click('@ideas-view-gallery');
- waitForCreateIdeasBoardCondition($page, "location.search.includes('view=gallery')");
-
- $search = $page->script('decodeURIComponent(location.search)');
- expect($search)->not->toContain($stages['todo']->id)
- ->and($search)->toContain($stages['done']->id);
- $page->assertNoJavaScriptErrors();
-});
-
-test('move to stage works from the gallery card menu', function () {
- [$user, $workspace, $stages] = createIdeasBoardSetup();
- $a = createIdeasBoardIdea($workspace, $user, $stages['todo'], 0, 'Idea A');
- $this->actingAs($user);
-
- $page = visit(route('app.create.ideas.index', ['view' => 'gallery']));
- waitForCreateIdeasBoardTestId($page, "idea-card-menu-{$a->id}");
- $page->click("@idea-card-menu-{$a->id}");
- waitForCreateIdeasBoardTestId($page, "idea-move-{$a->id}");
- $page->click("@idea-move-{$a->id}");
- waitForCreateIdeasBoardTestId($page, "idea-move-to-{$a->id}-{$stages['done']->id}");
- $page->click("@idea-move-to-{$a->id}-{$stages['done']->id}");
- waitForCreateIdeasBoardDatabase($page, fn (): bool => $a->refresh()->idea_stage_id === $stages['done']->id);
-
- expect($a->refresh()->idea_stage_id)->toBe($stages['done']->id);
- $page->assertVisible("@idea-card-{$a->id}")
- ->assertNoJavaScriptErrors();
-});
-
test('move to stage works on a filtered board and appends to the end of the stage', function () {
[$user, $workspace, $stages] = createIdeasBoardSetup();
$label = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id]);
@@ -678,46 +568,6 @@ test('a dragged stage leaves a column-sized placeholder where it will land', fun
$page->assertNoJavaScriptErrors();
});
-test('the new stage button is a column-wide target with centered content', function () {
- [$user, , $stages] = createIdeasBoardSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.create.ideas.index'))->resize(1600, 900);
- waitForCreateIdeasBoardTestId($page, 'idea-stage-new');
-
- $metrics = $page->script(<<<JS
- (() => {
- const centerOffset = (testId) => {
- const element = document.querySelector('[data-testid="' + testId + '"]');
- const range = document.createRange();
- range.selectNodeContents(element);
- const content = range.getBoundingClientRect();
- const box = element.getBoundingClientRect();
- return Math.abs((content.left + content.width / 2) - (box.left + box.width / 2));
- };
- const button = document.querySelector('[data-testid="idea-stage-new"]');
- return {
- buttonWidth: button.offsetWidth,
- columnWidth: document.querySelector('[data-testid="idea-column-{$stages['todo']->id}"]').offsetWidth,
- buttonOffset: centerOffset('idea-stage-new'),
- newIdeaOffset: centerOffset('idea-column-new-{$stages['todo']->id}'),
- background: getComputedStyle(button).backgroundColor,
- };
- })()
- JS);
-
- expect($metrics['buttonWidth'])->toBe($metrics['columnWidth'])
- ->and($metrics['buttonOffset'])->toBeLessThan(1.5)
- ->and($metrics['newIdeaOffset'])->toBeLessThan(1.5)
- ->and($metrics['background'])->toBe('rgba(0, 0, 0, 0)');
-
- $page->hover('@idea-stage-new');
- waitForCreateIdeasBoardCondition($page, "getComputedStyle(document.querySelector('[data-testid=\"idea-stage-new\"]')).backgroundColor !== 'rgba(0, 0, 0, 0)'");
-
- expect($page->script("getComputedStyle(document.querySelector('[data-testid=\"idea-stage-new\"]')).backgroundColor"))->not->toBe('rgba(0, 0, 0, 0)');
- $page->assertNoJavaScriptErrors();
-});
-
test('the gallery stage filter has an unassigned option that combines with stages', function () {
[$user, $workspace, $stages] = createIdeasBoardSetup();
$loose = createIdeasBoardIdea($workspace, $user, null, 0, 'Loose');
@@ -851,28 +701,6 @@ test('on a phone the label filter shows only its icon and the page does not scro
$page->assertNoJavaScriptErrors();
});
-test('on a phone the create tabs and the board toolbar share one header row', function () {
- [$user, $workspace] = createIdeasBoardSetup();
- createIdeasBoardIdea($workspace, $user, null, 0, 'First');
- $this->actingAs($user);
-
- $page = visit(route('app.create.ideas.index'))->resize(390, 844);
- waitForCreateIdeasBoardTestId($page, 'ideas-filter-labels-filter');
-
- expect($page->script(<<<'JS'
- (() => {
- const tabs = document.querySelector('[data-testid="create-tabs"]').getBoundingClientRect();
- const filter = document.querySelector('[data-testid="ideas-filter-labels-filter"]').getBoundingClientRect();
-
- return {
- sameRow: filter.top < tabs.bottom && filter.bottom > tabs.top,
- overflow: document.documentElement.scrollWidth - window.innerWidth,
- };
- })()
- JS))->toBe(['sameRow' => true, 'overflow' => 0]);
- $page->assertNoJavaScriptErrors();
-});
-
test('scrolling a column loads its next ten ideas and the count comes from the database', function () {
[$user, $workspace, $stages] = createIdeasBoardSetup();
$ideas = collect(range(0, 14))->map(fn (int $position): Idea => createIdeasBoardIdea($workspace, $user, $stages['todo'], $position, "Idea {$position}"));
diff --git a/tests/Browser/CreateShellTest.php b/tests/Browser/CreateShellTest.php
index 2ea08086b..b6a8a711e 100644
--- a/tests/Browser/CreateShellTest.php
+++ b/tests/Browser/CreateShellTest.php
@@ -2,7 +2,6 @@
declare(strict_types=1);
-use App\Enums\User\Locale;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
@@ -49,18 +48,53 @@ function createShellUser(): User
return $user->fresh();
}
-test('the new menu offers a post and an idea', function () {
+test('the new menu lists its items in order for an admin and each one opens its target', function () {
$this->actingAs(createShellUser());
$page = visit(route('app.create.ideas.index'));
waitForCreateShellTestId($page, 'sidebar-new');
$page->click('@sidebar-new');
- waitForCreateShellTestId($page, 'sidebar-new-idea');
+ waitForCreateShellTestId($page, 'sidebar-new-member');
+ waitForCreateShellMenuSettled($page);
- $page->assertVisible('@sidebar-new-post')
- ->assertVisible('@sidebar-new-idea')
- ->assertScript("getComputedStyle(document.querySelector('[data-testid=\"sidebar-new-post\"] svg')).color === getComputedStyle(document.documentElement).getPropertyValue('--info').trim() || getComputedStyle(document.querySelector('[data-testid=\"sidebar-new-post\"] svg')).color !== getComputedStyle(document.querySelector('[data-testid=\"sidebar-new-channel\"] svg')).color", true)
- ->click('@sidebar-new-idea');
+ expect($page->script('[...document.querySelectorAll(\'[data-testid^="sidebar-new-"]:not([data-testid="sidebar-new-menu"]):not([data-testid$="-icon"])\')].map((el) => el.dataset.testid)'))
+ ->toBe(['sidebar-new-post', 'sidebar-new-idea', 'sidebar-new-channel', 'sidebar-new-member']);
+ expect($page->script("document.querySelector('[data-testid=\"sidebar-new-menu\"]').getBoundingClientRect().top >= document.querySelector('[data-testid=\"sidebar-new\"]').getBoundingClientRect().bottom"))->toBeTrue();
+
+ $page->click('@sidebar-new-channel');
+ waitForCreateShellTestId($page, 'connect-channel-dialog');
+ $page->assertVisible('@connect-channel-dialog')
+ ->keys('@connect-channel-dialog', 'Escape');
+ $page->script(<<<'JS'
+ (async () => {
+ for (let i = 0; i < 100; i++) {
+ if (!document.querySelector('[data-testid="connect-channel-dialog"]')) return;
+ await new Promise((r) => setTimeout(r, 50));
+ }
+ })();
+ JS);
+
+ $page->click('@sidebar-new');
+ waitForCreateShellTestId($page, 'sidebar-new-member');
+ waitForCreateShellMenuSettled($page);
+ $page->click('@sidebar-new-member');
+ waitForCreateShellTestId($page, 'invite-member-dialog');
+ $page->assertVisible('@invite-member-dialog')
+ ->assertVisible('#invite-email')
+ ->click('@invite-member-cancel');
+ $page->script(<<<'JS'
+ (async () => {
+ for (let i = 0; i < 100; i++) {
+ if (!document.querySelector('[data-testid="invite-member-dialog"]')) return;
+ await new Promise((r) => setTimeout(r, 50));
+ }
+ })();
+ JS);
+
+ $page->click('@sidebar-new');
+ waitForCreateShellTestId($page, 'sidebar-new-idea');
+ waitForCreateShellMenuSettled($page);
+ $page->click('@sidebar-new-idea');
waitForCreateShellTestId($page, 'create-header');
$page->assertVisible('@create-header')
@@ -81,45 +115,22 @@ test('the new menu opens the post composer', function () {
$page->assertVisible('@post-composer-dialog')->assertNoJavaScriptErrors();
});
-test('the create nav item links to ideas and is active there', function () {
+test('the create nav item links to ideas and the ideas tab is current', function () {
$this->actingAs(createShellUser());
$page = visit(route('app.create.ideas.index'));
$href = parse_url(route('app.create.ideas.index'), PHP_URL_PATH);
waitForCreateShellTestId($page, "nav-{$href}");
+ waitForCreateShellTestId($page, 'create-tab-ideas');
$page->assertVisible("@nav-{$href}")
->assertScript("document.querySelector('[data-testid=\"nav-{$href}\"]').getAttribute('href')", $href)
->assertScript("document.querySelector('[data-testid=\"nav-{$href}\"]').dataset.active", 'true')
- ->assertNoJavaScriptErrors();
-});
-
-test('the ideas tab is the current page', function () {
- $this->actingAs(createShellUser());
-
- $page = visit(route('app.create.ideas.index'));
- waitForCreateShellTestId($page, 'create-tab-ideas');
-
- $page->assertVisible('@create-header')
+ ->assertVisible('@create-header')
->assertAttribute('@create-tab-ideas', 'aria-current', 'page')
->assertNoJavaScriptErrors();
});
-test('the new menu lists post, idea, connect channel and invite member in order for an admin', function () {
- $this->actingAs(createShellUser());
-
- $page = visit(route('app.create.ideas.index'));
- waitForCreateShellTestId($page, 'sidebar-new');
- $page->click('@sidebar-new');
- waitForCreateShellTestId($page, 'sidebar-new-member');
- waitForCreateShellMenuSettled($page);
-
- expect($page->script('[...document.querySelectorAll(\'[data-testid^="sidebar-new-"]:not([data-testid="sidebar-new-menu"]):not([data-testid$="-icon"])\')].map((el) => el.dataset.testid)'))
- ->toBe(['sidebar-new-post', 'sidebar-new-idea', 'sidebar-new-channel', 'sidebar-new-member']);
- expect($page->script("document.querySelector('[data-testid=\"sidebar-new-menu\"]').getBoundingClientRect().top >= document.querySelector('[data-testid=\"sidebar-new\"]').getBoundingClientRect().bottom"))->toBeTrue();
- $page->assertNoJavaScriptErrors();
-});
-
test('the new menu hides connect channel and invite member from a member', function () {
$owner = createShellUser();
$member = User::factory()->create(['account_id' => $owner->account_id]);
@@ -138,42 +149,10 @@ test('the new menu hides connect channel and invite member from a member', funct
->assertNoJavaScriptErrors();
});
-test('connect a new channel from the new menu opens the connect dialog', function () {
- $this->actingAs(createShellUser());
-
- $page = visit(route('app.create.ideas.index'));
- waitForCreateShellTestId($page, 'sidebar-new');
- $page->click('@sidebar-new');
- waitForCreateShellTestId($page, 'sidebar-new-channel');
- $page->click('@sidebar-new-channel');
- waitForCreateShellTestId($page, 'connect-channel-dialog');
-
- $page->assertVisible('@connect-channel-dialog')->assertNoJavaScriptErrors();
-});
-
-test('invite new member from the sidebar new menu opens the invite dialog', function () {
- $this->actingAs(createShellUser());
-
- $page = visit(route('app.create.ideas.index'));
- waitForCreateShellTestId($page, 'sidebar-new');
- $page->click('@sidebar-new');
- waitForCreateShellTestId($page, 'sidebar-new-member');
- waitForCreateShellMenuSettled($page);
-
- expect($page->script("document.querySelector('[data-testid=\"sidebar-new-menu\"]').getBoundingClientRect().top >= document.querySelector('[data-testid=\"sidebar-new\"]').getBoundingClientRect().bottom"))->toBeTrue();
-
- $page->click('@sidebar-new-member');
- waitForCreateShellTestId($page, 'invite-member-dialog');
-
- $page->assertVisible('@invite-member-dialog')
- ->assertVisible('#invite-email')
- ->assertNoJavaScriptErrors();
-});
-
-test('the create tabs border keeps the same padding as the publish page on every create page', function (string $route) {
+test('the create tabs border keeps the same padding as the publish page', function () {
$this->actingAs(createShellUser());
- $page = visit(route($route))->resize(1440, 900);
+ $page = visit(route('app.create.ideas.index'))->resize(1440, 900);
waitForCreateShellTestId($page, 'create-tabs');
$edges = $page->script(<<<'JS'
@@ -187,33 +166,4 @@ test('the create tabs border keeps the same padding as the publish page on every
expect($edges[0])->toBeGreaterThanOrEqual(32)
->and($edges[1])->toBeGreaterThanOrEqual(32);
$page->assertNoJavaScriptErrors();
-})->with([
- 'ideas' => 'app.create.ideas.index',
- 'templates' => 'app.create.templates.index',
- 'feeds' => 'app.create.feeds.index',
-]);
-
-test('no create tab wraps onto a second line in any language', function (int $width) {
- $user = createShellUser();
- $this->actingAs($user);
-
- foreach (Locale::cases() as $locale) {
- $user->update(['locale' => $locale]);
-
- $page = visit(route('app.create.ideas.index'))->resize($width, 900);
- waitForCreateShellTestId($page, 'create-tab-ideas');
-
- $wrapped = $page->script(<<<'JS'
- [...document.querySelectorAll('[data-testid^="create-tab-"]')]
- .filter((tab) => {
- const range = document.createRange();
- range.selectNodeContents(tab);
- const tops = new Set([...range.getClientRects()].filter((rect) => rect.width > 0).map((rect) => Math.round(rect.top)));
- return tops.size > 1;
- })
- .map((tab) => tab.dataset.testid)
- JS);
-
- expect($wrapped)->toBe([], "{$locale->value} wraps");
- }
-})->with([390, 1280]);
+});
diff --git a/tests/Browser/CreateTemplatesTest.php b/tests/Browser/CreateTemplatesTest.php
index 6d0bb64d1..7d34eb9a6 100644
--- a/tests/Browser/CreateTemplatesTest.php
+++ b/tests/Browser/CreateTemplatesTest.php
@@ -419,17 +419,15 @@ test('the detail and the editor close with the close button, escape and an outsi
fn () => $page->script("document.body.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true }))"),
];
- foreach (range(1, 2) as $round) {
- foreach ($closers as $close) {
- waitForCreateTemplatesTestId($page, 'template-card-origin_story');
- $page->click('@template-card-origin_story');
- waitForCreateTemplatesDialog($page, 'template-detail');
- $close();
- waitForCreateTemplatesCondition($page, "!document.querySelector('[data-testid=\"template-detail\"]')");
-
- $page->assertMissing('@template-detail');
- expect($page->script('window.location.pathname + window.location.search'))->toBe($path);
- }
+ foreach ($closers as $close) {
+ waitForCreateTemplatesTestId($page, 'template-card-origin_story');
+ $page->click('@template-card-origin_story');
+ waitForCreateTemplatesDialog($page, 'template-detail');
+ $close();
+ waitForCreateTemplatesCondition($page, "!document.querySelector('[data-testid=\"template-detail\"]')");
+
+ $page->assertMissing('@template-detail');
+ expect($page->script('window.location.pathname + window.location.search'))->toBe($path);
}
$page->click('@templates-new');
@@ -494,27 +492,4 @@ test('clicking the active scope again does not duplicate its templates', functio
expect($page->script("document.querySelectorAll('article[data-testid^=\"template-card-\"]').length"))->toBe(1);
$page->assertNoJavaScriptErrors();
-})->with(['personal', 'team']);
-
-test('scope chips are links to their scope', function () {
- [$user] = createTemplatesSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.create.templates.index', ['view' => 'team']));
- waitForCreateTemplatesTestId($page, 'templates-scope-personal');
-
- $links = $page->script(<<<'JS'
- ['discover', 'team', 'personal'].map((scope) => {
- const chip = document.querySelector(`[data-testid="templates-scope-${scope}"]`);
-
- return [chip.tagName, chip.getAttribute('href'), chip.getAttribute('aria-current')];
- })
- JS);
-
- expect($links)->toBe([
- ['A', parse_url(route('app.create.templates.index'), PHP_URL_PATH), null],
- ['A', parse_url(route('app.create.templates.index'), PHP_URL_PATH).'?view=team', 'page'],
- ['A', parse_url(route('app.create.templates.index'), PHP_URL_PATH).'?view=personal', null],
- ]);
- $page->assertNoJavaScriptErrors();
-});
+})->with(['team']);
diff --git a/tests/Browser/CreateWorkspaceMetadataSheetTest.php b/tests/Browser/CreateWorkspaceMetadataSheetTest.php
index 81be35a43..d31eb5b82 100644
--- a/tests/Browser/CreateWorkspaceMetadataSheetTest.php
+++ b/tests/Browser/CreateWorkspaceMetadataSheetTest.php
@@ -75,5 +75,4 @@ test('workspace metadata creation uses a centered dialog and still saves', funct
->assertNoJavaScriptErrors();
})->with([
'signature' => ['signature', 'app.signatures.index', 'workspace_signatures'],
- 'label' => ['label', 'app.labels.index', 'workspace_labels'],
]);
diff --git a/tests/Browser/DialogFooterTest.php b/tests/Browser/DialogFooterTest.php
index 43615a763..39765310f 100644
--- a/tests/Browser/DialogFooterTest.php
+++ b/tests/Browser/DialogFooterTest.php
@@ -80,21 +80,30 @@ test('a dialog footer sits in a rounded muted panel inset from the dialog edges'
})()
JS))->toBeTrue();
- $page->assertNoJavaScriptErrors();
-});
+ $geometry = $page->script(<<<'JS'
+ (() => {
+ const box = document.querySelector('[data-testid="create-label-sheet"]').getBoundingClientRect();
+ const close = document.querySelector('[data-testid="create-label-sheet"] [data-testid="dialog-close"]').getBoundingClientRect();
-test('on a phone the footer actions share one row, with the primary last filling the rest', function () {
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create(['account_id' => $user->account_id, 'user_id' => $user->id]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
- $this->actingAs($user->fresh());
+ return {
+ centeredX: Math.abs((box.left + box.right) / 2 - window.innerWidth / 2) <= 1,
+ centeredY: Math.abs((box.top + box.bottom) / 2 - window.innerHeight / 2) <= 1,
+ maxWidth: Math.round(box.width) === 512,
+ shorterThanViewport: box.height < window.innerHeight - 100,
+ closeInside: close.top >= box.top && close.right <= box.right,
+ };
+ })()
+ JS);
- $page = visit(route('app.labels.index'))->resize(390, 844);
- waitForDialogFooterTestId($page, 'labels-empty-create');
- $page->click('@labels-empty-create');
- waitForDialogFooterTestId($page, 'create-label-sheet');
+ expect($geometry)->toBe([
+ 'centeredX' => true,
+ 'centeredY' => true,
+ 'maxWidth' => true,
+ 'shorterThanViewport' => true,
+ 'closeInside' => true,
+ ]);
+
+ $page->resize(390, 844);
$page->script('new Promise((resolve) => setTimeout(resolve, 400))');
$layout = $page->script(<<<'JS'
@@ -118,23 +127,5 @@ test('on a phone the footer actions share one row, with the primary last filling
'overflow' => false,
]);
- $page->resize(1280, 900);
- $page->script('new Promise((resolve) => setTimeout(resolve, 300))');
-
- $desktop = $page->script(<<<'JS'
- (() => {
- const footer = document.querySelector('[data-testid="create-label-sheet"] [data-slot="dialog-footer"]');
- const cancel = footer.querySelector('[data-testid="cancel-create-label"]').getBoundingClientRect();
- const submit = footer.querySelector('[data-testid="submit-create-label"]').getBoundingClientRect();
- return {
- sameRow: Math.round(cancel.top) === Math.round(submit.top),
- hugsContent: submit.width < footer.getBoundingClientRect().width / 2,
- primaryEnd: Math.round(footer.getBoundingClientRect().right - submit.right),
- };
- })()
- JS);
-
- expect($desktop)->toMatchArray(['sameRow' => true, 'hugsContent' => true, 'primaryEnd' => 12]);
-
$page->assertNoJavaScriptErrors();
});
diff --git a/tests/Browser/DialogFullScreenMobileTest.php b/tests/Browser/DialogFullScreenMobileTest.php
index 32a2d78b0..f40ff4500 100644
--- a/tests/Browser/DialogFullScreenMobileTest.php
+++ b/tests/Browser/DialogFullScreenMobileTest.php
@@ -133,39 +133,3 @@ test('on a phone an alert dialog fills the screen with its footer in view', func
$page->assertNoJavaScriptErrors();
});
-
-test('on desktop a dialog stays centered with its maximum width', function () {
- $this->actingAs(dialogFullScreenAdmin());
-
- $page = openDialogFullScreenLabel(1280, 900);
-
- $geometry = $page->script(<<<'JS'
- (() => {
- const box = document.querySelector('[data-testid="create-label-sheet"]').getBoundingClientRect();
-
- return {
- centeredX: Math.abs((box.left + box.right) / 2 - window.innerWidth / 2) <= 1,
- centeredY: Math.abs((box.top + box.bottom) / 2 - window.innerHeight / 2) <= 1,
- maxWidth: Math.round(box.width) === 512,
- shorterThanViewport: box.height < window.innerHeight - 100,
- rounded: parseFloat(getComputedStyle(document.querySelector('[data-testid="create-label-sheet"]')).borderTopLeftRadius) > 0,
- closeInside: (() => {
- const close = document.querySelector('[data-testid="create-label-sheet"] [data-testid="dialog-close"]').getBoundingClientRect();
-
- return close.top >= box.top && close.right <= box.right;
- })(),
- };
- })()
- JS);
-
- expect($geometry)->toBe([
- 'centeredX' => true,
- 'centeredY' => true,
- 'maxWidth' => true,
- 'shorterThanViewport' => true,
- 'rounded' => true,
- 'closeInside' => true,
- ]);
-
- $page->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/ImageCropperTest.php b/tests/Browser/ImageCropperTest.php
index c75bd4f39..10f3d1e23 100644
--- a/tests/Browser/ImageCropperTest.php
+++ b/tests/Browser/ImageCropperTest.php
@@ -230,28 +230,6 @@ test('a profile photo opens the media editor locked to a square 1:1 crop and sav
expect($page->script("Boolean(document.querySelector('[data-testid=\"media-editor\"]'))"))->toBeFalse();
});
-test('rotating the photo turns the uploaded avatar', function () {
- $this->actingAs(User::factory()->create());
-
- $page = visit(route('app.profile.edit'));
-
- selectPhoto($page);
- waitForCropSelection($page);
- recordUpload($page);
-
- $page->click('@media-editor-rotate-right')
- ->click('@media-editor-apply')
- ->assertNoJavaScriptErrors();
-
- $request = decodedUpload($page);
-
- expect($request['width'])->toBe(512)
- ->and(isQuadrantColour($request['pixels']['topLeft'], [0, 0, 255]))->toBeTrue()
- ->and(isQuadrantColour($request['pixels']['topRight'], [255, 0, 0]))->toBeTrue()
- ->and(isQuadrantColour($request['pixels']['bottomLeft'], [255, 255, 0]))->toBeTrue()
- ->and(isQuadrantColour($request['pixels']['bottomRight'], [0, 255, 0]))->toBeTrue();
-});
-
test('cancelling the editor discards the photo without uploading', function () {
$this->actingAs(User::factory()->create());
diff --git a/tests/Browser/ImportedPostCardTest.php b/tests/Browser/ImportedPostCardTest.php
index fd7715ec7..24576ada8 100644
--- a/tests/Browser/ImportedPostCardTest.php
+++ b/tests/Browser/ImportedPostCardTest.php
@@ -294,24 +294,27 @@ test('a draft shows no metrics band in its details', function () {
->assertNoJavaScriptErrors();
});
-test('the content type badge has an icon for stories and reels and is hidden for a regular post', function (ContentType $contentType, ?string $label) {
+test('the content type badge has an icon for stories and reels and is hidden for a regular post', function () {
[$user, $workspace, $account] = importedCardSetup();
- $post = importedCardPost($workspace, $account, $contentType);
+ $expectations = [
+ [importedCardPost($workspace, $account, ContentType::InstagramStory), 'posts.content_types.instagram_story.label'],
+ [importedCardPost($workspace, $account, ContentType::InstagramReel), 'posts.content_types.instagram_reel.label'],
+ [importedCardPost($workspace, $account, ContentType::InstagramFeed), null],
+ ];
$this->actingAs($user);
$page = visit(route('app.posts.index', ['tab' => 'sent']));
- waitForImportedCardTestId($page, "post-card-{$post->id}");
- if ($label === null) {
- $page->assertMissing("@post-content-type-{$post->id}");
- } else {
- $page->assertSeeIn("@post-content-type-{$post->id}", __($label))
- ->assertScript("document.querySelector('[data-testid=\"post-content-type-{$post->id}\"] svg') !== null", true);
+ foreach ($expectations as [$post, $label]) {
+ waitForImportedCardTestId($page, "post-card-{$post->id}");
+
+ if ($label === null) {
+ $page->assertMissing("@post-content-type-{$post->id}");
+ } else {
+ $page->assertSeeIn("@post-content-type-{$post->id}", __($label))
+ ->assertScript("document.querySelector('[data-testid=\"post-content-type-{$post->id}\"] svg') !== null", true);
+ }
}
$page->assertNoJavaScriptErrors();
-})->with([
- 'story' => [ContentType::InstagramStory, 'posts.content_types.instagram_story.label'],
- 'reel' => [ContentType::InstagramReel, 'posts.content_types.instagram_reel.label'],
- 'regular post' => [ContentType::InstagramFeed, null],
-]);
+});
diff --git a/tests/Browser/InsightsChannelFilterTest.php b/tests/Browser/InsightsChannelFilterTest.php
index a0505cf1e..6dbd95c5a 100644
--- a/tests/Browser/InsightsChannelFilterTest.php
+++ b/tests/Browser/InsightsChannelFilterTest.php
@@ -118,7 +118,7 @@ test('the channel filter scopes the dashboard and keeps the channel in the url',
->assertNoJavaScriptErrors();
});
-test('the follower bar tooltip shows a series swatch and the value', function () {
+test('the follower bar tooltip shows a series swatch and the toolbar fits a 390px viewport', function () {
[$user] = insightsChannelFilterFixture();
$this->actingAs($user);
@@ -134,13 +134,8 @@ test('the follower bar tooltip shows a series swatch and the value', function ()
->assertScript('document.querySelector("[data-testid=analytics-tooltip-value]")?.innerText', '120')
->assertScript('document.querySelector("[data-testid=analytics-tooltip-detail]")?.innerText.includes("110")', true)
->assertNoJavaScriptErrors();
-});
-
-test('the toolbar fits a 390px viewport without clipping the range presets', function () {
- [$user] = insightsChannelFilterFixture();
- $this->actingAs($user);
- $page = visit(route('app.insights'))->resize(390, 844);
+ $page->resize(390, 844);
waitForInsightsChannelTestId($page, 'insights-range-custom');
$page->assertScript('(() => { const group = document.querySelector("[data-testid=insights-range-presets] [role=group]"); return group.scrollWidth <= group.clientWidth + 1; })()', true)
@@ -198,16 +193,3 @@ test('a channel without data shows the filtered empty state and history navigati
->assertMissing('@analytics-filtered-empty-state')
->assertNoJavaScriptErrors();
});
-
-test('the sidebar keeps its publish count and channel list on the insights page', function () {
- [$user] = insightsChannelFilterFixture();
- $this->actingAs($user);
-
- $page = visit(route('app.insights'));
- waitForInsightsChannelTestId($page, 'sidebar-publish-count');
-
- expect($page->script("document.querySelector('[data-testid=\"sidebar-publish-count\"]').textContent.trim()"))->toMatch('/^\d+$/')
- ->and($page->script("document.querySelectorAll('[data-testid=\"sidebar-channels-list\"] [data-testid^=\"sidebar-channel-row-\"]').length"))->toBeGreaterThan(0);
-
- $page->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/InsightsParityTest.php b/tests/Browser/InsightsParityTest.php
index 85d8673c9..91bdf0419 100644
--- a/tests/Browser/InsightsParityTest.php
+++ b/tests/Browser/InsightsParityTest.php
@@ -154,11 +154,59 @@ test('the header offers CSV and Markdown exports of the filtered page and explai
->assertNoJavaScriptErrors();
});
-test('summary cards and sections explain themselves with info tooltips', function () {
- ['user' => $user] = insightsParitySetup();
+test('followers and posts charts show network logos and say how many channels are shown', function () {
+ ['user' => $user, 'instagram' => $instagram] = insightsParitySetup();
+ $this->actingAs($user);
+
+ $page = visit(route('app.insights'));
+ waitForInsightsParityTestId($page, 'accounts-unovis-bar-chart');
+ waitForInsightsParityCondition($page, 'document.querySelectorAll("[data-testid=analytics-axis-channel]").length >= 4');
+
+ $page->assertScript('document.querySelectorAll("[data-testid=analytics-axis-channel]").length', 4)
+ ->assertScript('document.querySelector("[data-testid=analytics-followers-subtitle]")?.textContent.includes("Showing")', false);
+
+ $page->navigate(route('app.insights', ['channels' => [$instagram->id]]));
+ waitForInsightsParityTestId($page, 'analytics-followers-subtitle');
+ waitForInsightsParityCondition($page, 'document.querySelectorAll("[data-testid=analytics-axis-channel]").length >= 2');
+
+ $page->assertSeeIn('@analytics-followers-subtitle', 'Showing 1 of 2 channels. Filter by channel to see a different set.')
+ ->assertSeeIn('@analytics-posts-subtitle', 'Showing 1 of 2 channels.')
+ ->assertScript('document.querySelectorAll("[data-testid=analytics-axis-channel]").length', 2)
+ ->assertScript('document.querySelector("[data-testid=analytics-axis-channel]").getAttribute("data-platform")', 'instagram')
+ ->assertNoJavaScriptErrors();
+});
+
+test('a channel whose connection is lost shows the disconnected dot in the filter, the table and the charts', function () {
+ ['user' => $user, 'facebook' => $facebook] = insightsParitySetup();
+ $facebook->update(['status' => SocialAccountStatus::TokenExpired]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.insights'));
+ waitForInsightsParityTestId($page, 'analytics-channel-filter');
+ waitForInsightsParityCondition($page, 'document.querySelectorAll("[data-testid=analytics-axis-channel] [data-testid^=channel-avatar-disconnected]").length >= 2');
+
+ $page->assertScript('document.querySelectorAll("[data-testid=analytics-axis-channel] [data-testid^=channel-avatar-disconnected]").length', 2)
+ ->assertScript("document.querySelectorAll('[data-testid=\"channel-avatar-disconnected-{$facebook->id}\"]').length >= 1", true)
+ ->click('@analytics-channel-filter');
+ waitForInsightsParityCondition($page, "document.querySelectorAll('[data-testid=\"channel-avatar-disconnected-{$facebook->id}\"]').length >= 2");
+
+ $page->assertNoJavaScriptErrors();
+});
+
+test('the insights dashboard shows channel avatars, explains itself, sorts and customizes the table and opens top posts', function () {
+ ['user' => $user, 'post' => $post] = insightsParitySetup();
$this->actingAs($user);
$page = visit(route('app.insights'));
+ waitForInsightsParityTestId($page, 'accounts-unovis-bar-chart');
+ waitForInsightsParityCondition($page, 'document.querySelectorAll("[data-testid=analytics-axis-channel]").length >= 4');
+
+ $page->assertScript('document.querySelectorAll("[data-testid=analytics-axis-channel] [data-slot=avatar] img").length', 2)
+ ->assertScript('document.querySelectorAll("[data-testid=analytics-axis-channel] [data-slot=avatar] > div").length', 2)
+ ->assertScript('[...document.querySelectorAll("[data-testid=analytics-axis-channel]")].every((channel) => channel.querySelectorAll("img").length >= 1)', true)
+ ->assertScript('document.querySelectorAll("[data-testid=analytics-top-post-channel]").length >= 2', true)
+ ->assertNoJavaScriptErrors();
+
waitForInsightsParityTestId($page, 'analytics-summary-posts-about');
foreach (['posts', 'followers', 'reactions', 'comments', 'engagement_rate'] as $metric) {
@@ -177,13 +225,29 @@ test('summary cards and sections explain themselves with info tooltips', functio
waitForInsightsParityTestId($page, 'analytics-performance-about-content');
$page->assertSeeIn('@analytics-performance-about-content', 'Totals per channel')
->assertNoJavaScriptErrors();
-});
-test('the performance columns picker changes the table and remembers the choice', function () {
- ['user' => $user] = insightsParitySetup();
- $this->actingAs($user);
+ waitForInsightsParityTestId($page, 'analytics-performance-sort-reactions');
+
+ $order = 'Array.from(document.querySelectorAll("tbody th[scope=row]")).map((cell) => (cell.innerText.match(/@\\w+/) || [""])[0]).join(",")';
+
+ $page->assertScript('document.querySelector("[data-testid=analytics-performance-columns]").closest("table") === null', true)
+ ->click('@analytics-performance-sort-reactions');
+ waitForInsightsParityCondition($page, 'document.querySelector("[data-testid=analytics-performance-column-reactions]").getAttribute("aria-sort") === "descending"');
+ $descending = $page->script($order);
+
+ $page->click('@analytics-performance-sort-reactions');
+ waitForInsightsParityCondition($page, 'document.querySelector("[data-testid=analytics-performance-column-reactions]").getAttribute("aria-sort") === "ascending"');
+ $ascending = $page->script($order);
+
+ expect($descending)->toContain('@alpha')
+ ->and($ascending)->toBe(implode(',', array_reverse(explode(',', $descending))));
+
+ $page->click('@analytics-performance-sort-channel');
+ waitForInsightsParityCondition($page, 'document.querySelector("[data-testid=analytics-performance-channel-header]").getAttribute("aria-sort") === "ascending"');
+
+ expect($page->script($order))->toBe('@alpha,@bravo');
+ $page->assertNoJavaScriptErrors();
- $page = visit(route('app.insights'));
waitForInsightsParityTestId($page, 'analytics-performance-columns');
$headers = 'Array.from(document.querySelectorAll("[data-testid^=analytics-performance-column-]")).map((cell) => cell.dataset.testid.replace("analytics-performance-column-", "")).join(",")';
@@ -220,67 +284,7 @@ test('the performance columns picker changes the table and remembers the choice'
$page->assertScript($headers, 'posts,reactions,engagement_rate,views')
->assertNoJavaScriptErrors();
-});
-
-test('followers and posts charts show network logos and say how many channels are shown', function () {
- ['user' => $user, 'instagram' => $instagram] = insightsParitySetup();
- $this->actingAs($user);
-
- $page = visit(route('app.insights'));
- waitForInsightsParityTestId($page, 'accounts-unovis-bar-chart');
- waitForInsightsParityCondition($page, 'document.querySelectorAll("[data-testid=analytics-axis-channel]").length >= 4');
-
- $page->assertScript('document.querySelectorAll("[data-testid=analytics-axis-channel]").length', 4)
- ->assertScript('document.querySelector("[data-testid=analytics-followers-subtitle]")?.textContent.includes("Showing")', false);
-
- $page->navigate(route('app.insights', ['channels' => [$instagram->id]]));
- waitForInsightsParityTestId($page, 'analytics-followers-subtitle');
- waitForInsightsParityCondition($page, 'document.querySelectorAll("[data-testid=analytics-axis-channel]").length >= 2');
-
- $page->assertSeeIn('@analytics-followers-subtitle', 'Showing 1 of 2 channels. Filter by channel to see a different set.')
- ->assertSeeIn('@analytics-posts-subtitle', 'Showing 1 of 2 channels.')
- ->assertScript('document.querySelectorAll("[data-testid=analytics-axis-channel]").length', 2)
- ->assertScript('document.querySelector("[data-testid=analytics-axis-channel]").getAttribute("data-platform")', 'instagram')
- ->assertNoJavaScriptErrors();
-});
-
-test('performance and follower charts show each channel as avatar plus network badge', function () {
- ['user' => $user] = insightsParitySetup();
- $this->actingAs($user);
-
- $page = visit(route('app.insights'));
- waitForInsightsParityTestId($page, 'accounts-unovis-bar-chart');
- waitForInsightsParityCondition($page, 'document.querySelectorAll("[data-testid=analytics-axis-channel]").length >= 4');
-
- $page->assertScript('document.querySelectorAll("[data-testid=analytics-axis-channel] [data-slot=avatar] img").length', 2)
- ->assertScript('document.querySelectorAll("[data-testid=analytics-axis-channel] [data-slot=avatar] > div").length', 2)
- ->assertScript('[...document.querySelectorAll("[data-testid=analytics-axis-channel]")].every((channel) => channel.querySelectorAll("img").length >= 1)', true)
- ->assertScript('document.querySelectorAll("[data-testid=analytics-top-post-channel]").length >= 2', true)
- ->assertNoJavaScriptErrors();
-});
-
-test('a channel whose connection is lost shows the disconnected dot in the filter, the table and the charts', function () {
- ['user' => $user, 'facebook' => $facebook] = insightsParitySetup();
- $facebook->update(['status' => SocialAccountStatus::TokenExpired]);
- $this->actingAs($user);
-
- $page = visit(route('app.insights'));
- waitForInsightsParityTestId($page, 'analytics-channel-filter');
- waitForInsightsParityCondition($page, 'document.querySelectorAll("[data-testid=analytics-axis-channel] [data-testid^=channel-avatar-disconnected]").length >= 2');
-
- $page->assertScript('document.querySelectorAll("[data-testid=analytics-axis-channel] [data-testid^=channel-avatar-disconnected]").length', 2)
- ->assertScript("document.querySelectorAll('[data-testid=\"channel-avatar-disconnected-{$facebook->id}\"]').length >= 1", true)
- ->click('@analytics-channel-filter');
- waitForInsightsParityCondition($page, "document.querySelectorAll('[data-testid=\"channel-avatar-disconnected-{$facebook->id}\"]').length >= 2");
-
- $page->assertNoJavaScriptErrors();
-});
-
-test('clicking a top post opens its post details on the insights page', function () {
- ['user' => $user, 'post' => $post] = insightsParitySetup();
- $this->actingAs($user);
- $page = visit(route('app.insights'));
waitForInsightsParityTestId($page, 'analytics-top-post-link');
$path = $page->script('location.pathname');
@@ -292,31 +296,3 @@ test('clicking a top post opens its post details on the insights page', function
->assertSeeIn("@post-details-text-{$post->id}", 'Insights parity post alpha')
->assertNoJavaScriptErrors();
});
-
-test('performance columns sort ascending and descending, with the columns menu above the table', function () {
- ['user' => $user] = insightsParitySetup();
- $this->actingAs($user);
-
- $page = visit(route('app.insights'));
- waitForInsightsParityTestId($page, 'analytics-performance-sort-reactions');
-
- $order = 'Array.from(document.querySelectorAll("tbody th[scope=row]")).map((cell) => (cell.innerText.match(/@\\w+/) || [""])[0]).join(",")';
-
- $page->assertScript('document.querySelector("[data-testid=analytics-performance-columns]").closest("table") === null', true)
- ->click('@analytics-performance-sort-reactions');
- waitForInsightsParityCondition($page, 'document.querySelector("[data-testid=analytics-performance-column-reactions]").getAttribute("aria-sort") === "descending"');
- $descending = $page->script($order);
-
- $page->click('@analytics-performance-sort-reactions');
- waitForInsightsParityCondition($page, 'document.querySelector("[data-testid=analytics-performance-column-reactions]").getAttribute("aria-sort") === "ascending"');
- $ascending = $page->script($order);
-
- expect($descending)->toContain('@alpha')
- ->and($ascending)->toBe(implode(',', array_reverse(explode(',', $descending))));
-
- $page->click('@analytics-performance-sort-channel');
- waitForInsightsParityCondition($page, 'document.querySelector("[data-testid=analytics-performance-channel-header]").getAttribute("aria-sort") === "ascending"');
-
- expect($page->script($order))->toBe('@alpha,@bravo');
- $page->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/LabelFilterPopoverTest.php b/tests/Browser/LabelFilterPopoverTest.php
index 826ba1792..b033a7443 100644
--- a/tests/Browser/LabelFilterPopoverTest.php
+++ b/tests/Browser/LabelFilterPopoverTest.php
@@ -107,32 +107,3 @@ test('the label filter offers to create a label when the workspace has none', fu
$page->assertNoJavaScriptErrors();
});
-
-test('the label picker creates a label from its header and the composer selects it', function () {
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create(['account_id' => $user->account_id, 'user_id' => $user->id]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
- WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Campaign']);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.create'));
- waitForLabelPopoverTestId($page, 'composer-tags-trigger');
- $page->click('@composer-tags-trigger');
- waitForLabelPopoverTestId($page, 'composer-label-create');
-
- $page->assertSeeIn('[data-slot="popover-content"] h3', __('labels.title'))
- ->click('@composer-label-create');
- waitForLabelPopoverTestId($page, 'composer-label-new-name');
-
- $page->fill('@composer-label-new-name', 'Launch')
- ->click('@submit-composer-label-new');
- waitForLabelPopoverTestId($page, 'composer-label-create');
-
- $label = WorkspaceLabel::query()->where('workspace_id', $workspace->id)->where('name', 'Launch')->firstOrFail();
-
- $page->assertVisible("@composer-label-option-{$label->id}")
- ->assertScript("document.querySelector('[data-testid=\"composer-label-checkbox-{$label->id}\"]').getAttribute('data-state')", 'checked')
- ->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/LabelRowMenuTest.php b/tests/Browser/LabelRowMenuTest.php
index 38c0f3138..3010da415 100644
--- a/tests/Browser/LabelRowMenuTest.php
+++ b/tests/Browser/LabelRowMenuTest.php
@@ -75,7 +75,7 @@ test('the filtered posts page lands with the label selected', function () {
assertLabelFilterSelected(visit(route('app.posts.index', ['labels' => [$label->id]])), 'posts-label', $label->id);
});
-test('the labels page without labels shows the illustration and a create button', function () {
+test('the labels page without labels shows a centered illustration and a create button that is never cut off', function () {
[$user, $label] = labelMenuOwner();
$label->delete();
$this->actingAs($user);
@@ -87,37 +87,7 @@ test('the labels page without labels shows the illustration and a create button'
->assertMissing('@header-title')
->assertMissing('@create-label-button')
->assertMissing('@header-search-input')
- ->assertSeeIn('@labels-empty', __('labels.no_labels_yet'))
- ->click('@labels-empty-create');
- waitForLabelMenuTestId($page, 'create-label-sheet');
-
- $page->assertVisible('@create-label-sheet')->assertNoJavaScriptErrors();
-});
-
-test('a search without results keeps the header and search and shows the illustration', function () {
- [$user] = labelMenuOwner();
- $this->actingAs($user);
-
- $page = visit(route('app.labels.index', ['search' => 'nothing-matches']));
- waitForLabelMenuTestId($page, 'empty-state');
-
- $page->assertVisible('@header-title')
- ->assertVisible('@create-label-button')
- ->assertVisible('@header-search-input')
- ->assertSeeIn('@empty-state', __('labels.no_search_results'))
- ->assertMissing('@labels-empty')
- ->assertMissing('@settings-centered')
- ->assertVisible('@labels-empty-illustration')
- ->assertNoJavaScriptErrors();
-});
-
-test('the labels empty state sits in the middle of the page', function () {
- [$user, $label] = labelMenuOwner();
- $label->delete();
- $this->actingAs($user);
-
- $page = visit(route('app.labels.index'));
- waitForLabelMenuTestId($page, 'labels-empty');
+ ->assertSeeIn('@labels-empty', __('labels.no_labels_yet'));
expect($page->script(<<<'JS'
(() => {
@@ -130,38 +100,6 @@ test('the labels empty state sits in the middle of the page', function () {
})()
JS))->toBeTrue();
- $page->assertNoJavaScriptErrors();
-});
-
-test('a long labels list starts at the top and scrolls normally', function () {
- [$user, $label] = labelMenuOwner();
- WorkspaceLabel::factory()->count(30)->create(['workspace_id' => $label->workspace_id]);
- $this->actingAs($user);
-
- $page = visit(route('app.labels.index'));
- waitForLabelMenuTestId($page, "label-row-{$label->id}");
-
- expect($page->script(<<<'JS'
- (() => {
- const scroller = document.querySelector('[data-testid="app-layout-scroller"]');
- const header = document.querySelector('[data-testid="header-title"]').getBoundingClientRect();
- const top = header.top - scroller.getBoundingClientRect().top;
- const scrolls = scroller.scrollHeight > scroller.clientHeight;
- scroller.scrollTop = scroller.scrollHeight;
- return [document.querySelector('[data-testid="settings-centered"]') === null, top < 120, scrolls, scroller.scrollTop > 0];
- })()
- JS))->toBe([true, true, true, true]);
-
- $page->assertNoJavaScriptErrors();
-});
-
-test('the labels empty state is never cut off on a short screen', function () {
- [$user, $label] = labelMenuOwner();
- $label->delete();
- $this->actingAs($user);
-
- $page = visit(route('app.labels.index'));
- waitForLabelMenuTestId($page, 'labels-empty');
$page->resize(375, 480);
expect($page->script(<<<'JS'
@@ -176,15 +114,25 @@ test('the labels empty state is never cut off on a short screen', function () {
})()
JS))->toBe([true, true]);
- $page->assertNoJavaScriptErrors();
+ $page->click('@labels-empty-create');
+ waitForLabelMenuTestId($page, 'create-label-sheet');
+ $page->assertVisible('@create-label-sheet')->assertNoJavaScriptErrors();
});
-test('clearing a search without results never flashes the no labels state', function () {
+test('a search without results keeps the header and search, and clearing it never flashes the no labels state', function () {
[$user, $label] = labelMenuOwner();
$this->actingAs($user);
$page = visit(route('app.labels.index', ['search' => 'nothing-matches']));
- waitForLabelMenuTestId($page, 'header-search-input');
+ waitForLabelMenuTestId($page, 'empty-state');
+
+ $page->assertVisible('@header-title')
+ ->assertVisible('@create-label-button')
+ ->assertVisible('@header-search-input')
+ ->assertSeeIn('@empty-state', __('labels.no_search_results'))
+ ->assertMissing('@labels-empty')
+ ->assertMissing('@settings-centered')
+ ->assertVisible('@labels-empty-illustration');
$flashed = $page->script(<<<'JS'
(async () => {
@@ -208,6 +156,28 @@ test('clearing a search without results never flashes the no labels state', func
$page->assertVisible("@label-row-{$label->id}")->assertNoJavaScriptErrors();
});
+test('a long labels list starts at the top and scrolls normally', function () {
+ [$user, $label] = labelMenuOwner();
+ WorkspaceLabel::factory()->count(30)->create(['workspace_id' => $label->workspace_id]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.labels.index'));
+ waitForLabelMenuTestId($page, "label-row-{$label->id}");
+
+ expect($page->script(<<<'JS'
+ (() => {
+ const scroller = document.querySelector('[data-testid="app-layout-scroller"]');
+ const header = document.querySelector('[data-testid="header-title"]').getBoundingClientRect();
+ const top = header.top - scroller.getBoundingClientRect().top;
+ const scrolls = scroller.scrollHeight > scroller.clientHeight;
+ scroller.scrollTop = scroller.scrollHeight;
+ return [document.querySelector('[data-testid="settings-centered"]') === null, top < 120, scrolls, scroller.scrollTop > 0];
+ })()
+ JS))->toBe([true, true, true, true]);
+
+ $page->assertNoJavaScriptErrors();
+});
+
test('a label row shows its color, how many posts use it and its actions in one menu', function () {
[$user, $label] = labelMenuOwner();
$label->update(['color' => '#16a34a']);
diff --git a/tests/Browser/LinkCardPreviewTest.php b/tests/Browser/LinkCardPreviewTest.php
index 01845ee94..978eba943 100644
--- a/tests/Browser/LinkCardPreviewTest.php
+++ b/tests/Browser/LinkCardPreviewTest.php
@@ -6,7 +6,6 @@ use Amp\DeferredFuture;
use Amp\TimeoutCancellation;
use App\Enums\PostPlatform\ContentType;
use App\Enums\SocialAccount\Platform;
-use App\Enums\User\Locale;
use App\Jobs\Analytics\BootstrapAccountAnalytics;
use App\Jobs\Analytics\CollectAccountDailySnapshot;
use App\Models\Media;
@@ -142,8 +141,6 @@ test('facebook linkedin and mastodon previews render fetched link cards', functi
Http::assertSentCount(1);
})->with([
'Facebook' => Platform::Facebook,
- 'LinkedIn' => Platform::LinkedIn,
- 'Mastodon' => Platform::Mastodon,
]);
test('removing a url removes its visible card', function () {
@@ -298,8 +295,6 @@ test('the editor link card can be dropped and the post saves without it', functi
expect($post->postPlatforms()->sole()->meta)->toEqual(['link_preview' => false]);
})->with([
'Facebook' => Platform::Facebook,
- 'Bluesky' => Platform::Bluesky,
- 'LinkedIn' => Platform::LinkedIn,
]);
test('the threads link card cannot be dropped because threads always shows it', function () {
@@ -345,30 +340,6 @@ test('replacing the link card with media attaches the card image', function () {
->and(data_get($post->fresh()->media, '0.id'))->toBe($media->id);
});
-test('the replace link preview button stays on one line in every language', function () {
- $url = 'https://93.184.216.34/article';
- Http::fake([$url => Http::response('<meta property="og:title" content="Article card">')]);
- [$post, $account] = seedLinkCardPreviewPost(Platform::Facebook, "Read {$url}");
- $user = auth()->user();
-
- foreach (Locale::cases() as $locale) {
- $user->update(['locale' => $locale]);
- $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
- waitForLinkCardPreviewTestId($page, "composer-link-card-{$account->id}-replace");
-
- $wraps = $page->script(<<<JS
- (() => {
- const label = document.querySelector('[data-testid="composer-link-card-{$account->id}-replace"] [data-single-line]');
- const lineHeight = parseFloat(getComputedStyle(label).lineHeight) || 20;
- return label.getBoundingClientRect().height > lineHeight * 1.5;
- })()
- JS);
-
- expect($wraps)->toBeFalse("{$locale->value} wraps");
- $page->assertNoJavaScriptErrors();
- }
-});
-
test('the shared step editor shows no link card and the network card does', function () {
$url = 'https://93.184.216.34/article';
Http::fake([$url => Http::response('<meta property="og:title" content="Article card">')]);
diff --git a/tests/Browser/McpAuthorizeFitTest.php b/tests/Browser/McpAuthorizeFitTest.php
deleted file mode 100644
index 50a6b7063..000000000
--- a/tests/Browser/McpAuthorizeFitTest.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-use App\Enums\User\Locale;
-use App\Models\User;
-use App\Models\Workspace;
-use Illuminate\Support\Facades\DB;
-
-function waitForMcpAuthorizeTestId(mixed $page, string $testId): void
-{
- $page->script(<<<JS
- (async () => {
- for (let attempt = 0; attempt < 200; attempt++) {
- const element = document.querySelector('[data-testid="{$testId}"]');
- if (element && element.getBoundingClientRect().height > 0) return;
- await new Promise((resolve) => setTimeout(resolve, 50));
- }
- })();
- JS);
-}
-
-test('the mcp authorize buttons and workspace picker stay on one line in every language', function (int $width) {
- config(['trypost.self_hosted' => false]);
-
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create(['account_id' => $user->account_id, 'user_id' => $user->id]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
-
- $clientId = mcpOauthClient('Claude');
- DB::table('oauth_clients')->where('id', $clientId)->update(['redirect_uris' => json_encode(['https://client.example/callback'])]);
-
- $this->actingAs($user->fresh());
-
- $page = visit(route('passport.authorizations.authorize', oauthAuthorizeQuery($clientId)))->resize($width, 900);
- waitForMcpAuthorizeTestId($page, 'mcp-authorize-approve');
-
- $slots = [
- 'mcp-authorize-approve' => 'mcp.authorize.approve',
- 'mcp-authorize-cancel' => 'mcp.authorize.cancel',
- 'mcp-authorize-workspace' => 'mcp.authorize.select_workspace',
- ];
-
- $translations = collect($slots)->map(fn (string $key): array => collect(Locale::cases())
- ->mapWithKeys(fn (Locale $locale): array => [$locale->value => __($key, [], $locale->value)])
- ->all())->all();
-
- $json = json_encode($translations, JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $wrapped = $page->script(<<<JS
- (() => {
- const slots = {$json};
- const failures = [];
-
- for (const [testId, texts] of Object.entries(slots)) {
- const element = document.querySelector('[data-testid="' + testId + '"]');
- const label = element.querySelector('span') ?? element;
- const original = label.innerHTML;
- const height = element.getBoundingClientRect().height;
-
- for (const [locale, text] of Object.entries(texts)) {
- label.textContent = text;
- const fits = element.scrollWidth <= element.clientWidth + 1
- && element.getBoundingClientRect().height <= height + 1
- && document.documentElement.scrollWidth <= window.innerWidth;
- if (!fits) failures.push(testId + ' ' + locale + ': ' + text);
- }
-
- label.innerHTML = original;
- }
-
- return failures;
- })()
- JS);
-
- expect($wrapped)->toBe([]);
- $page->assertNoJavaScriptErrors();
-})->with(['phone' => 390, 'desktop' => 1280]);
diff --git a/tests/Browser/MediaEditorTest.php b/tests/Browser/MediaEditorTest.php
index 7f64b19d9..27d921203 100644
--- a/tests/Browser/MediaEditorTest.php
+++ b/tests/Browser/MediaEditorTest.php
@@ -100,14 +100,6 @@ function mediaEditorSegmentIds(mixed $page): array
return $page->script('Array.from(document.querySelectorAll(\'[data-testid="media-editor-segments"] button\')).map((segment) => segment.dataset.testid)');
}
-/**
- * @return list<string>
- */
-function mediaEditorPresetIds(mixed $page): array
-{
- return $page->script('Array.from(document.querySelectorAll(\'[data-testid^="crop-aspect-"]\')).map((preset) => preset.dataset.testid)');
-}
-
function clickMediaEditorStage(mixed $page, float $x, float $y): void
{
$page->script(<<<JS
@@ -215,120 +207,15 @@ test('alt text can be generated with AI for a post image', function () {
$page->assertNoJavaScriptErrors();
});
-test('a TikTok photo offers no segments and TikTok\'s presets in order', function () {
- [$post, $postPlatform] = seedMediaEditorPost(ContentType::TikTokPhoto);
- $page = visit(route('app.posts.edit', $post));
- openMediaEditor($page, $postPlatform);
-
- expect(mediaEditorPresetIds($page))->toBe([
- 'crop-aspect-freeform', 'crop-aspect-original', 'crop-aspect-4-3',
- 'crop-aspect-16-9', 'crop-aspect-9-16', 'crop-aspect-1-1',
- ]);
- $page->assertMissing('@media-editor-segments')
- ->assertMissing('@media-editor-edit-tab')
- ->assertNoJavaScriptErrors();
-});
-
-test('an X post offers Edit and Alt Text with X\'s presets in order', function () {
- [$post, $postPlatform] = seedMediaEditorPost(ContentType::XPost);
- $page = visit(route('app.posts.edit', $post));
- openMediaEditor($page, $postPlatform);
-
- expect(mediaEditorPresetIds($page))->toBe([
- 'crop-aspect-freeform', 'crop-aspect-original', 'crop-aspect-1-1',
- 'crop-aspect-4-3', 'crop-aspect-16-9', 'crop-aspect-2-1',
- ]);
- expect(mediaEditorSegmentIds($page))->toBe(['media-editor-edit-tab', 'media-editor-alt-tab']);
- $page->assertNoJavaScriptErrors();
-});
-
-test('each channel\'s editor shows that channel\'s presets', function () {
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create(['user_id' => $user->id, 'account_id' => $user->account_id]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
- $tiktok = SocialAccount::factory()->tiktok()->create(['workspace_id' => $workspace->id]);
- $x = SocialAccount::factory()->x()->create(['workspace_id' => $workspace->id]);
- $this->actingAs($user);
- $base64 = base64_encode((string) file_get_contents(base_path('tests/fixtures/crop-quadrants.png')));
-
- $page = visit(route('app.posts.create'));
- waitForMediaEditor($page, "document.querySelector('[data-testid=\"composer-add-account\"]')?.getBoundingClientRect().height > 0");
- $page->click('@composer-add-account')
- ->click("@composer-account-option-{$tiktok->id}")
- ->click("@composer-account-option-{$x->id}");
- waitForMediaEditor($page, "document.querySelector('[data-testid=\"composer-file-input\"]')");
- $page->script(<<<JS
- (() => {
- const bytes = Uint8Array.from(atob('{$base64}'), (character) => character.charCodeAt(0));
- const input = document.querySelector('[data-testid="composer-file-input"]');
- const transfer = new DataTransfer();
- transfer.items.add(new File([bytes], 'quadrants.png', { type: 'image/png' }));
- input.files = transfer.files;
- input.dispatchEvent(new Event('change', { bubbles: true }));
- })();
- JS);
- waitForMediaEditor($page, "document.querySelector('[data-testid=\"composer-media-item\"]')");
- $page->click('@composer-next');
-
- $page->click("@composer-account-{$tiktok->id}");
- $page->assertMissing("@composer-type-{$tiktok->id}-tiktok_photo");
- openMediaEditorPanel($page, $tiktok->id);
- expect(mediaEditorPresetIds($page))->toBe([
- 'crop-aspect-freeform', 'crop-aspect-original', 'crop-aspect-4-3',
- 'crop-aspect-16-9', 'crop-aspect-9-16', 'crop-aspect-1-1',
- ]);
- $page->assertMissing('@media-editor-segments')
- ->click('@media-editor-cancel');
- waitForMediaEditor($page, "!document.querySelector('[data-testid=\"media-editor\"]')");
-
- $page->click("@composer-account-{$x->id}");
- openMediaEditorPanel($page, $x->id);
- expect(mediaEditorPresetIds($page))->toBe([
- 'crop-aspect-freeform', 'crop-aspect-original', 'crop-aspect-1-1',
- 'crop-aspect-4-3', 'crop-aspect-16-9', 'crop-aspect-2-1',
- ]);
- $page->assertVisible('@media-editor-alt-tab')
- ->assertNoJavaScriptErrors();
-});
-
-test('an Instagram feed post offers Edit, Alt Text and Tag People with its presets', function () {
+test('an Instagram feed post offers Edit, Alt Text and Tag People', function () {
[$post, $postPlatform] = seedMediaEditorPost(ContentType::InstagramFeed);
$page = visit(route('app.posts.edit', $post));
openMediaEditor($page, $postPlatform);
- expect(mediaEditorPresetIds($page))->toBe([
- 'crop-aspect-freeform', 'crop-aspect-original', 'crop-aspect-3-4',
- 'crop-aspect-4-5', 'crop-aspect-1-1', 'crop-aspect-1-91-1',
- ]);
expect(mediaEditorSegmentIds($page))->toBe(['media-editor-edit-tab', 'media-editor-alt-tab', 'media-editor-tags-tab']);
$page->assertNoJavaScriptErrors();
});
-test('an Instagram story offers no tagging and only the vertical preset', function () {
- [$post, $postPlatform] = seedMediaEditorPost(ContentType::InstagramStory);
- $page = visit(route('app.posts.edit', $post));
- openMediaEditor($page, $postPlatform);
-
- expect(mediaEditorPresetIds($page))->toBe([
- 'crop-aspect-freeform', 'crop-aspect-original', 'crop-aspect-9-16',
- ]);
- $page->assertMissing('@media-editor-tags-tab')
- ->assertNoJavaScriptErrors();
-});
-
-test('a Pinterest pin offers its presets', function () {
- [$post, $postPlatform] = seedMediaEditorPost(ContentType::PinterestPin);
- $page = visit(route('app.posts.edit', $post));
- openMediaEditor($page, $postPlatform);
-
- expect(mediaEditorPresetIds($page))->toBe([
- 'crop-aspect-freeform', 'crop-aspect-original', 'crop-aspect-2-3', 'crop-aspect-1-1',
- ]);
- $page->assertNoJavaScriptErrors();
-});
-
test('center and reset only enable once the geometry changes', function () {
[$post, $postPlatform] = seedMediaEditorPost();
$page = visit(route('app.posts.edit', $post));
@@ -354,7 +241,7 @@ test('center and reset only enable once the geometry changes', function () {
$page->assertNoJavaScriptErrors();
});
-test('the stage only takes tags while tagging', function () {
+test('the stage only takes tags while tagging and switching tabs ends tagging mode', function () {
[$post, $postPlatform] = seedMediaEditorPost();
$page = visit(route('app.posts.edit', $post));
openMediaEditor($page, $postPlatform);
@@ -376,14 +263,7 @@ test('the stage only takes tags while tagging', function () {
$page->assertVisible('@media-editor-tag-form')
->click('@media-editor-tags-finish')
->assertMissing('@media-editor-tag-form')
- ->assertVisible('@media-editor-tags-start')
- ->assertNoJavaScriptErrors();
-});
-
-test('switching tabs ends tagging mode', function () {
- [$post, $postPlatform] = seedMediaEditorPost();
- $page = visit(route('app.posts.edit', $post));
- openMediaEditor($page, $postPlatform);
+ ->assertVisible('@media-editor-tags-start');
$page->click('@media-editor-tags-tab')
->click('@media-editor-tags-start')
@@ -958,7 +838,7 @@ test('the filter intensity reaches the saved pixels', function (int $intensity)
expect($red['red'])->toBeGreaterThan($red['green'] + 60)
->and($red['green'])->toBeGreaterThan(20);
-})->with([40, 100]);
+})->with([100]);
test('a crop with a filter on an image stored on another host is applied and saved', function () {
[$post, $postPlatform] = seedMediaEditorPost();
diff --git a/tests/Browser/MediaLightboxTest.php b/tests/Browser/MediaLightboxTest.php
index 170c32a28..68c6300ae 100644
--- a/tests/Browser/MediaLightboxTest.php
+++ b/tests/Browser/MediaLightboxTest.php
@@ -153,6 +153,15 @@ test('five images open at the clicked one and move with the buttons and arrow ke
$page->assertPresent("@post-thumbnail-more-{$post->id}")
->assertNotPresent("@post-thumbnail-{$post->id}-4");
+ $expandOpacity = "getComputedStyle(document.querySelector('[data-testid=\"post-thumbnail-expand-{$post->id}-1\"]')).opacity";
+
+ expect($page->script($expandOpacity))->toBe('0');
+
+ $page->hover("@post-thumbnail-{$post->id}-1");
+ waitForMediaLightboxCondition($page, "{$expandOpacity} === '1'");
+
+ expect($page->script($expandOpacity))->toBe('1');
+
$page->click("@post-thumbnail-{$post->id}-1");
waitForMediaLightboxTestId($page, 'media-lightbox-counter');
@@ -190,24 +199,12 @@ test('five images open at the clicked one and move with the buttons and arrow ke
expect(mediaLightboxCounter($page))->toBe('5 / 5')
->and(mediaLightboxImageLabel($page))->toBe('5');
- $page->assertNotPresent("@post-details-{$post->id}")
- ->assertNoJavaScriptErrors();
-});
-
-test('the thumbnail strip jumps to the clicked item and marks it active', function () {
- [$user, $post] = mediaLightboxSetup(array_map(mediaLightboxImage(...), range(1, 5)));
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index', ['tab' => 'sent']));
- waitForMediaLightboxTestId($page, "post-thumbnail-{$post->id}-0");
-
- $page->click("@post-thumbnail-{$post->id}-0");
- waitForMediaLightboxTestId($page, 'media-lightbox-thumbnails');
+ $page->assertNotPresent("@post-details-{$post->id}");
$active = "[...document.querySelectorAll('[data-testid^=\"media-lightbox-thumbnail-\"]')].map((thumb) => thumb.dataset.active)";
expect($page->script("document.querySelectorAll('[data-testid^=\"media-lightbox-thumbnail-\"]').length"))->toBe(5)
- ->and($page->script($active))->toBe(['true', 'false', 'false', 'false', 'false']);
+ ->and($page->script($active))->toBe(['false', 'false', 'false', 'false', 'true']);
$page->click('@media-lightbox-thumbnail-3');
waitForMediaLightboxCondition($page, "document.querySelector('[data-testid=\"media-lightbox-counter\"]').textContent.trim() === '4 / 5'");
@@ -235,7 +232,31 @@ test('the thumbnail strip jumps to the clicked item and marks it active', functi
JS);
expect($layout)->toBe(['imageAboveStrip' => true, 'zoomAboveStrip' => true, 'counterOnTop' => true, 'thumbSize' => 80]);
- $page->assertNoJavaScriptErrors();
+
+ $scale = "new DOMMatrix(getComputedStyle(document.querySelector('[data-testid=\"media-lightbox-image\"]')).transform).a";
+
+ expect($page->script($scale))->toEqual(1)
+ ->and($page->script("document.querySelector('[data-testid=\"media-lightbox-zoom-out\"]').disabled"))->toBeTrue();
+
+ $page->click('@media-lightbox-zoom-in');
+ $page->click('@media-lightbox-zoom-in');
+ waitForMediaLightboxCondition($page, "{$scale} === 2");
+
+ expect($page->script($scale))->toEqual(2);
+
+ $page->click('@media-lightbox-zoom-in');
+ $page->click('@media-lightbox-zoom-in');
+ waitForMediaLightboxCondition($page, "{$scale} === 3");
+
+ expect($page->script($scale))->toEqual(3)
+ ->and($page->script("document.querySelector('[data-testid=\"media-lightbox-zoom-in\"]').disabled"))->toBeTrue();
+
+ $page->click('@media-lightbox-zoom-out');
+ waitForMediaLightboxCondition($page, "{$scale} === 2.5");
+
+ expect($page->script($scale))->toEqual(2.5);
+ $page->assertVisible('@media-lightbox')
+ ->assertNoJavaScriptErrors();
});
test('a video plays in the lightbox', function () {
@@ -257,24 +278,6 @@ test('a video plays in the lightbox', function () {
->assertNoJavaScriptErrors();
});
-test('hovering a thumbnail shows the expand icon', function () {
- [$user, $post] = mediaLightboxSetup([mediaLightboxImage(1)]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index', ['tab' => 'sent']));
- waitForMediaLightboxTestId($page, "post-thumbnail-{$post->id}-0");
-
- $opacity = "getComputedStyle(document.querySelector('[data-testid=\"post-thumbnail-expand-{$post->id}-0\"]')).opacity";
-
- expect($page->script($opacity))->toBe('0');
-
- $page->hover("@post-thumbnail-{$post->id}-0");
- waitForMediaLightboxCondition($page, "{$opacity} === '1'");
-
- expect($page->script($opacity))->toBe('1');
- $page->assertNoJavaScriptErrors();
-});
-
test('the details dialog media strip opens the same lightbox', function () {
[$user, $post] = mediaLightboxSetup(array_map(mediaLightboxImage(...), range(1, 3)));
$this->actingAs($user);
@@ -295,39 +298,3 @@ test('the details dialog media strip opens the same lightbox', function () {
->assertVisible("@post-details-{$post->id}")
->assertNoJavaScriptErrors();
});
-
-test('the zoom buttons scale the image', function () {
- [$user, $post] = mediaLightboxSetup([mediaLightboxImage(1)]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index', ['tab' => 'sent']));
- waitForMediaLightboxTestId($page, "post-thumbnail-{$post->id}-0");
-
- $page->click("@post-thumbnail-{$post->id}-0");
- waitForMediaLightboxTestId($page, 'media-lightbox-image');
-
- $scale = "new DOMMatrix(getComputedStyle(document.querySelector('[data-testid=\"media-lightbox-image\"]')).transform).a";
-
- expect($page->script($scale))->toEqual(1)
- ->and($page->script("document.querySelector('[data-testid=\"media-lightbox-zoom-out\"]').disabled"))->toBeTrue();
-
- $page->click('@media-lightbox-zoom-in');
- $page->click('@media-lightbox-zoom-in');
- waitForMediaLightboxCondition($page, "{$scale} === 2");
-
- expect($page->script($scale))->toEqual(2);
-
- $page->click('@media-lightbox-zoom-in');
- $page->click('@media-lightbox-zoom-in');
- waitForMediaLightboxCondition($page, "{$scale} === 3");
-
- expect($page->script($scale))->toEqual(3)
- ->and($page->script("document.querySelector('[data-testid=\"media-lightbox-zoom-in\"]').disabled"))->toBeTrue();
-
- $page->click('@media-lightbox-zoom-out');
- waitForMediaLightboxCondition($page, "{$scale} === 2.5");
-
- expect($page->script($scale))->toEqual(2.5);
- $page->assertVisible('@media-lightbox')
- ->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/MemberAccessDialogTest.php b/tests/Browser/MemberAccessDialogTest.php
index 9977eb907..4e1d1086e 100644
--- a/tests/Browser/MemberAccessDialogTest.php
+++ b/tests/Browser/MemberAccessDialogTest.php
@@ -2,7 +2,6 @@
declare(strict_types=1);
-use App\Enums\User\Locale;
use App\Models\Invite;
use App\Models\User;
use App\Models\Workspace;
@@ -110,43 +109,3 @@ test('editing a member saves the publishing choice and labels the member', funct
$page->assertSeeIn("@member-badge-{$member->id}", 'Needs approval')
->assertNoJavaScriptErrors();
});
-
-test('the member access copy fits on one line in every locale', function () {
- [$owner] = memberAccessOwner();
- $wrapped = [];
-
- foreach (Locale::cases() as $locale) {
- $owner->update(['locale' => $locale]);
- $this->actingAs($owner->fresh());
-
- $page = visit(route('app.members'));
- waitForMemberAccessTestId($page, 'invite-member-button');
- $page->click('@invite-member-button');
- waitForMemberAccessTestId($page, 'member-access-publishing-trigger');
-
- $lines = $page->script(<<<'JS'
- ['member-access-admin-label', 'member-access-admin-description', 'member-access-publishing-label', 'member-access-publishing-trigger', 'invite-member-cancel', 'invite-member-submit']
- .map((testId) => {
- const element = document.querySelector(`[data-testid="${testId}"]`);
- const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
- let lineCount = 0;
- while (walker.nextNode()) {
- if (!walker.currentNode.textContent.trim()) continue;
- const range = document.createRange();
- range.selectNodeContents(walker.currentNode);
- const tops = new Set([...range.getClientRects()].filter((rect) => rect.width > 0).map((rect) => Math.round(rect.top)));
- lineCount = Math.max(lineCount, tops.size);
- }
- return [element.textContent.trim(), lineCount];
- })
- .filter(([, lineCount]) => lineCount > 1)
- .map(([text]) => text)
- JS);
-
- foreach ($lines as $text) {
- $wrapped[] = "{$locale->value}: {$text}";
- }
- }
-
- expect($wrapped)->toBe([]);
-});
diff --git a/tests/Browser/MobileEditorTest.php b/tests/Browser/MobileEditorTest.php
deleted file mode 100644
index ac74ed9be..000000000
--- a/tests/Browser/MobileEditorTest.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-use App\Models\Post;
-use App\Models\PostNote;
-use App\Models\User;
-use App\Models\Workspace;
-
-/**
- * Seed an authenticated user whose current workspace holds a fresh draft post,
- * and act as them. Returns the post so each test can drive its editor.
- */
-function seedMobileEditorPost(array $postAttributes = []): Post
-{
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create(['user_id' => $user->id]);
- $workspace->members()->attach($user->id, membershipPivot('member'));
- $user->update(['current_workspace_id' => $workspace->id]);
-
- $post = Post::factory()->create(array_merge([
- 'workspace_id' => $workspace->id,
- 'user_id' => $user->id,
- 'content' => 'hello from mobile',
- ], $postAttributes));
-
- test()->actingAs($user);
-
- return $post;
-}
-
-/**
- * Poll browser-side until the testid element has laid out (width/height > 0).
- * These Pest browser assertions do not auto-wait, so settle async UI first.
- */
-function waitForTestId(mixed $page, string $testId): void
-{
- $page->script(<<<JS
- (async () => {
- const sel = '[data-testid="{$testId}"]';
- for (let i = 0; i < 100; i++) {
- const el = document.querySelector(sel);
- if (el && el.getBoundingClientRect().height > 0) return;
- await new Promise((r) => setTimeout(r, 50));
- }
- })();
- JS);
-}
-
-test('post notes are accessible on a phone after the post exists', function () {
- $post = seedMobileEditorPost();
- PostNote::factory()->create([
- 'post_id' => $post->id,
- 'user_id' => $post->user_id,
- 'body' => 'a note on the go',
- ]);
-
- $page = visit(route('app.posts.index', ['tab' => 'drafts']))->resize(375, 812);
-
- $page->click("@post-notes-trigger-{$post->id}");
- waitForTestId($page, 'note-actions');
- $page->assertVisible('@note-actions');
-});
diff --git a/tests/Browser/MobileOverflowTest.php b/tests/Browser/MobileOverflowTest.php
index b85fa0db5..e3200a37f 100644
--- a/tests/Browser/MobileOverflowTest.php
+++ b/tests/Browser/MobileOverflowTest.php
@@ -68,7 +68,6 @@ test('key pages do not overflow horizontally on a phone', function () {
'workspaces (AuthLayout)' => route('app.workspaces.index'),
'posts index (default)' => route('app.posts.index'),
'post editor (full-width)' => route('app.posts.edit', $post),
- 'calendar (full-width)' => route('app.calendar'),
'settings (tabs)' => route('app.api-keys.index'),
];
diff --git a/tests/Browser/NetworkOptionsLocaleTest.php b/tests/Browser/NetworkOptionsLocaleTest.php
deleted file mode 100644
index bdee89838..000000000
--- a/tests/Browser/NetworkOptionsLocaleTest.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-use App\Enums\PostPlatform\ContentType;
-use App\Enums\SocialAccount\Platform;
-use App\Enums\User\Locale;
-use App\Models\Post;
-use App\Models\PostPlatform;
-use App\Models\SocialAccount;
-use App\Models\User;
-use App\Models\Workspace;
-use Illuminate\Support\Facades\Http;
-
-function waitForNetworkOptionsTestId(mixed $page, string $testId): void
-{
- $page->script(<<<JS
- (async () => {
- for (let i = 0; i < 100; i++) {
- if (document.querySelector('[data-testid="{$testId}"]')?.getBoundingClientRect().height > 0) return;
- await new Promise((resolve) => setTimeout(resolve, 50));
- }
- })();
- JS);
-
- waitForWebFonts($page);
-}
-
-test('network card labels stay on one line in every language', function (Platform $platform, ContentType $contentType, string $readyTestId, array $meta) {
- Http::fake(['*' => Http::response([], 200)]);
-
- foreach (Locale::cases() as $locale) {
- $user = User::factory()->create(['locale' => $locale]);
- $workspace = Workspace::factory()->create(['user_id' => $user->id]);
- $workspace->members()->attach($user->id, membershipPivot('member'));
- $user->update(['current_workspace_id' => $workspace->id]);
- $account = SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => $platform, 'token_expires_at' => now()->addDays(20)]);
- $post = Post::factory()->create(['workspace_id' => $workspace->id, 'user_id' => $user->id, 'content' => 'Options']);
- PostPlatform::factory()->create(['post_id' => $post->id, 'social_account_id' => $account->id, 'platform' => $platform, 'content_type' => $contentType, 'meta' => $meta]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
- waitForNetworkOptionsTestId($page, $readyTestId);
- expect($page->script("document.querySelectorAll('[data-single-line]').length"))->toBeGreaterThan(0);
-
- $wrapped = $page->script(<<<'JS'
- [...document.querySelectorAll('[data-single-line]')]
- .filter((el) => {
- const lineHeight = parseFloat(getComputedStyle(el).lineHeight) || 20;
- return el.getBoundingClientRect().height > lineHeight * 1.5;
- })
- .map((el) => el.textContent.trim())
- JS);
-
- expect($wrapped)->toBe([], "{$locale->value} wraps: ".implode(', ', (array) $wrapped));
- $page->assertNoJavaScriptErrors();
- }
-})->with([
- 'instagram types' => [Platform::Instagram, ContentType::InstagramFeed, 'composer-customization', []],
- 'facebook types' => [Platform::Facebook, ContentType::FacebookPost, 'composer-customization', []],
- 'google business types' => [Platform::GoogleBusiness, ContentType::GoogleBusinessPost, 'google-business-topic-STANDARD', []],
- 'google business offer' => [Platform::GoogleBusiness, ContentType::GoogleBusinessPost, 'google-business-add-details', ['topic_type' => 'OFFER']],
- 'google business event' => [Platform::GoogleBusiness, ContentType::GoogleBusinessPost, 'google-business-start-time', ['topic_type' => 'EVENT', 'event' => ['start_time' => '09:00']]],
- 'instagram reel' => [Platform::Instagram, ContentType::InstagramReel, 'instagram-share-to-feed', []],
- 'youtube' => [Platform::YouTube, ContentType::YouTubeShort, 'youtube-title', []],
- 'mastodon' => [Platform::Mastodon, ContentType::MastodonPost, 'mastodon-content-warning', []],
- 'threads' => [Platform::Threads, ContentType::ThreadsPost, 'threads-topic-tag', []],
-]);
diff --git a/tests/Browser/PostApprovalsTest.php b/tests/Browser/PostApprovalsTest.php
index c00054b7f..3a8109cf4 100644
--- a/tests/Browser/PostApprovalsTest.php
+++ b/tests/Browser/PostApprovalsTest.php
@@ -5,7 +5,6 @@ declare(strict_types=1);
use App\Actions\Post\CreatePosts;
use App\Enums\Post\Status as PostStatus;
use App\Enums\PostPlatform\ContentType;
-use App\Enums\User\Locale;
use App\Enums\User\TimeFormat;
use App\Jobs\PublishPost;
use App\Models\Post;
@@ -41,34 +40,6 @@ function waitForApprovalsGone(mixed $page, string $testId): void
JS);
}
-/**
- * Labels of the card footer actions that wrap onto a second line or spill
- * past the card, for every card on the page.
- *
- * @return list<string>
- */
-function approvalsFooterProblems(mixed $page): array
-{
- return $page->script(<<<'JS'
- [...document.querySelectorAll('[data-testid^="post-actions-"]')].flatMap((actions) => {
- const card = actions.closest('[data-testid^="post-card-"]').getBoundingClientRect();
- const problems = [];
- if (actions.getBoundingClientRect().right > card.right + 1) problems.push(`overflow: ${actions.textContent.trim()}`);
- actions.querySelectorAll('button, a').forEach((control) => {
- const walker = document.createTreeWalker(control, NodeFilter.SHOW_TEXT);
- while (walker.nextNode()) {
- if (!walker.currentNode.textContent.trim()) continue;
- const range = document.createRange();
- range.selectNodeContents(walker.currentNode);
- const tops = new Set([...range.getClientRects()].filter((rect) => rect.width > 0).map((rect) => Math.round(rect.top)));
- if (tops.size > 1) problems.push(`wrap: ${control.textContent.trim()}`);
- }
- });
- return problems;
- })
- JS);
-}
-
/**
* @return array{0: User, 1: Workspace, 2: SocialAccount, 3: User}
*/
@@ -210,40 +181,6 @@ test('a requester adding a draft to the queue is told it awaits approval', funct
expect($draft->fresh()->status)->toBe(PostStatus::PendingApproval);
});
-test('the approval card footer does not wrap or overflow in any language', function () {
- [$owner, $workspace, $channel, $requester] = approvalsBrowserSetup();
- $queued = approvalsBrowserRequest($workspace, $requester, $channel);
- approvalsBrowserRequest($workspace, $requester, $channel, [
- 'queue' => null,
- 'scheduled_at' => now()->addDay()->startOfHour()->toIso8601String(),
- ]);
-
- $problems = [];
-
- foreach ([$owner, $requester] as $user) {
- foreach (Locale::cases() as $locale) {
- $user->update(['locale' => $locale]);
- $this->actingAs($user->fresh());
-
- $page = visit(route('app.posts.index', ['tab' => 'approvals']))->resize(1440, 900);
- waitForApprovalsTestId($page, "post-actions-{$queued->id}");
-
- foreach (approvalsFooterProblems($page) as $problem) {
- $problems[] = "{$user->name} {$locale->value} desktop {$problem}";
- }
-
- $page->resize(390, 844);
- waitForApprovalsTestId($page, "post-actions-{$queued->id}");
-
- foreach (approvalsFooterProblems($page) as $problem) {
- $problems[] = "{$user->name} {$locale->value} phone {$problem}";
- }
- }
- }
-
- expect($problems)->toBe([]);
-});
-
test('a new time for a late request is typed in the channel zone', function () {
[$owner, $workspace, $channel, $requester] = approvalsBrowserSetup();
$owner->update(['timezone' => 'Asia/Tokyo', 'time_format' => TimeFormat::TwentyFourHour]);
diff --git a/tests/Browser/PostCardLabelsTest.php b/tests/Browser/PostCardLabelsTest.php
index e2a9b9ef9..cba0fe6f1 100644
--- a/tests/Browser/PostCardLabelsTest.php
+++ b/tests/Browser/PostCardLabelsTest.php
@@ -5,7 +5,6 @@ declare(strict_types=1);
use App\Actions\Post\CreatePosts;
use App\Enums\PostPlatform\ContentType;
use App\Models\Post;
-use App\Models\PostPlatform;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
@@ -178,34 +177,6 @@ test('a draft card clears every label with clear all', function () {
->assertNoJavaScriptErrors();
});
-test('a sent card accepts labels', function () {
- [$user, $workspace, $channel] = cardLabelsSetup();
- $label = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Campaign']);
- $published = Post::factory()->published()->create([
- 'workspace_id' => $workspace->id,
- 'user_id' => $user->id,
- 'published_at' => now()->subHour(),
- ]);
- PostPlatform::factory()->published()->create([
- 'post_id' => $published->id,
- 'social_account_id' => $channel->id,
- 'platform' => $channel->platform,
- 'enabled' => true,
- ]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index', ['tab' => 'sent']));
- openCardLabelsPicker($page, $published->id);
-
- $page->click("@post-labels-{$published->id}-checkbox-{$label->id}");
- waitForCardLabelsTestId($page, "post-label-chip-{$published->id}-{$label->id}");
- waitForCardLabelsStored($page, $published, [$label->id]);
-
- expect($published->labels()->pluck('workspace_labels.id')->all())->toBe([$label->id]);
- $page->assertVisible("@post-label-chip-{$published->id}-{$label->id}")
- ->assertNoJavaScriptErrors();
-});
-
test('the label filter drops a card once its label is removed', function () {
[$user, $workspace, $channel] = cardLabelsSetup();
$label = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Campaign']);
@@ -232,21 +203,6 @@ test('the label filter drops a card once its label is removed', function () {
->assertNoJavaScriptErrors();
});
-test('a member who needs approval can edit the labels on a card', function () {
- [$requester, $workspace, $channel] = cardLabelsSetup('approval');
- $label = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Campaign']);
- $owner = User::query()->findOrFail($workspace->user_id);
- $tagged = cardLabelsPost($owner, $workspace, $channel, ['label_ids' => [$label->id]]);
- $this->actingAs($requester);
-
- $page = visit(route('app.posts.index'));
- waitForCardLabelsTestId($page, "post-label-chip-{$tagged->id}-{$label->id}");
-
- $page->assertVisible("@post-label-chip-{$tagged->id}-{$label->id}")
- ->assertVisible("@post-labels-{$tagged->id}-trigger")
- ->assertNoJavaScriptErrors();
-});
-
test('a rejected change rolls the card back and shows an error', function () {
[$user, $workspace, $channel] = cardLabelsSetup();
$label = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Campaign']);
diff --git a/tests/Browser/PostComposerDialogTest.php b/tests/Browser/PostComposerDialogTest.php
index cd4eb2c52..95e4bd345 100644
--- a/tests/Browser/PostComposerDialogTest.php
+++ b/tests/Browser/PostComposerDialogTest.php
@@ -6,7 +6,6 @@ use App\Dto\MediaItem;
use App\Enums\Post\Status as PostStatus;
use App\Enums\PostPlatform\ContentType;
use App\Enums\SocialAccount\Platform;
-use App\Enums\User\Locale;
use App\Models\Media;
use App\Models\Post;
use App\Models\PostNote;
@@ -23,6 +22,18 @@ use Illuminate\Support\Facades\Storage;
* animation settles is swallowed. Poll from the page (never sleep()) until the
* dialog is open and still.
*/
+function waitForComposerCondition(mixed $page, string $condition): void
+{
+ $page->script(<<<JS
+ (async () => {
+ for (let attempt = 0; attempt < 300; attempt++) {
+ if ({$condition}) return;
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ }
+ })();
+ JS);
+}
+
function waitForComposerReady(mixed $page, string $testId = 'composer-add-account'): void
{
$page->script(<<<JS
@@ -117,9 +128,15 @@ test('posts channel filter keeps accounts distinct and persists across tabs', fu
PostPlatform::factory()->instagram()->create(['post_id' => $secondPost->id, 'social_account_id' => $secondInstagram->id]);
$this->actingAs($user);
- visit(route('app.posts.index', ['tab' => 'drafts']))
- ->click('@posts-channel-filter')
- ->fill('@posts-channel-search', 'first_channel')
+ $page = visit(route('app.posts.index', ['tab' => 'drafts']));
+ waitForComposerCondition($page, "document.querySelector('[data-testid=\"post-card-{$firstPost->id}\"]')?.getBoundingClientRect().height > 0");
+
+ for ($attempt = 0; $attempt < 3 && ! $page->script("document.querySelector('[data-testid=\"posts-channel-search\"]')?.getBoundingClientRect().height > 0"); $attempt++) {
+ $page->click('@posts-channel-filter');
+ waitForComposerCondition($page, "document.querySelector('[data-testid=\"posts-channel-search\"]')?.getBoundingClientRect().height > 0");
+ }
+
+ $page->fill('@posts-channel-search', 'first_channel')
->assertVisible("@posts-channel-option-{$firstInstagram->id}")
->assertMissing("@posts-channel-option-{$secondInstagram->id}")
->click("@posts-channel-checkbox-{$firstInstagram->id}")
@@ -468,18 +485,22 @@ test('composer searches and selects multiple labels and exposes emoji and signat
->assertAttribute("@composer-label-checkbox-{$firstLabel->id}", 'data-state', 'checked')
->assertAttribute("@composer-label-checkbox-{$secondLabel->id}", 'data-state', 'checked');
- $page->click('@composer-tags-trigger')
- ->click('@composer-base-emoji')
- ->click('button[aria-label="grinning face"]')
+ $page->click('@composer-tags-trigger');
+ waitForComposerCondition($page, "!document.querySelector('[data-testid=\"composer-label-search\"]')");
+ $page->click('@composer-base-emoji');
+ waitForComposerCondition($page, "document.querySelector('button[aria-label=\"grinning face\"]')?.getBoundingClientRect().height > 0");
+ $page->click('button[aria-label="grinning face"]')
->assertValue('@composer-base-content', '😀')
->click('@composer-base-signature')
->click('text=Campaign signature')
->assertValue('@composer-base-content', "😀\n\n#campaign")
->click('@composer-add-account')
->click("@composer-account-option-{$account->id}")
- ->assertVisible("@composer-{$account->id}-toolbar")
- ->click("@composer-{$account->id}-emoji")
- ->click('button[aria-label="grinning face with big eyes"]')
+ ->assertVisible("@composer-{$account->id}-toolbar");
+ waitForComposerCondition($page, "!document.querySelector('[data-testid=\"composer-account-option-{$account->id}\"]')");
+ $page->click("@composer-{$account->id}-emoji");
+ waitForComposerCondition($page, "document.querySelector('button[aria-label=\"grinning face with big eyes\"]')?.getBoundingClientRect().height > 0");
+ $page->click('button[aria-label="grinning face with big eyes"]')
->assertValue("@composer-caption-{$account->id}", "😀\n\n#campaign😃")
->click('@composer-save-draft');
@@ -1341,57 +1362,6 @@ test('the composer asks to connect a channel when the workspace has none', funct
$page->assertVisible('@connect-channel-dialog')->assertNoJavaScriptErrors();
});
-test('the schedule picker footer keeps both actions on one line in every language', function () {
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create([
- 'user_id' => $user->id,
- 'account_id' => $user->account_id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
- $account = SocialAccount::factory()->linkedin()->create(['workspace_id' => $workspace->id]);
- $this->actingAs($user);
-
- $translations = collect(Locale::cases())
- ->mapWithKeys(fn (Locale $locale): array => [$locale->value => [
- 'more' => __('posts.composer.schedule_picker.more_actions', [], $locale->value),
- 'done' => __('posts.composer.schedule_picker.done', [], $locale->value),
- ]])
- ->all();
- $json = json_encode($translations, JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $page = visit(route('app.posts.create'));
- waitForComposerReady($page);
- $page->click('@composer-add-account')
- ->click("@composer-account-option-{$account->id}")
- ->click('@composer-schedule-trigger')
- ->click('@composer-schedule-custom')
- ->assertVisible('@composer-schedule-more-actions');
-
- $wrapped = $page->script(<<<JS
- (() => {
- const translations = {$json};
- const more = document.querySelector('[data-testid="composer-schedule-more-actions"]');
- const done = document.querySelector('[data-testid="composer-schedule-done"]');
- const moreText = [...more.childNodes].find((node) => node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== '');
- const doneText = [...done.childNodes].find((node) => node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== '');
- const singleLine = more.getBoundingClientRect().height;
- return Object.entries(translations)
- .filter(([, text]) => {
- moreText.textContent = text.more;
- doneText.textContent = text.done;
- const footer = more.parentElement.getBoundingClientRect();
- const needed = (more.scrollWidth + done.scrollWidth + 8) * 1.04 + 16;
- return more.getBoundingClientRect().height > singleLine || needed > footer.width;
- })
- .map(([locale, text]) => locale + ': ' + text.more + ' / ' + text.done);
- })()
- JS);
-
- expect($wrapped)->toBe([]);
-});
-
test('the composer is wide enough for the preview on a desktop screen', function (int $width, int $dialog) {
$user = User::factory()->create();
$workspace = Workspace::factory()->create(['user_id' => $user->id, 'account_id' => $user->account_id]);
diff --git a/tests/Browser/PostDetailsDialogTest.php b/tests/Browser/PostDetailsDialogTest.php
index f0588c13d..a15644484 100644
--- a/tests/Browser/PostDetailsDialogTest.php
+++ b/tests/Browser/PostDetailsDialogTest.php
@@ -182,7 +182,6 @@ test('the details media sits below the text in a single scrollable row', functio
]);
$page->assertNoJavaScriptErrors();
})->with([
- 'four images' => [4, false],
'eight images' => [8, true],
]);
@@ -254,16 +253,7 @@ test('the details metrics follow the order of the post content type and network'
->toBe($expected);
$page->assertNoJavaScriptErrors();
})->with([
- 'instagram story' => [Platform::Instagram, PublicationContentType::Story, ['views', 'reach', 'replies', 'engagement_rate', 'reactions']],
- 'instagram carousel' => [Platform::Instagram, PublicationContentType::Carousel, ['reactions', 'comments', 'engagement_rate', 'views', 'shares', 'saves', 'follows', 'reach']],
'instagram reel' => [Platform::Instagram, PublicationContentType::Reel, ['reactions', 'comments', 'engagement_rate', 'views', 'shares', 'saves', 'watch_time_milliseconds', 'average_watch_time_milliseconds', 'reach']],
- 'x text' => [Platform::X, PublicationContentType::Text, ['reactions', 'comments', 'engagement_rate', 'impressions', 'shares', 'quotes', 'bookmarks']],
- 'facebook image' => [Platform::Facebook, PublicationContentType::Image, ['reactions', 'comments', 'engagement_rate', 'impressions', 'shares']],
- 'threads text' => [Platform::Threads, PublicationContentType::Text, ['reactions', 'comments', 'engagement_rate', 'views', 'quotes', 'shares']],
- 'mastodon text' => [Platform::Mastodon, PublicationContentType::Text, ['reactions', 'comments', 'shares']],
- 'pinterest image' => [Platform::Pinterest, PublicationContentType::Image, ['saves', 'comments', 'engagement_rate', 'impressions', 'reactions']],
- 'youtube short' => [Platform::YouTube, PublicationContentType::Short, ['reactions', 'comments', 'engagement_rate', 'views', 'shares', 'saves', 'watch_time_milliseconds', 'average_watch_time_milliseconds']],
- 'tiktok video' => [Platform::TikTok, PublicationContentType::Video, ['reactions', 'comments', 'engagement_rate', 'views', 'shares', 'reach', 'watch_time_milliseconds', 'average_watch_time_milliseconds']],
]);
function postDetailsDialogMetricsBandState(mixed $page, string $band): array
@@ -321,7 +311,10 @@ test('the metrics band arrows follow the real overflow when the metrics change w
expect(postDetailsDialogMetricsBandState($page, $band))->toBe(['overflows' => true, 'next' => true, 'fadeNext' => true]);
$page->assertNoJavaScriptErrors();
-})->with(['dialog', 'card'])->with([1280, 1440, 1920]);
+})->with([
+ 'dialog' => ['dialog', 1280],
+ 'card' => ['card', 1920],
+]);
test('a publishing post shows a spinning status in its details', function () {
[$user, $account] = postDetailsDialogSetup();
diff --git a/tests/Browser/PreferencesPageTest.php b/tests/Browser/PreferencesPageTest.php
index 7308165f1..dba9eb1ae 100644
--- a/tests/Browser/PreferencesPageTest.php
+++ b/tests/Browser/PreferencesPageTest.php
@@ -2,11 +2,9 @@
declare(strict_types=1);
-use App\Enums\User\DefaultPostAction;
use App\Enums\User\Locale;
use App\Enums\User\Theme;
use App\Enums\User\TimeFormat;
-use App\Enums\User\WeekStart;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
@@ -93,44 +91,40 @@ test('the system theme follows the operating system', function () {
->assertNoJavaScriptErrors();
});
-test('the language changes in place and stays the user locale', function () {
+test('the language picker suggests the browser language, filters as you type and changes the language in place', function () {
$user = preferencesUser(['locale' => Locale::English]);
$this->actingAs($user);
+ $toastAppears = "(async () => { for (let i = 0; i < 20; i++) { if (document.querySelector('[data-sonner-toast]')) return true; await new Promise((r) => setTimeout(r, 50)); } return false; })();";
- $page = visit(route('app.settings.preferences'));
- choosePreference($page, 'preferences-language', 'pt-BR', 'locale');
+ $page = visit(route('app.settings.preferences'))->withLocale('pt-PT');
+ waitForPreferencesTestId($page, 'preferences-language-trigger');
- $title = __('settings.preferences.title', [], 'pt-BR');
- $page->script("(async () => { for (let i = 0; i < 150; i++) { if (document.body.innerText.includes('{$title}')) return; await new Promise((r) => setTimeout(r, 50)); } })();");
+ $page->click('@preferences-language-trigger');
+ waitForPreferencesTestId($page, 'preferences-language-suggestions');
- $page->assertSeeIn('@header-title', $title)->assertNoJavaScriptErrors();
- expect($user->fresh()->locale)->toBe(Locale::PortugueseBrazil);
-});
+ $page->assertVisible('[data-testid="preferences-language-suggestions"] [data-testid="preferences-language-option-pt-BR"]')
+ ->assertVisible('@preferences-language-detected')
+ ->assertSeeIn('@preferences-language-suggestions', __('settings.preferences.language.suggestions'));
-test('the language picker filters languages as you type', function () {
- $this->actingAs(preferencesUser(['locale' => Locale::English]));
+ expect($page->script("document.querySelectorAll('[data-testid=\"preferences-language-option-pt-BR\"]').length"))->toBe(1);
- $page = visit(route('app.settings.preferences'));
- waitForPreferencesTestId($page, 'preferences-language-trigger');
- $page->click('@preferences-language-trigger');
- waitForPreferencesTestId($page, 'preferences-language-search');
- $page->type('@preferences-language-search', 'Portug');
- waitForPreferencesTestId($page, 'preferences-language-option-pt-BR');
+ $page->fill('@preferences-language-search', 'Deutsch');
+ $page->assertMissing('@preferences-language-suggestions')
+ ->assertVisible('@preferences-language-option-de');
+ $page->fill('@preferences-language-search', 'Portug');
+ waitForPreferencesTestId($page, 'preferences-language-option-pt-BR');
$page->assertVisible('@preferences-language-option-pt-BR')
->assertMissing('@preferences-language-option-de')
- ->assertNoJavaScriptErrors();
-});
-
-test('the time zone picker suggests the browser time zone first', function () {
- $this->actingAs(preferencesUser());
+ ->click('@preferences-language-option-pt-BR');
+ waitForPreferencesTestId($page, 'preferences-saved-locale');
- $page = visit(route('app.settings.preferences'));
- waitForPreferencesTestId($page, 'preferences-timezone-trigger');
- $page->click('@preferences-timezone-trigger');
- waitForPreferencesTestId($page, 'preferences-timezone-detected');
+ $title = __('settings.preferences.title', [], 'pt-BR');
+ $page->script("(async () => { for (let i = 0; i < 150; i++) { if (document.body.innerText.includes('{$title}')) return; await new Promise((r) => setTimeout(r, 50)); } })();");
- $page->assertVisible('@preferences-timezone-detected')->assertNoJavaScriptErrors();
+ expect($page->script($toastAppears))->toBeFalse();
+ $page->assertSeeIn('@header-title', $title)->assertNoJavaScriptErrors();
+ expect($user->fresh()->locale)->toBe(Locale::PortugueseBrazil);
});
test('a zone that is the user, browser and channel zone is suggested once with every reason', function () {
@@ -193,8 +187,9 @@ test('a zone that is the user, browser and channel zone is suggested once with e
$page->assertNoJavaScriptErrors();
});
-test('without channels the picker shows no empty group and search filters both groups', function () {
- $this->actingAs(preferencesUser(['timezone' => 'UTC']));
+test('without channels the picker shows no empty group, search filters both groups and picking a zone saves it', function () {
+ $user = preferencesUser(['timezone' => 'UTC']);
+ $this->actingAs($user);
$page = visit(route('app.settings.preferences'))->withTimezone('UTC');
waitForPreferencesTestId($page, 'preferences-timezone-trigger');
@@ -209,53 +204,29 @@ test('without channels the picker shows no empty group and search filters both g
$page->assertMissing('@preferences-timezone-suggestions')
->assertMissing('@preferences-timezone-option-UTC')
- ->assertNoJavaScriptErrors();
-});
-
-test('a 12-hour clock shows meridiem hours on the calendar', function () {
- $user = preferencesUser(['locale' => Locale::German, 'time_format' => TimeFormat::TwentyFourHour]);
- $this->actingAs($user);
-
- $page = visit(route('app.settings.preferences'));
- choosePreference($page, 'preferences-time-format', '12h', 'time_format');
- expect($user->fresh()->time_format)->toBe(TimeFormat::TwelveHour);
-
- $page = visit(route('app.calendar', ['view' => 'week']));
- waitForPreferencesTestId($page, 'calendar-slot-'.now()->startOfWeek()->format('Y-m-d').'-14');
+ ->click('@preferences-timezone-option-Pacific-Auckland');
+ waitForPreferencesTestId($page, 'preferences-saved-timezone');
- $page->assertScript("document.body.innerText.includes('2 PM')", true)
- ->assertNoJavaScriptErrors();
-});
-
-test('the week start and default posting action save', function () {
- $user = preferencesUser();
- $this->actingAs($user);
-
- $page = visit(route('app.settings.preferences'));
- choosePreference($page, 'preferences-week-start', 'sunday', 'week_starts_on');
- choosePreference($page, 'preferences-default-post-action', 'custom', 'default_post_action');
-
- $user->refresh();
- expect($user->week_starts_on)->toBe(WeekStart::Sunday)
- ->and($user->default_post_action)->toBe(DefaultPostAction::Custom);
-
- $page = visit(route('app.calendar', ['view' => 'month']));
- waitForPreferencesTestId($page, 'calendar-month-grid');
$page->assertNoJavaScriptErrors();
+ expect($user->fresh()->timezone)->toBe('Pacific/Auckland');
});
-test('the time format offers only two clocks and keeps its value after a language change', function () {
- $user = preferencesUser(['locale' => Locale::English, 'time_format' => TimeFormat::TwelveHour]);
+test('the time format offers two clocks, keeps its value after a language change and shows meridiem hours on the calendar', function () {
+ $user = preferencesUser(['locale' => Locale::English, 'time_format' => TimeFormat::TwentyFourHour]);
$this->actingAs($user);
+ $toastAppears = "(async () => { for (let i = 0; i < 20; i++) { if (document.querySelector('[data-sonner-toast]')) return true; await new Promise((r) => setTimeout(r, 50)); } return false; })();";
$page = visit(route('app.settings.preferences'));
waitForPreferencesTestId($page, 'preferences-time-format-trigger');
$page->click('@preferences-time-format-trigger');
- waitForPreferencesTestId($page, 'preferences-time-format-option-24h');
+ waitForPreferencesTestId($page, 'preferences-time-format-option-12h');
expect($page->script('document.querySelectorAll(\'[data-testid^="preferences-time-format-option-"]\').length'))->toBe(2);
- $page->keys('@preferences-time-format-option-24h', 'Escape');
- $page->script('(async () => { for (let i = 0; i < 150; i++) { if (! document.querySelector(\'[data-testid^="preferences-time-format-option-"]\')) return; await new Promise((r) => setTimeout(r, 50)); } })();');
+ $page->click('@preferences-time-format-option-12h');
+ waitForPreferencesTestId($page, 'preferences-saved-time_format');
+
+ expect($page->script($toastAppears))->toBeFalse()
+ ->and($user->fresh()->time_format)->toBe(TimeFormat::TwelveHour);
choosePreference($page, 'preferences-language', 'de', 'locale');
$label = __('settings.preferences.time_format.twelve_hour', [], 'de');
@@ -263,42 +234,10 @@ test('the time format offers only two clocks and keeps its value after a languag
$page->assertSeeIn('@preferences-time-format-value', $label)->assertNoJavaScriptErrors();
expect($user->fresh()->time_format)->toBe(TimeFormat::TwelveHour);
-});
-
-test('saving a preference shows no success toast', function () {
- $user = preferencesUser(['time_format' => TimeFormat::TwelveHour]);
- $this->actingAs($user);
- $toastAppears = "(async () => { for (let i = 0; i < 20; i++) { if (document.querySelector('[data-sonner-toast]')) return true; await new Promise((r) => setTimeout(r, 50)); } return false; })();";
-
- $page = visit(route('app.settings.preferences'));
- choosePreference($page, 'preferences-time-format', '24h', 'time_format');
- expect($page->script($toastAppears))->toBeFalse();
-
- choosePreference($page, 'preferences-language', 'de', 'locale');
- expect($page->script($toastAppears))->toBeFalse();
- $page->assertNoJavaScriptErrors();
- expect($user->fresh()->time_format)->toBe(TimeFormat::TwentyFourHour);
-});
-
-test('the language select suggests the language detected in the browser', function () {
- $user = preferencesUser();
- $this->actingAs($user);
-
- $page = visit(route('app.settings.preferences'))->withLocale('pt-PT');
- waitForPreferencesTestId($page, 'preferences-language-trigger');
-
- $page->click('@preferences-language-trigger');
- waitForPreferencesTestId($page, 'preferences-language-suggestions');
-
- $page->assertVisible('[data-testid="preferences-language-suggestions"] [data-testid="preferences-language-option-pt-BR"]')
- ->assertVisible('@preferences-language-detected')
- ->assertSeeIn('@preferences-language-suggestions', __('settings.preferences.language.suggestions'));
-
- expect($page->script("document.querySelectorAll('[data-testid=\"preferences-language-option-pt-BR\"]').length"))->toBe(1);
+ $page = visit(route('app.calendar', ['view' => 'week']));
+ waitForPreferencesTestId($page, 'calendar-slot-'.now()->startOfWeek()->format('Y-m-d').'-14');
- $page->fill('@preferences-language-search', 'Deutsch');
- $page->assertMissing('@preferences-language-suggestions')
- ->assertVisible('@preferences-language-option-de')
+ $page->assertScript("document.body.innerText.includes('2 PM')", true)
->assertNoJavaScriptErrors();
});
diff --git a/tests/Browser/ProfileTimezoneTest.php b/tests/Browser/ProfileTimezoneTest.php
deleted file mode 100644
index 2c4e8666f..000000000
--- a/tests/Browser/ProfileTimezoneTest.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-use App\Models\User;
-
-function waitForProfileTimezoneTestId(mixed $page, string $testId): void
-{
- $page->script(<<<JS
- (async () => {
- const sel = '[data-testid="{$testId}"]';
- for (let i = 0; i < 100; i++) {
- const el = document.querySelector(sel);
- if (el && el.getBoundingClientRect().height > 0) return;
- await new Promise((r) => setTimeout(r, 50));
- }
- })();
- JS);
-}
-
-test('a user changes their time zone on the preferences page', function () {
- $user = User::factory()->create();
- $this->actingAs($user);
-
- $page = visit(route('app.settings.preferences'));
- waitForProfileTimezoneTestId($page, 'preferences-timezone-trigger');
- $page->click('@preferences-timezone-trigger');
- waitForProfileTimezoneTestId($page, 'preferences-timezone-search');
- $page->type('@preferences-timezone-search', 'Warsaw');
- waitForProfileTimezoneTestId($page, 'preferences-timezone-option-Europe-Warsaw');
- $page->click('@preferences-timezone-option-Europe-Warsaw');
- waitForProfileTimezoneTestId($page, 'preferences-saved-timezone');
-
- expect($user->fresh()->timezone)->toBe('Europe/Warsaw');
- $page->assertNoJavaScriptErrors();
-});
-
-test('the profile page no longer shows the time zone', function () {
- $this->actingAs(User::factory()->create());
-
- $page = visit(route('app.profile.edit'));
- waitForProfileTimezoneTestId($page, 'header-title');
-
- $page->assertMissing('@profile-timezone-trigger')
- ->assertMissing('@preferences-timezone-trigger')
- ->assertNoJavaScriptErrors();
-});
-
-test('the register form sends the browser time zone', function () {
- config()->set('trypost.self_hosted', false);
-
- $page = visit(route('register'));
- waitForProfileTimezoneTestId($page, 'register-timezone');
-
- expect($page->script("document.querySelector('[data-testid=\"register-timezone\"]').value"))->not->toBe('');
- $page->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/PublishCardActionsTest.php b/tests/Browser/PublishCardActionsTest.php
index 2db0865b9..7dd199884 100644
--- a/tests/Browser/PublishCardActionsTest.php
+++ b/tests/Browser/PublishCardActionsTest.php
@@ -240,26 +240,6 @@ test('post details opens a read-only preview of the post', function () {
->not->toBe(__('posts.publish.unscheduled'));
});
-test('delete confirms with a plain dialog before removing the post', function () {
- [$user, $workspace, $channel] = cardActionsSetup();
- $queued = cardActionsPost($user, $workspace, $channel);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'));
- openCardActionsMenu($page, $queued->id);
- $page->click("@post-delete-{$queued->id}");
- waitForCardActionsTestId($page, 'confirm-delete-action');
-
- $page->assertMissing('@confirm-delete-input')
- ->assertSeeIn('@confirm-delete-action', __('posts.edit.delete_modal.action'))
- ->click('@confirm-delete-action');
- waitForCardActionsCondition($page, "!document.querySelector('[data-testid=\"post-card-{$queued->id}\"]')");
-
- expect(Post::query()->whereKey($queued->id)->exists())->toBeFalse();
- $page->assertMissing("@post-card-{$queued->id}")
- ->assertNoJavaScriptErrors();
-});
-
test('draft and sent menus only offer the actions valid for their status', function () {
[$user, $workspace, $channel] = cardActionsSetup();
$draft = cardActionsPost($user, $workspace, $channel, ['status' => 'draft', 'queue' => null]);
diff --git a/tests/Browser/PublishListSkeletonTest.php b/tests/Browser/PublishListSkeletonTest.php
index 7157e9a13..bfa6749d9 100644
--- a/tests/Browser/PublishListSkeletonTest.php
+++ b/tests/Browser/PublishListSkeletonTest.php
@@ -138,98 +138,87 @@ function publishListPost(User $user, Workspace $workspace, SocialAccount $channe
return $post;
}
-test('each tab shows the skeleton, never the empty state, until its cards arrive', function (string $tab, string $variant) {
+test('each tab shows the skeleton, never the empty state, until its cards arrive', function () {
[$user, $workspace, $channel] = publishListSetup();
- $post = publishListPost($user, $workspace, $channel, $tab);
- $from = $tab === 'drafts' ? 'sent' : 'drafts';
+ $posts = collect(['queue', 'approvals', 'drafts', 'sent'])
+ ->mapWithKeys(fn (string $tab): array => [$tab => publishListPost($user, $workspace, $channel, $tab)]);
$this->actingAs($user);
- $page = visit(route('app.posts.index', ['tab' => $from]));
- waitForPublishListSkeletonTestId($page, 'empty-state');
+ $page = visit(route('app.posts.index', ['tab' => 'sent']));
+ waitForPublishListSkeletonTestId($page, "post-card-{$posts['sent']->id}");
holdPublishListReloads($page);
- $page->click("@publish-tab-{$tab}");
- waitForPublishListSkeletonTestId($page, "publish-list-skeleton-{$tab}");
+ foreach (['queue' => 'timeline', 'approvals' => 'list', 'drafts' => 'list', 'sent' => 'list'] as $tab => $variant) {
+ $post = $posts[$tab];
- expect(publishListVisible($page, "publish-list-skeleton-{$tab}"))->toBeTrue()
- ->and($page->script("document.querySelector('[data-testid=\"publish-list-skeleton-{$tab}\"]').dataset.variant"))->toBe($variant)
- ->and(publishListVisible($page, 'empty-state'))->toBeFalse()
- ->and(publishListVisible($page, "post-card-{$post->id}"))->toBeFalse()
- ->and(publishListVisible($page, 'publish-filters'))->toBeTrue()
- ->and(publishListVisible($page, "publish-tab-{$tab}"))->toBeTrue()
- ->and($page->script("document.querySelectorAll('[data-testid=\"publish-list-skeleton-metrics\"]').length > 0"))->toBe($tab === 'sent')
- ->and($page->script("document.querySelectorAll('[data-testid=\"publish-list-skeleton-slot\"]').length > 0"))->toBe($variant === 'timeline');
+ $page->click("@publish-tab-{$tab}");
+ waitForPublishListSkeletonTestId($page, "publish-list-skeleton-{$tab}");
- $page->script('window.__releasePublishList()');
- waitForPublishListSkeletonTestId($page, "post-card-{$post->id}");
+ expect(publishListVisible($page, "publish-list-skeleton-{$tab}"))->toBeTrue()
+ ->and($page->script("document.querySelector('[data-testid=\"publish-list-skeleton-{$tab}\"]').dataset.variant"))->toBe($variant)
+ ->and(publishListVisible($page, 'empty-state'))->toBeFalse()
+ ->and(publishListVisible($page, "post-card-{$post->id}"))->toBeFalse()
+ ->and(publishListVisible($page, 'publish-filters'))->toBeTrue()
+ ->and(publishListVisible($page, "publish-tab-{$tab}"))->toBeTrue()
+ ->and($page->script("document.querySelectorAll('[data-testid=\"publish-list-skeleton-metrics\"]').length > 0"))->toBe($tab === 'sent')
+ ->and($page->script("document.querySelectorAll('[data-testid=\"publish-list-skeleton-slot\"]').length > 0"))->toBe($variant === 'timeline');
+
+ $page->script('window.__releasePublishList()');
+ waitForPublishListSkeletonTestId($page, "post-card-{$post->id}");
+
+ $page->assertVisible("@post-card-{$post->id}")
+ ->assertMissing("@publish-list-skeleton-{$tab}")
+ ->assertMissing('@empty-state');
+ }
+
+ $page->assertNoJavaScriptErrors();
+});
- $page->assertVisible("@post-card-{$post->id}")
- ->assertMissing("@publish-list-skeleton-{$tab}")
- ->assertMissing('@empty-state')
- ->assertNoJavaScriptErrors();
-})->with([
- 'queue' => ['queue', 'timeline'],
- 'approvals' => ['approvals', 'list'],
- 'drafts' => ['drafts', 'list'],
- 'sent' => ['sent', 'list'],
-]);
-
-test('a tab without data shows its empty state and never the skeleton', function (string $scope, string $tab) {
+test('a tab without data shows its empty state and never the skeleton', function (string $scope) {
[$user, , $channel] = publishListSetup();
$channel->update(['posting_schedule' => PostingSchedule::empty()]);
- $from = $tab === 'drafts' ? 'sent' : 'drafts';
$url = fn (string $tab): string => $scope === 'channel'
? route('app.channels.publish', ['account' => $channel, 'tab' => $tab])
: route('app.posts.index', ['tab' => $tab]);
$this->actingAs($user);
- $page = visit($url($from));
- waitForPublishListSkeletonTestId($page, "publish-empty-new-post-{$from}");
+ $page = visit($url('drafts'));
+ waitForPublishListSkeletonTestId($page, 'publish-empty-new-post-drafts');
watchPublishListSkeleton($page);
- $page->click("@publish-tab-{$tab}");
- waitForPublishListSkeletonTestId($page, "publish-empty-new-post-{$tab}");
-
- expect($page->script('window.__publishSkeletonSeen'))->toBeFalse();
-
- $page->assertVisible("@publish-empty-new-post-{$tab}")
- ->assertMissing("@publish-list-skeleton-{$tab}")
- ->assertNoJavaScriptErrors();
+ foreach (['sent', 'queue', 'approvals', 'drafts'] as $tab) {
+ $page->click("@publish-tab-{$tab}");
+ waitForPublishListSkeletonTestId($page, "publish-empty-new-post-{$tab}");
- $direct = visit($url($tab));
- waitForPublishListSkeletonTestId($direct, "publish-empty-new-post-{$tab}");
+ $page->assertVisible("@publish-empty-new-post-{$tab}")
+ ->assertMissing("@publish-list-skeleton-{$tab}");
+ }
- $direct->assertVisible("@publish-empty-new-post-{$tab}")
- ->assertMissing("@publish-list-skeleton-{$tab}")
- ->assertNoJavaScriptErrors();
-})->with(['all', 'channel'])->with(['queue', 'approvals', 'drafts', 'sent']);
+ expect($page->script('window.__publishSkeletonSeen'))->toBeFalse();
+ $page->assertNoJavaScriptErrors();
+})->with(['all', 'channel']);
-test('the channel queue skeleton follows the show posting times toggle', function (bool $showSlots, string $variant) {
+test('the channel queue skeleton is a plain list while the posting times are hidden', function () {
[$user, $workspace, $channel] = publishListSetup();
$post = publishListPost($user, $workspace, $channel, 'queue');
$this->actingAs($user);
$page = visit(route('app.channels.publish', ['account' => $channel, 'tab' => 'drafts']));
waitForPublishListSkeletonTestId($page, 'empty-state');
- $page->script("window.localStorage.setItem('publish.showSlots', '".($showSlots ? 'true' : 'false')."')");
+ $page->script("window.localStorage.setItem('publish.showSlots', 'false')");
$page->click('@publish-tab-sent');
waitForPublishListSkeletonTestId($page, 'empty-state');
holdPublishListReloads($page);
-
$page->click('@publish-tab-queue');
waitForPublishListSkeletonTestId($page, 'publish-list-skeleton-queue');
- expect($page->script("document.querySelector('[data-testid=\"publish-list-skeleton-queue\"]').dataset.variant"))->toBe($variant)
+ expect($page->script("document.querySelector('[data-testid=\"publish-list-skeleton-queue\"]').dataset.variant"))->toBe('list')
->and(publishListVisible($page, 'empty-state'))->toBeFalse();
$page->script('window.__releasePublishList()');
waitForPublishListSkeletonTestId($page, "post-card-{$post->id}");
-
$page->assertVisible("@post-card-{$post->id}")->assertNoJavaScriptErrors();
-})->with([
- 'posting times shown' => [true, 'timeline'],
- 'posting times hidden' => [false, 'list'],
-]);
+});
test('the deferred list keeps appending pages on scroll', function () {
[$user, $workspace, $channel] = publishListSetup();
@@ -258,24 +247,6 @@ test('the deferred list keeps appending pages on scroll', function () {
$page->assertMissing('@publish-list-skeleton-drafts')->assertNoJavaScriptErrors();
});
-test('a channel queue with posting times hidden and no posts shows its empty state, never the skeleton', function () {
- [$user, , $channel] = publishListSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.channels.publish', ['account' => $channel, 'tab' => 'drafts']));
- waitForPublishListSkeletonTestId($page, 'publish-empty-new-post-drafts');
- $page->script("window.localStorage.setItem('publish.showSlots', 'false')");
- $page->click('@publish-tab-sent');
- waitForPublishListSkeletonTestId($page, 'publish-empty-new-post-sent');
- watchPublishListSkeleton($page);
-
- $page->click('@publish-tab-queue');
- waitForPublishListSkeletonTestId($page, 'publish-empty-new-post-queue');
-
- expect($page->script('window.__publishSkeletonSeen'))->toBeFalse();
- $page->assertMissing('@publish-list-skeleton-queue')->assertNoJavaScriptErrors();
-});
-
test('deleting a draft keeps the list on screen without the skeleton', function () {
[$user, $workspace, $channel] = publishListSetup();
$deleted = publishListPost($user, $workspace, $channel, 'drafts');
@@ -290,7 +261,9 @@ test('deleting a draft keeps the list on screen without the skeleton', function
waitForPublishListSkeletonTestId($page, "post-delete-{$deleted->id}");
$page->click("@post-delete-{$deleted->id}");
waitForPublishListSkeletonTestId($page, 'confirm-delete-action');
- $page->click('@confirm-delete-action');
+ $page->assertMissing('@confirm-delete-input')
+ ->assertSeeIn('@confirm-delete-action', __('posts.edit.delete_modal.action'))
+ ->click('@confirm-delete-action');
waitForPublishListSkeletonCondition($page, "document.querySelector('[data-testid=\"post-card-{$deleted->id}\"]') === null");
expect($page->script('window.__publishSkeletonSeen'))->toBeFalse()
diff --git a/tests/Browser/PublishPageTest.php b/tests/Browser/PublishPageTest.php
index ce200f522..58c9078d0 100644
--- a/tests/Browser/PublishPageTest.php
+++ b/tests/Browser/PublishPageTest.php
@@ -99,37 +99,7 @@ function publishPagePost(User $user, Workspace $workspace, SocialAccount $channe
])->first();
}
-test('the channel page shows the weekly goal progress', function () {
- [$user, , $channel] = publishPageSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.channels.publish', $channel));
- waitForPublishPageTestId($page, 'publish-goal-progress');
-
- expect($page->script('new URL(document.querySelector(\'[data-testid="schedule-view-calendar"]\').href).search'))->toBe('');
- expect($page->script('new URL(document.querySelector(\'[data-testid="schedule-view-calendar"]\').href).pathname'))->toBe(route('app.channels.calendar', ['account' => $channel->id, 'view' => 'week'], false));
- $page->assertSeeIn('@publish-goal-progress', trans('posts.publish.goal', ['sent' => 0, 'goal' => 3]))
- ->assertAttribute('@publish-goal-pie', 'data-percent', '0')
- ->assertNoJavaScriptErrors();
-});
-
-test('the weekly goal pie fills with the posts sent this week', function () {
- [$user, $workspace, $channel] = publishPageSetup();
- $post = publishPagePost($user, $workspace, $channel);
- $post->postPlatforms()->update(['status' => 'published', 'published_at' => now()]);
- $this->actingAs($user);
-
- $page = visit(route('app.channels.publish', $channel));
- waitForPublishPageTestId($page, 'publish-goal-pie');
-
- $page->assertSeeIn('@publish-goal-progress', trans('posts.publish.goal', ['sent' => 1, 'goal' => 3]))
- ->assertAttribute('@publish-goal-pie', 'data-percent', '33')
- ->assertNoJavaScriptErrors();
-
- expect($page->script("document.querySelectorAll('[data-testid=\"publish-goal-pie\"] circle').length"))->toBe(2);
-});
-
-test('clicking the weekly goal opens a popover with sent, scheduled and to do', function () {
+test('the weekly goal shows its progress, fills the pie and opens a popover with sent, scheduled and to do', function () {
[$user, $workspace, $channel] = publishPageSetup();
$sent = publishPagePost($user, $workspace, $channel);
$sent->update(['status' => PostStatus::Published]);
@@ -139,6 +109,12 @@ test('clicking the weekly goal opens a popover with sent, scheduled and to do',
$page = visit(route('app.channels.publish', $channel));
waitForPublishPageTestId($page, 'publish-goal-progress');
+ expect($page->script('new URL(document.querySelector(\'[data-testid="schedule-view-calendar"]\').href).search'))->toBe('')
+ ->and($page->script('new URL(document.querySelector(\'[data-testid="schedule-view-calendar"]\').href).pathname'))->toBe(route('app.channels.calendar', ['account' => $channel->id, 'view' => 'week'], false));
+ $page->assertSeeIn('@publish-goal-progress', trans('posts.publish.goal', ['sent' => 1, 'goal' => 3]))
+ ->assertAttribute('@publish-goal-pie', 'data-percent', '33');
+ expect($page->script("document.querySelectorAll('[data-testid=\"publish-goal-pie\"] circle').length"))->toBe(2);
+
$page->click('@publish-goal-progress');
waitForPublishPageTestId($page, 'publish-goal-popover');
@@ -167,59 +143,9 @@ test('a draft is added to the queue from the drafts tab', function () {
expect($draft->refresh()->status)->toBe(PostStatus::Scheduled)
->and($draft->schedule_mode)->toBe(ScheduleMode::Queue);
- $page = visit(route('app.channels.publish', $channel));
- waitForPublishPageTestId($page, "post-card-{$draft->id}");
-
- $page->assertVisible("@post-card-{$draft->id}")
- ->assertSeeIn('@publish-tab-count-queue', '1')
- ->assertNoJavaScriptErrors();
-});
-
-test('a queued post moves to drafts from its menu', function () {
- [$user, $workspace, $channel] = publishPageSetup();
- $queued = publishPagePost($user, $workspace, $channel);
- $this->actingAs($user);
-
- $page = visit(route('app.channels.publish', $channel));
- waitForPublishPageTestId($page, "post-card-menu-{$queued->id}");
- $page->click("@post-card-menu-{$queued->id}");
- waitForPublishPageTestId($page, "post-move-drafts-{$queued->id}");
- $page->click("@post-move-drafts-{$queued->id}");
- waitForPublishPagePostStatus($page, $queued, PostStatus::Draft);
-
- expect($queued->refresh()->status)->toBe(PostStatus::Draft);
$page->assertNoJavaScriptErrors();
});
-test('the sent tab shows a published post', function () {
- [$user, $workspace, $channel] = publishPageSetup();
- $published = Post::factory()->published()->create([
- 'workspace_id' => $workspace->id,
- 'user_id' => $user->id,
- 'published_at' => now()->subHour(),
- ]);
- PostPlatform::factory()->published()->create([
- 'post_id' => $published->id,
- 'social_account_id' => $channel->id,
- 'platform' => $channel->platform,
- 'enabled' => true,
- ]);
- $this->actingAs($user);
-
- $page = visit(route('app.channels.publish', ['account' => $channel, 'tab' => 'sent']));
- waitForPublishPageTestId($page, "post-card-{$published->id}");
-
- $page->assertVisible("@post-card-{$published->id}")
- ->assertSeeIn('@publish-tab-count-sent', '1')
- ->click("@post-card-menu-{$published->id}");
- waitForPublishPageTestId($page, "post-duplicate-{$published->id}");
-
- $page->assertVisible("@post-duplicate-{$published->id}")
- ->assertMissing("@post-delete-{$published->id}")
- ->assertMissing("@post-move-drafts-{$published->id}")
- ->assertNoJavaScriptErrors();
-});
-
test('add to queue is disabled for a draft whose channel has no posting times', function () {
[$user, $workspace] = publishPageSetup();
$channel = SocialAccount::factory()->linkedin()->create([
@@ -254,28 +180,6 @@ test('editing a draft from a channel page keeps the channel page and tab', funct
$page->assertVisible('@post-composer-dialog')->assertNoJavaScriptErrors();
});
-test('the sidebar shows scheduled counts per channel and in total', function () {
- [$user, $workspace, $channel] = publishPageSetup();
- $other = SocialAccount::factory()->x()->create(['workspace_id' => $workspace->id]);
- publishPagePost($user, $workspace, $channel);
- $custom = Post::factory()->scheduled()->create(['workspace_id' => $workspace->id, 'user_id' => $user->id]);
- PostPlatform::factory()->create([
- 'post_id' => $custom->id,
- 'social_account_id' => $other->id,
- 'platform' => $other->platform,
- 'enabled' => true,
- ]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'));
- waitForPublishPageTestId($page, "sidebar-channel-count-{$channel->id}");
-
- $page->assertSeeIn("@sidebar-channel-count-{$channel->id}", '1')
- ->assertSeeIn("@sidebar-channel-count-{$other->id}", '1')
- ->assertSeeIn('@sidebar-publish-count', '2')
- ->assertNoJavaScriptErrors();
-});
-
test('saving a queued post edited on a channel page returns to that page and tab', function () {
[$user, $workspace, $channel] = publishPageSetup();
$queued = publishPagePost($user, $workspace, $channel);
@@ -409,19 +313,7 @@ test('an empty tab shows its illustration, copy and a new post button that opens
waitForPublishPageTestId($page, 'post-composer-dialog');
$page->assertVisible('@post-composer-dialog')->assertNoJavaScriptErrors();
-})->with(['approvals', 'drafts', 'sent']);
-
-test('an empty tab on a channel page offers a new post, not the welcome', function () {
- [$user, , $channel] = publishPageSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.channels.publish', ['account' => $channel, 'tab' => 'drafts']));
- waitForPublishPageTestId($page, 'publish-empty-new-post-drafts');
-
- $page->assertMissing('@publish-welcome')
- ->assertVisible('@publish-empty-connect-more')
- ->assertNoJavaScriptErrors();
-});
+})->with(['drafts']);
test('a workspace without channels is welcomed with connect and invite actions', function () {
$user = User::factory()->create(['timezone' => 'UTC']);
@@ -453,19 +345,6 @@ test('a workspace without channels is welcomed with connect and invite actions',
$page->assertVisible('@connect-channel-dialog')->assertNoJavaScriptErrors();
});
-test('the queue tab shows the empty state when there are no posts and no posting times', function () {
- [$user, , $channel] = publishPageSetup();
- $channel->update(['posting_schedule' => PostingSchedule::empty()]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index', ['tab' => 'queue']));
- waitForPublishPageTestId($page, 'publish-empty-illustration');
-
- $page->assertSeeIn('@empty-state', __('posts.publish.empty.queue.title'))
- ->assertVisible('@publish-empty-new-post-queue')
- ->assertNoJavaScriptErrors();
-});
-
test('an active label filter shows its count in the primary color', function () {
[$user, $workspace] = publishPageSetup();
$label = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id]);
@@ -572,12 +451,36 @@ test('on a phone the calendar row holds the channels, filter menu, view switch a
$page->assertNoJavaScriptErrors();
});
-test('the channel page puts the filters on one row on a phone and the view switch in the header on desktop', function () {
- [$user, , $channel] = publishPageSetup();
+test('the channel page adapts its filters, tabs, calendar link and notes button to the viewport', function () {
+ [$user, $workspace, $channel] = publishPageSetup();
$channel->update(['display_name' => 'A channel with a rather long display name', 'posting_goal' => 5]);
+ $post = publishPagePost($user, $workspace, $channel);
$this->actingAs($user);
- $page = visit(route('app.channels.publish', $channel))->resize(390, 844);
+ $notes = <<<'JS'
+ (() => {
+ const row = document.querySelector('[data-testid^="post-card-"]');
+ const card = row.querySelector('article').getBoundingClientRect();
+ const notes = row.querySelector('[data-testid^="post-notes-trigger-"]').getBoundingClientRect();
+
+ return {
+ inside: notes.left >= card.left && notes.right <= card.right && notes.top >= card.top,
+ beside: notes.left >= card.right,
+ };
+ })()
+ JS;
+
+ $calendarPath = 'new URL(document.querySelector(\'[data-testid="schedule-view-calendar"]\').href).pathname';
+
+ $page = visit(route('app.channels.publish', $channel))->resize(900, 800);
+ waitForPublishPageTestId($page, "post-notes-trigger-{$post->id}");
+ expect($page->script($notes))->toBe(['inside' => true, 'beside' => false]);
+
+ $page->resize(1280, 800);
+ waitForPublishPageScript($page, 'document.querySelector(\'[data-testid^="post-notes-trigger-"]\').getBoundingClientRect().left >= document.querySelector(\'[data-testid^="post-card-"] article\').getBoundingClientRect().right');
+ expect($page->script($notes))->toBe(['inside' => false, 'beside' => true]);
+
+ $page->resize(390, 844);
waitForPublishPageTestId($page, 'publish-tabs-mobile-trigger');
$phone = $page->script(<<<'JS'
@@ -595,10 +498,26 @@ test('the channel page puts the filters on one row on a phone and the view switc
})()
JS);
- expect($phone)->toBe(['oneRow' => true, 'belowGoal' => true, 'tags' => false, 'overflow' => false]);
+ expect($phone)->toBe(['oneRow' => true, 'belowGoal' => true, 'tags' => false, 'overflow' => false])
+ ->and($page->script($calendarPath))->toBe(route('app.channels.calendar', ['account' => $channel->id, 'view' => 'days'], false))
+ ->and($page->script('Boolean(document.querySelector(\'[data-testid="publish-timezone-trigger"]\'))'))->toBeFalse();
+
+ $page->click('@publish-menu');
+ waitForPublishPageTestId($page, 'publish-menu-content');
+ waitForPublishPageScript($page, 'Math.abs(window.innerHeight - document.querySelector(\'[data-testid="publish-menu-content"]\').getBoundingClientRect().bottom) <= 1');
+
+ $pressed = 'document.querySelector(\'[data-testid="publish-toggle-slots"]\').getAttribute("aria-pressed")';
+ $before = $page->script($pressed);
+ $page->assertVisible('@publish-timezone-trigger')
+ ->click('@publish-toggle-slots');
+
+ expect($page->script($pressed))->toBe($before === 'true' ? 'false' : 'true')
+ ->and($page->script('new URL(document.querySelector(\'[data-testid="publish-manage-slots"]\').href).pathname'))
+ ->toBe(route('app.channels.settings', $channel, false));
$page->resize(1280, 800);
- waitForPublishPageScript($page, 'Boolean(document.querySelector(\'[data-testid="schedule-view-list"]\')?.closest("header"))');
+ waitForPublishPageScript($page, '!document.querySelector(\'[data-testid="publish-menu-content"]\')');
+ waitForPublishPageTestId($page, 'publish-timezone-trigger');
$desktop = $page->script(<<<'JS'
(() => {
@@ -614,14 +533,12 @@ test('the channel page puts the filters on one row on a phone and the view switc
JS);
expect($desktop)->toBe(['switchInHeader' => true, 'newPostInHeader' => true, 'order' => true]);
- $page->assertNoJavaScriptErrors();
-});
-test('on a phone the tabs are a select that opens a sheet and moves to the picked tab', function () {
- [$user, , $channel] = publishPageSetup();
- $this->actingAs($user);
+ $page->click('@publish-menu');
+ waitForPublishPageTestId($page, 'publish-toggle-slots');
+ $page->assertVisible('@publish-manage-slots');
- $page = visit(route('app.channels.publish', $channel))->resize(390, 844);
+ $page->resize(390, 844);
waitForPublishPageTestId($page, 'publish-tabs-mobile-trigger');
expect($page->script('document.querySelector(\'[data-testid="posts-tabs"]\').getBoundingClientRect().height'))->toBe(0);
@@ -635,87 +552,15 @@ test('on a phone the tabs are a select that opens a sheet and moves to the picke
waitForPublishPageScript($page, 'new URLSearchParams(location.search).get("tab") === "drafts"');
$page->assertSeeIn('@publish-tabs-mobile-trigger', trans('posts.publish.tabs.drafts'))
- ->assertMissing('@publish-tabs-sheet')
- ->assertNoJavaScriptErrors();
-});
-
-test('on a phone the filter button opens a sheet with the time zone and posting times, on desktop they stay separate', function () {
- [$user, , $channel] = publishPageSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.channels.publish', $channel))->resize(390, 844);
- waitForPublishPageTestId($page, 'publish-menu');
- expect($page->script('Boolean(document.querySelector(\'[data-testid="publish-timezone-trigger"]\'))'))->toBeFalse();
-
- $page->click('@publish-menu');
- waitForPublishPageTestId($page, 'publish-menu-content');
- waitForPublishPageScript($page, 'Math.abs(window.innerHeight - document.querySelector(\'[data-testid="publish-menu-content"]\').getBoundingClientRect().bottom) <= 1');
-
- $pressed = 'document.querySelector(\'[data-testid="publish-toggle-slots"]\').getAttribute("aria-pressed")';
- $before = $page->script($pressed);
- $page->assertVisible('@publish-timezone-trigger')
- ->click('@publish-toggle-slots');
-
- expect($page->script($pressed))->toBe($before === 'true' ? 'false' : 'true')
- ->and($page->script('new URL(document.querySelector(\'[data-testid="publish-manage-slots"]\').href).pathname'))
- ->toBe(route('app.channels.settings', $channel, false));
-
- $page->resize(1280, 800);
- waitForPublishPageScript($page, '!document.querySelector(\'[data-testid="publish-menu-content"]\')');
- waitForPublishPageTestId($page, 'publish-timezone-trigger');
-
- $page->assertVisible('@publish-timezone-trigger')
- ->click('@publish-menu');
- waitForPublishPageTestId($page, 'publish-toggle-slots');
- $page->assertVisible('@publish-manage-slots')->assertNoJavaScriptErrors();
-});
-
-test('the notes button sits inside the post card below the large breakpoint and beside it above', function () {
- [$user, $workspace, $channel] = publishPageSetup();
- $post = publishPagePost($user, $workspace, $channel);
- $this->actingAs($user);
-
- $measure = <<<'JS'
- (() => {
- const row = document.querySelector('[data-testid^="post-card-"]');
- const card = row.querySelector('article').getBoundingClientRect();
- const notes = row.querySelector('[data-testid^="post-notes-trigger-"]').getBoundingClientRect();
-
- return {
- inside: notes.left >= card.left && notes.right <= card.right && notes.top >= card.top,
- beside: notes.left >= card.right,
- };
- })()
- JS;
-
- $page = visit(route('app.channels.publish', $channel))->resize(900, 800);
- waitForPublishPageTestId($page, "post-notes-trigger-{$post->id}");
- expect($page->script($measure))->toBe(['inside' => true, 'beside' => false]);
-
- $page->resize(1280, 800);
- waitForPublishPageScript($page, 'document.querySelector(\'[data-testid^="post-notes-trigger-"]\').getBoundingClientRect().left >= document.querySelector(\'[data-testid^="post-card-"] article\').getBoundingClientRect().right');
- expect($page->script($measure))->toBe(['inside' => false, 'beside' => true]);
-
- $page->assertNoJavaScriptErrors();
-});
-
-test('on a phone the calendar link of the lists opens the three days view, on desktop the week', function () {
- [$user, , $channel] = publishPageSetup();
- $this->actingAs($user);
-
- $path = 'new URL(document.querySelector(\'[data-testid="schedule-view-calendar"]\').href).pathname';
-
- $page = visit(route('app.channels.publish', $channel))->resize(390, 844);
- waitForPublishPageTestId($page, 'schedule-view-calendar');
- expect($page->script($path))->toBe(route('app.channels.calendar', ['account' => $channel->id, 'view' => 'days'], false));
+ ->assertMissing('@publish-tabs-sheet');
$page->navigate(route('app.posts.index'));
waitForPublishPageTestId($page, 'schedule-view-calendar');
- expect($page->script($path))->toBe(route('app.calendar', ['view' => 'days'], false));
+ expect($page->script($calendarPath))->toBe(route('app.calendar', ['view' => 'days'], false));
$page->resize(1280, 800);
- waitForPublishPageScript($page, $path.'.endsWith("/week")');
- expect($page->script($path))->toBe(route('app.calendar', ['view' => 'week'], false));
+ waitForPublishPageScript($page, $calendarPath.'.endsWith("/week")');
+ expect($page->script($calendarPath))->toBe(route('app.calendar', ['view' => 'week'], false));
$page->assertNoJavaScriptErrors();
});
diff --git a/tests/Browser/PublishQueueTest.php b/tests/Browser/PublishQueueTest.php
index 6a72cdba7..37ab5ea9c 100644
--- a/tests/Browser/PublishQueueTest.php
+++ b/tests/Browser/PublishQueueTest.php
@@ -255,6 +255,7 @@ test('a stale reorder is rolled back and reported', function () {
test('the posting times toggle hides every slot and survives a reload', function () {
[$user, , $channel] = publishQueueSetup();
+ $queued = publishQueuePost($user, $channel);
$slot = $channel->posting_schedule->nextSlots(now()->addMinute(), $channel->timezone, 1)[0];
$slotKey = publishQueueSlotKey($channel, $slot);
$this->actingAs($user);
@@ -267,12 +268,14 @@ test('the posting times toggle hides every slot and survives a reload', function
waitForPublishQueueCondition($page, '!document.querySelector(\'[data-testid^="queue-slot-"]\')');
expect($page->script('document.querySelectorAll(\'[data-testid^="queue-slot-"]\').length'))->toBe(0);
+ $page->assertVisible("@post-card-{$queued->id}");
$page->refresh();
- waitForPublishQueueTestId($page, 'publish-page');
+ waitForPublishQueueTestId($page, "post-card-{$queued->id}");
expect($page->script('document.querySelectorAll(\'[data-testid^="queue-slot-"]\').length'))->toBe(0);
- $page->assertNoJavaScriptErrors();
+ $page->assertVisible("@post-card-{$queued->id}")
+ ->assertNoJavaScriptErrors();
});
test('a far display time zone regroups slots under its own calendar day', function () {
@@ -348,7 +351,7 @@ test('more times extends the queue range', function () {
->assertNoJavaScriptErrors();
});
-test('a failed post is listed in sent with its failed badge and actions, not in the queue', function () {
+test('a failed post is listed in sent with its failed badge and actions', function () {
[$user, $workspace, $channel] = publishQueueSetup();
$failed = Post::factory()->failed()->create([
'workspace_id' => $workspace->id,
@@ -365,13 +368,6 @@ test('a failed post is listed in sent with its failed badge and actions, not in
]);
$this->actingAs($user);
- $page = visit(route('app.posts.index'));
- waitForPublishQueueTestId($page, 'publish-tab-queue');
-
- $page->assertMissing("@post-card-{$failed->id}")
- ->assertMissing('@needs-attention')
- ->assertNoJavaScriptErrors();
-
$page = visit(route('app.posts.index', ['tab' => 'sent']));
waitForPublishQueueTestId($page, "post-card-{$failed->id}");
@@ -434,7 +430,7 @@ function waitForPublishQueueMode(mixed $page, Post $post, ScheduleMode $mode): v
}
}
-test('a channel with one scheduled post shows it between its free posting times', function () {
+test('a scheduled post sits between the free posting times and its drag handle shows in the gutter on hover', function () {
[$user, , $channel] = publishQueueSetup();
$queued = publishQueuePost($user, $channel);
[, $nextFree] = $channel->posting_schedule->nextSlots(now()->addMinute(), $channel->timezone, 2);
@@ -442,24 +438,14 @@ test('a channel with one scheduled post shows it between its free posting times'
$this->actingAs($user);
$page = publishQueueVisitWithCleanStorage(route('app.channels.publish', $channel));
+ waitForPublishQueueTestId($page, "post-time-{$queued->id}");
waitForPublishQueueTestId($page, "queue-slot-{$nextFreeKey}");
$page->assertVisible("@post-card-{$queued->id}")
- ->assertVisible("@post-drag-handle-{$queued->id}")
->assertVisible("@queue-slot-{$nextFreeKey}")
->assertMissing('@queue-slot-'.publishQueueSlotKey($channel, $queued->scheduled_at));
expect(publishQueueFollows($page, "post-card-{$queued->id}", "queue-slot-{$nextFreeKey}"))->toBeTrue();
- $page->assertNoJavaScriptErrors();
-});
-
-test('the drag handle sits in the gutter beside the time and shows on hover', function () {
- [$user, , $channel] = publishQueueSetup();
- $queued = publishQueuePost($user, $channel);
- $this->actingAs($user);
-
- $page = publishQueueVisitWithCleanStorage(route('app.channels.publish', $channel));
- waitForPublishQueueTestId($page, "post-time-{$queued->id}");
$handle = "document.querySelector('[data-testid=\"post-drag-handle-{$queued->id}\"]')";
$time = "document.querySelector('[data-testid=\"post-time-{$queued->id}\"]')";
@@ -478,24 +464,6 @@ test('the drag handle sits in the gutter beside the time and shows on hover', fu
$page->assertNoJavaScriptErrors();
});
-test('the posting times toggle on a channel hides the free slots but keeps the posts', function () {
- [$user, , $channel] = publishQueueSetup();
- $queued = publishQueuePost($user, $channel);
- $this->actingAs($user);
-
- $page = publishQueueVisitWithCleanStorage(route('app.channels.publish', $channel));
- waitForPublishQueueTestId($page, "post-card-{$queued->id}");
- waitForPublishQueueCondition($page, '!!document.querySelector(\'[data-testid^="queue-slot-"]\')');
- $page->click('@publish-menu');
- waitForPublishQueueTestId($page, 'publish-toggle-slots');
- $page->click('@publish-toggle-slots');
- waitForPublishQueueCondition($page, '!document.querySelector(\'[data-testid^="queue-slot-"]\')');
-
- expect($page->script('document.querySelectorAll(\'[data-testid^="queue-slot-"]\').length'))->toBe(0);
- $page->assertVisible("@post-card-{$queued->id}")
- ->assertNoJavaScriptErrors();
-});
-
test('dragging a post with its own time onto a free slot queues it at that slot', function () {
[$user, , $channel] = publishQueueSetup();
publishQueuePost($user, $channel);
@@ -653,33 +621,6 @@ test('a pending queue request shows at its reserved slot and approving it keeps
->assertNoJavaScriptErrors();
});
-test('a failed post without a stored reason explains it generically', function () {
- [$user, $workspace, $channel] = publishQueueSetup();
- $failed = Post::factory()->failed()->create([
- 'workspace_id' => $workspace->id,
- 'user_id' => $user->id,
- 'scheduled_at' => now()->subDay(),
- ]);
- PostPlatform::factory()->failed()->create([
- 'post_id' => $failed->id,
- 'social_account_id' => $channel->id,
- 'platform' => $channel->platform,
- 'enabled' => true,
- 'error_message' => null,
- 'error_context' => null,
- ]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index', ['tab' => 'sent']));
- waitForPublishQueueTestId($page, "post-status-{$failed->id}");
- $page->click("@post-status-{$failed->id}");
- waitForPublishQueueTestId($page, "post-failure-{$failed->id}");
-
- $page->assertSeeIn("@post-failure-reason-{$failed->id}", __('posts.publish.failure.generic'))
- ->assertMissing("@post-failure-details-{$failed->id}")
- ->assertNoJavaScriptErrors();
-});
-
test('a publishing post waiting for a network limit shows when it retries', function () {
[$user, $workspace, $channel] = publishQueueSetup();
$user->update(['time_format' => TimeFormat::TwentyFourHour]);
@@ -774,40 +715,3 @@ test('a publishing post sits in its own queue group and moves to sent once it se
$page->assertVisible("@post-card-{$publishing->id}")
->assertNoJavaScriptErrors();
});
-
-test('a post publishing to several channels shows each channel settling in the status strip', function () {
- [$user, $workspace, $channel] = publishQueueSetup();
- $second = SocialAccount::factory()->x()->create(['workspace_id' => $workspace->id]);
- $publishing = Post::factory()->create([
- 'workspace_id' => $workspace->id,
- 'user_id' => $user->id,
- 'status' => PostStatus::Publishing,
- 'schedule_mode' => ScheduleMode::Custom,
- 'scheduled_at' => now()->subMinute(),
- 'content' => 'Going out on two channels',
- ]);
- $done = PostPlatform::factory()->create([
- 'post_id' => $publishing->id,
- 'social_account_id' => $channel->id,
- 'platform' => $channel->platform,
- 'enabled' => true,
- 'status' => PostPlatformStatus::Published,
- ]);
- $running = PostPlatform::factory()->create([
- 'post_id' => $publishing->id,
- 'social_account_id' => $second->id,
- 'platform' => $second->platform,
- 'enabled' => true,
- 'status' => PostPlatformStatus::Publishing,
- ]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'))->resize(1280, 900);
- waitForPublishQueueTestId($page, "post-publishing-target-{$running->id}");
-
- expect($page->script("document.querySelector('[data-testid=\"post-publishing-target-{$done->id}\"]').dataset.progress"))->toBe('done')
- ->and($page->script("document.querySelector('[data-testid=\"post-publishing-target-{$running->id}\"]').dataset.progress"))->toBe('running');
-
- $page->assertSeeIn("@post-publishing-{$publishing->id}", __('posts.publish.publishing_badge'))
- ->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/ReferralSourceSurveyTest.php b/tests/Browser/ReferralSourceSurveyTest.php
index b22dd1920..4fdfd79d9 100644
--- a/tests/Browser/ReferralSourceSurveyTest.php
+++ b/tests/Browser/ReferralSourceSurveyTest.php
@@ -47,27 +47,6 @@ test('a user who has not said where they found us answers from the in-app card',
expect($user->fresh()->referral_source)->toBe(ReferralSource::ProductHunt);
});
-test('a user who already answered never sees the card', function () {
- config(['trypost.self_hosted' => false]);
-
- $user = User::factory()->create(['referral_source' => ReferralSource::Google]);
- $workspace = Workspace::factory()->create([
- 'account_id' => $user->account_id,
- 'user_id' => $user->id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
-
- $this->actingAs($user->fresh());
-
- $page = visit(route('app.calendar'))->resize(1280, 900);
- waitForReferralSurveyCondition($page, "document.querySelector('[data-testid=\"app-content-shell\"]')");
-
- $page->assertMissing('@referral-source-survey')
- ->assertNoJavaScriptErrors();
-});
-
test('on a phone the survey slides up as a bottom sheet and can be answered', function () {
config(['trypost.self_hosted' => false]);
diff --git a/tests/Browser/RegisterLanguagePickerTest.php b/tests/Browser/RegisterLanguagePickerTest.php
deleted file mode 100644
index 988dc8eed..000000000
--- a/tests/Browser/RegisterLanguagePickerTest.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-function waitForRegisterLanguageTestId(mixed $page, string $testId): void
-{
- $page->script(<<<JS
- (async () => {
- const sel = '[data-testid="{$testId}"]';
- for (let i = 0; i < 100; i++) {
- const el = document.querySelector(sel);
- if (el && el.getBoundingClientRect().height > 0) return;
- await new Promise((r) => setTimeout(r, 50));
- }
- })();
- JS);
-}
-
-beforeEach(fn () => config(['trypost.self_hosted' => false]));
-
-test('the register screen offers a language picker starting on the negotiated locale', function () {
- $page = visit(route('register'));
-
- waitForRegisterLanguageTestId($page, 'language-picker-trigger');
-
- $page->assertVisible('@language-picker-trigger')
- ->assertSee('English')
- ->assertNoJavaScriptErrors();
-});
-
-test('picking a language translates the register screen without a page load', function () {
- $page = visit(route('register'));
-
- waitForRegisterLanguageTestId($page, 'language-picker-trigger');
-
- $page->click('@language-picker-trigger');
- waitForRegisterLanguageTestId($page, 'language-picker-option-pt-BR');
-
- $page->click('@language-picker-option-pt-BR');
- waitForRegisterLanguageTestId($page, 'language-picker-trigger');
-
- $page->assertSee('Criar conta')
- ->assertSee('Português')
- ->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/RepurposeTest.php b/tests/Browser/RepurposeTest.php
index a3e4f1017..c43325d7d 100644
--- a/tests/Browser/RepurposeTest.php
+++ b/tests/Browser/RepurposeTest.php
@@ -122,31 +122,14 @@ test('a destination is not warned about missing media before there is any', func
->assertNoJavaScriptErrors();
});
-test('the source account is picked from a searchable list on the edit page', function () {
- [$user, $workspace, $source] = repurposeOwnerWithAccounts();
-
- $other = SocialAccount::factory()->for($workspace)->create(['platform' => Platform::Facebook]);
-
- $repurpose = Repurpose::factory()->create([
- 'workspace_id' => $workspace->id,
- 'source_social_account_id' => $source->id,
- ]);
-
- $this->actingAs($user);
-
- $page = visit(route('app.repurposes.show', $repurpose));
-
- waitForRepurposeTestId($page, 'source-account-select');
-
- $page->click('@source-account-select')
- ->assertSee($other->display_name)
- ->assertNoJavaScriptErrors();
-});
-
-test('switching the source hands the old one back to the destinations before saving', function () {
+test('the source account is picked from a searchable list and handed back to the destinations when switched', function () {
[$user, $workspace, $source] = repurposeOwnerWithAccounts();
$facebook = SocialAccount::factory()->for($workspace)->create(['platform' => Platform::Facebook]);
+ $broken = SocialAccount::factory()->for($workspace)->create([
+ 'platform' => Platform::Instagram,
+ 'status' => AccountStatus::TokenExpired,
+ ]);
$repurpose = Repurpose::factory()->create([
'workspace_id' => $workspace->id,
@@ -164,11 +147,14 @@ test('switching the source hands the old one back to the destinations before sav
->assertAttribute('@repurpose-source-avatar', 'data-platform', Platform::Instagram->value)
->click('@source-account-select');
- usleep(300000);
+ waitForRepurposeTestId($page, "source-option-{$facebook->id}");
- $page->click("@source-option-{$facebook->id}");
+ $page->assertSee($facebook->display_name)
+ ->assertVisible("@source-option-disconnected-{$broken->id}")
+ ->assertMissing("@source-option-disconnected-{$source->id}")
+ ->click("@source-option-{$facebook->id}");
- usleep(400000);
+ waitForRepurposeTestId($page, "channel-{$source->id}");
$page->assertVisible("@channel-{$source->id}")
->assertMissing("@channel-{$facebook->id}")
@@ -193,7 +179,7 @@ test('deleting sits behind the menu instead of on the page', function () {
$page->assertMissing('@delete-repurpose')
->click('@repurpose-menu');
- usleep(400000);
+ waitForRepurposeTestId($page, 'delete-repurpose');
$page->assertVisible('@delete-repurpose')
->assertNoJavaScriptErrors();
@@ -222,7 +208,7 @@ test('the activity list reads as what happened, never as a database id', functio
$page->click('@tab-activity');
- usleep(500000);
+ waitForRepurposeTestId($page, "repurpose-item-{$withoutLink->id}");
$page->assertVisible("@repurpose-item-{$withoutLink->id}")
->assertDontSee($withoutLink->source_media_id)
@@ -291,34 +277,6 @@ test('an autosave the backend rejects says so instead of failing quietly', funct
expect($repurpose->fresh()->destinations)->toHaveCount(1);
});
-test('a source account that needs reconnecting says so in the picker', function () {
- [$user, $workspace, $source] = repurposeOwnerWithAccounts();
-
- $broken = SocialAccount::factory()->for($workspace)->create([
- 'platform' => Platform::Instagram,
- 'status' => AccountStatus::TokenExpired,
- ]);
-
- $repurpose = Repurpose::factory()->create([
- 'workspace_id' => $workspace->id,
- 'source_social_account_id' => $source->id,
- ]);
-
- $this->actingAs($user);
-
- $page = visit(route('app.repurposes.show', $repurpose));
-
- waitForRepurposeTestId($page, 'source-account-select');
-
- $page->click('@source-account-select');
-
- waitForRepurposeTestId($page, "source-option-disconnected-{$broken->id}");
-
- $page->assertVisible("@source-option-disconnected-{$broken->id}")
- ->assertMissing("@source-option-disconnected-{$source->id}")
- ->assertNoJavaScriptErrors();
-});
-
test('the list shows each repurpose as a row that opens it and the back button returns', function () {
[$user, $workspace, $source, $destination] = repurposeOwnerWithAccounts();
@@ -359,29 +317,6 @@ test('the list shows each repurpose as a row that opens it and the back button r
->assertNoJavaScriptErrors();
});
-test('the destination picker does not list google business', function () {
- [$user, $workspace, $source] = repurposeOwnerWithAccounts();
-
- $googleBusiness = SocialAccount::factory()->for($workspace)->create(['platform' => Platform::GoogleBusiness]);
- $facebook = SocialAccount::factory()->for($workspace)->create(['platform' => Platform::Facebook]);
-
- $repurpose = Repurpose::factory()->create([
- 'workspace_id' => $workspace->id,
- 'user_id' => $user->id,
- 'source_social_account_id' => $source->id,
- ]);
-
- $this->actingAs($user);
-
- $page = visit(route('app.repurposes.show', $repurpose));
-
- waitForRepurposeTestId($page, "channel-{$facebook->id}");
-
- $page->assertVisible("@channel-{$facebook->id}")
- ->assertMissing("@channel-{$googleBusiness->id}")
- ->assertNoJavaScriptErrors();
-});
-
test('without any channel the empty state offers to connect one, like the publish page', function () {
$user = User::factory()->create();
$workspace = Workspace::factory()->create(['account_id' => $user->account_id, 'user_id' => $user->id]);
@@ -492,7 +427,7 @@ test('a destination row switch adds and removes the destination', function () {
->assertNoJavaScriptErrors();
});
-test('the watched format select saves the new format', function () {
+test('the watched format select and the publishing radio save', function () {
[$user, $workspace, $source] = repurposeOwnerWithAccounts();
$repurpose = Repurpose::factory()->create([
@@ -500,6 +435,7 @@ test('the watched format select saves the new format', function () {
'user_id' => $user->id,
'source_social_account_id' => $source->id,
'source_format' => SourceFormat::Reel,
+ 'publish_mode' => PublishMode::Publish,
]);
$this->actingAs($user);
@@ -510,30 +446,19 @@ test('the watched format select saves the new format', function () {
$page->click('@source-format-select');
waitForRepurposeTestId($page, 'source-format-option-story');
$page->click('@source-format-option-story');
- waitForRepurposeTestId($page, 'repurpose-saved');
- expect($repurpose->fresh()->source_format)->toBe(SourceFormat::Story);
- $page->assertNoJavaScriptErrors();
-});
+ for ($attempt = 0; $attempt < 50 && $repurpose->fresh()->source_format !== SourceFormat::Story; $attempt++) {
+ $page->script('new Promise((resolve) => setTimeout(resolve, 100))');
+ }
-test('the publishing radio saves draft mode', function () {
- [$user, $workspace, $source] = repurposeOwnerWithAccounts();
-
- $repurpose = Repurpose::factory()->create([
- 'workspace_id' => $workspace->id,
- 'user_id' => $user->id,
- 'source_social_account_id' => $source->id,
- 'publish_mode' => PublishMode::Publish,
- ]);
-
- $this->actingAs($user);
-
- $page = visit(route('app.repurposes.show', $repurpose));
- waitForRepurposeTestId($page, 'publish-mode-draft');
+ expect($repurpose->fresh()->source_format)->toBe(SourceFormat::Story);
$page->assertAttribute('@publish-mode-publish', 'aria-checked', 'true')
->click('@publish-mode-draft');
- waitForRepurposeTestId($page, 'repurpose-saved');
+
+ for ($attempt = 0; $attempt < 50 && $repurpose->fresh()->publish_mode !== PublishMode::Draft; $attempt++) {
+ $page->script('new Promise((resolve) => setTimeout(resolve, 100))');
+ }
expect($repurpose->fresh()->publish_mode)->toBe(PublishMode::Draft);
$page->assertAttribute('@publish-mode-draft', 'aria-checked', 'true')
diff --git a/tests/Browser/SettingsDescriptionTest.php b/tests/Browser/SettingsDescriptionTest.php
deleted file mode 100644
index 615bbe102..000000000
--- a/tests/Browser/SettingsDescriptionTest.php
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-use App\Enums\User\Locale;
-use App\Models\AccessToken;
-use App\Models\SocialAccount;
-use App\Models\User;
-use App\Models\Webhook;
-use App\Models\Workspace;
-use App\Models\WorkspaceLabel;
-use App\Models\WorkspaceSignature;
-
-function waitForSettingsDescriptionTestId(mixed $page, string $testId): void
-{
- $page->script(<<<JS
- (async () => {
- const selector = '[data-testid="{$testId}"]';
- for (let attempt = 0; attempt < 200; attempt++) {
- const element = document.querySelector(selector);
- if (element && element.getBoundingClientRect().height > 0) return;
- await new Promise((resolve) => setTimeout(resolve, 50));
- }
- })();
- JS);
-
- waitForWebFonts($page);
-}
-
-test('a settings page description fits on one line in every language', function (string $route, string $key) {
- config(['trypost.self_hosted' => false]);
-
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create([
- 'account_id' => $user->account_id,
- 'user_id' => $user->id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
-
- SocialAccount::factory()->linkedin()->create(['workspace_id' => $workspace->id]);
- WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id]);
- WorkspaceSignature::factory()->create(['workspace_id' => $workspace->id]);
- Webhook::factory()->create(['workspace_id' => $workspace->id]);
- $token = $user->createToken('Existing key');
- AccessToken::find($token->token->id)->forceFill(['workspace_id' => $workspace->id])->saveQuietly();
-
- $this->actingAs($user->fresh());
-
- $page = visit(route($route));
- waitForSettingsDescriptionTestId($page, 'settings-page-description');
-
- $translations = collect(Locale::cases())
- ->mapWithKeys(fn (Locale $locale): array => [$locale->value => __($key, [], $locale->value)])
- ->all();
-
- $json = json_encode($translations, JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $wrapped = $page->script(<<<JS
- (() => {
- const translations = {$json};
- const element = document.querySelector('[data-testid="settings-page-description"]');
- const lineHeight = parseFloat(getComputedStyle(element).lineHeight);
- return Object.entries(translations)
- .filter(([, text]) => {
- element.textContent = text;
- return Math.round(element.getBoundingClientRect().height / lineHeight) > 1;
- })
- .map(([locale]) => locale);
- })()
- JS);
-
- expect($wrapped)->toBe([]);
-})->with([
- 'channels' => ['app.workspace.channels', 'channels.description'],
- 'members' => ['app.members', 'settings.workspace.members_description'],
- 'signatures' => ['app.signatures.index', 'signatures.description'],
- 'labels' => ['app.labels.index', 'labels.description'],
- 'webhooks' => ['app.webhooks.index', 'webhooks.description'],
- 'api keys' => ['app.api-keys.index', 'settings.api_keys.description'],
- 'mcp' => ['app.mcp.index', 'mcp.subtitle'],
-]);
diff --git a/tests/Browser/SettingsSidebarTest.php b/tests/Browser/SettingsSidebarTest.php
index 3615f1477..ec3bc1bc5 100644
--- a/tests/Browser/SettingsSidebarTest.php
+++ b/tests/Browser/SettingsSidebarTest.php
@@ -2,7 +2,6 @@
declare(strict_types=1);
-use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
@@ -74,18 +73,6 @@ test('members only see the settings they may use', function () {
->assertNoJavaScriptErrors();
});
-test('a user without a workspace sees only personal settings', function () {
- $this->actingAs(User::factory()->create(['current_workspace_id' => null]));
-
- $page = visit(route('app.profile.edit'));
- waitForSettingsSidebarTestId($page, 'settings-sidebar');
-
- $page->assertVisible('@settings-nav-profile')
- ->assertMissing('@settings-nav-general')
- ->assertMissing('@settings-nav-mcp')
- ->assertNoJavaScriptErrors();
-});
-
test('the back link returns to the app', function () {
$this->actingAs(settingsSidebarUser('admin'));
@@ -97,36 +84,6 @@ test('the back link returns to the app', function () {
$page->assertVisible('@sidebar-new')->assertNoJavaScriptErrors();
});
-test('the back to app link in the settings sidebar highlights on hover', function () {
- $this->actingAs(settingsSidebarUser('admin'));
-
- $page = visit(route('app.profile.edit'));
- waitForSettingsSidebarTestId($page, 'settings-back');
-
- $background = fn (): string => $page->script('getComputedStyle(document.querySelector(\'[data-testid="settings-back"]\')).backgroundColor');
-
- expect($background())->toBe('rgba(0, 0, 0, 0)');
-
- $page->hover('@settings-back');
- $page->script('new Promise((resolve) => setTimeout(resolve, 300))');
-
- expect($background())->not->toBe('rgba(0, 0, 0, 0)');
-
- $page->assertNoJavaScriptErrors();
-});
-
-test('the channels item shows how many channels the workspace has connected', function () {
- $user = settingsSidebarUser('admin');
- SocialAccount::factory()->count(3)->create(['workspace_id' => $user->current_workspace_id]);
- $this->actingAs($user);
-
- $page = visit(route('app.profile.edit'));
- waitForSettingsSidebarTestId($page, 'settings-nav-channels-count');
-
- $page->assertSeeIn('@settings-nav-channels-count', '3')
- ->assertNoJavaScriptErrors();
-});
-
test('with the sidebar collapsed the settings nav stays as icons and the footer toggle expands it', function () {
$this->actingAs(settingsSidebarUser('admin'));
@@ -182,31 +139,6 @@ test('with the sidebar collapsed the settings nav stays as icons and the footer
->assertNoJavaScriptErrors();
});
-test('the settings sidebar footer shows the user menu, expanded and collapsed', function () {
- $user = settingsSidebarUser('admin');
- $this->actingAs($user);
-
- $state = "document.querySelector('[data-slot=\"sidebar\"][data-state]')?.dataset.state";
-
- $page = visit(route('app.profile.edit'))->resize(1280, 900);
- waitForSettingsSidebarTestId($page, 'sidebar-workspace-menu');
-
- $page->assertSeeIn('@sidebar-workspace-menu', $user->name)
- ->click('@sidebar-workspace-menu');
-
- waitForSettingsSidebarTestId($page, 'logout-button');
- $page->assertVisible('@logout-button');
- $page->script("document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }))");
-
- $page->click('@sidebar-footer-toggle');
- waitForSettingsSidebarScript($page, "{$state} === 'collapsed'");
- $page->script('new Promise((resolve) => setTimeout(resolve, 400))');
-
- $page->assertVisible('@sidebar-workspace-menu')
- ->assertVisible('[data-testid="sidebar-workspace-menu"] [data-slot="avatar"]')
- ->assertNoJavaScriptErrors();
-});
-
function waitForSettingsSidebarScript(mixed $page, string $condition): void
{
$page->script(<<<JS
diff --git a/tests/Browser/SidebarChannelReorderTest.php b/tests/Browser/SidebarChannelReorderTest.php
index c922aa017..98becd8a9 100644
--- a/tests/Browser/SidebarChannelReorderTest.php
+++ b/tests/Browser/SidebarChannelReorderTest.php
@@ -160,37 +160,6 @@ test('the second channel can be dragged to the top twice in a row', function ()
$page->assertNoJavaScriptErrors();
});
-test('the first channel can go last and the last channel can go first', function () {
- [$user, [$alpha, $bravo, $charlie, $delta]] = sidebarReorderSetup();
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'));
- waitForSidebarReorderTestId($page, "sidebar-channel-{$delta->id}");
-
- sidebarReorderDrag($page, $alpha, $delta, 0.9);
- $expected = [$bravo->id, $charlie->id, $delta->id, $alpha->id];
- sidebarReorderSettle($page, $user, $expected);
-
- expect(sidebarReorderDbOrder($user))->toBe($expected)
- ->and(sidebarReorderDomOrder($page))->toBe($expected);
-
- sidebarReorderDrag($page, $alpha, $bravo, 0.1);
- $expected = [$alpha->id, $bravo->id, $charlie->id, $delta->id];
- sidebarReorderSettle($page, $user, $expected);
-
- expect(sidebarReorderDbOrder($user))->toBe($expected)
- ->and(sidebarReorderDomOrder($page))->toBe($expected);
-
- sidebarReorderDrag($page, $delta, $alpha, 0.1);
- $expected = [$delta->id, $alpha->id, $bravo->id, $charlie->id];
- sidebarReorderSettle($page, $user, $expected);
-
- expect(sidebarReorderDbOrder($user))->toBe($expected)
- ->and(sidebarReorderDomOrder($page))->toBe($expected);
-
- $page->assertNoJavaScriptErrors();
-});
-
test('a placeholder opens where the channel would land and the drop uses it', function () {
[$user, [$alpha, $bravo, $charlie, $delta]] = sidebarReorderSetup();
$this->actingAs($user);
@@ -267,34 +236,6 @@ test('escape cancels a drag and restores the order', function () {
$page->assertNoJavaScriptErrors();
});
-test('dropping outside the list cancels the drag', function () {
- [$user, [$alpha, $bravo, $charlie, $delta]] = sidebarReorderSetup();
- $this->actingAs($user);
- $original = [$alpha->id, $bravo->id, $charlie->id, $delta->id];
-
- $page = visit(route('app.posts.index'))->resize(1280, 800);
- waitForSidebarReorderTestId($page, "sidebar-channel-{$delta->id}");
-
- sidebarReorderPickUp($page, $bravo);
- sidebarReorderMoveTo($page, "sidebar-channel-row-{$delta->id}", 0.75);
- sidebarReorderPause($page);
-
- expect(sidebarReorderSlots($page))->toBe([$alpha->id, $charlie->id, $delta->id, 'placeholder']);
-
- sidebarReorderMouse($page, 'mouseMove', ['x' => 900, 'y' => 400, 'steps' => 8]);
- sidebarReorderPause($page);
-
- expect(sidebarReorderSlots($page))->toBe([$alpha->id, 'placeholder', $charlie->id, $delta->id]);
-
- sidebarReorderDrop($page);
- sidebarReorderPause($page, 800);
-
- expect(sidebarReorderDbOrder($user))->toBe($original)
- ->and(sidebarReorderSlots($page))->toBe($original);
-
- $page->assertNoJavaScriptErrors();
-});
-
test('an expanded channel submenu does not shift the drop position', function () {
[$user, [$alpha, $bravo, $charlie, $delta]] = sidebarReorderSetup();
$this->actingAs($user);
@@ -314,7 +255,14 @@ test('an expanded channel submenu does not shift the drop position', function ()
expect(sidebarReorderDbOrder($user))->toBe($expected);
- sidebarReorderDrag($page, $alpha, $charlie, 0.75);
+ sidebarReorderPickUp($page, $alpha);
+ sidebarReorderPause($page);
+ sidebarReorderMoveTo($page, "sidebar-channel-row-{$charlie->id}", 0.75);
+ sidebarReorderPause($page);
+
+ expect(sidebarReorderSlots($page))->toBe([$delta->id, $bravo->id, $charlie->id, 'placeholder']);
+
+ sidebarReorderDrop($page);
$expected = [$delta->id, $bravo->id, $charlie->id, $alpha->id];
sidebarReorderSettle($page, $user, $expected);
diff --git a/tests/Browser/SidebarChannelsTest.php b/tests/Browser/SidebarChannelsTest.php
index a23123a44..87edea69c 100644
--- a/tests/Browser/SidebarChannelsTest.php
+++ b/tests/Browser/SidebarChannelsTest.php
@@ -257,7 +257,8 @@ test('an expanded channel shows its scheduled count on the Publish item', functi
$page->click("@sidebar-channel-{$channel->id}-toggle");
waitForSidebarChannelsTestId($page, "sidebar-channel-{$channel->id}-publish-count");
- $page->assertSeeIn("@sidebar-channel-{$channel->id}-publish-count", '3')
+ $page->assertSeeIn('@sidebar-publish-count', '3')
+ ->assertSeeIn("@sidebar-channel-{$channel->id}-publish-count", '3')
->click("@sidebar-channel-{$empty->id}-toggle");
waitForSidebarChannelsTestId($page, "sidebar-channel-{$empty->id}-publish");
@@ -265,64 +266,6 @@ test('an expanded channel shows its scheduled count on the Publish item', functi
->assertNoJavaScriptErrors();
});
-test('the channel chevron gets a hover background and buttons use the pointer cursor', function () {
- $user = sidebarChannelsUser('admin');
- $channel = SocialAccount::factory()->linkedin()->create(['workspace_id' => $user->current_workspace_id]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'));
- waitForSidebarChannelsTestId($page, "sidebar-channel-{$channel->id}");
-
- $toggle = "document.querySelector('[data-testid=\"sidebar-channel-{$channel->id}-toggle\"]')";
-
- expect($page->script("getComputedStyle({$toggle}).backgroundColor"))->toBe('rgba(0, 0, 0, 0)')
- ->and($page->script("{$toggle}.tagName"))->toBe('BUTTON')
- ->and($page->script("getComputedStyle({$toggle}).cursor"))->toBe('pointer');
-
- $page->hover("@sidebar-channel-{$channel->id}");
- $page->hover("@sidebar-channel-{$channel->id}-toggle");
- waitForSidebarChannelsScript($page, "getComputedStyle({$toggle}).backgroundColor === 'rgba(51, 34, 0, 0.06)'");
-
- expect($page->script("getComputedStyle({$toggle}).backgroundColor"))->toBe('rgba(51, 34, 0, 0.06)');
- $page->assertNoJavaScriptErrors();
-});
-
-test('the channels header shows the channel count and reveals sized actions on hover', function () {
- $user = sidebarChannelsUser('admin');
- $channels = SocialAccount::factory()->linkedin()->count(3)->create(['workspace_id' => $user->current_workspace_id]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'));
- waitForSidebarChannelsTestId($page, "sidebar-channel-{$channels->first()->id}");
-
- $actions = "document.querySelector('[data-testid=\"sidebar-channels-actions\"]')";
-
- expect(trim((string) $page->script("document.querySelector('[data-testid=\"sidebar-channels-label\"]').textContent")))->toBe('Channels · 3')
- ->and($page->script("getComputedStyle({$actions}).opacity"))->toBe('0');
-
- $page->hover('@sidebar-channels-label');
- waitForSidebarChannelsScript($page, "getComputedStyle({$actions}).opacity === '1'");
-
- expect($page->script("getComputedStyle({$actions}).opacity"))->toBe('1');
-
- foreach (['search' => '8px', 'settings' => '6px', 'connect' => '8px'] as $action => $radius) {
- $button = "document.querySelector('[data-testid=\"sidebar-channels-{$action}\"]')";
-
- expect($page->script("[{$button}.getBoundingClientRect().width, {$button}.getBoundingClientRect().height]"))->toBe([24, 24])
- ->and($page->script("[{$button}.querySelector('svg').getBoundingClientRect().width, {$button}.querySelector('svg').getBoundingClientRect().height]"))->toBe([16, 16])
- ->and($page->script("getComputedStyle({$button}).borderTopLeftRadius"))->toBe($radius);
- }
-
- $page->hover('@sidebar-channels-settings');
- $settings = "document.querySelector('[data-testid=\"sidebar-channels-settings\"]')";
- waitForSidebarChannelsScript($page, "getComputedStyle({$settings}).backgroundColor === 'rgba(51, 34, 0, 0.06)'");
-
- expect($page->script("getComputedStyle({$settings}).backgroundColor"))->toBe('rgba(51, 34, 0, 0.06)')
- ->and($page->script("{$settings}.querySelector('svg').getBoundingClientRect().width"))->toBe(16);
-
- $page->assertNoJavaScriptErrors();
-});
-
test('keyboard focus reveals the channels header actions', function () {
$user = sidebarChannelsUser('member');
SocialAccount::factory()->linkedin()->create(['workspace_id' => $user->current_workspace_id]);
@@ -392,7 +335,7 @@ test('the channels settings and connect actions show a tooltip above them', func
})()
JS))->toBeTrue();
$page->assertNoJavaScriptErrors();
-})->with(['settings', 'connect']);
+})->with(['settings']);
test('only the channel list scrolls while the main nav and the footer stay fixed', function () {
$user = sidebarChannelsUser('admin');
@@ -433,22 +376,6 @@ test('only the channel list scrolls while the main nav and the footer stay fixed
$page->assertNoJavaScriptErrors();
});
-test('a verified x channel shows its badge on the avatar', function () {
- $user = sidebarChannelsUser('admin');
- $verified = SocialAccount::factory()->x()->create(['workspace_id' => $user->current_workspace_id, 'meta' => ['x_verified_type' => 'business']]);
- $plain = SocialAccount::factory()->linkedin()->create(['workspace_id' => $user->current_workspace_id]);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'));
- waitForSidebarChannelsTestId($page, "channel-avatar-verified-{$verified->id}");
-
- $page->assertVisible("@channel-avatar-verified-{$verified->id}")
- ->assertAttribute("@channel-avatar-verified-{$verified->id}", 'data-verified', 'business')
- ->assertAttribute("@channel-avatar-verified-{$verified->id}", 'aria-label', __('channels.verified.business'))
- ->assertMissing("@channel-avatar-verified-{$plain->id}")
- ->assertNoJavaScriptErrors();
-});
-
test('the collapsed sidebar shows every channel network badge without clipping it', function () {
$user = sidebarChannelsUser('admin');
$channels = collect([
diff --git a/tests/Browser/SidebarLanguageSwitchTest.php b/tests/Browser/SidebarLanguageSwitchTest.php
index 86a00cc60..3245930f5 100644
--- a/tests/Browser/SidebarLanguageSwitchTest.php
+++ b/tests/Browser/SidebarLanguageSwitchTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
use App\Enums\User\Locale;
use App\Enums\User\Theme;
-use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
@@ -67,45 +66,6 @@ test('switching language in the sidebar translates the page in place', function
expect($user->refresh()->locale)->toBe(Locale::Japanese);
});
-test('switching to a right-to-left language flips the document direction', function () {
- $user = User::factory()->create(['locale' => Locale::English]);
- $workspace = Workspace::factory()->create([
- 'account_id' => $user->account_id,
- 'user_id' => $user->id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
-
- $this->actingAs($user);
-
- $page = visit(route('app.calendar'));
- waitForSidebarLanguageTestId($page, 'sidebar-workspace-menu');
-
- $page->script(<<<'JS'
- (async () => {
- const wait = (ms) => new Promise((r) => setTimeout(r, ms));
- window.__dirBefore = document.documentElement.dir;
- document.querySelector('[data-testid="sidebar-workspace-menu"]').click();
- await wait(400);
- const trigger = document.querySelector('[data-testid="sidebar-language-trigger"]');
- trigger.dispatchEvent(new PointerEvent('pointermove', { bubbles: true }));
- trigger.click();
- await wait(600);
- document.querySelector('[data-testid="sidebar-language-ar"]').click();
- for (let i = 0; i < 150; i++) {
- if (document.documentElement.dir === 'rtl') return;
- await wait(50);
- }
- })();
- JS);
-
- $page->assertScript('window.__dirBefore', 'ltr')
- ->assertScript('document.documentElement.dir', 'rtl')
- ->assertNoJavaScriptErrors();
-
- expect($user->refresh()->locale)->toBe(Locale::Arabic);
-});
-
test('the calendar header follows the language, not the previous one', function () {
$user = User::factory()->create(['locale' => Locale::English]);
$workspace = Workspace::factory()->create([
@@ -143,41 +103,6 @@ test('the calendar header follows the language, not the previous one', function
->assertScript('/September/.test(window.__header)', false);
});
-test('the month view header follows the language too', function () {
- $user = User::factory()->create(['locale' => Locale::English]);
- $workspace = Workspace::factory()->create([
- 'account_id' => $user->account_id,
- 'user_id' => $user->id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
-
- $this->actingAs($user);
-
- $page = visit(route('app.calendar', ['view' => 'month', 'month' => '2026-09-01']));
- waitForSidebarLanguageTestId($page, 'sidebar-workspace-menu');
-
- $page->script(<<<'JS'
- (async () => {
- const wait = (ms) => new Promise((r) => setTimeout(r, ms));
- document.querySelector('[data-testid="sidebar-workspace-menu"]').click();
- await wait(400);
- const trigger = document.querySelector('[data-testid="sidebar-language-trigger"]');
- trigger.dispatchEvent(new PointerEvent('pointermove', { bubbles: true }));
- trigger.click();
- await wait(600);
- document.querySelector('[data-testid="sidebar-language-pt-BR"]').click();
- await wait(2500);
- window.__monthHeader = document.body.innerText;
- })();
- JS);
-
- $page->script('(async () => { for (let i = 0; i < 150; i++) { if (window.__monthHeader !== undefined) return; await new Promise((r) => setTimeout(r, 50)); } })();');
-
- $page->assertScript('/setembro/i.test(window.__monthHeader)', true)
- ->assertScript('/September/.test(window.__monthHeader)', false);
-});
-
test('switching theme in the sidebar applies it in place and saves it', function () {
$user = User::factory()->create(['theme' => Theme::Light]);
$workspace = Workspace::factory()->create([
@@ -234,28 +159,6 @@ test('switching theme in the sidebar applies it in place and saves it', function
->assertNoJavaScriptErrors();
});
-test('the sidebar menu header pluralizes the channel count in the user language', function (int $channels) {
- $user = User::factory()->create(['locale' => Locale::Polish]);
- $workspace = Workspace::factory()->create([
- 'account_id' => $user->account_id,
- 'user_id' => $user->id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- SocialAccount::factory()->count($channels)->create(['workspace_id' => $workspace->id]);
-
- $this->actingAs($user);
-
- $page = visit(route('app.calendar'));
- waitForSidebarLanguageTestId($page, 'sidebar-workspace-menu');
- $page->click('@sidebar-workspace-menu');
- waitForSidebarLanguageTestId($page, 'sidebar-menu-plan');
-
- $page->assertSeeIn('@sidebar-menu-plan', trans_choice('sidebar.channels_count', $channels, [], 'pl'))
- ->assertSeeIn('@sidebar-menu-manage-team', __('sidebar.manage_team', [], 'pl'))
- ->assertNoJavaScriptErrors();
-})->with([1, 3, 5]);
-
test('the user menu has a help and support submenu with the support links', function (bool $selfHosted) {
config(['trypost.self_hosted' => $selfHosted]);
$user = User::factory()->create();
@@ -302,4 +205,4 @@ test('the user menu has a help and support submenu with the support links', func
]);
$page->assertNoJavaScriptErrors();
-})->with(['cloud' => false, 'self-hosted' => true]);
+})->with(['cloud' => false]);
diff --git a/tests/Browser/SidebarMenuTest.php b/tests/Browser/SidebarMenuTest.php
index 89307920a..beacb923c 100644
--- a/tests/Browser/SidebarMenuTest.php
+++ b/tests/Browser/SidebarMenuTest.php
@@ -32,13 +32,16 @@ function waitForSidebarTestId(mixed $page, string $testId): void
test('account owners see settings, channels and plans and billing in the sidebar menu', function () {
config(['trypost.self_hosted' => false]);
- $user = User::factory()->create();
+ $plan = Plan::query()->where('slug', Slug::Socials)->firstOrFail();
+ $user = User::factory()->create(['name' => 'Ada Lovelace', 'email' => '[email protected]']);
+ $user->account->update(['plan_id' => $plan->id]);
$workspace = Workspace::factory()->create([
'user_id' => $user->id,
'account_id' => $user->account_id,
]);
$workspace->members()->attach($user->id, membershipPivot('admin'));
$user->update(['current_workspace_id' => $workspace->id]);
+ SocialAccount::factory()->count(2)->create(['workspace_id' => $workspace->id]);
subscribeAccount($user->account);
@@ -53,7 +56,11 @@ test('account owners see settings, channels and plans and billing in the sidebar
waitForSidebarTestId($page, 'logout-button');
- $page->assertVisible('@sidebar-menu-settings')
+ $page->assertMissing('@sidebar-menu-email')
+ ->assertVisible('@sidebar-menu-avatar')
+ ->assertSeeIn('@sidebar-menu-name', 'Ada Lovelace')
+ ->assertSeeIn('@sidebar-menu-plan', "{$plan->name} · 2 channels")
+ ->assertVisible('@sidebar-menu-settings')
->assertVisible('@sidebar-menu-billing')
->assertVisible('@sidebar-menu-channels')
->assertVisible('@sidebar-menu-manage-team')
@@ -78,59 +85,7 @@ test('account owners see settings, channels and plans and billing in the sidebar
'sidebar-support-trigger',
'logout-button',
]);
-});
-
-test('the sidebar menu header shows the user, plan and channel count', function () {
- config(['trypost.self_hosted' => false]);
-
- $plan = Plan::query()->where('slug', Slug::Socials)->firstOrFail();
- $user = User::factory()->create(['name' => 'Ada Lovelace', 'email' => '[email protected]']);
- $user->account->update(['plan_id' => $plan->id]);
- $workspace = Workspace::factory()->create([
- 'user_id' => $user->id,
- 'account_id' => $user->account_id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- SocialAccount::factory()->count(2)->create(['workspace_id' => $workspace->id]);
-
- subscribeAccount($user->account);
-
- $this->actingAs($user);
-
- $page = visit(route('app.calendar'));
-
- waitForSidebarTestId($page, 'sidebar-workspace-menu');
- $page->click('@sidebar-workspace-menu');
- waitForSidebarTestId($page, 'sidebar-menu-plan');
-
- $page->assertMissing('@sidebar-menu-email')
- ->assertVisible('@sidebar-menu-avatar')
- ->assertSeeIn('@sidebar-menu-name', 'Ada Lovelace')
- ->assertSeeIn('@sidebar-menu-plan', "{$plan->name} · 2 channels")
- ->assertVisible('@sidebar-menu-manage-team')
- ->assertNoJavaScriptErrors();
-});
-
-test('manage team in the sidebar menu opens the members page', function () {
- config(['trypost.self_hosted' => false]);
-
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create([
- 'user_id' => $user->id,
- 'account_id' => $user->account_id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
-
- subscribeAccount($user->account);
-
- $this->actingAs($user);
-
- $page = visit(route('app.calendar'));
- waitForSidebarTestId($page, 'sidebar-workspace-menu');
- $page->click('@sidebar-workspace-menu');
waitForSidebarTestId($page, 'sidebar-menu-manage-team');
$page->click('@sidebar-menu-manage-team');
@@ -172,41 +127,6 @@ test('account billing is hidden in the sidebar menu when self-hosted', function
->toBe('0 channels');
});
-test('workspace admins see channels but not plans and billing', function () {
- config(['trypost.self_hosted' => false]);
-
- [
- 'owner' => $owner,
- 'member' => $admin,
- 'shared_workspaces' => [$workspace],
- ] = strandedMemberOnSharedAccount(
- sharedWorkspaces: 1,
- attachMember: true,
- setMemberCurrent: true,
- );
-
- $workspace->members()->updateExistingPivot($admin->id, membershipPivot('admin'));
-
- subscribeAccount($owner->account);
-
- $this->actingAs($admin->fresh());
-
- $page = visit(route('app.calendar'));
-
- waitForSidebarTestId($page, 'sidebar-workspace-menu');
-
- $page->assertVisible('@sidebar-workspace-menu')
- ->click('@sidebar-workspace-menu');
-
- waitForSidebarTestId($page, 'logout-button');
-
- $page->assertVisible('@sidebar-menu-settings')
- ->assertVisible('@sidebar-menu-channels')
- ->assertMissing('@sidebar-menu-billing')
- ->assertVisible('@sidebar-menu-manage-team')
- ->assertVisible('@logout-button');
-});
-
test('workspace members do not see channels or plans and billing in the sidebar menu', function () {
config(['trypost.self_hosted' => false]);
@@ -242,69 +162,7 @@ test('workspace members do not see channels or plans and billing in the sidebar
->assertVisible('@logout-button');
});
-test('members whose posts need approval do not see channels or plans and billing in the sidebar menu', function () {
- config(['trypost.self_hosted' => false]);
-
- [
- 'owner' => $owner,
- 'member' => $requester,
- 'shared_workspaces' => [$workspace],
- ] = strandedMemberOnSharedAccount(
- sharedWorkspaces: 1,
- attachMember: true,
- setMemberCurrent: true,
- );
-
- $workspace->members()->updateExistingPivot($requester->id, membershipPivot('approval'));
-
- subscribeAccount($owner->account);
-
- $this->actingAs($requester->fresh());
-
- $page = visit(route('app.calendar'));
-
- waitForSidebarTestId($page, 'sidebar-workspace-menu');
-
- $page->assertVisible('@sidebar-workspace-menu')
- ->click('@sidebar-workspace-menu');
-
- waitForSidebarTestId($page, 'logout-button');
-
- $page->assertVisible('@sidebar-menu-settings')
- ->assertMissing('@sidebar-menu-billing')
- ->assertMissing('@sidebar-menu-channels')
- ->assertMissing('@sidebar-menu-manage-team')
- ->assertVisible('@logout-button');
-});
-
-test('the sidebar has no media library item', function () {
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create([
- 'user_id' => $user->id,
- 'account_id' => $user->account_id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
-
- subscribeAccount($user->account);
-
- $this->actingAs($user);
-
- $page = visit(route('app.calendar'));
-
- waitForSidebarTestId($page, 'sidebar-workspace-menu');
-
- $ideasPath = route('app.create.ideas.index', absolute: false);
- $createItem = "nav-{$ideasPath}";
- $navItems = $page->script('Array.from(document.querySelectorAll("[data-testid^=\'nav-\']")).map((el) => el.dataset.testid)');
-
- expect($navItems)->toContain($createItem)
- ->and($navItems)->not->toContain('nav-/assets');
-
- $page->assertNoJavaScriptErrors();
-});
-
-test('the sidebar new button uses the strong brand color', function () {
+test('the sidebar new button and its menu use the brand colors', function () {
$user = User::factory()->create();
$workspace = Workspace::factory()->create([
'user_id' => $user->id,
@@ -331,6 +189,25 @@ test('the sidebar new button uses the strong brand color', function () {
expect($colors)->toBe(['rgb(109, 40, 217)', 'rgb(255, 255, 255)', '3.35544e+07px', 'none']);
+ $page->click('@sidebar-new');
+ waitForSidebarTestId($page, 'sidebar-new-idea');
+
+ $menuColors = $page->script(<<<'JS'
+ (async () => {
+ for (let i = 0; i < 60; i++) {
+ const post = document.querySelector('[data-testid="sidebar-new-post"] span');
+ const idea = document.querySelector('[data-testid="sidebar-new-idea"] span');
+ if (post && idea) {
+ return [getComputedStyle(post).backgroundColor, getComputedStyle(idea).backgroundColor];
+ }
+ await new Promise((r) => setTimeout(r, 50));
+ }
+ return null;
+ })()
+ JS);
+
+ expect($menuColors)->toBe(['rgb(221, 214, 254)', 'rgb(237, 233, 254)']);
+
$page->assertNoJavaScriptErrors();
});
@@ -377,95 +254,7 @@ test('workspaces without a logo use the brand colors in the workspace menu', fun
$page->assertNoJavaScriptErrors();
});
-test('the new menu uses the brand colors for post and idea', function () {
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create([
- 'user_id' => $user->id,
- 'account_id' => $user->account_id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
-
- subscribeAccount($user->account);
-
- $this->actingAs($user);
-
- $page = visit(route('app.calendar'));
-
- waitForSidebarTestId($page, 'sidebar-new');
- $page->click('@sidebar-new');
- waitForSidebarTestId($page, 'sidebar-new-idea');
-
- $colors = $page->script(<<<'JS'
- (async () => {
- for (let i = 0; i < 60; i++) {
- const post = document.querySelector('[data-testid="sidebar-new-post"] span');
- const idea = document.querySelector('[data-testid="sidebar-new-idea"] span');
- if (post && idea) {
- return [getComputedStyle(post).backgroundColor, getComputedStyle(idea).backgroundColor];
- }
- await new Promise((r) => setTimeout(r, 50));
- }
- return null;
- })()
- JS);
-
- expect($colors)->toBe(['rgb(221, 214, 254)', 'rgb(237, 233, 254)']);
-
- $page->assertNoJavaScriptErrors();
-});
-
-test('no sidebar menu item wraps onto a second line in any language', function () {
- config(['trypost.self_hosted' => false]);
-
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create([
- 'user_id' => $user->id,
- 'account_id' => $user->account_id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
-
- subscribeAccount($user->account);
-
- $wrapped = [];
-
- foreach (Locale::cases() as $locale) {
- $user->update(['locale' => $locale]);
- $this->actingAs($user->fresh());
-
- $page = visit(route('app.calendar'));
- waitForSidebarTestId($page, 'sidebar-workspace-menu');
- $page->click('@sidebar-workspace-menu');
- waitForSidebarTestId($page, 'sidebar-menu-manage-team');
-
- $lines = $page->script(<<<'JS'
- [...document.querySelectorAll('[role="menu"] [role="menuitem"]')]
- .map((item) => {
- const walker = document.createTreeWalker(item, NodeFilter.SHOW_TEXT);
- let lineCount = 0;
- while (walker.nextNode()) {
- if (!walker.currentNode.textContent.trim()) continue;
- const range = document.createRange();
- range.selectNodeContents(walker.currentNode);
- const tops = new Set([...range.getClientRects()].filter((rect) => rect.width > 0).map((rect) => Math.round(rect.top)));
- lineCount = Math.max(lineCount, tops.size);
- }
- return [item.textContent.trim(), lineCount];
- })
- .filter(([, lineCount]) => lineCount > 1)
- .map(([text]) => text)
- JS);
-
- foreach ($lines as $text) {
- $wrapped[] = "{$locale->value}: {$text}";
- }
- }
-
- expect($wrapped)->toBe([]);
-});
-
-test('the main sidebar navigation is ordered create, publish, insights, repurpose', function () {
+test('the main sidebar navigation is ordered and the logo is the vector mark with the wordmark', function () {
$user = User::factory()->create();
$workspace = Workspace::factory()->create([
'user_id' => $user->id,
@@ -476,7 +265,7 @@ test('the main sidebar navigation is ordered create, publish, insights, repurpos
subscribeAccount($user->account);
$this->actingAs($user);
- $page = visit(route('app.posts.index'));
+ $page = visit(route('app.posts.index'))->resize(1280, 900);
waitForSidebarTestId($page, 'sidebar-logo');
$paths = array_map(
@@ -487,21 +276,6 @@ test('the main sidebar navigation is ordered create, publish, insights, repurpos
expect($page->script(<<<'JS'
Array.from(document.querySelectorAll('[data-testid^="nav-"]')).map((link) => new URL(link.href).pathname)
JS))->toBe($paths);
-});
-
-test('the sidebar logo is the vector mark with the wordmark, and only the mark when collapsed', function () {
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create([
- 'user_id' => $user->id,
- 'account_id' => $user->account_id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
- $this->actingAs($user);
-
- $page = visit(route('app.posts.index'))->resize(1280, 900);
- waitForSidebarTestId($page, 'sidebar-logo');
expect($page->script(<<<'JS'
(() => {
@@ -511,7 +285,6 @@ test('the sidebar logo is the vector mark with the wordmark, and only the mark w
images: logo.querySelectorAll('img').length,
visible: visible.length,
text: visible[0]?.textContent.trim(),
- font: getComputedStyle(visible[0]).fontFamily,
mark: visible[0]?.querySelector('svg') !== null,
};
})()
@@ -702,4 +475,4 @@ test('on a phone a global bar with the menu button and logo sits above the conte
expect($page->script('document.querySelector(\'[data-testid="app-mobile-bar"]\').getBoundingClientRect().height'))->toBe(0);
$page->assertNoJavaScriptErrors();
-})->with(['app.posts.index', 'app.profile.edit']);
+})->with(['app.posts.index']);
diff --git a/tests/Browser/SignatureLabelHeaderTest.php b/tests/Browser/SignatureLabelHeaderTest.php
index 75325fa75..ec9f7456f 100644
--- a/tests/Browser/SignatureLabelHeaderTest.php
+++ b/tests/Browser/SignatureLabelHeaderTest.php
@@ -103,58 +103,6 @@ test('signature edit uses a centered dialog and resets canceled changes', functi
->and($signature->fresh()->content)->toBe('#updated');
});
-test('label edit uses a centered dialog and resets canceled changes', function () {
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create([
- 'account_id' => $user->account_id,
- 'user_id' => $user->id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- $label = WorkspaceLabel::factory()->create([
- 'workspace_id' => $workspace->id,
- 'name' => 'Original label',
- ]);
- $this->actingAs($user);
-
- $page = visit(route('app.labels.index'));
- $page
- ->click("@label-row-{$label->id}")
- ->assertVisible('@edit-label-dialog')
- ->fill('@edit-label-name', 'Unsaved name')
- ->click('@cancel-edit-label')
- ->assertMissing('@edit-label-dialog')
- ->click("@label-row-{$label->id}")
- ->assertValue('@edit-label-name', 'Original label');
-
- $layout = $page->script(<<<'JS'
- (async () => {
- const dialog = document.querySelector('[data-testid="edit-label-dialog"]');
- await Promise.all(dialog.getAnimations().map((animation) => animation.finished));
- const rect = dialog.getBoundingClientRect();
- const cancel = dialog.querySelector('[data-testid="cancel-edit-label"]');
- const save = dialog.querySelector('[data-testid="submit-edit-label"]');
-
- return {
- centered: Math.abs(rect.left + rect.width / 2 - window.innerWidth / 2) < 2,
- cancelBeforeSave: cancel.getBoundingClientRect().right <= save.getBoundingClientRect().left,
- };
- })();
- JS);
-
- expect($layout)
- ->centered->toBeTrue()
- ->cancelBeforeSave->toBeTrue();
-
- $page
- ->fill('@edit-label-name', 'Updated label')
- ->click('@submit-edit-label')
- ->assertMissing('@edit-label-dialog')
- ->assertNoJavaScriptErrors();
-
- expect($label->fresh()->name)->toBe('Updated label');
-});
-
test('label and signature deletion use a plain confirmation without typing', function () {
$user = User::factory()->create();
$workspace = Workspace::factory()->create([
@@ -194,78 +142,3 @@ test('label and signature deletion use a plain confirmation without typing', fun
expect($label->fresh()->trashed())->toBeTrue()
->and($signature->fresh()->trashed())->toBeTrue();
});
-
-test('signature and label rows do not show the creation date', function () {
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create([
- 'account_id' => $user->account_id,
- 'user_id' => $user->id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
-
- $signature = WorkspaceSignature::factory()->create([
- 'workspace_id' => $workspace->id,
- 'created_at' => '2025-01-15 10:00:00',
- ]);
- $label = WorkspaceLabel::factory()->create([
- 'workspace_id' => $workspace->id,
- 'created_at' => '2025-01-15 10:00:00',
- ]);
-
- $this->actingAs($user);
-
- visit(route('app.signatures.index'))
- ->assertVisible("@signature-row-{$signature->id}")
- ->assertScript("document.querySelector('[data-testid=\"signature-row-{$signature->id}\"]').innerText.includes('2025')", false)
- ->assertNoJavaScriptErrors();
-
- visit(route('app.labels.index'))
- ->assertVisible("@label-row-{$label->id}")
- ->assertScript("document.querySelector('[data-testid=\"label-row-{$label->id}\"]').innerText.includes('2025')", false)
- ->assertNoJavaScriptErrors();
-});
-
-test('hovering a label row keeps the card background', function () {
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create([
- 'account_id' => $user->account_id,
- 'user_id' => $user->id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
-
- $label = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id]);
-
- $this->actingAs($user);
-
- $page = visit(route('app.labels.index'))->assertVisible("@label-row-{$label->id}");
-
- $background = $page->script("getComputedStyle(document.querySelector('[data-testid=\"label-row-{$label->id}\"]')).backgroundColor");
-
- $page->hover("@label-row-{$label->id}")
- ->assertScript("getComputedStyle(document.querySelector('[data-testid=\"label-row-{$label->id}\"]')).backgroundColor", $background)
- ->assertNoJavaScriptErrors();
-});
-
-test('hovering a signature row keeps the card background', function () {
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create([
- 'account_id' => $user->account_id,
- 'user_id' => $user->id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
-
- $signature = WorkspaceSignature::factory()->create(['workspace_id' => $workspace->id]);
-
- $this->actingAs($user);
-
- $page = visit(route('app.signatures.index'))->assertVisible("@signature-row-{$signature->id}");
-
- $background = $page->script("getComputedStyle(document.querySelector('[data-testid=\"signature-row-{$signature->id}\"]')).backgroundColor");
-
- $page->hover("@signature-row-{$signature->id}")
- ->assertScript("getComputedStyle(document.querySelector('[data-testid=\"signature-row-{$signature->id}\"]')).backgroundColor", $background)
- ->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/SignaturesPageTest.php b/tests/Browser/SignaturesPageTest.php
index d361ce054..52eb9f592 100644
--- a/tests/Browser/SignaturesPageTest.php
+++ b/tests/Browser/SignaturesPageTest.php
@@ -109,27 +109,6 @@ test('clearing a signature search never flashes the no signatures state', functi
$page->assertVisible("@signature-row-{$signature->id}")->assertNoJavaScriptErrors();
});
-test('a long signatures list starts at the top and scrolls normally', function () {
- [$user, $workspace] = signaturesPageOwner();
- WorkspaceSignature::factory()->count(30)->create(['workspace_id' => $workspace->id]);
- $this->actingAs($user);
-
- $page = visit(route('app.signatures.index'));
- waitForSignaturesPageTestId($page, 'header-title');
-
- expect($page->script(<<<'JS'
- (() => {
- const scroller = document.querySelector('[data-testid="app-layout-scroller"]');
- const top = document.querySelector('[data-testid="header-title"]').getBoundingClientRect().top - scroller.getBoundingClientRect().top;
- const scrolls = scroller.scrollHeight > scroller.clientHeight;
- scroller.scrollTop = scroller.scrollHeight;
- return [document.querySelector('[data-testid="settings-centered"]') === null, top < 120, scrolls, scroller.scrollTop > 0];
- })()
- JS))->toBe([true, true, true, true]);
-
- $page->assertNoJavaScriptErrors();
-});
-
test('the signatures empty state is never cut off on a short screen', function () {
[$user] = signaturesPageOwner();
$this->actingAs($user);
@@ -152,48 +131,3 @@ test('the signatures empty state is never cut off on a short screen', function (
$page->assertNoJavaScriptErrors();
});
-
-test('the signature dialog uses the standard dialog buttons and copy', function () {
- [$user] = signaturesPageOwner();
- $this->actingAs($user);
-
- $page = visit(route('app.signatures.index'));
- waitForSignaturesPageTestId($page, 'signatures-empty-create');
- $page->click('@signatures-empty-create');
- waitForSignaturesPageTestId($page, 'create-signature-sheet');
-
- $page->assertSeeIn('@create-signature-sheet', __('signatures.create.description'));
-
- [$cancel, $submit] = $page->script(<<<'JS'
- (() => ['cancel-create-signature', 'submit-create-signature'].map((id) =>
- Math.round(document.querySelector(`[data-testid="${id}"]`).getBoundingClientRect().height)
- ))()
- JS);
-
- expect($cancel)->toBe($submit)->toBeLessThan(36);
-
- $page->assertNoJavaScriptErrors();
-});
-
-test('a signature row previews its text and keeps its actions in one menu', function () {
- [$user, $workspace] = signaturesPageOwner();
- $signature = WorkspaceSignature::factory()->create([
- 'workspace_id' => $workspace->id,
- 'name' => 'Launch',
- 'content' => '#launch #trypost',
- ]);
- $this->actingAs($user);
-
- $page = visit(route('app.signatures.index'));
- waitForSignaturesPageTestId($page, "signature-row-{$signature->id}");
-
- $page->assertSeeIn("@signature-preview-{$signature->id}", '#launch #trypost')
- ->click("@signature-menu-{$signature->id}");
- waitForSignaturesPageTestId($page, "edit-signature-{$signature->id}");
-
- $page->assertVisible("@delete-signature-{$signature->id}")
- ->click("@edit-signature-{$signature->id}");
- waitForSignaturesPageTestId($page, 'edit-signature-sheet');
-
- $page->assertVisible('@edit-signature-sheet')->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/SignupPreferencesTest.php b/tests/Browser/SignupPreferencesTest.php
index a92765964..ea9a39e1c 100644
--- a/tests/Browser/SignupPreferencesTest.php
+++ b/tests/Browser/SignupPreferencesTest.php
@@ -31,7 +31,6 @@ test('the register form sends the zone, week start and clock the browser reports
$page->assertNoJavaScriptErrors();
})->with([
'United States' => ['en-US', 'America/New_York', 'sunday', '12h'],
- 'Brazil' => ['pt-BR', 'America/Sao_Paulo', 'sunday', '24h'],
'Germany' => ['de-DE', 'Europe/Berlin', 'monday', '24h'],
]);
diff --git a/tests/Browser/WebhookCreateDialogTest.php b/tests/Browser/WebhookCreateDialogTest.php
index 78b1f6f65..765ffe024 100644
--- a/tests/Browser/WebhookCreateDialogTest.php
+++ b/tests/Browser/WebhookCreateDialogTest.php
@@ -2,7 +2,6 @@
declare(strict_types=1);
-use App\Enums\User\Locale;
use App\Models\User;
use App\Models\Webhook;
use App\Models\Workspace;
@@ -69,17 +68,7 @@ test('creating a webhook happens in a centered dialog with cancel before the pri
->click('@create-webhook-events-post-created')
->assertEnabled('@create-webhook-submit')
->click('@create-webhook-events-post-created')
- ->assertDisabled('@create-webhook-submit')
- ->assertNoJavaScriptErrors();
-});
-
-test('the events picker selects all, deselects all and toggles a row while counting the selection', function () {
- $this->actingAs(webhookCreateDialogAdmin());
-
- $page = visit(route('app.webhooks.index'));
- waitForWebhookCreateTestId($page, 'webhooks-empty-create');
- $page->click('@webhooks-empty-create');
- waitForWebhookCreateTestId($page, 'create-webhook-events-toggle-all');
+ ->assertDisabled('@create-webhook-submit');
$checkedCount = "document.querySelectorAll('[data-testid=\"create-webhook-events\"] [role=\"checkbox\"][data-state=\"checked\"]').length";
@@ -91,67 +80,25 @@ test('the events picker selects all, deselects all and toggles a row while count
->assertScript($checkedCount, 7)
->assertSeeIn('@create-webhook-events-count', '7 of 7 selected')
->assertSeeIn('@create-webhook-events-toggle-all', __('posts.composer.deselect_all'))
+ ->assertEnabled('@create-webhook-submit')
->click('@create-webhook-events-toggle-all')
->assertScript($checkedCount, 0)
->assertSeeIn('@create-webhook-events-count', '0 of 7 selected')
- ->assertSeeIn('@create-webhook-events-toggle-all', __('posts.composer.select_all'))
+ ->assertDisabled('@create-webhook-submit')
->click('@create-webhook-events-post-failed-description')
->assertScript("document.querySelector('[data-testid=\"create-webhook-events-post-failed-checkbox\"]').getAttribute('data-state')", 'checked')
->assertSeeIn('@create-webhook-events-count', '1 of 7 selected')
->click('@create-webhook-events-post-failed-checkbox')
->assertScript("document.querySelector('[data-testid=\"create-webhook-events-post-failed-checkbox\"]').getAttribute('data-state')", 'unchecked')
->assertSeeIn('@create-webhook-events-count', '0 of 7 selected')
- ->assertNoJavaScriptErrors();
-});
-
-test('the create button stays disabled until an endpoint and an event are set', function () {
- $this->actingAs(webhookCreateDialogAdmin());
-
- $page = visit(route('app.webhooks.index'));
- waitForWebhookCreateTestId($page, 'webhooks-empty-create');
- $page->click('@webhooks-empty-create');
- waitForWebhookCreateTestId($page, 'create-webhook-endpoint');
+ ->click('@create-webhook-events-post-published')
+ ->click('@cancel-create-webhook');
+ waitForWebhookCreateTestIdGone($page, 'create-webhook-dialog');
- $page->click('@create-webhook-events-toggle-all')
- ->assertDisabled('@create-webhook-submit')
- ->fill('@create-webhook-endpoint', 'https://example.com/hooks')
- ->assertEnabled('@create-webhook-submit')
- ->click('@create-webhook-events-toggle-all')
- ->assertDisabled('@create-webhook-submit')
+ $page->assertMissing('@create-webhook-dialog')
->assertNoJavaScriptErrors();
-});
-test('the endpoint helper and event descriptions stay on one line in every language', function () {
- $user = webhookCreateDialogAdmin();
- $wrapped = [];
-
- foreach (Locale::cases() as $locale) {
- $user->update(['locale' => $locale]);
- $this->actingAs($user->fresh());
-
- $page = visit(route('app.webhooks.index'));
- waitForWebhookCreateTestId($page, 'webhooks-empty-create');
- $page->click('@webhooks-empty-create');
- waitForWebhookCreateTestId($page, 'create-webhook-events-post-created-description');
-
- $lines = $page->script(<<<'JS'
- [...document.querySelectorAll('[data-testid="create-webhook-endpoint-help"], [data-testid="create-webhook-events-count"], [data-testid="create-webhook-events-toggle-all"], [data-testid$="-description"]')]
- .map((element) => {
- const range = document.createRange();
- range.selectNodeContents(element);
- const tops = new Set([...range.getClientRects()].filter((rect) => rect.width > 0).map((rect) => Math.round(rect.top)));
- return [element.textContent.trim(), tops.size];
- })
- .filter(([, lineCount]) => lineCount > 1)
- .map(([text]) => text)
- JS);
-
- foreach ($lines as $text) {
- $wrapped[] = "{$locale->value}: {$text}";
- }
- }
-
- expect($wrapped)->toBe([]);
+ expect(Webhook::query()->count())->toBe(0);
});
test('an invalid endpoint shows an inline error and a valid one opens the new webhook page', function () {
@@ -194,25 +141,6 @@ test('an invalid endpoint shows an inline error and a valid one opens the new we
->assertNoJavaScriptErrors();
});
-test('cancel closes the dialog without creating a webhook', function () {
- $this->actingAs(webhookCreateDialogAdmin());
-
- $page = visit(route('app.webhooks.index'));
- waitForWebhookCreateTestId($page, 'webhooks-empty-create');
- $page->click('@webhooks-empty-create');
- waitForWebhookCreateTestId($page, 'create-webhook-endpoint');
-
- $page->fill('@create-webhook-endpoint', 'https://example.com/hooks')
- ->click('@create-webhook-events-post-published')
- ->click('@cancel-create-webhook');
- waitForWebhookCreateTestIdGone($page, 'create-webhook-dialog');
-
- $page->assertMissing('@create-webhook-dialog')
- ->assertNoJavaScriptErrors();
-
- expect(Webhook::query()->count())->toBe(0);
-});
-
test('a workspace without webhooks shows only the centered illustration with a create button', function () {
$this->actingAs(webhookCreateDialogAdmin());
@@ -235,17 +163,3 @@ test('a workspace without webhooks shows only the centered illustration with a c
$page->assertNoJavaScriptErrors();
});
-
-test('a workspace with webhooks keeps the header and the list at the top', function () {
- $user = webhookCreateDialogAdmin();
- Webhook::factory()->create(['workspace_id' => $user->current_workspace_id]);
- $this->actingAs($user);
-
- $page = visit(route('app.webhooks.index'));
- waitForWebhookCreateTestId($page, 'header-title');
-
- $page->assertVisible('@create-webhook-button')
- ->assertMissing('@webhooks-empty')
- ->assertMissing('@settings-centered')
- ->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/WebhookDeleteTest.php b/tests/Browser/WebhookDeleteTest.php
index 78596bc5c..5844b2b10 100644
--- a/tests/Browser/WebhookDeleteTest.php
+++ b/tests/Browser/WebhookDeleteTest.php
@@ -20,40 +20,7 @@ function waitForWebhookDeleteTestId(mixed $page, string $testId): void
JS);
}
-test('deleting a webhook asks for confirmation without typing a keyword', function () {
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create([
- 'account_id' => $user->account_id,
- 'user_id' => $user->id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
- $webhook = Webhook::factory()->create(['workspace_id' => $workspace->id]);
- $this->actingAs($user);
-
- $page = visit(route('app.webhooks.index'));
- waitForWebhookDeleteTestId($page, "webhook-row-{$webhook->id}");
- $page->click("[data-testid=\"webhook-row-{$webhook->id}\"] [data-testid=\"row-actions-trigger\"]");
- waitForWebhookDeleteTestId($page, 'delete-webhook-button');
-
- expect($page->script('location.pathname'))->toBe(route('app.webhooks.index', absolute: false));
-
- $page->click('@delete-webhook-button');
- waitForWebhookDeleteTestId($page, 'confirm-delete-action');
-
- $page->assertMissing('@confirm-delete-input')
- ->click('@confirm-delete-action');
-
- for ($attempt = 0; $attempt < 50 && Webhook::query()->whereKey($webhook->id)->exists(); $attempt++) {
- $page->script('new Promise((resolve) => setTimeout(resolve, 100))');
- }
-
- expect(Webhook::query()->whereKey($webhook->id)->exists())->toBeFalse();
- $page->assertNoJavaScriptErrors();
-});
-
-test('a webhook row highlights the host, shows its status and opens the details from the menu', function () {
+test('the webhook list shows the host and status, deletes without typing and opens the details from the menu', function () {
$user = User::factory()->create();
$workspace = Workspace::factory()->create([
'account_id' => $user->account_id,
@@ -62,6 +29,7 @@ test('a webhook row highlights the host, shows its status and opens the details
$workspace->members()->attach($user->id, membershipPivot('admin'));
$user->update(['current_workspace_id' => $workspace->id]);
subscribeAccount($user->account);
+ $doomed = Webhook::factory()->create(['workspace_id' => $workspace->id]);
$webhook = Webhook::factory()->create([
'workspace_id' => $workspace->id,
'endpoint' => 'https://hooks.example.com/trypost/inbound?token=abc',
@@ -71,6 +39,11 @@ test('a webhook row highlights the host, shows its status and opens the details
$page = visit(route('app.webhooks.index'));
waitForWebhookDeleteTestId($page, "webhook-row-{$webhook->id}");
+ $page->assertVisible('@create-webhook-button')
+ ->assertVisible('@header-title')
+ ->assertMissing('@webhooks-empty')
+ ->assertMissing('@settings-centered');
+
expect($page->script(<<<JS
(() => {
const spans = document.querySelectorAll('[data-testid="webhook-endpoint-{$webhook->id}"] span');
@@ -80,7 +53,28 @@ test('a webhook row highlights the host, shows its status and opens the details
$page->assertSeeIn("@webhook-status-{$webhook->id}", __("webhooks.status.{$webhook->status->value}"))
->assertVisible("@webhook-status-dot-{$webhook->id}")
- ->click("[data-testid=\"webhook-row-{$webhook->id}\"] [data-testid=\"row-actions-trigger\"]");
+ ->click("[data-testid=\"webhook-row-{$doomed->id}\"] [data-testid=\"row-actions-trigger\"]");
+ waitForWebhookDeleteTestId($page, 'delete-webhook-button');
+
+ expect($page->script('location.pathname'))->toBe(route('app.webhooks.index', absolute: false));
+
+ $page->click('@delete-webhook-button');
+ waitForWebhookDeleteTestId($page, 'confirm-delete-action');
+
+ $page->assertMissing('@confirm-delete-input')
+ ->click('@confirm-delete-action');
+
+ $page->script(<<<JS
+ (async () => {
+ for (let i = 0; i < 100 && document.querySelector('[data-testid="webhook-row-{$doomed->id}"]'); i++) {
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ }
+ })()
+ JS);
+
+ expect(Webhook::query()->whereKey($doomed->id)->exists())->toBeFalse();
+
+ $page->click("[data-testid=\"webhook-row-{$webhook->id}\"] [data-testid=\"row-actions-trigger\"]");
waitForWebhookDeleteTestId($page, "view-webhook-{$webhook->id}");
$page->click("@view-webhook-{$webhook->id}");
diff --git a/tests/Browser/WebhookShowTest.php b/tests/Browser/WebhookShowTest.php
index a77bc2ab1..dcb50f949 100644
--- a/tests/Browser/WebhookShowTest.php
+++ b/tests/Browser/WebhookShowTest.php
@@ -2,15 +2,12 @@
declare(strict_types=1);
-use App\Enums\User\Locale;
use App\Enums\Webhook\EventType;
-use App\Jobs\DispatchWebhook;
use App\Models\User;
use App\Models\Webhook;
use App\Models\WebhookLog;
use App\Models\Workspace;
use App\Services\WebhookService;
-use Illuminate\Support\Facades\Queue;
function waitForWebhookShowTestId(mixed $page, string $testId): void
{
@@ -92,84 +89,6 @@ test('the header shows the host, the path and the status', function () {
$page->assertNoJavaScriptErrors();
});
-test('the actions menu edits the endpoint and deletes the webhook after a plain confirmation', function () {
- [$user, $webhook] = webhookShowFixture();
- $this->actingAs($user);
-
- $page = visit(route('app.webhooks.show', $webhook));
- waitForWebhookShowTestId($page, 'webhook-actions-trigger');
- $page->click('@webhook-actions-trigger');
- waitForWebhookShowTestId($page, 'edit-webhook-button');
-
- $page->assertVisible('@toggle-webhook-status')
- ->assertMissing('@copy-id-button')
- ->assertVisible('@rotate-secret-menu-item')
- ->click('@edit-webhook-button');
- waitForWebhookShowTestId($page, 'edit-webhook-dialog');
-
- $page->assertValue('@edit-webhook-endpoint', 'https://hooks.example.com/trypost/inbound')
- ->click('@cancel-edit-webhook');
- waitForWebhookShowCondition($page, "!document.querySelector('[data-testid=\"edit-webhook-dialog\"]')");
-
- $page->click('@webhook-actions-trigger');
- waitForWebhookShowTestId($page, 'delete-webhook-button');
- $page->click('@delete-webhook-button');
- waitForWebhookShowTestId($page, 'confirm-delete-action');
-
- $page->assertMissing('@confirm-delete-input')
- ->click('@confirm-delete-action');
-
- $indexPath = route('app.webhooks.index', absolute: false);
- waitForWebhookShowCondition($page, "location.pathname === '{$indexPath}'");
-
- expect(Webhook::query()->whereKey($webhook->id)->exists())->toBeFalse()
- ->and($page->script('location.pathname'))->toBe($indexPath);
- $page->assertNoJavaScriptErrors();
-});
-
-test('the actions menu pauses an enabled webhook', function () {
- [$user, $webhook] = webhookShowFixture();
- $this->actingAs($user);
-
- $page = visit(route('app.webhooks.show', $webhook));
- waitForWebhookShowTestId($page, 'webhook-actions-trigger');
- $page->click('@webhook-actions-trigger');
- waitForWebhookShowTestId($page, 'toggle-webhook-status');
- $page->click('@toggle-webhook-status');
-
- $disabled = __('webhooks.status.disabled');
- waitForWebhookShowCondition($page, "document.querySelector('[data-testid=\"webhook-status\"]').textContent.includes('{$disabled}')");
-
- $page->assertSeeIn('@webhook-status', $disabled)
- ->assertNoJavaScriptErrors();
- expect($webhook->fresh()->status->value)->toBe('disabled');
-});
-
-test('send test event pings the endpoint', function () {
- [$user, $webhook] = webhookShowFixture();
- $this->mock(WebhookService::class)
- ->shouldReceive('ping')
- ->once()
- ->with('https://hooks.example.com/trypost/inbound', Mockery::type('string'));
- $this->actingAs($user);
-
- $page = visit(route('app.webhooks.show', $webhook));
- waitForWebhookShowTestId($page, 'send-test-webhook');
- $page->click('@send-test-webhook');
- waitForWebhookShowCondition($page, "document.querySelector('[data-sonner-toast]') !== null");
-
- $page->assertSee(__('webhooks.flash.tested'));
-
- expect($page->script(<<<'JS'
- (() => {
- const toast = document.querySelector('[data-sonner-toast]');
- return [toast.querySelector('[data-icon] svg')?.classList.contains('tabler-icon') ?? false, Math.round(toast.getBoundingClientRect().width) >= 356];
- })()
- JS))->toBe([true, true]);
-
- $page->assertNoJavaScriptErrors();
-});
-
test('the newest delivery is selected by default and selecting a row shows its payload inline', function () {
[$user, $webhook] = webhookShowFixture();
$older = WebhookLog::factory()->create([
@@ -208,25 +127,57 @@ test('the newest delivery is selected by default and selecting a row shows its p
->assertNoJavaScriptErrors();
});
-test('replay from the detail pane dispatches the selected delivery again', function () {
- Queue::fake();
+test('the actions menu pauses, edits and deletes the webhook after a plain confirmation', function () {
[$user, $webhook] = webhookShowFixture();
- WebhookLog::factory()->create(['webhook_id' => $webhook->id]);
$this->actingAs($user);
$page = visit(route('app.webhooks.show', $webhook));
- waitForWebhookShowTestId($page, 'replay-log');
- $page->click('@replay-log');
- waitForWebhookShowCondition($page, "document.querySelector('[data-sonner-toast]') !== null");
+ waitForWebhookShowTestId($page, 'webhook-actions-trigger');
+ $page->click('@webhook-actions-trigger');
+ waitForWebhookShowTestId($page, 'toggle-webhook-status');
- $page->assertSee(__('webhooks.flash.replayed'))
- ->assertNoJavaScriptErrors();
- Queue::assertPushed(DispatchWebhook::class, 1);
+ $page->assertMissing('@copy-id-button')
+ ->assertVisible('@rotate-secret-menu-item')
+ ->click('@toggle-webhook-status');
+
+ $disabled = __('webhooks.status.disabled');
+ waitForWebhookShowCondition($page, "document.querySelector('[data-testid=\"webhook-status\"]').textContent.includes('{$disabled}')");
+
+ $page->assertSeeIn('@webhook-status', $disabled);
+ expect($webhook->fresh()->status->value)->toBe('disabled');
+
+ waitForWebhookShowCondition($page, "!document.querySelector('[data-testid=\"toggle-webhook-status\"]')");
+ $page->click('@webhook-actions-trigger');
+ waitForWebhookShowTestId($page, 'edit-webhook-button');
+ $page->click('@edit-webhook-button');
+ waitForWebhookShowTestId($page, 'edit-webhook-dialog');
+
+ $page->assertValue('@edit-webhook-endpoint', 'https://hooks.example.com/trypost/inbound')
+ ->click('@cancel-edit-webhook');
+ waitForWebhookShowCondition($page, "!document.querySelector('[data-testid=\"edit-webhook-dialog\"]')");
+
+ $page->click('@webhook-actions-trigger');
+ waitForWebhookShowTestId($page, 'delete-webhook-button');
+ $page->click('@delete-webhook-button');
+ waitForWebhookShowTestId($page, 'confirm-delete-action');
+
+ $page->assertMissing('@confirm-delete-input')
+ ->click('@confirm-delete-action');
+
+ $indexPath = route('app.webhooks.index', absolute: false);
+ waitForWebhookShowCondition($page, "location.pathname === '{$indexPath}'");
+
+ expect(Webhook::query()->whereKey($webhook->id)->exists())->toBeFalse()
+ ->and($page->script('location.pathname'))->toBe($indexPath);
+ $page->assertNoJavaScriptErrors();
});
-test('a webhook without deliveries shows the empty state with a send test button', function () {
+test('send test event pings the endpoint from the header and from the empty deliveries state', function () {
[$user, $webhook] = webhookShowFixture();
- $this->mock(WebhookService::class)->shouldReceive('ping')->once();
+ $this->mock(WebhookService::class)
+ ->shouldReceive('ping')
+ ->twice()
+ ->with('https://hooks.example.com/trypost/inbound', Mockery::type('string'));
$this->actingAs($user);
$page = visit(route('app.webhooks.show', $webhook));
@@ -239,44 +190,19 @@ test('a webhook without deliveries shows the empty state with a send test button
->click('@webhook-deliveries-send-test');
waitForWebhookShowCondition($page, "document.querySelector('[data-sonner-toast]') !== null");
- $page->assertNoJavaScriptErrors();
-});
+ $page->assertSee(__('webhooks.flash.tested'));
-test('header and section buttons and menu items stay on one line in every language', function () {
- [$user, $webhook] = webhookShowFixture();
- $wrapped = [];
-
- foreach (Locale::cases() as $locale) {
- $user->update(['locale' => $locale]);
- $this->actingAs($user->fresh());
-
- $page = visit(route('app.webhooks.show', $webhook));
- waitForWebhookShowTestId($page, 'webhook-actions-trigger');
- $page->click('@webhook-actions-trigger');
- waitForWebhookShowTestId($page, 'delete-webhook-button');
-
- $lines = $page->script(<<<'JS'
- [...document.querySelectorAll('[data-testid="send-test-webhook"], [data-testid="edit-webhook-events"], [data-testid="rotate-secret-button"], [data-testid="webhook-back"], [data-testid="webhook-deliveries-send-test"], [role="menuitem"]')]
- .map((element) => {
- const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
- const tops = new Set();
- while (walker.nextNode()) {
- const range = document.createRange();
- range.selectNodeContents(walker.currentNode);
- [...range.getClientRects()].filter((rect) => rect.width > 0).forEach((rect) => tops.add(Math.round(rect.top)));
- }
- return [element.textContent.trim(), tops.size];
- })
- .filter(([, lineCount]) => lineCount > 1)
- .map(([text]) => text)
- JS);
-
- foreach ($lines as $text) {
- $wrapped[] = "{$locale->value}: {$text}";
- }
- }
-
- expect($wrapped)->toBe([]);
+ expect($page->script(<<<'JS'
+ (() => {
+ const toast = document.querySelector('[data-sonner-toast]');
+ return [toast.querySelector('[data-icon] svg')?.classList.contains('tabler-icon') ?? false, Math.round(toast.getBoundingClientRect().width) >= 356];
+ })()
+ JS))->toBe([true, true]);
+
+ $page->click('@send-test-webhook');
+ waitForWebhookShowCondition($page, "document.querySelectorAll('[data-sonner-toast]').length >= 2");
+
+ $page->assertNoJavaScriptErrors();
});
test('a live delivery update never shows the same delivery twice', function () {
diff --git a/tests/Browser/WelcomeMobileTest.php b/tests/Browser/WelcomeMobileTest.php
index b95eae25a..c3d8ddc26 100644
--- a/tests/Browser/WelcomeMobileTest.php
+++ b/tests/Browser/WelcomeMobileTest.php
@@ -3,7 +3,6 @@
declare(strict_types=1);
use App\Enums\User\Goal;
-use App\Enums\User\Locale;
use App\Enums\User\Persona;
use App\Enums\User\ReferralSource;
use App\Models\SocialAccount;
@@ -114,78 +113,41 @@ function welcomeMobileContinueFits(mixed $page, string $testId, string $optionPr
JS);
}
-test('the welcome header fits a phone in every language on the persona step', function () {
- config(['trypost.self_hosted' => false]);
-
- $user = welcomeMobileOwner();
- $this->actingAs($user);
-
- $failures = [];
-
- foreach (Locale::cases() as $locale) {
- $user->update(['locale' => $locale]);
-
- $page = visit(route('app.welcome.persona'))->resize(390, 844);
- waitForWelcomeMobileTestId($page, 'theme-toggle-cycle');
- waitForWelcomeMobileTestId($page, 'welcome-step-persona');
-
- $result = welcomeMobileHeaderProblems($page);
-
- foreach ($result['problems'] as $problem) {
- $failures[] = "{$locale->value}: {$problem}";
- }
-
- if (! $result['stepsAboveTitle']) {
- $failures[] = "{$locale->value}: step dots are not centered above the title";
- }
- }
-
- expect($failures)->toBe([]);
-});
-
-test('the welcome header fits a phone on the goals and plan steps', function (string $route, array $attributes) {
+test('the welcome header fits a phone and the continue button stays on screen', function (string $route, array $attributes, ?string $continue, ?string $optionPrefix, bool $hasBack) {
config(['trypost.self_hosted' => false]);
$this->actingAs(welcomeMobileOwner($attributes));
$page = visit(route($route))->resize(390, 844);
waitForWelcomeMobileTestId($page, 'theme-toggle-cycle');
- waitForWelcomeMobileTestId($page, 'welcome-back');
+ waitForWelcomeMobileTestId($page, $hasBack ? 'welcome-back' : 'welcome-step-persona');
$result = welcomeMobileHeaderProblems($page);
expect($result['problems'])->toBe([])
->and($result['stepsAboveTitle'])->toBeTrue();
- $page->assertVisible('@welcome-back')
- ->assertMissing('@theme-toggle')
+ if ($continue !== null) {
+ $fits = welcomeMobileContinueFits($page, $continue, $optionPrefix);
+
+ expect($fits['visible'])->toBeTrue()
+ ->and($fits['lastClear'])->toBeTrue();
+ }
+
+ if ($hasBack) {
+ $page->assertVisible('@welcome-back');
+ }
+
+ $page->assertMissing('@theme-toggle')
->assertNoJavaScriptErrors();
})->with([
- 'goals' => ['app.welcome.goals', ['persona' => Persona::Agency->value]],
+ 'persona' => ['app.welcome.persona', [], 'welcome-persona-continue', 'welcome-persona-', false],
+ 'goals' => ['app.welcome.goals', ['persona' => Persona::Agency->value], 'welcome-goals-continue', 'welcome-goal-', true],
'plan' => ['app.welcome.plan', [
'persona' => Persona::Agency->value,
'goals' => [Goal::SaveTime->value],
'referral_source' => ReferralSource::ProductHunt->value,
- ]],
-]);
-
-test('the continue button stays on screen on a phone', function (string $route, array $attributes, string $continue, string $optionPrefix) {
- config(['trypost.self_hosted' => false]);
-
- $this->actingAs(welcomeMobileOwner($attributes));
-
- $page = visit(route($route))->resize(390, 844);
- waitForWelcomeMobileTestId($page, $continue);
-
- $result = welcomeMobileContinueFits($page, $continue, $optionPrefix);
-
- expect($result['visible'])->toBeTrue()
- ->and($result['lastClear'])->toBeTrue();
-
- $page->assertNoJavaScriptErrors();
-})->with([
- 'persona' => ['app.welcome.persona', [], 'welcome-persona-continue', 'welcome-persona-'],
- 'goals' => ['app.welcome.goals', ['persona' => Persona::Agency->value], 'welcome-goals-continue', 'welcome-goal-'],
+ ], null, null, true],
]);
test('the plan step lists the features once on a phone and per plan on desktop', function () {
diff --git a/tests/Browser/WelcomeOptionsFitTest.php b/tests/Browser/WelcomeOptionsFitTest.php
deleted file mode 100644
index 7b39670ef..000000000
--- a/tests/Browser/WelcomeOptionsFitTest.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-use App\Enums\User\Goal;
-use App\Enums\User\Locale;
-use App\Enums\User\Persona;
-use App\Models\User;
-use App\Models\Workspace;
-
-function waitForWelcomeOptionsTestId(mixed $page, string $testId): void
-{
- $page->script(<<<JS
- (async () => {
- const selector = '[data-testid="{$testId}"]';
- for (let attempt = 0; attempt < 200; attempt++) {
- const element = document.querySelector(selector);
- if (element && element.getBoundingClientRect().height > 0) return;
- await new Promise((resolve) => setTimeout(resolve, 50));
- }
- })();
- JS);
-
- waitForWebFonts($page);
-}
-
-test('every welcome option label fits on one line in every language', function (string $route, array $attributes, string $testIdPrefix, string $langPrefix, array $values) {
- config(['trypost.self_hosted' => false]);
-
- $user = User::factory()->create($attributes);
- $workspace = Workspace::factory()->create([
- 'account_id' => $user->account_id,
- 'user_id' => $user->id,
- ]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
-
- $this->actingAs($user->fresh());
-
- $page = visit(route($route))->resize(1280, 900);
- waitForWelcomeOptionsTestId($page, "{$testIdPrefix}-{$values[0]}-label");
-
- $translations = collect($values)
- ->mapWithKeys(fn (string $value): array => [$value => collect(Locale::cases())
- ->mapWithKeys(fn (Locale $locale): array => [$locale->value => __("{$langPrefix}.{$value}", [], $locale->value)])
- ->all()])
- ->all();
-
- $json = json_encode($translations, JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $wrapped = $page->script(<<<JS
- (() => {
- const translations = {$json};
- const wrapped = [];
- for (const [value, texts] of Object.entries(translations)) {
- const element = document.querySelector('[data-testid="{$testIdPrefix}-' + value + '-label"]');
- const lineHeight = parseFloat(getComputedStyle(element).lineHeight);
- for (const [locale, text] of Object.entries(texts)) {
- element.textContent = text;
- if (Math.round(element.getBoundingClientRect().height / lineHeight) > 1) {
- wrapped.push(locale + ': ' + value + ' — ' + text);
- }
- }
- }
- return wrapped;
- })()
- JS);
-
- expect($wrapped)->toBe([]);
-})->with([
- 'persona' => ['app.welcome.persona', [], 'welcome-persona', 'welcome.personas', array_column(Persona::cases(), 'value')],
- 'goals' => ['app.welcome.goals', ['persona' => Persona::Agency->value], 'welcome-goal', 'welcome.goals', array_column(Goal::cases(), 'value')],
-]);
diff --git a/tests/Browser/WelcomePlanTest.php b/tests/Browser/WelcomePlanTest.php
index ea2155847..9e1ef0bb8 100644
--- a/tests/Browser/WelcomePlanTest.php
+++ b/tests/Browser/WelcomePlanTest.php
@@ -3,7 +3,6 @@
declare(strict_types=1);
use App\Enums\User\Goal;
-use App\Enums\User\Locale;
use App\Enums\User\Persona;
use App\Enums\User\ReferralSource;
use App\Models\SocialAccount;
@@ -95,47 +94,3 @@ test('the plan step shows both plans with networks and no yearly toggle', functi
->assertMissing('@plan-interval-monthly')
->assertNoJavaScriptErrors();
});
-
-test('every plan feature fits on one line in every language', function () {
- config(['trypost.self_hosted' => false]);
-
- $this->actingAs(welcomeOwnerOnPlanStep());
-
- $page = visit(route('app.welcome.plan'))->resize(1280, 900);
- waitForWelcomePlanTestId($page, 'plan-feature-label-socials-team');
-
- $keys = ['networks_all', 'accounts_unlimited', 'calendar', 'ai', 'mcp', 'repurpose', 'analytics', 'team'];
-
- $translations = collect($keys)
- ->mapWithKeys(fn (string $key): array => [$key => collect(Locale::cases())
- ->mapWithKeys(fn (Locale $locale): array => [$locale->value => __("billing.plans.features.{$key}", [], $locale->value)])
- ->all()])
- ->all();
-
- $json = json_encode($translations, JSON_UNESCAPED_UNICODE | JSON_HEX_APOS | JSON_HEX_QUOT);
-
- $wrapped = $page->script(<<<JS
- (() => {
- const translations = {$json};
- const wrapped = [];
- for (const [key, texts] of Object.entries(translations)) {
- const label = document.querySelector('[data-testid="plan-feature-label-socials-' + key + '"]');
- const wrapper = label.parentElement;
- const available = wrapper.parentElement.getBoundingClientRect().width - 24;
- const siblings = [...wrapper.children]
- .filter((child) => child !== label)
- .reduce((total, child) => total + child.getBoundingClientRect().width + 6, 0);
- label.style.whiteSpace = 'nowrap';
- for (const [locale, text] of Object.entries(texts)) {
- label.textContent = text;
- if ((label.getBoundingClientRect().width + siblings) * 1.04 > available) {
- wrapped.push(locale + ': ' + key + ' — ' + text);
- }
- }
- }
- return wrapped;
- })()
- JS);
-
- expect($wrapped)->toBe([]);
-});
diff --git a/tests/Browser/WorkspaceCreateTest.php b/tests/Browser/WorkspaceCreateTest.php
index dcf65a332..36f0501a5 100644
--- a/tests/Browser/WorkspaceCreateTest.php
+++ b/tests/Browser/WorkspaceCreateTest.php
@@ -19,7 +19,7 @@ function waitForWorkspaceCreateTestId(mixed $page, string $testId): void
JS);
}
-test('a workspace is created from its name alone and settings have no brand page', function () {
+test('a workspace is created from its name alone', function () {
config(['trypost.self_hosted' => true]);
$user = User::factory()->create();
@@ -37,11 +37,4 @@ test('a workspace is created from its name alone and settings have no brand page
->assertNoJavaScriptErrors();
expect(Workspace::where('name', 'Second')->exists())->toBeTrue();
-
- $settings = visit(route('app.workspace.settings'));
- waitForWorkspaceCreateTestId($settings, 'settings-sidebar');
-
- $settings->assertVisible('@settings-nav-general')
- ->assertMissing('@settings-nav-brand')
- ->assertNoJavaScriptErrors();
});
diff --git a/tests/Browser/WorkspaceInsightsTest.php b/tests/Browser/WorkspaceInsightsTest.php
index 43f1380c9..758b0ba96 100644
--- a/tests/Browser/WorkspaceInsightsTest.php
+++ b/tests/Browser/WorkspaceInsightsTest.php
@@ -145,23 +145,6 @@ test('workspace dashboard explains the empty state without inventing follower to
->assertNoConsoleLogs();
});
-test('the empty insights hero has no connect button for members who cannot manage channels', function () {
- $owner = User::factory()->create();
- $workspace = Workspace::factory()->create(['user_id' => $owner->id, 'account_id' => $owner->account_id]);
- subscribeAccount($owner->account);
- $member = workspaceMember($workspace);
-
- $this->actingAs($member);
- $page = visit(route('app.insights'));
- waitForWorkspaceInsightsTestId($page, 'analytics-empty-state');
-
- $page->assertVisible('@analytics-empty-state')
- ->assertSee('Turn your posts into insights')
- ->assertMissing('@analytics-empty-connect')
- ->assertNoJavaScriptErrors()
- ->assertNoConsoleLogs();
-});
-
test('the empty insights hero explains pending data once a channel is connected', function () {
Queue::fake([BootstrapAccountAnalytics::class, CollectAccountDailySnapshot::class]);
$user = User::factory()->create();
@@ -241,33 +224,6 @@ test('the custom preset opens the calendar with quick ranges that apply a custom
->assertNoConsoleLogs();
});
-test('the workspace insights page offers exactly 7 days, 30 days, month to date and custom', function () {
- Queue::fake([BootstrapAccountAnalytics::class, CollectAccountDailySnapshot::class]);
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create(['user_id' => $user->id, 'account_id' => $user->account_id]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
- $account = SocialAccount::factory()->instagram()->create(['workspace_id' => $workspace->id]);
- AnalyticsAccountDailySnapshot::factory()->create([
- 'workspace_id' => $workspace->id,
- 'social_account_id' => $account->id,
- 'social_account_key' => $account->id,
- 'platform' => $account->platform,
- 'network' => $account->platform->network(),
- 'platform_user_id' => $account->platform_user_id,
- 'date' => now('UTC')->toDateString(),
- 'followers_count' => 100,
- ]);
-
- $this->actingAs($user);
- $page = visit(route('app.insights'));
- waitForWorkspaceInsightsTestId($page, 'insights-range-7d');
-
- $page->assertScript('Array.from(document.querySelectorAll("[data-testid^=insights-range-]")).map((element) => element.dataset.testid).filter((id) => ["insights-range-7d", "insights-range-30d", "insights-range-mtd", "insights-range-last_month", "insights-range-custom"].includes(id)).join(",")', 'insights-range-7d,insights-range-30d,insights-range-mtd,insights-range-custom')
- ->assertNoJavaScriptErrors();
-});
-
test('a range preset on the workspace dashboard reloads with that range', function () {
Queue::fake([BootstrapAccountAnalytics::class, CollectAccountDailySnapshot::class]);
$user = User::factory()->create();
@@ -307,22 +263,6 @@ test('a range preset on the workspace dashboard reloads with that range', functi
->assertNoConsoleLogs();
});
-test('workspace dashboard is titled Insights for a German user', function () {
- $user = User::factory()->create(['locale' => Locale::German]);
- $workspace = Workspace::factory()->create(['user_id' => $user->id, 'account_id' => $user->account_id]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
-
- $this->actingAs($user);
-
- visit(route('app.insights'))
- ->assertScript('document.querySelector("[data-testid=analytics-page-header]")?.textContent.includes("Insights")', true)
- ->assertScript('document.title.includes("Insights")', true)
- ->assertNoJavaScriptErrors()
- ->assertNoConsoleLogs();
-});
-
test('dashboard refreshes when the first analytics snapshot arrives after opening the page', function () {
Queue::fake([BootstrapAccountAnalytics::class, CollectAccountDailySnapshot::class]);
$user = User::factory()->create();
@@ -464,7 +404,6 @@ test('workspace dashboard abbreviates large percentage changes in the user local
->assertNoJavaScriptErrors()
->assertNoConsoleLogs();
})->with([
- 'English' => [Locale::English, '+186.5K%'],
'Portuguese' => [Locale::PortugueseBrazil, "+186,5\u{00A0}mil%"],
]);
@@ -489,50 +428,6 @@ test('the channel filter offers to connect a channel when the workspace has none
$page->assertVisible('@connect-channel-dialog')->assertNoJavaScriptErrors();
});
-test('the insights toolbar border keeps the page padding instead of touching the panel edges', function () {
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create(['user_id' => $user->id, 'account_id' => $user->account_id]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
- $this->actingAs($user);
-
- $page = visit(route('app.insights'))->resize(1440, 900);
- waitForWorkspaceInsightsTestId($page, 'analytics-toolbar');
-
- $edges = $page->script(<<<'JS'
- (() => {
- const toolbar = document.querySelector('[data-testid="analytics-toolbar"]');
- const row = toolbar.getBoundingClientRect();
- const panel = document.querySelector('[data-slot="sidebar-inset"]').getBoundingClientRect();
- return [Math.round(row.left - panel.left), Math.round(panel.right - row.right), getComputedStyle(toolbar).borderBottomWidth];
- })()
- JS);
-
- expect($edges[0])->toBeGreaterThanOrEqual(32)
- ->and($edges[1])->toBeGreaterThanOrEqual(32)
- ->and($edges[2])->toBe('1px');
- $page->assertNoJavaScriptErrors();
-});
-
-test('the workspace insights page has no label filter', function () {
- Queue::fake([BootstrapAccountAnalytics::class, CollectAccountDailySnapshot::class]);
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create(['user_id' => $user->id, 'account_id' => $user->account_id]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
- SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::Instagram]);
-
- $this->actingAs($user);
- $page = visit(route('app.insights'));
- waitForWorkspaceInsightsTestId($page, 'analytics-filters');
-
- $page->assertVisible('@analytics-channel-filter')
- ->assertMissing('@analytics-label-filter')
- ->assertNoJavaScriptErrors();
-});
-
test('on a phone the workspace insights range presets collapse into a dropdown', function () {
Queue::fake([BootstrapAccountAnalytics::class, CollectAccountDailySnapshot::class]);
$user = User::factory()->create();
@@ -578,22 +473,6 @@ test('on a phone the workspace insights range presets collapse into a dropdown',
->assertNoJavaScriptErrors();
});
-test('on desktop the workspace insights range keeps the segmented control', function () {
- Queue::fake([BootstrapAccountAnalytics::class, CollectAccountDailySnapshot::class]);
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create(['user_id' => $user->id, 'account_id' => $user->account_id]);
- $workspace->members()->attach($user->id, membershipPivot('admin'));
- $user->update(['current_workspace_id' => $workspace->id]);
- subscribeAccount($user->account);
-
- $this->actingAs($user);
- $page = visit(route('app.insights'));
- waitForWorkspaceInsightsTestId($page, 'insights-range-7d');
-
- $page->assertScript('document.querySelector("[data-testid=insights-range-mobile-trigger]").getBoundingClientRect().height', 0)
- ->assertNoJavaScriptErrors();
-});
-
test('charts keep their width while the sidebar animates and resize once it settles', function () {
Queue::fake([BootstrapAccountAnalytics::class, CollectAccountDailySnapshot::class]);
$user = User::factory()->create();
diff --git a/tests/Browser/WritingAssistantTest.php b/tests/Browser/WritingAssistantTest.php
index b353d0307..f6e7c880d 100644
--- a/tests/Browser/WritingAssistantTest.php
+++ b/tests/Browser/WritingAssistantTest.php
@@ -4,12 +4,9 @@ declare(strict_types=1);
use App\Ai\Agents\PostWritingAssistant;
use App\Enums\SocialAccount\Platform;
-use App\Models\Post;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
-use Illuminate\Auth\Access\Response as AuthResponse;
-use Illuminate\Support\Facades\Gate;
/**
* Poll from the page (never sleep()) until the element is laid out and, when
@@ -88,8 +85,10 @@ function openWritingAssistant(User $user, array $accounts, string $content = '')
}
$page->click('@composer-add-account');
foreach ($accounts as $account) {
+ waitForWritingAssistantTestId($page, "composer-account-option-{$account->id}");
$page->click("@composer-account-option-{$account->id}");
}
+ waitForWritingAssistantTestId($page, 'composer-ai-assistant');
$page->click('@composer-ai-assistant');
waitForWritingAssistantTestId($page, 'writing-assistant-panel');
@@ -175,25 +174,6 @@ test('a premium X channel gets suggestions written for its own limit', function
$page->assertNoJavaScriptErrors();
});
-test('a denied AI gate shows the subscription message', function () {
- [$user, $accounts] = writingAssistantSetup([Platform::LinkedIn]);
- PostWritingAssistant::fake(['unused']);
- Gate::before(fn (User $user, string $ability): ?AuthResponse => $ability === 'useAi'
- ? AuthResponse::deny(__('billing.flash.subscription_required'))
- : null);
-
- $page = openWritingAssistant($user, $accounts)
- ->click('@writing-assistant-mode-generate')
- ->fill('@writing-assistant-prompt', 'new summer collection launch')
- ->click('@writing-assistant-generate');
-
- waitForWritingAssistantTestId($page, 'writing-assistant-error', __('billing.flash.subscription_required'));
- $page->assertSeeIn('@writing-assistant-error', __('billing.flash.subscription_required'))
- ->assertNoJavaScriptErrors();
-
- PostWritingAssistant::assertNeverPrompted();
-});
-
test('switching channel after a suggestion resets the panel and never writes to the other channel', function () {
[$user, [$linkedIn, $x]] = writingAssistantSetup([Platform::LinkedIn, Platform::X]);
PostWritingAssistant::fake(['Shortened for LinkedIn']);
@@ -202,9 +182,11 @@ test('switching channel after a suggestion resets the panel and never writes to
$page = visit(route('app.posts.create'));
waitForWritingAssistantComposer($page);
$page->fill('@composer-base-content', 'Hello world')
- ->click('@composer-add-account')
- ->click("@composer-account-option-{$linkedIn->id}")
- ->click("@composer-account-option-{$x->id}");
+ ->click('@composer-add-account');
+ waitForWritingAssistantTestId($page, "composer-account-option-{$linkedIn->id}");
+ $page->click("@composer-account-option-{$linkedIn->id}");
+ waitForWritingAssistantTestId($page, "composer-account-option-{$x->id}");
+ $page->click("@composer-account-option-{$x->id}");
waitForWritingAssistantTestId($page, 'composer-customization');
$page->click("@composer-account-{$linkedIn->id}")
->click('@composer-ai-assistant');
@@ -221,19 +203,3 @@ test('switching channel after a suggestion resets the panel and never writes to
->assertMissing('@writing-assistant-suggestion')
->assertNoJavaScriptErrors();
});
-
-test('a validation error shows the server message inline', function () {
- [$user, $accounts] = writingAssistantSetup([Platform::LinkedIn]);
- PostWritingAssistant::fake(['unused']);
- $tooLong = str_repeat('a ', intdiv(Post::CONTENT_MAX_LENGTH, 2) + 1);
- $message = __('validation.max.string', ['attribute' => 'current content', 'max' => Post::CONTENT_MAX_LENGTH]);
-
- $page = openWritingAssistant($user, $accounts, $tooLong)
- ->click('@writing-assistant-mode-rephrase');
-
- waitForWritingAssistantTestId($page, 'writing-assistant-error', $message);
- $page->assertSeeIn('@writing-assistant-error', $message)
- ->assertNoJavaScriptErrors();
-
- PostWritingAssistant::assertNeverPrompted();
-});
diff --git a/tests/Browser/XLinkDefusingTest.php b/tests/Browser/XLinkDefusingTest.php
index ab2150fb1..f1e3ccd78 100644
--- a/tests/Browser/XLinkDefusingTest.php
+++ b/tests/Browser/XLinkDefusingTest.php
@@ -98,15 +98,3 @@ test('the x preview leaves the link alone when defusing is disabled', function (
$page->assertSeeIn('@x-preview-content', 'New post: https://acme.com/blog')
->assertNoJavaScriptErrors();
});
-
-test('the character counter counts the defused length for x', function () {
- config()->set('trypost.platforms.x.defuse_links', true);
-
- [$post, $account] = seedXDefusingPost('New post: https://acme.com/blog');
-
- $page = visit(route('app.posts.edit', $post));
- waitForXDefusingTestId($page, "composer-char-count-{$account->id}");
-
- $page->assertSeeIn("@composer-char-count-{$account->id}", '255')
- ->assertNoJavaScriptErrors();
-});
diff --git a/tests/Browser/YouTubeDescriptionTest.php b/tests/Browser/YouTubeDescriptionTest.php
index 6caa183fa..f909fdeae 100644
--- a/tests/Browser/YouTubeDescriptionTest.php
+++ b/tests/Browser/YouTubeDescriptionTest.php
@@ -94,7 +94,7 @@ test('youtube description editor counts UTF-8 bytes and saves only its independe
expect(data_get($platforms[0]->fresh()->meta, 'description'))->toBe($description)
->and(data_get($platforms[1]->fresh()->meta, 'description'))->toBe('Channel 2')
->and($post->fresh()->content)->toBe('Short title');
-})->with([[1280, 900], [375, 812]]);
+})->with([[375, 812]]);
test('youtube description clearing restores content fallback without changing another post', function (string $description) {
[$post, $platforms] = seedYouTubeDescriptionEditor();
@@ -114,7 +114,6 @@ test('youtube description clearing restores content fallback without changing an
->assertNoJavaScriptErrors();
})->with([
'empty description' => [''],
- 'whitespace description' => [" \t\n\u{00A0}"],
]);
test('youtube description long preview stays inside the preview card', function (int $width, int $height) {
@@ -142,4 +141,4 @@ test('youtube description long preview stays inside the preview card', function
JS);
expect($layout)->toEqual(['scrolls' => true, 'bounded' => true, 'insideCard' => true, 'noOverflow' => true]);
$page->assertNoJavaScriptErrors();
-})->with([[1280, 900], [375, 812]]);
+})->with([[375, 812]]);
diff --git a/tests/Feature/Posts/PostLabelsApprovalMemberTest.php b/tests/Feature/Posts/PostLabelsApprovalMemberTest.php
new file mode 100644
index 000000000..40e3749de
--- /dev/null
+++ b/tests/Feature/Posts/PostLabelsApprovalMemberTest.php
@@ -0,0 +1,35 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Enums\Post\Status as PostStatus;
+use App\Models\Post;
+use App\Models\User;
+use App\Models\Workspace;
+use App\Models\WorkspaceLabel;
+
+beforeEach(function () {
+ $this->owner = User::factory()->create();
+ $this->workspace = Workspace::factory()->create(['account_id' => $this->owner->account_id, 'user_id' => $this->owner->id]);
+ $this->workspace->members()->attach($this->owner->id, membershipPivot('admin'));
+ $this->owner->update(['current_workspace_id' => $this->workspace->id]);
+ $this->label = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id, 'name' => 'Campaign']);
+});
+
+test('a member who needs approval can edit the labels of a post without changing its status', function () {
+ $member = workspaceMember($this->workspace, 'approval');
+ $post = Post::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'user_id' => $this->owner->id,
+ 'status' => PostStatus::Scheduled,
+ ]);
+
+ $this->actingAs($member)
+ ->from(route('app.posts.index'))
+ ->patch(route('app.posts.labels.update', $post), ['labels' => [$this->label->id]])
+ ->assertSessionHasNoErrors()
+ ->assertRedirect(route('app.posts.index'));
+
+ expect($post->labels()->pluck('workspace_labels.id')->all())->toBe([$this->label->id])
+ ->and($post->fresh()->status)->toBe(PostStatus::Scheduled);
+});
diff --git a/tests/Feature/SingleLineCopyTest.php b/tests/Feature/SingleLineCopyTest.php
new file mode 100644
index 000000000..e6e027f3d
--- /dev/null
+++ b/tests/Feature/SingleLineCopyTest.php
@@ -0,0 +1,44 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Enums\User\Locale;
+use Illuminate\Support\Arr;
+use Illuminate\Support\Str;
+
+/**
+ * The longest form of a translation as it renders: every plural form, with
+ * the placeholders the slots show filled in.
+ */
+function singleLineCopyLength(string $translation): int
+{
+ $values = ['count' => '12', 'total' => '7', 'network' => 'Google Business Profile', 'name' => 'Português (Brasil)'];
+
+ return collect(explode('|', $translation))
+ ->map(fn (string $form): string => (string) preg_replace('/^\s*(\{[^}]*\}|\[[^\]]*\])\s*/', '', $form))
+ ->map(fn (string $form): string => (string) preg_replace_callback('/:([a-z_]+)/', fn (array $match): string => $values[$match[1]] ?? '00', $form))
+ ->map(fn (string $form): int => mb_strlen($form))
+ ->max();
+}
+
+test('single-line copy stays within its length in every locale', function (string $locale) {
+ $budgets = require base_path('tests/fixtures/single-line-copy.php');
+ $files = [];
+ $tooLong = [];
+
+ foreach ($budgets as $key => $budget) {
+ $file = Str::before($key, '.');
+ $files[$file] ??= require lang_path("{$locale}/{$file}.php");
+ $translation = Arr::get($files[$file], Str::after($key, '.'));
+
+ expect($translation)->toBeString("{$locale} is missing {$key}");
+
+ $length = singleLineCopyLength($translation);
+
+ if ($length > $budget) {
+ $tooLong[] = "{$key}: {$length} > {$budget} ({$translation})";
+ }
+ }
+
+ expect($tooLong)->toBe([], "{$locale} copy no longer fits its one-line slot; shorten it: ".implode('; ', $tooLong));
+})->with(Locale::values());
diff --git a/tests/Browser/LoginErrorMessageTest.php b/tests/Feature/SocialLoginInviteMismatchTest.php
similarity index 74%
rename from tests/Browser/LoginErrorMessageTest.php
rename to tests/Feature/SocialLoginInviteMismatchTest.php
index f34d279b1..eade73577 100644
--- a/tests/Browser/LoginErrorMessageTest.php
+++ b/tests/Feature/SocialLoginInviteMismatchTest.php
@@ -9,7 +9,7 @@ use App\Models\Workspace;
use Laravel\Socialite\Facades\Socialite;
use Laravel\Socialite\Two\User as SocialiteUser;
-test('login page displays the wrong-invite-email error flashed from the oauth callback', function () {
+beforeEach(function () {
config([
'trypost.self_hosted' => false,
'trypost.google_auth_enabled' => true,
@@ -17,7 +17,9 @@ test('login page displays the wrong-invite-email error flashed from the oauth ca
'services.google-auth.client_secret' => 'test-client-secret',
'services.google-auth.redirect' => 'https://app.trypost.test/auth/google/callback',
]);
+});
+test('a google login whose email is not the invited one is sent to login with the wrong email error', function () {
$inviterAccount = Account::factory()->create();
$inviter = User::factory()->create(['account_id' => $inviterAccount->id]);
$inviterAccount->update(['owner_id' => $inviter->id]);
@@ -32,6 +34,8 @@ test('login page displays the wrong-invite-email error flashed from the oauth ca
'workspaces' => [$workspace->id],
]);
+ $this->get(route('auth.google.redirect', ['invite' => $invite->id]));
+
$socialiteUser = new SocialiteUser;
$socialiteUser->map([
'id' => 'g-wrong-email',
@@ -42,11 +46,12 @@ test('login page displays the wrong-invite-email error flashed from the oauth ca
Socialite::shouldReceive('driver')
->with('google-auth')
->andReturn($driver = Mockery::mock());
- $driver->shouldReceive('redirect')->andReturn(redirect(route('auth.google.callback')));
$driver->shouldReceive('user')->andReturn($socialiteUser);
- $page = visit(route('auth.google.redirect', ['invite' => $invite->id]));
+ $this->get(route('auth.google.callback'))
+ ->assertRedirect(route('login'))
+ ->assertSessionHasErrors(['email' => __('settings.members.flash.wrong_email')]);
- $page->assertRoute('login')
- ->assertSee(__('settings.members.flash.wrong_email'));
+ $this->assertGuest();
+ expect(User::where('email', '[email protected]')->exists())->toBeFalse();
});
diff --git a/tests/Pest.php b/tests/Pest.php
index 3f47aa3b6..f487e4125 100644
--- a/tests/Pest.php
+++ b/tests/Pest.php
@@ -65,6 +65,19 @@ pest()->in('Feature/Social')
pest()->tia()->locally();
+/*
+|--------------------------------------------------------------------------
+| Browser Timeout
+|--------------------------------------------------------------------------
+|
+| CI runs the browser suite with four processes per runner, so an action can
+| wait longer than the plugin's 5 seconds before its element is ready. This is
+| the ceiling of each wait, not a delay.
+|
+*/
+
+pest()->browser()->timeout(15000);
+
/*
|--------------------------------------------------------------------------
| Expectations
diff --git a/tests/fixtures/single-line-copy.php b/tests/fixtures/single-line-copy.php
new file mode 100644
index 000000000..1acd8bb1f
--- /dev/null
+++ b/tests/fixtures/single-line-copy.php
@@ -0,0 +1,156 @@
+<?php
+
+declare(strict_types=1);
+
+/*
+| Lang keys rendered on one line (buttons, tabs, menu items, badges) and the
+| longest rendered translation allowed for each, in characters. The value is
+| the longest translation when the key was added; raise it only after
+| checking the slot still fits in every locale.
+*/
+
+return [
+ 'accounts.connect.actions.back' => 8,
+ 'accounts.connect.actions.connect_again' => 17,
+ 'accounts.connect.actions.start_again' => 16,
+ 'accounts.connect.actions.try_again' => 16,
+ 'accounts.connect.connected' => 11,
+ 'accounts.connect.finish' => 18,
+ 'accounts.connect.help.label' => 17,
+ 'accounts.connect.selected' => 16,
+ 'accounts.connect.switch.button' => 18,
+ 'accounts.connect.switch.button_short' => 8,
+ 'accounts.connect.switch.connect' => 37,
+ 'analytics.channel.metrics_card.both' => 10,
+ 'analytics.channel.metrics_card.comparison' => 13,
+ 'analytics.channel.metrics_card.menu.posts' => 13,
+ 'analytics.channel.metrics_card.presets.audience_growth.label' => 15,
+ 'analytics.channel.metrics_card.presets.content_impact.label' => 19,
+ 'analytics.channel.metrics_card.presets.follower_growth_rate.label' => 25,
+ 'analytics.channel.metrics_card.presets.visibility.label' => 13,
+ 'analytics.channel.series.followers' => 11,
+ 'analytics.channel.series.posts' => 13,
+ 'analytics.channel.this_period' => 15,
+ 'auth.login.title' => 24,
+ 'auth.register.password_requirements.min' => 25,
+ 'auth.register.password_requirements.mixed_case' => 30,
+ 'auth.register.password_requirements.number' => 21,
+ 'auth.register.password_requirements.symbol' => 26,
+ 'auth.register.title' => 30,
+ 'billing.plans.features.accounts_unlimited' => 35,
+ 'billing.plans.features.ai' => 15,
+ 'billing.plans.features.analytics' => 9,
+ 'billing.plans.features.calendar' => 36,
+ 'billing.plans.features.mcp' => 44,
+ 'billing.plans.features.networks_all' => 39,
+ 'billing.plans.features.repurpose' => 46,
+ 'billing.plans.features.team' => 31,
+ 'calendar.title' => 10,
+ 'channels.description' => 43,
+ 'channels.goal_dialog.description' => 57,
+ 'channels.grid.title' => 10,
+ 'channels.settings_page.cancel' => 9,
+ 'channels.settings_page.timezone_confirm' => 22,
+ 'create.tabs.feeds' => 10,
+ 'create.tabs.ideas' => 8,
+ 'create.tabs.templates' => 10,
+ 'labels.description' => 47,
+ 'mcp.authorize.approve' => 13,
+ 'mcp.authorize.cancel' => 9,
+ 'mcp.authorize.select_workspace' => 28,
+ 'mcp.subtitle' => 45,
+ 'posts.approvals.approve' => 10,
+ 'posts.approvals.reject' => 9,
+ 'posts.approvals.revert' => 32,
+ 'posts.approvals.schedule' => 15,
+ 'posts.composer.deselect_all' => 23,
+ 'posts.composer.edit_view' => 11,
+ 'posts.composer.hashtags_remaining' => 16,
+ 'posts.composer.link_preview.replace_with_media' => 40,
+ 'posts.composer.schedule_picker.done' => 8,
+ 'posts.composer.schedule_picker.more_actions' => 16,
+ 'posts.composer.select_all' => 17,
+ 'posts.content_types.facebook_post.label' => 11,
+ 'posts.content_types.facebook_reel.label' => 5,
+ 'posts.content_types.facebook_story.label' => 8,
+ 'posts.content_types.instagram_feed.label' => 15,
+ 'posts.content_types.instagram_reel.label' => 5,
+ 'posts.content_types.instagram_story.label' => 8,
+ 'posts.content_types.threads_ghost_post.label' => 17,
+ 'posts.content_types.threads_post.label' => 6,
+ 'posts.content_types.youtube_short.label' => 9,
+ 'posts.edit.tabs.preview' => 19,
+ 'posts.form.ai_generated.label' => 17,
+ 'posts.form.google_business.add_more_details' => 18,
+ 'posts.form.google_business.add_time' => 15,
+ 'posts.form.google_business.event_end_time' => 20,
+ 'posts.form.google_business.event_start_time' => 16,
+ 'posts.form.google_business.topic_type.event' => 13,
+ 'posts.form.google_business.topic_type.offer' => 11,
+ 'posts.form.google_business.topic_type.standard' => 14,
+ 'posts.form.instagram.share_to_feed' => 20,
+ 'posts.form.mastodon.content_warning' => 20,
+ 'posts.form.thread.start' => 17,
+ 'posts.form.threads.topic' => 9,
+ 'posts.form.tiktok.privacy_level' => 13,
+ 'posts.form.youtube.embeddable' => 23,
+ 'posts.form.youtube.made_for_kids' => 14,
+ 'posts.form.youtube.notify_subscribers' => 26,
+ 'posts.form.youtube.visibility' => 13,
+ 'posts.list_view' => 6,
+ 'posts.publish.actions.add_to_queue' => 28,
+ 'settings.api_keys.description' => 42,
+ 'settings.members.access.admin_description' => 41,
+ 'settings.members.access.needs_approval' => 25,
+ 'settings.members.access.publishes_directly' => 22,
+ 'settings.members.access.publishing' => 15,
+ 'settings.members.cancel' => 9,
+ 'settings.members.invite.submit' => 21,
+ 'settings.members.roles.admin' => 14,
+ 'settings.preferences.theme.system' => 9,
+ 'settings.workspace.members_description' => 60,
+ 'sidebar.channels' => 8,
+ 'sidebar.language' => 28,
+ 'sidebar.log_out' => 14,
+ 'sidebar.manage_team' => 19,
+ 'sidebar.plans_billing' => 26,
+ 'sidebar.settings' => 13,
+ 'sidebar.support.menu' => 20,
+ 'sidebar.theme' => 26,
+ 'signatures.description' => 43,
+ 'webhooks.actions.delete' => 11,
+ 'webhooks.actions.disable' => 26,
+ 'webhooks.actions.edit' => 20,
+ 'webhooks.actions.enable' => 21,
+ 'webhooks.actions.rotate' => 36,
+ 'webhooks.actions.send_test' => 31,
+ 'webhooks.create.endpoint_help' => 58,
+ 'webhooks.description' => 49,
+ 'webhooks.event_descriptions.post_created' => 41,
+ 'webhooks.event_descriptions.post_deleted' => 36,
+ 'webhooks.event_descriptions.post_failed' => 50,
+ 'webhooks.event_descriptions.post_partially_published' => 55,
+ 'webhooks.event_descriptions.post_published' => 48,
+ 'webhooks.event_descriptions.post_scheduled' => 51,
+ 'webhooks.event_descriptions.post_unscheduled' => 54,
+ 'webhooks.rotate.submit' => 23,
+ 'webhooks.show.edit' => 11,
+ 'webhooks.title' => 8,
+ 'welcome.goals.drive_sales' => 31,
+ 'welcome.goals.grow_audience' => 26,
+ 'welcome.goals.manage_clients' => 31,
+ 'welcome.goals.other' => 14,
+ 'welcome.goals.plan_calendar' => 30,
+ 'welcome.goals.save_time' => 35,
+ 'welcome.goals.stay_on_brand' => 31,
+ 'welcome.goals.use_mcp' => 36,
+ 'welcome.personas.agency' => 10,
+ 'welcome.personas.creator' => 23,
+ 'welcome.personas.developer' => 15,
+ 'welcome.personas.freelancer' => 23,
+ 'welcome.personas.marketer' => 25,
+ 'welcome.personas.online_store' => 21,
+ 'welcome.personas.other' => 9,
+ 'welcome.personas.small_business' => 17,
+ 'welcome.personas.startup' => 10,
+];