Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install mathesar_types to full-fill some of the important db functions to work with e2e integ Testing #1168

Closed
ManishShah120 opened this issue Mar 14, 2022 · 8 comments · Fixed by #1199
Assignees
Labels
good first issue Everything in "Help wanted", PLUS being relatively easy and straightforward to implement. help wanted Community contributors can implement this type: bug Something isn't working work: frontend Related to frontend code in the mathesar_ui directory

Comments

@ManishShah120
Copy link
Contributor

Description

While running the e2e integration testing, integ environment is missing certain db functions, which doesn't allow the e2e environment to work with.

Expected behavior

All the front-end functionality should work exactly the same manner as working with any browser in the playwright browser or e2e testing environment.

To Reproduce

This issue was found while working on these e2e tests, please refer these links:-

Environment

  • OS: (eg. macOS 10.14.6; Fedora 32)
  • Browser: (eg. Safari; Firefox; chromium)
  • Browser Version: (eg. 13; 73)
  • Other info:

Additional context

Please refere:-

@ManishShah120 ManishShah120 added status: triage type: bug Something isn't working labels Mar 14, 2022
@pavish pavish added work: frontend Related to frontend code in the mathesar_ui directory ready Ready for implementation and removed status: triage labels Mar 14, 2022
@pavish pavish added this to the [06.1] 2022-03 improvements milestone Mar 14, 2022
@pavish pavish added good first issue Everything in "Help wanted", PLUS being relatively easy and straightforward to implement. help wanted Community contributors can implement this labels Mar 14, 2022
@kgodey
Copy link
Contributor

kgodey commented Mar 14, 2022

@ManishShah120 are you working on this? I saw some messages in Matrix that might indicate that you are.

@ManishShah120
Copy link
Contributor Author

Yes, @kgodey am working on it. It's a blocker for one of the other issue I am working on.

@kgodey kgodey added status: started and removed ready Ready for implementation labels Mar 14, 2022
@kgodey
Copy link
Contributor

kgodey commented Mar 14, 2022

Great thanks @ManishShah120, assigned to you.

@silentninja
Copy link
Contributor

@ManishShah120 Few other issues(#1128, #1127) depend on this issue If you haven't started working on it, please let us know so that a core contributor can fix this issue.

@ManishShah120
Copy link
Contributor Author

ManishShah120 commented Mar 18, 2022

@ManishShah120 Few other issues(#1128, #1127) depend on this issue If you haven't started working on it, please let us know so that a core contributor can fix this issue.

Hi, @silentninja I was working on it(but not working at present), but then I found out that, the issue I faced can be solved, by passing patent_schema as an argument to the tests or fixture associated with it so was rethinking about this issue(may be there is no issue), and hence #1128 fixed with #1170 , I also tried to work on #1127 , in my case It got resolved, but #1182 is failing don't know why, should I open a PR, to make sure if it actually got fixed.

cc: @pavish

@silentninja
Copy link
Contributor

silentninja commented Mar 18, 2022

@ManishShah120 That's not a proper solution, the reason why it works is that patent scheme is installing custom types https://github.com/centerofci/mathesar/blob/fbdfe75f5838d8948a540a6363f20654bf62c5b1/mathesar/tests/conftest.py#L136 when it is created. The proper solution is to use a schema like patent_schema which installs custom types instead of base_schema. base_schema should not be used for any test case which relies on custom types, the test cases would be misleading if done so.

@ManishShah120
Copy link
Contributor Author

ManishShah120 commented Mar 18, 2022

https://github.com/centerofci/mathesar/blob/fbdfe75f5838d8948a540a6363f20654bf62c5b1/mathesar/tests/conftest.py#L136

when it is created. The proper solution is to use a schema like patent_schema which installs custom types instead of base_schema. base_schema should not be used for any test case which relies on custom types, the test cases would be misleading if done so.

@silentninja I see. So do we need to do any of these:- 🤔

@pytest.fixture
def install_custom_type_schema(test_db_model):
    engine = create_mathesar_engine(test_db_model.name)
    install.install_mathesar_on_database(engine)

OR

@pytest.fixture
def install_custom_type_schema(test_db_model):
    engine = create_mathesar_engine(test_db_model.name)
    _add_custom_types_to_engine(engine)
    install.install_mathesar_on_database(engine)

and then pass these fixture wherever it is required 🤔

@silentninja
Copy link
Contributor

@ManishShah120 Yes, that should be the correct way forward. The correct fixture is the first one as create_mathesar_engine does call _add_custom_types_to_engine when creating the engine, so additional call for _add_custom_types_to_engine is not necessary as done in the second fixture.

@pytest.fixture
def install_custom_type_schema(test_db_model):
    engine = create_mathesar_engine(test_db_model.name)
    install.install_mathesar_on_database(engine)

I would also look into renaming it to something like custom_types_schema instead of install_custom_type_schema as it returns a schema with custom types installed instead of installing custom types into a schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Everything in "Help wanted", PLUS being relatively easy and straightforward to implement. help wanted Community contributors can implement this type: bug Something isn't working work: frontend Related to frontend code in the mathesar_ui directory
Projects
No open projects
4 participants