Jen Chen

@jenc

Software Developer

Joined on Aug 24, 2021

  • Get Started Vercel is an end-to-end platform for developers, that allows you to create and deploy your web application. Vercel provides the following features to enable you to serve fast and personalized content to your users: Deployments CI/CD Custom domains Monitoring your project CLI vercel env
     Like  Bookmark
  • https://browsee.io/blog/chropath-a-quick-way-to-get-and-verify-xpath-and-css-selectors/ Install and access Install from chrome web store Can see the ChroPath by using F12 on Chrome of the target website Usage Search for the related XPath by Xpath Choose Rel Path XPath (related XPath) and keyin the keyword of the selector //td[contains(text(),'WL1XXB0029')]/preceding::td/div and press Enter
     Like  Bookmark
  • https://docs.microsoft.com/en-us/sql/connect/jdbc/working-with-a-connection?view=sql-server-ver15 Create connection Use Class.forName to prevent No suitable driver found for jdbc:sqlite error: Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Create connection url with required variables String connectionUrl = "jdbc:sqlserver://localhost;database=AdventureWorks;integratedSecurity=true;" eg,
     Like  Bookmark
  • https://www.sitepoint.com/bdd-javascript-cucumber-gherkin/ https://vinodmuralidharan.medium.com/cucumber-js-data-table-guide-a2447b74c86e Different between the data tables and Examples At least two columns .feature file Scenario: Category dropdown When the user navigates to the home page When the user selects a category from the category dropdown:
     Like  Bookmark
  • https://www.typescriptlang.org/docs/handbook/2/objects.html interface ArrayType<Type> { length: number; slice(start: number, end: number): Type; } function getShuffledArray<Type extends ArrayType<Type>>(array: Type): Type { for (let i = array.length - 1; i > 0; i -= 1) { const j = Math.floor(Math.random() * (i + 1));
     Like  Bookmark
  • https://www.geeksforgeeks.org/how-to-use-async-await-with-foreach-loop-in-javascript/ https://stackoverflow.com/questions/37764665/how-to-implement-sleep-function-in-typescript Create a delay function for visibility: function delay(ms: number) { return new Promise( resolve => setTimeout(resolve, ms) ); } Have a function that prints out texts:
     Like  Bookmark
  • Assign a value to a variable that is defined outside of Promise Use Promise.then function getPromiseNums(): Promise<number[]> { return Promise.resolve([1, 2, 3, 4, 5]); } function disPlayNums(): void { let len = 0; getPromiseNums()
     Like  Bookmark
  • 1. Setup before and after tests using pytest fixture https://docs.pytest.org/en/6.2.x/example/simple.html https://stackoverflow.com/questions/22627659/run-code-before-and-after-each-test-in-py-test Pass variables via command line using pytest_addoption in conftest.py: import pytest def pytest_addoption(parser):
     Like 2 Bookmark
  • The Purpose of Formatting Code formatting is about communication, and communication is the professional developer’s first order of business Coding style and readability persist, even as the original codes are changed over time because of maintenance and extension needs. Vertical Formatting Example of Java projects file length distributions: What can we see from the graph?
     Like  Bookmark
  • Data Abstraction Hiding implementation is about abstractions! To not expose the details of data, use: interface getters and setters Data/Object Anti-Symmetry Objects hide their data behind abstractions and expose functions that operate on that data.
     Like  Bookmark
  • When Buy 3rd party packages Use open source Use components or subsystems that are created by other teams Using Third-Party Code Provider interface (3rd party packages or frameworks)Broad applicability for various environments and users User interface
     Like  Bookmark
  • Writing automated unit tests is encouraged because of the trend of Agile and TDD movements. However, it is important to write good tests instead of just writing tests. The Three Laws of TDD Other resources: https://blog.cleancoder.com/uncle-bob/2014/12/17/TheCyclesOfTDD.html https://www.ibm.com/garage/method/practices/code/practice_test_driven_development/ The tests and the production code are written together, with the tests just a few seconds ahead of the production code. First Law
     Like  Bookmark
  • Source https://www.typescriptlang.org/docs/handbook/2/generics.html Example The constructors of ClassA and ClassB both take string arguments during object creation The function getClassInstance has two parameters, one is a string parameter for object creation. The other is the class type for the constructor class ClassA { private myName: string;
     Like  Bookmark
  • 0. Modularize functions and everything that can be modularized For example, need to check if a class of an element contains disabled before clicking (such as the next and previous icons). Thus, create another function to check if disabled is not in WebElement, then click the WebElement. 1. Check if an element class contains disabled Or check other attributes of the element that indicate the element's displayed or interactable status. Get the element first, get the class attribute of the element, and check if it contains the keyword disabled. Interact with the element if it does not contain disabled. (or remove the disabled attribute before interacting with the element) For example,
     Like  Bookmark
  • Issues Element is not attached to the page document selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document Solution 1 https://www.crifan.com/selenium_by_id_got_element_click_error_element_is_not_attached_to_the_page_document/ Refresh the current page before locating and interacting with the element. self.driver.refresh()
     Like  Bookmark
  • https://appdividend.com/2022/06/03/how-to-import-class-from-another-file-in-python/ https://www.pythonpool.com/import-classes-from-another-file-in-python/ Import Classes From Another File Add __init__.py in the module folder Should not name the file name with . , eg, base.page.py, otherwise it leads to the module not found error (. is for the route of folder layers) Use . to locate the .py file in the folder
     Like  Bookmark
  • Example response of API call https://www.postman.com/collections/6655f0c79fe567dd58fc Other reading https://www.labnol.org/google-api-service-account-220405 https://medium.com/@sirajul.anik/understanding-oauth-2-0-179543b18bd Original packages from google API doc (more complicated solutions) https://www.npmjs.com/package/googleapis https://www.npmjs.com/package/@google-cloud/local-auth
     Like  Bookmark
  • Source https://www.youtube.com/c/LambdaTest/featured Code smells examples Sleep instead of Wait Poor variable naming Repetitive codes Try Catch with an empty catch Single class with all helper functions
     Like  Bookmark
  • 1. WebDriver object is inited by Test class and is assigned to Page class 2. Aware driver object becomes null in POM model Might be due to the design which passes the incorrect driver object to the page object. 3. Use TestBase class, PageBase class Or another way that applies more OOP and design patterns. 4. Invisible elements cannot be found when using WebDriverWait ExpectedConditions.visibilityOfElementLocated For example, when sending the key to the file upload input tag.
     Like  Bookmark
  • Virtual environment https://realpython.com/python-virtual-environments-a-primer/ https://docs.python.org/3/tutorial/venv.html Can install packages in the virtual environment using command lines. For example, writing linux scripts setup.sh and teardown.sh to create env and install packages via conda. setup.sh #!/bin/bash
     Like  Bookmark