Skip to content

Commit

Permalink
commit web katalog restorant PWA
Browse files Browse the repository at this point in the history
  • Loading branch information
AdisufatulAnam committed Dec 26, 2022
0 parents commit f3f5a51
Show file tree
Hide file tree
Showing 67 changed files with 35,452 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": "airbnb-base",
"overrides": [],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"import/no-extraneous-dependencies": 0,
"no-extra-semi": 0,
"no-console": 0,
"no-alert": 0,
"no-underscore-dangle": 0,
"no-restricted-globals": 0,
"linebreak-style": 0
}
}
32 changes: 32 additions & 0 deletions codecept.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const { setHeadlessWhen, setCommonPlugins } = require('@codeceptjs/configure');
// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);

// enable all common plugins https://github.com/codeceptjs/configure#setcommonplugins
setCommonPlugins();

/** @type {CodeceptJS.MainConfig} */
exports.config = {
tests: 'e2e/**/*.spec.js',
output: 'e2e/outputs',
helpers: {
Puppeteer: {
url: 'http://127.0.0.1:9090',
show: true,
windowSize: '1200x900',
},
},
include: {
I: './steps_file.js',
},
name: 'Projek',
plugins: {
retryFailedStep: {
enabled: true,
},
screenshotOnFail: {
enabled: true,
},
},
};
77 changes: 77 additions & 0 deletions e2e/Liking_Restaurants.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/* eslint-disable no-plusplus */
/* eslint-disable no-undef */
const assert = require('assert');

// eslint-disable-next-line no-undef
Feature('Liking Restaurants');

// eslint-disable-next-line no-undef
Before(({
I,
}) => {
I.amOnPage('/#/favorite');
});

Scenario('showing empty liked restaurants', ({
I,
}) => {
I.see('Tidak ada restaurants untuk ditampilkan', '.movie-item__not__found');
});

Scenario('liking one restaurants', async ({
I,
}) => {
I.see('Tidak ada restaurants untuk ditampilkan', '.movie-item__not__found');

I.amOnPage('/');

I.seeElement('.movie__title a');

const firstRestaurant = locate('.movie__title a').first();
const firstRestaurantTitle = await I.grabTextFrom(firstRestaurant);
I.click(firstRestaurant);

I.seeElement('#likeButton');
I.click('#likeButton');

I.amOnPage('/#/favorite');
I.seeElement('.movie-item');
const likedRestaurantTitle = await I.grabTextFrom('.movie__title');

assert.strictEqual(firstRestaurantTitle, likedRestaurantTitle);
});

// Scenario('searching movies', async ({ I }) => {
// I.see('Tidak ada film untuk ditampilkan', '.movie-item__not__found');

// I.amOnPage('/');

// I.seeElement('.movie__title a');

// const titles = [];

// for (let i = 1; i <= 3; i++) {
// I.click(locate('.movie__title a').at(i));
// I.seeElement('#likeButton');
// I.click('#likeButton');
// titles.push(await I.grabTextFrom('.movie__title'));
// I.amOnPage('/');
// }

// I.amOnPage('/#/like');
// I.seeElement('#query');

// const searchQuery = titles[1].substring(1, 3);
// const matchingMovies = titles.filter((title) => title.indexOf(searchQuery) !== -1);

// I.fillField('#query', searchQuery);
// I.pressKey('Enter');

// const visibleLikedMovies = await I.grabNumberOfVisibleElements('.movie-item');
// assert.strictEqual(matchingMovies.length, visibleLikedMovies);

// matchingMovies.forEach(async (title, index) => {
// const visibleTitle = await I.grabTextFrom(locate('.movie__title').at(index + 1));
// assert.strictEqual(title, visibleTitle);
// });
// });
47 changes: 47 additions & 0 deletions e2e/UnLiking_Restaurants.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* eslint-disable no-undef */
const assert = require('assert');

// eslint-disable-next-line no-undef
Feature('Unliking Restaurants');
Before(({
I
}) => {
I.amOnPage('/#/favorite');
});
Scenario('showing empty liked menu restaurant', ({
I
}) => {
I.dontSeeElement('.movie-item');
});

Scenario('unliking one restaurant', async ({
I
}) => {
I.amOnPage('/');

I.waitForElement('.movie-item a', 30);
I.seeElement('.movie-item a');

const firstRestaurant = locate('.movie-item a').first();
const firstRestaurantsTitles = await I.grabTextFrom(firstRestaurant);
I.click(firstRestaurant);

I.seeElement('#likeButton');
I.click('#likeButton');

I.amOnPage('/#/favorite');
I.seeElement('.movie-item');

const unlikedRestaurantsTitles = await I.grabTextFrom('.movie-item a');
assert.strictEqual(firstRestaurantsTitles, unlikedRestaurantsTitles);

I.seeElement('.movie-item a');
await I.grabTextFrom(firstRestaurant);
I.click(firstRestaurant);

I.seeElement('#likeButton');
I.click('#likeButton');

I.amOnPage('/#/favorite');
I.dontSeeElement('.movie-item');
});
Binary file added e2e/outputs/liking_one_restaurants.failed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added e2e/outputs/unliking_one_restaurant.failed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"allowJs": true
}
}
73 changes: 73 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// Karma configuration
// Generated on Fri Jul 03 2020 20:15:52 GMT+0700 (Western Indonesia Time)
module.exports = function (config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],

// list of files / patterns to load in the browser
files: [
'specs/**/*Spec.js',
],

// list of files / patterns to exclude
exclude: [],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'specs/**/*Spec.js': ['webpack', 'sourcemap'],
},

webpack: {
// karma watches the test entry points
// (you don't need to specify the entry option)
// webpack watches dependencies
// webpack configuration
devtool: 'inline-source-map',
mode: 'development',
},

webpackMiddleware: {
// webpack-dev-middleware configuration
// i. e.
stats: 'errors-only',
},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],

// web server port
port: 9876,

// enable / disable colors in the output (reporters and logs)
colors: true,

// level of logging
/* possible values: config.LOG_DISABLE || config.LOG_ERROR
|| config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG */
logLevel: config.LOG_INFO,

// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['ChromeHeadless'],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,
});
};
Loading

0 comments on commit f3f5a51

Please sign in to comment.