Skip to content

Commit

Permalink
wdio tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kb-kerem committed May 22, 2024
1 parent d7aa2dd commit 1914cfa
Show file tree
Hide file tree
Showing 12 changed files with 13,270 additions and 0 deletions.
13 changes: 13 additions & 0 deletions visual-js/visual-wdio/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:18 AS runner

COPY ./integration-tests/configs ./configs
COPY ./integration-tests/helpers ./helpers
COPY ./integration-tests/pages ./pages
COPY ./integration-tests/specs ./specs

COPY ./integration-tests/package.json ./
COPY ./integration-tests/tsconfig.json ./

RUN npm install

ENTRYPOINT ["npm", "run", "login-test"]
74 changes: 74 additions & 0 deletions visual-js/visual-wdio/integration-tests/configs/e2e.constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
const USERNAME =
process.env.VISUAL_CHECK === 'true' ? 'visual_user' : 'standard_user';
const PASSWORD = 'secret_sauce';
export const DEFAULT_TIMEOUT = 30 * 1000;
export const PAGES = {
CART: '/cart.html',
CHECKOUT_COMPLETE: '/checkout-complete.html',
CHECKOUT_PERSONAL_INFO: '/checkout-step-one.html',
CHECKOUT_SUMMARY: '/checkout-step-two.html',
LOGIN: '/',
SWAG_DETAILS: '/inventory-item.html',
SWAG_ITEMS: '/inventory.html',
SWAG_ITEMS_LONG: '/inventory-long.html',
};
export const PRODUCTS = {
BIKE_LIGHT: 0,
BOLT_SHIRT: 1,
ONE_SIE: 2,
TATT_SHIRT: 3,
BACKPACK: 4,
FLEECE_JACKET: 5,
};
export const LOGIN_USERS = {
LOCKED: {
username: 'locked_out_user',
password: PASSWORD,
},
NO_MATCH: {
username: 'd',
password: 'd',
},
NO_USER_DETAILS: {
username: '',
password: '',
},
NO_PASSWORD: {
username: USERNAME,
password: '',
},
PERFORMANCE: {
username: 'performance_glitch_user',
password: PASSWORD,
},
STANDARD: {
username: USERNAME,
password: PASSWORD,
},
VISUAL: {
username: 'visual_user',
password: PASSWORD,
},
};
export const PERSONAL_INFO = {
STANDARD: {
firstName: 'Sauce',
lastName: 'Bot',
zip: '94105',
},
NO_FIRSTNAME: {
firstName: '',
lastName: 'Bot',
zip: '94105',
},
NO_LAST_NAME: {
firstName: 'Sauce',
lastName: '',
zip: '94105',
},
NO_POSTAL_CODE: {
firstName: 'Sauce',
lastName: 'Bot',
zip: '',
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { Options } from '@wdio/types';
import { config as sauceSharedConfig } from './wdio.saucelabs.shared.conf.ts';

const buildName = `Sauce Demo Test - ${new Date().getTime()}`;

export const config: Options.Testrunner = {
...sauceSharedConfig,
//
// ============
// Capabilities
// ============
capabilities: [
{
browserName: 'chrome',
browserVersion: 'latest',
platformName: 'Windows 11',
'sauce:options': {
screenResolution: '2560x1600',
build: buildName,
},
},
],
// =====
// Hooks
// =====
before: async (_capabilities, _specs) => {
// Set all browsers to the "same" viewport
await browser.setWindowRect(null, null, 1920, 1080);
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import type { Options } from '@wdio/types';
import { config as sharedConfig } from './wdio.shared.conf.ts';
import { getSauceCredentials } from '../helpers/index.ts';

//
// Get the Sauce Labs credentials
const { sauceUsername, sauceAccessKey } = await getSauceCredentials();

export const config: Options.Testrunner = {
...sharedConfig,
//
// =================
// Service Providers
// =================
user: sauceUsername,
key: sauceAccessKey,
region: (process.env.REGION || 'us') as Options.SauceRegions,
//
// ============
// Capabilities
// ============
// Are not configured here, they can be found in:
// - wdio.saucelabs.desktop.conf.ts
// - wdio.saucelabs.mobile.conf.ts
//
// ========
// Services
// ========
services: (sharedConfig.services || []).concat([
//
// This service is needed for WDIO to make sure it can connect to Sauce Labs to:
// - automatically update the names
// - automatically update the status (passed/failed)
// - automatically send the stacktrace in case of a failure
//
'sauce',
//
// This service is needed for the Sauce Visual service to work
//
[
'@saucelabs/wdio-sauce-visual-service',
// The options for the Sauce Visual service
{},
],
]),
};
Loading

0 comments on commit 1914cfa

Please sign in to comment.