Coder Social home page Coder Social logo

testcafe_saucedemo's Introduction

TestCafe_TheInternet

This project is a simple POC / playground using TestCafe with TS.

TestCafe Notes

Best Practices: https://testcafe.io/documentation/402836/guides/basic-guides/best-practices#smart-assertions

Smart Assertions

Synopsis: Do not use await with certain calls such as getting text from a element for assertion. Not using await allows testCafe to use its "Smart Assertions" feature and keep checking the element until a timeout is reached. If you do use await, you are getting a static value at that point and time.

File Structure

├── .testcaferc.json
└── tests
    ├── |- test_group1/
    │   └── |-test1.js
    │       |-test2.js
    ├── |- test_group2/
    │   └── |-test1.js
    │       |-test2.js
    ├── |- page_model/
    │   └── |- page1.js
    │       |- page2.js
    ├── |- helpers/
    │   └── |- helper1.js
    │       |- helper2.js
    ├── |- roles/
    │   └── |- roles.js
    └── |-data

Roles

https://testcafe.io/documentation/402845/guides/advanced-guides/authentication

A feature of TestCafe that is like a pre-built helper function to call when you need to login with a specific user (e.g. Admin, Invalid user, valid user, etc...)

Setup & Teardown

Read more - Hooks: https://testcafe.io/documentation/403435/guides/advanced-guides/hooks Hooks are reusable code sequences that run before or after tests and fixtures.

After & AfterEach (aka Teardown)

fixture `My fixture`
    .page `http://example.com`
    .afterEach( async t => {
        await cleanDir();
    });

test('My test', async t => {
    //test actions
});

Before / BeforeEach (aka Setup)

fixture `Another fixture`
    .page `http://example.com`
    .beforeEach( async t => {
        await setupFileSystem();
    });

test('Another test', async t => {
    //test actions
});

Selector Plugins

If the AUT is built using a specific JS framework, try using one of the selector plugins:

testcafe_saucedemo's People

Contributors

nedwilbur avatar

Watchers

 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.