Why my test keeps getting skipped? (Using WebDriver.io and cucumber) - automated-tests

I am trying to run my test, but the result is some of my scenario test is getting skipped:
step-definitions file:
const { Given, When, Then } = require('#wdio/cucumber-framework');
const MainPage = require('../pageobjects/main-page.js');
const ElementsPage = require('../pageobjects/elements-page.js');
const ButtonsPage = require('../pageobjects/buttons-page.js')
Given('I am on the Main Page', async () => {
await MainPage.open(`https://demoqa.com/`)
});
When('I click Elements Button', async() => {
await MainPage.clickElements()
});
Then('I successfully go to <string> Page', async(namePage) => {
await ElementsPage.verifyClickButton(namePage)
});
When('I click Button on Navbar', async() => {
await ElementsPage.clickBtnButtons()
});
Then('I successfully open {string} Page', async(buttons) => {
await ButtonsPage.verifyNamePage(buttons)
});
When('I click on Click Me Button', async() => {
await ButtonsPage.clickBtnClickMe()
});
Then('I successfully click on Click Me Button', async() => {
await ButtonsPage.verifyClickMeButton()
});
When('I click on Right Click Me Button', async() => {
await ButtonsPage.clickBtnRightClickMe()
});
Then('I successfully click on Right Click Me Button', async() => {
await ButtonsPage.verifyRightClickMeButton()
});
When('I click on Double Click Me Button', async() => {
await ButtonsPage.clickBtnDoubleClickMe()
});
Then('I successfully click on Double Click Me Button', async() => {
await ButtonsPage.verifyDoubleClickMeButton()
});
Since there are no errors, I am wondering what should I do?
Console-logs:
"spec" Reporter:
------------------------------------------------------------------
[chrome 108.0.5359.125 windows #0-0] Running: chrome (v108.0.5359.125) on windows
[chrome 108.0.5359.125 windows #0-0] Session ID: 86891a0c4203314f998ad2a06ab208a6
[chrome 108.0.5359.125 windows #0-0]
[chrome 108.0.5359.125 windows #0-0] » \features\scenarios\buttons.feature
[chrome 108.0.5359.125 windows #0-0] Latihan Automation di demoqa.com
[chrome 108.0.5359.125 windows #0-0] Successfully click 3 Buttons in Elements Page
[chrome 108.0.5359.125 windows #0-0] ✓ Given I am on the Main Page
[chrome 108.0.5359.125 windows #0-0] ✓ When I click Elements Button
[chrome 108.0.5359.125 windows #0-0] ✓ Then I successfully go to "Elements" Page
[chrome 108.0.5359.125 windows #0-0] ✓ When I click Button on Navbar
[chrome 108.0.5359.125 windows #0-0] - Then I successfully open "Buttons" Page
[chrome 108.0.5359.125 windows #0-0] - When I click on Click Me Button
[chrome 108.0.5359.125 windows #0-0] - Then I successfully click on Click Me Button
[chrome 108.0.5359.125 windows #0-0] - When I click on Right Click Me Button
[chrome 108.0.5359.125 windows #0-0] - Then I successfully click on Right Click Me Button
[chrome 108.0.5359.125 windows #0-0] - Then I successfully click on Double Click Me Button
[chrome 108.0.5359.125 windows #0-0]
[chrome 108.0.5359.125 windows #0-0] 4 passing (37.2s)
[chrome 108.0.5359.125 windows #0-0] 7 skipped
Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:42
2022-12-20T08:58:07.664Z INFO #wdio/local-runner: Shutting down spawned worker
2022-12-20T08:58:07.927Z INFO #wdio/local-runner: Waiting for 0 to shut down gracefully
2022-12-20T08:58:07.929Z INFO #wdio/local-runner: shutting down
Am I am missing some configurations here? I don't know what to try, it is my first time using WebdriverIO.

Related

Pinia firebase user emailVerified property loses reactivity

Currently I'm building an app that on user signup navigates the user to an email verification page. This page then watches the firebase user object inside of a Pinia store waiting for the emailVerified user property to update before directing them to a new page.
When I update the user object manually using vue devtools I can observe my console.log. When I receive the email verification email and use the link provided by firebase my watcher does not react to the user update. I can refresh the pinia store using my vue devtools and I see emailVerified inside my firebase user object has been updated to true but my watcher was never hit.
Any ideas on why I am losing reactivity when going through the email flow?
testStore.js
export const useTestStore = defineStore('test', () => {
const auth = getAuth()
const {user} = useAuth(auth)
return {
user: user,
}
})
emailVerification.js
<script setup>
const { user } = storeToRefs(testStore)
watch(user, () => {
console.log('Direct user to new page')
}, { deep:true })
</script>
For some reason when replacing my watcher with setInterval it seems to works... although this is not the ideal solution
setInterval(function () {
if(user){
if(user.value?.emailVerified) {
console.log('Direct user to new page');
}
}
}, 5000);

How do I fix firebase auth/netwok-request-failed when opened by social media browsers?

I recently had a bug to solve for a customer on my webapp. It is givng a
Firebase: Error(auth/network-request-failed)
However I also realize upon selecting 'Ok' on the alert, the browser redirects the user to login with their account, however has a my FIREBASE_AUTH_DOMAIN - {projectID}.firbaseapp.com .
This only occurs when user visit the login/signUp link via social media browser.
So I changed the signInWithPopUp -> signInWithRedirect.
And now I still get the error if I am redirected to the login/signUp page. How I do fix this?
const loginGoogle = async () => {
closeSnackbar();
const provider = new GoogleAuthProvider();
signInWithRedirect(auth, provider)
.then(() => {
createUserDoc(); //creates a userProfile document
enqueueSnackbar(
`Welcome ${
!auth.currentUser.displayName ? "" : auth.currentUser.displayName
}`,
{ variant: "success" }
);
})
.catch((error) => {
alert(error.message);
});
router.push(redirect || "/shop");
};

open Angular dialog in async methode

I want to open progress dialog by the onclick event. When I click on the button, the dialog is not opened until all async methodes finished. So I want to open the dialog when it begin writing the file. someone any idea how to fix it?
Html
<buton onclick="writeFile"></button>
TS
public async writeFile() {
const dialogRef = this.dialog.open(ProgressComponent);
await this.writePage1()
await this.writePage2()
await this.writePage3()
await this.writePage4()
}
For somone that has the same issue here How I fixed it. you can use afterOpened() from the dialog to let first the dialog open and run the async methodes.
this.dialog.open(ProgressComponent).afterOpened().subscribe(() => {
await this.writePage1()
await this.writePage2()
await this.writePage3()
await this.writePage4()
});

Rnfirebase Notification not working when app is open react native

I have an app that shows notifications perfectly in the foreground and background but not working when the app is in front/open.
messaging().onNotificationOpenedApp(remoteMessage => {
console.log(
'Notification caused app to open from background state: 1111111-22333 app open in background' ,
remoteMessage.notification,
);
and
messaging().onMessage(async (remoteMessage) => {
console.log('Push Notification: laveshmahajana1 ',remoteMessage)
PushNotificationIos.addNotificationRequest({
id: remoteMessage.messageId,
body: remoteMessage.notification.body,
title: remoteMessage.notification.title,
userInfo: remoteMessage.data,
});
```
Have a try by using https://github.com/zo0r/react-native-push-notification npm.
For Example:
import PushNotification from "react-native-push-notification";
messaging().onMessage(async (remoteMessage) => {
PushNotification.localNotification({
title: remoteMessage.data.title,
message: remoteMessage.data.body,
})
})

Need to visit a registration link multiple times in Cypress

I have a bunch of Cypress tests that are being driven by a fixture file which contains the number of tests I want to run.
As part of my tests. I need to visit a registration link and register a new account.
The problem is that the first time I visit the registration form. It appears fine. But if I go to it again. The new form doesn't show and I only see the regular login form.
I suspect that because I'm running multiple tests from one spec file that Cypress is remembering that I've already visited the page and showing me the log in form.
I know I shouldn't be using the UI to register new accounts. But it's the only solution currently.
/// <reference types="cypress" />
let user;
before(function () {
cy.task("newUser").then((user) => {
user = user;
});
});
const types = require("../fixtures/types");
types.forEach((type) => {
context("Matter Creation", () => {
it("Tests if a Service Agent can create a new matter", () => {
cy.fixture("data").then((data) => {
cy.addNewUser({
userEmail: user.email,
userPassword: user.password,
});
});
});
});
context("User Registration", () => {
it("Tests the registration process from a users perspective", () => {
cy.userRegistration({
userEmail: user.email,
userPassword: user.password,
});
});
it("Tests that users are registered and can sign in", () => {
cy.verifyRegistration({
userEmail: user.email,
userPassword: user.password,
});
});
});
});
Fixed it by moving my before state into my describe block.
It was reusing old data, instead of using new data for every test.

Resources