I am using Testcafe (free version) with Java Script. I want to run all my test cases (resides in multiple test scripts in __test__ directory) in a single browser instance (That way 1 time log in) per browser type.
- For example, 1 instance for chrome and 1 instance for safari but all tests will run before closing the browser.
- If a test fails, I want the screenshot is taken and count number of the test failures. But do want to continue.
- I'm doing all on Node 12 Docker image, so it is best if I don't need to install anything else.
How do I do this with Testcafe?
const createTestCafe = require('testcafe') let testcafe = null let runner = null createTestCafe('localhost', 1337, 1338) .then(tc => { testcafe = tc const runner = testcafe.createRunner() return runner .src([ '__test__/*.js' ]) .browsers([ 'chrome:headless --no-sandbox --disable-gpu', 'safari' ]) .screenshots('./reports/screenshots/', true) .run({ selectorTimeout: 10000, assertionTimeout: 10000, }) }) runner .screenshots({ path: 'reports/screenshots/', takeOnFails: true, }) .then(failedCount => { console.log('Tests failed: ' + failedCount) testcafe.close() }) .catch(error => { console.log("An ERROR detected:" + error) }) This is how you install chrome on Dockerfile. Can someone tell me how to install Firefox on Dockerfile?
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \ http_proxy=${http_proxy} https_proxy=${https_proxy} apt-get update && \ http_proxy=${http_proxy} https_proxy=${https_proxy} apt-get install -y --allow-unauthenticated google-chrome-stable && \ apt clean && rm -rf /var/lib/apt/lists/*