Skip to content

Commit

Permalink
test: add e2e for citations preview
Browse files Browse the repository at this point in the history
  • Loading branch information
shibbas committed Nov 1, 2023
1 parent 583110e commit b1baf35
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
60 changes: 60 additions & 0 deletions tests/e2e/hars/citation-content.har
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"log": {
"version": "1.2",
"creator": {
"name": "Playwright",
"version": "1.39.0"
},
"browser": {
"name": "chromium",
"version": "119.0.6045.9"
},
"entries": [
{
"startedDateTime": "2023-11-01T01:18:30.135Z",
"time": 13.495,
"request": {
"method": "GET",
"url": "http://localhost:5173/content/support.md",
"httpVersion": "HTTP/2.0",
"cookies": [],
"headers": [
{ "name": "Accept", "value": "*/*" },
{ "name": "Accept-Language", "value": "en-US" },
{ "name": "Origin", "value": "http://localhost:5173" },
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.6045.9 Safari/537.36"
}
],
"queryString": [],
"headersSize": -1,
"bodySize": -1
},
"response": {
"status": 200,
"statusText": "",
"httpVersion": "HTTP/2.0",
"cookies": [],
"headers": [
{ "name": "access-control-allow-origin", "value": "http://localhost:5173" },
{ "name": "content-length", "value": "10797" },
{ "name": "content-type", "value": "text/markdown" },
{ "name": "date", "value": "Wed, 01 Nov 2023 01:18:30 GMT" },
{ "name": "vary", "value": "Origin" }
],
"content": {
"size": -1,
"mimeType": "text/markdown",
"text": "# Contoso Real Estate Customer Support Guide\n\n> This document contains information generated using a language model (Azure OpenAI). The information\n> contained in this document is only for demonstration purposes and does not reflect the opinions or\n> beliefs of Microsoft. Microsoft makes no representations or warranties of any kind, express or implied,\n> about the completeness, accuracy, reliability, suitability or availability with respect to the information\n> contained in this document.\n\n> All rights reserved to Microsoft\n\n## Customer Support Guide\n\nWelcome to Contoso Real Estate! We're delighted to have you as a part of our community of travelers and hosts. This comprehensive customer support guide will assist you in navigating various aspects of our platform, ensuring that your experience with us is smooth and enjoyable.\n\n## Table of Contents\n\n1. [How to Search and Book Rentals](#how-to-search-and-book-rentals)\n2. [How to Cancel a Confirmed Booking](#how-to-cancel-a-confirmed-booking)\n3. [How to Contact Customer Support](#how-to-contact-customer-support)\n4. [How to Report a Problem with a Listing](#how-to-report-a-problem-with-a-listing)\n5. [How to Report a Problem with a Guest or Host](#how-to-report-a-problem-with-a-guest-or-host)\n6. [How to Report a Safety Issue](#how-to-report-a-safety-issue)\n7. [How to Report a Payment or Refund Issue](#how-to-report-a-payment-or-refund-issue)\n8. [Guest or Host Rule Violations](#guest-or-host-rule-violations)\n9. [Compensation for Damage](#compensation-for-damage)\n10. [Payment Error Resolution](#payment-error-resolution)\n\n---\n\n## 1. How to Search and Book Rentals\n\nContoso Real Estate offers a wide range of rental properties for your stay. Here's how to search and book rentals:\n\n1. **Search for Rentals:**\n\n - Enter your destination, check-in and check-out dates, and the number of guests.\n - Apply filters such as price range, property type, and amenities to narrow down your options.\n - Browse through the listings to find the perfect place for your stay.\n\n2. **View Listing Details:**\n\n - Click on a listing to view detailed information, including photos, property description, reviews, and host information.\n\n3. **Make a Booking:**\n\n - Click the \"Book Now\" button on the listing page.\n - Review the booking details, including the total cost and house rules.\n - Confirm your booking by providing payment information.\n - Once the host accepts your booking, you'll receive a confirmation.\n\n4. **Payment:**\n\n - Contoso Real Estate handles the payment process securely. You'll only be charged once your booking is confirmed.\n\n5. **Communication:**\n - You can communicate with the host through our messaging system for any questions or special requests.\n\n---\n\n## 2. How to Cancel a Confirmed Booking\n\nLife happens, and sometimes you need to cancel a confirmed booking. Here's how to do it:\n\n1. **Log In:**\n\n - Log in to your Contoso Real Estate account.\n\n2. **Go to Your Bookings:**\n\n - Click on your profile picture and navigate to \"Bookings.\"\n\n3. **Select the Booking to Cancel:**\n\n - Find the booking you want to cancel and click on it.\n\n4. **Cancel Reservation:**\n\n - Click on the \"Cancel Reservation\" button.\n - Review the cancellation policy to understand any potential fees.\n - Confirm the cancellation.\n\n5. **Cancellation Fees:**\n\n - Depending on the host's cancellation policy, you may be subject to cancellation fees. These fees will be clearly displayed during the cancellation process.\n\n6. **Refunds:**\n - If eligible for a refund, it will be processed according to the cancellation policy.\n\n---\n\n## 3. How to Contact Customer Support\n\nIf you encounter any issues or have questions, our customer support team is here to assist you. Here's how to contact us:\n\n1. **Through the Website:**\n\n - Click on the \"Help\" or \"Contact Us\" option located in the website's navigation menu.\n - Follow the prompts to describe your issue or question.\n\n2. **Via Email:**\n\n - Send an email to support@contosorealestate.com with your inquiry.\n - Be sure to provide your booking ID if applicable.\n\n3. **Phone Support:**\n\n - Call our dedicated customer support hotline at +1 (800) 123-4567.\n - Our support agents are available 24/7 to assist you.\n\n4. **In-App Messaging:**\n - If you're logged into our mobile app, you can initiate a chat with our support team through the app's messaging feature.\n\nOur goal is to address your concerns promptly and efficiently.\n\n---\n\n## 4. How to Report a Problem with a Listing\n\nIf you encounter any issues with a listing you've booked or noticed inaccurate information, please report it. Here's how:\n\n1. **Log In:**\n\n - Log in to your Contoso Real Estate account.\n\n2. **Go to Your Bookings:**\n\n - Click on your profile picture and navigate to \"Bookings.\"\n\n3. **Select the Booking with the Issue:**\n\n - Find the booking associated with the problematic listing and click on it.\n\n4. **Report a Problem:**\n\n - Click on the \"Report a Problem\" button.\n - Describe the issue you've encountered with the listing in detail.\n\n5. **Submit the Report:**\n - Once you've provided the necessary information, submit the report.\n\nOur team will investigate the issue and take appropriate action.\n\n---\n\n## 5. How to Report a Problem with a Guest or Host\n\nIf you have concerns about the behavior of a guest or host during your stay, please report it to us. Here's how:\n\n1. **Log In:**\n\n - Log in to your Contoso Real Estate account.\n\n2. **Go to Your Bookings:**\n\n - Click on your profile picture and navigate to \"Bookings.\"\n\n3. **Select the Booking with the Issue:**\n\n - Find the booking associated with the problematic guest or host and click on it.\n\n4. **Report a Problem:**\n\n - Click on the \"Report a Problem\" button.\n - Provide a detailed description of the issue, including any relevant evidence.\n\n5. **Submit the Report:**\n - Once you've provided the necessary information, submit the report.\n\nWe take such reports seriously and will investigate them thoroughly.\n\n---\n\n## 6. How to Report a Safety Issue\n\nYour safety is our top priority. If you encounter any safety concerns during your stay, please report them immediately. Here's how:\n\n1. **Log In:**\n\n - Log in to your Contoso Real Estate account.\n\n2. **Go to Your Bookings:**\n\n - Click on your profile picture and navigate to \"Bookings.\"\n\n3. **Select the Booking with the Safety Issue:**\n\n - Find the booking associated with the safety concern and click on it.\n\n4. **Report a Safety Issue:**\n\n - Click on the \"Report a Safety Issue\" button.\n - Provide a detailed description of the safety concern.\n\n5. **Submit the Report:**\n - Once you've provided the necessary information, submit the report.\n\nOur team will prioritize your safety and take appropriate action.\n\n## 7. How to Report a Payment or Refund Issue\n\nIf you encounter any problems related to payments or refunds, such as issues with a guest or host requesting payments outside of our platform, please report it immediately. Here's how:\n\n1. **Log In:**\n\n - Log in to your Contoso Real Estate account.\n\n2. **Go to Your Bookings:**\n\n - Click on your profile picture and navigate to \"Bookings.\"\n\n3. **Select the Booking with the Payment Issue:**\n\n - Find the booking associated with the payment or refund problem and click on it.\n\n4. **Report a Payment Issue:**\n\n - Click on the \"Report a Payment Issue\" button.\n - Provide a detailed description of the payment or refund issue.\n\n5. **Submit the Report:**\n - Once you've provided the necessary information, submit the report.\n\nOur financial support team will investigate the matter and work to resolve it promptly.\n\n---\n\n## 8. Guest or Host Rule Violations\n\nAt Contoso Real Estate, we expect all users to adhere to our community guidelines and rules. If you believe a guest or host has violated these rules, please report it to us. Here's how:\n\n1. **Log In:**\n\n - Log in to your Contoso Real Estate account.\n\n2. **Go to Your Bookings:**\n\n - Click on your profile picture and navigate to \"Bookings.\"\n\n3. **Select the Booking with the Rule Violation:**\n\n - Find the booking associated with the rule violation and click on it.\n\n4. **Report a Rule Violation:**\n\n - Click on the \"Report a Rule Violation\" button.\n - Describe the violation in detail and provide any relevant evidence.\n\n5. **Submit the Report:**\n - Once you've provided the necessary information, submit the report.\n\nOur team will review the report and take appropriate action to maintain a safe and respectful community.\n\n---\n\n## 9. Compensation for Damage\n\nAccidents can happen during a stay, and we have procedures in place to handle compensation for damage. Here's how it works:\n\n1. **Reporting Damage:**\n\n - If you, as a guest, notice damage during your stay or if you're a host and your property has been damaged, report it immediately through the platform.\n\n2. **Document Damage:**\n\n - Take photos or videos of the damage and provide a clear description.\n\n3. **Communication:**\n\n - Communicate with the other party to discuss the issue and attempt to reach a resolution.\n\n4. **Claim Resolution:**\n\n - If an agreement cannot be reached, you can file a damage claim through Contoso Real Estate, and our support team will assist in resolving the issue.\n\n5. **Resolution Timeline:**\n\n - Our team will work diligently to reach a resolution within a reasonable timeframe.\n\n6. **Insurance:**\n - Contoso Real Estate may offer insurance options to provide coverage for certain types of damage. Review your options in your account settings.\n\n---\n\n## 10. Payment Error Resolution\n\nIn the rare event of a payment error, our team is here to help you resolve it. Here's what to do:\n\n1. **Payment Error Notification:**\n\n - If you receive a payment error notification, do not hesitate to contact our customer support immediately.\n\n2. **Contact Customer Support:**\n\n - Follow the steps outlined in Section 3, \"How to Contact Customer Support,\" to reach our support team for payment-related issues.\n\n3. **Provide Details:**\n\n - Be prepared to provide details of the payment error, including any error messages or transaction IDs.\n\n4. **Resolution:**\n - Our dedicated team will investigate the issue and work towards a swift resolution, ensuring your funds are handled correctly.\n\nWe understand the importance of timely and accurate payments and will do our best to rectify any payment errors promptly.\n\n---\n\nWe hope this comprehensive customer support guide has been helpful in addressing your questions and concerns. Contoso Real Estate is committed to providing you with a safe and enjoyable experience. If you require further assistance, please don't hesitate to reach out to our customer support team using the methods outlined in Section 3. Your satisfaction is our priority!\n"
},
"headersSize": -1,
"bodySize": -1,
"redirectURL": ""
},
"cache": {},
"timings": { "send": -1, "wait": -1, "receive": 13.495 }
}
]
}
}
13 changes: 13 additions & 0 deletions tests/e2e/webapp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,19 @@ test.describe('generate answer', () => {
await expect(citations.nth(0)).toBeEnabled();
await expect(citations.nth(0)).toContainText('support.md');
expect(await citations.nth(0).getAttribute('href')).toContain('/content/support.md');

await page.routeFromHAR('./tests/e2e/hars/citation-content.har', {
url: '/content/support.md',
update: false,
updateContent: 'embed',
});

await citations.nth(0).click();
// the thought process should be visible on the citation tab with citations visible
await expect(page.getByTestId('aside-thought-process').getByTestId('citation')).toBeVisible();

// markdown converted to html
await expect(page.getByRole('heading', { name: 'Contoso Real Estate Customer Support Guide' })).toBeVisible();
});
});

Expand Down

0 comments on commit b1baf35

Please sign in to comment.