0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00
ghost/apps/admin-x-settings/test/acceptance/advanced/integrations/integrationsList.test.ts
Ronald Langeveld d12b79e036
🐛 Fixed First Promoter always showing Active (#20010)
ref https://github.com/TryGhost/Ghost/issues/19797

- Fixed FirstPromoter always showing Active in Integration Settings list
- This was due to the position of the variable in the array being in the
wrong positon and indexed incorrectly.
- Added additional testing to avoid it from cropping up again.
2024-04-11 13:09:12 +08:00

37 lines
2.2 KiB
TypeScript

import {expect, test} from '@playwright/test';
import {globalDataRequests} from '../../../utils/acceptance';
import {mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Integrations List', async () => {
// This is a test for the integrations list, which is a list of integrations that can be toggled on and off
// To ensure the app logic shows the correct initial state, all integrations are disabled by default, except for Unsplash
test('Only Unsplash Shows Active on initial new setup', async ({page}) => {
await mockApi({page, requests: {
...globalDataRequests,
getSettingValue: {method: 'GET', path: '/settings/', response: responseFixtures.settings}
}});
await page.goto('/');
const section = page.getByTestId('integrations');
// const zapierElement = await section.getByText('Zapier').last();
const zapierElement = section.getByTestId('zapier-integration');
const slackElement = section.getByTestId('slack-integration');
const ampElement = section.getByTestId('amp-integration');
const unsplashElement = section.getByTestId('unsplash-integration');
const firstPromoterElement = section.getByTestId('firstpromoter-integration');
const pinturaElement = section.getByTestId('pintura-integration');
const zapierStatus = await zapierElement.getByText('Active');
const slackStatus = await slackElement.getByText('Active');
const ampStatus = await ampElement.getByText('Active');
const unsplashStatus = await unsplashElement.getByText('Active');
const firstPromoterStatus = await firstPromoterElement.getByText('Active');
const pinturaStatus = await pinturaElement.getByText('Active');
expect(await zapierStatus.isVisible()).toBe(false);
expect(await slackStatus.isVisible()).toBe(false);
expect(await ampStatus.isVisible()).toBe(false);
expect(await unsplashStatus.isVisible()).toBe(true); // Unsplash is the only active integration
expect(await firstPromoterStatus.isVisible()).toBe(false);
expect(await pinturaStatus.isVisible()).toBe(false);
});
});