Giter Site home page Giter Site logo

ecommerce_exercise's Introduction

eCommerce demo in Swift gif demo

Description

This is a single page app with two views: products and vouchers. Both are laid out as collection views for extendability. Actual products and vouchers are table files that feed a "cart brain" file and the collection views.

The vouchers have been implemented just like products, to be added or removed manually, because the user story specified that we needed to raise errors if the wrong voucher was applied. In real life, I would have tried to go back to the client with a case to narrow the possibilities for annoying the customer, and request to make the vouchers automatically applicable with a positive message shown.

I chose not to use the UIAlertController for the voucher and stock check error messages, as I wanted to keep the design subtle and the scolding of the user to a minimum.

The app looks as good in portrait or landscape, on any iPhone or iPad device. Much time was spent with Autolayout.

Testing is done with automation using the new eyeTest tool, which uses Javascript instructions via Instruments to automate the testing of the user stories, in RSpec style. While building the tests, I added some of my own collection view test methods, but unfortunately the automated scrolling function doesn't scroll far enough to pass my stock check user story. You can see this functionality working in the simulator.

Technical improvements:

The brief did not require use of a database but, after building, I think it must be easier to use CoreData or a Rails back end to share the cart and stock information. I am particularly unhappy with calling two instantiations of ProductList() (one in the Cart Brain and one in ProductViewController).

Future plans, extending the brief:

  • build the buy/checkout screen
  • add a + sign to the products so that users could add more than one of the same product
  • for less scrolling, add gender and category filters at the top of the screen

To install and run the simulator

  • with Xcode installed
  • in terminal: git clone [email protected]:saramoohead/ecommerce_exercise.git
  • open Xcode
  • open eCommerceExercise.project
  • run the build into the simulator with the device of your choice

To install and run the feature tests (gif demo below)

  • after the project has been successfully built into the simulator, shortcut: ⌘R
  • stop the simulator, shortcut: ⌘.
  • launch Instruments, shortcut: ⌘i
  • choose Automation
  • go to the Display Settings tab in bottom right corner, shortcut ⌘2
  • select Add then Import and choose the featureTest.js file
  • the script will appear in the bottom left window
  • hit the play button at the bottom of the screen to see the test messages

Assigned user stories

The prioritised list of user stories is as follows:

  • As a User I can view the products and their category, price and availability information.
  • As a User I can add a product to my shopping cart.
  • As a User I can remove a product from my shopping cart.
  • As a User I can view the total price for the products in my shopping cart.
  • As a User I can apply a voucher to my shopping cart.
  • As a User I can view the total price for the products in my shopping cart with discounts applied.
  • As a User I am alerted when I apply an invalid voucher to my shopping cart.
  • As a User I am unable to put Out of Stock products to the shopping cart.

ecommerce_exercise's People

Contributors

saramoohead avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.