Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/IshanBhatBhardwaj/8b…
Browse files Browse the repository at this point in the history
…y8-challenge into development
  • Loading branch information
IshanBhatBhardwaj committed Aug 7, 2024
2 parents 0131bdf + 9b965e5 commit 54d5327
Show file tree
Hide file tree
Showing 6 changed files with 521 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ NEXT_PUBLIC_TURNSTILE_SITE_KEY=cloudflare_turnstile_site_key_goes_here
TURNSTILE_SECRET_KEY=cloudflare_turnstile_secret_key_goes_here
NEXT_PUBLIC_SUPABASE_URL=supabase_api_url_goes_here
NEXT_PUBLIC_SUPABASE_ANON_KEY=supabase_anon_key_goes_here
SUPABASE_SERVICE_ROLE_KEY=supabase_service_role_key_goes_here
SUPABASE_SERVICE_ROLE_KEY=supabase_service_role_key_goes_here
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
.yarn/install-state.gz
src/__tests__/supabase/migrations/


# testing
/coverage

Expand Down Expand Up @@ -41,4 +42,13 @@ next-env.d.ts
# ide-specific folders
.vscode/
.idea/
*storybook.log
*storybook.log

# python
/venv
__pycache__
.pytest_cache




113 changes: 113 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,119 @@ the same for both commands, and will be the same each time you run these command

Run the script 'npm run create-symlink-supabase-to-src'. This will create a symlink between the supabase/migrations/20240711063356_initial_schema.sql file -> src/__tests__/supabase/migrations/20240711063356_initial_schema.sql file.
Note, if you are a windows user, you may have to run the command prompt as an administrator to run the script.
=======
## Selenium Tests

### Prerequisites

- **Python**: Ensure Python is installed on your system.
[Documentation](https://www.python.org/).
- **Selenium**: Python package for browser automation.
[Documentation](https://selenium-python.readthedocs.io/installation.html#).
- **Pytest**: Python package for unit testing.
[Documentation](https://docs.pytest.org/en/stable/getting-started.html).
- **Drivers**: Included with Selenium version 4.6.0 and higher.
[Documentation](https://www.selenium.dev/documentation/selenium_manager/).


### Setup Instructions


### Python Version

While our project can run on different versions of Python, it is best practice to use Python 3 for better performance, security, and compatibility with modern libraries and frameworks.

### Installing Python 3

If you do not have Python 3 installed, you can download it from the [official Python website](https://www.python.org/downloads/).

```
python --version
```

### Note
The command to run Python might be `python3` on some systems (like Ubuntu and WSL), while in other environments it might just be `python`. Please adjust the commands accordingly based on your environment.

### Systems using Python 3
* Ubuntu (including WSL)
* CentOS/RHEL (recent versions)
* Fedora
* macOS (often default)

### Systems using Python (depends on configuration)
* Older Linux distributions (e.g., Ubuntu 12.04, CentOS 6)
* Conda Environments
* Docker Containers

### 1. Create Virtual Enviornment

`python3 -m venv venv`

### 2. Activate Virtual Enviornment

macOS
`source venv/bin/activate`

Windows
`venv\Scripts\activate`

Linux
`source venv/bin/activate`



### 3. Installing Selenium
Selenium does not need to be installed on a per-project basis. To see if you
already have it installed, you can run the following command:

```
pip show selenium
```

If installed, it will print information about the package. If the version is less
than 4.6.0, you should update it by running:

```
pip install -U selenium
```

Otherwise, you can install it by running the following command:

```
pip install selenium
```

For more information on installing Selenium, see [this](https://www.selenium.dev/documentation/webdriver/getting_started/install_library/).

For information on upgrading Selenium, see [this](https://www.selenium.dev/documentation/webdriver/troubleshooting/upgrade_to_selenium_4/).


### 4. Installing pytest

Be sure to install pytest:

```
pip install pytest
```

## 5. Before Running Selenium Tests

To ensure that Selenium tests run efficiently, it is recommended to first compile your project using `npm run build`. This step improves performance by compiling and optimizing the code, which can make the tests smoother.

I. **Build the Project:**
```
npm run build
```

II. **Start Development Server:**
```
npm run start
```

### 7. Run the tests

To run the Selenium tests, navigate into `src/__tests__/e2e` and run
`python3 -m pytest`.

## Contributing

Expand Down
66 changes: 66 additions & 0 deletions STYLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,69 @@ Semi-colons are required at the end of each statement. This requirement can be t
## Simplicity and Consistency

Prefer the simplest words possible (while maintaining precision and clarity) when naming your variables, functions, etc, and use those terms consistently. Follow the principle of least surprise: if two functions serve a similar purpose, or have similar parameters, try to structure their signatures in similar ways. By following this principle, we can create a codebase that is highly intuitive to work with.



# Python Style Guide

## Naming Conventions

### Variables
- Use `snake_case` for variable names.
```python
example_variable = 10
```

### Functions and Methods
- Use `snake_case` for function and method names.
```python
def example_function():
pass
```

## Documentation

### Docstrings
- Use docstrings to comment and document your code. Docstrings should be used for modules, classes, methods, and functions.
```python
def example_function(param1, param2):
"""
This is an example function.
Args:
param1 (int): The first parameter.
param2 (str): The second parameter.
Returns:
bool: The return value. True for success, False otherwise.
"""
return True
```

## Code Layout

### Indentation
- Use 4 spaces per indentation level.
```python
def example_function():
if True:
print("Hello, world!")
```


### Blank Lines
- Use blank lines to separate top-level functions and class definitions.
- Use blank lines sparingly inside functions to indicate logical sections.

```python
class ExampleClass:
def __init__(self, value):
self.value = value

def example_method(self):
if self.value:
return True

return False
```

Loading

0 comments on commit 54d5327

Please sign in to comment.