Skip to content

Commit

Permalink
Chore/feature flags tests (#503)
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardZaydler authored Apr 11, 2024
1 parent 69fc860 commit da13d82
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
47 changes: 47 additions & 0 deletions playwright/e2eTests/notificationsOperations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,53 @@ const test = base.extend<{

test.describe.configure({ mode: "serial" });

test("With feature flags set to true", async ({ notificationsPage, page }) => {
await page.route("api/config", (route) => {
route.fulfill({
json: {
featureFlags: {
isSubscriptionToAllTagsAvailable: true,
isPlottingAvailable: true,
isPlottingDefaultOn: true,
},
},
});
});

await notificationsPage.gotoNotificationsPage();
await notificationsPage.addSubscriptionButton.click();

const addGraphCheckbox = page.locator('label:has-text("Add graph to notification")');
const allTagsToggle = page.locator('text="All tags"');

await expect(allTagsToggle).toBeVisible();
await expect(addGraphCheckbox).toBeVisible();
await expect(addGraphCheckbox.locator("> input")).toBeChecked();
});

test("With feature flags set to false", async ({ notificationsPage, page }) => {
await page.route("api/config", (route) => {
route.fulfill({
json: {
featureFlags: {
isSubscriptionToAllTagsAvailable: false,
isPlottingAvailable: false,
isPlottingDefaultOn: false,
},
},
});
});

await notificationsPage.gotoNotificationsPage();
await notificationsPage.addSubscriptionButton.click();

const addGraphCheckbox = page.locator('label:has-text("Add graph to notification")');
const allTagsToggle = page.locator('text="All tags"');

await expect(allTagsToggle).not.toBeVisible();
await expect(addGraphCheckbox).not.toBeVisible();
});

test("Add delivery channel", async ({
channelType,
channelAccountName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export const SubscriptionListContainer: React.FC<Props> = (props) => {

const { config } = useAppSelector(ConfigState);

const isPlottingDefaultOn = !!config?.featureFlags.isPlottingDefaultOn;
const isPlottingDefaultOn =
!!config?.featureFlags.isPlottingDefaultOn && config.featureFlags.isPlottingAvailable;

const handleCloseModal = (modal: ModalType) => {
closeModal(modal);
Expand Down
4 changes: 2 additions & 2 deletions src/tests/core/api/local/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ web:
label: Twilio voice
feature_flags:
is_plotting_available: true
is_plotting_default_on: true
is_subscription_to_all_tags_available: true
is_plotting_default_on: false
is_subscription_to_all_tags_available: false
log:
log_file: stdout
log_level: info
Expand Down

0 comments on commit da13d82

Please sign in to comment.