diff --git a/.gitignore b/.gitignore index da04610..45a7e06 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ _site vendor .DS_Store .vercel +__pycache__/ +*.pyc \ No newline at end of file diff --git a/_includes/nav.html b/_includes/nav.html index 975df6a..39c90d2 100644 --- a/_includes/nav.html +++ b/_includes/nav.html @@ -158,6 +158,14 @@ >Blog +
  • + Create Blog Post +
  • Blog +
  • + Create Blog Post +
  • + + + {% include header.html %} + + + + {% include nav.html %} +
    +

    {{ page.title }}

    +

    Published on {{ page.date | date: "%B %d, %Y" }} · Reading Time: {{ page.reading_time }} minutes

    +
    +
    +
    +
    + {% if page.image %} + Blog Image + {% endif %} +
    +
    +

    {{ content }}

    +
    +
    +
    + {% include footer.html %} + + + diff --git a/_layouts/create-blog.html b/_layouts/create-blog.html new file mode 100644 index 0000000..5753a94 --- /dev/null +++ b/_layouts/create-blog.html @@ -0,0 +1,75 @@ + + + + {% include header.html %} + + + + {% include nav.html %} +
    +
    +
    +
    Form
    + + +
    +
    +
    + {% include footer.html %} + + diff --git a/_posts/2024-10-14-blog_2.markdown b/_posts/2024-10-14-blog_2.markdown index bab770e..aabca16 100644 --- a/_posts/2024-10-14-blog_2.markdown +++ b/_posts/2024-10-14-blog_2.markdown @@ -1,5 +1,5 @@ --- -layout: default +layout: blog-post title: "The Future of Remote Work Technology" date: 2024-10-14 image: ../assets/images/blog/blog2.png diff --git a/_posts/2024-10-15-blog_3.markdown b/_posts/2024-10-15-blog_3.markdown index 4820383..888b976 100644 --- a/_posts/2024-10-15-blog_3.markdown +++ b/_posts/2024-10-15-blog_3.markdown @@ -1,5 +1,5 @@ --- -layout: default +layout: blog-post title: "The Importance of Cybersecurity in the Digital Age" date: 2024-10-15 image: ../assets/images/blog/blog1.png diff --git a/_posts/2024-10-16-blog_1.markdown b/_posts/2024-10-16-blog_1.markdown index 9be2486..b02da54 100644 --- a/_posts/2024-10-16-blog_1.markdown +++ b/_posts/2024-10-16-blog_1.markdown @@ -1,5 +1,5 @@ --- -layout: default +layout: blog-post title: "The Rise of AI in Everyday Life" date: 2024-10-16 image: ../assets/images/blog/blog3.png diff --git a/_test/test_blog_form.py b/_test/test_blog_form.py new file mode 100644 index 0000000..05ac936 --- /dev/null +++ b/_test/test_blog_form.py @@ -0,0 +1,58 @@ +import unittest +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC + + +class TestGoogleForm(unittest.TestCase): + def setUp(self): + """Set up the WebDriver.""" + self.driver = webdriver.Chrome() # Ensure ChromeDriver is installed and in PATH + self.driver.maximize_window() + + def test_fill_google_form(self): + """Test case for filling out the Google Form.""" + driver = self.driver + + + driver.get("http://localhost:4000/create-blog") + + # Switch to the iframe containing the Google Form + iframe = driver.find_element(By.TAG_NAME, "iframe") + driver.switch_to.frame(iframe) + + # Wait for the form to load + wait = WebDriverWait(driver, 10) + + # Fill out the "Title" question + title_field = wait.until( + EC.presence_of_element_located((By.CSS_SELECTOR, 'input[aria-labelledby="i1 i4"]')) + ) + title_field.send_keys("Sample Title") + + # Fill out the "Content" question + content_field = wait.until( + EC.presence_of_element_located((By.CSS_SELECTOR, 'textarea[aria-labelledby="i6 i9"]')) + ) + content_field.send_keys("This is a test content for the Google Form.") + + # Submit the form + submit_button = wait.until( + EC.element_to_be_clickable((By.XPATH, '//span[contains(@class, "NPEfkd") and text()="Submit"]')) + ) + submit_button.click() + + # Verify submission + success_message = wait.until( + EC.presence_of_element_located((By.XPATH, '//div[contains(@class, "vHW8K") and text()="Your response has been recorded."]')) + ) + self.assertTrue(success_message.is_displayed(), "Form submission failed!") + + def tearDown(self): + """Tear down the WebDriver.""" + self.driver.quit() + + +if __name__ == "__main__": + unittest.main() diff --git a/create-blog.markdown b/create-blog.markdown new file mode 100644 index 0000000..5cf5b0a --- /dev/null +++ b/create-blog.markdown @@ -0,0 +1,6 @@ +--- +layout: create-blog +title: Create Blog Post +permalink: /create-blog +--- +