Failing to perform getText() and use in expect condition using async/await. Following is the it block
it('Apply permission to a folder', async () => {
await docsHomePage.clickProject();
await projectsPage.projectCreateNewFolderAndSelect("AutoProject");
await projectsPage.uploadFile('Aug2017.pdf');
//uploadMessageElement = await projectsPage.getFileUploadSuccessMessage();
let uploadMessageText = element(by.id('projects-upload-success-new'));
expect(await uploadMessageText.getText()).toEqual('1 new Document created sucessfully');
await projectsPage.clickFileUploadSuccessCloseButton();
});
Getting the following error:
2) Non Angular CLM Page Apply permission to a folder
Message:
Failed: script timeout
(Session info: chrome=79.0.3945.117)
Stack:
ScriptTimeoutError: script timeout
(Session info: chrome=79.0.3945.117)
at Object.throwDecodedError
(C:\Users\sagar.ladwa\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium- webdriver\lib\error.js:514:15)
at parseHttpResponse (C:\Users\sagar.ladwa\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:519:13)
at doSend.then.response (C:\Users\sagar.ladwa\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:441:30)
at process._tickCallback (internal/process/next_tick.js:68:7)Error
at ElementArrayFinder.applyAction_ (C:\Users\sagar.ladwa\AppData\Roaming\npm\node_modules\protractor\built\element.js:459:27)
at ElementArrayFinder.(anonymous function).args [as getText] (C:\Users\sagar.ladwa\AppData\Roaming\npm\node_modules\protractor\built\element.js:91:29)
at ElementFinder.(anonymous function).args [as getText] (C:\Users\sagar.ladwa\AppData\Roaming\npm\node_modules\protractor\built\element.js:831:22)
at UserContext.it (C:\Users\sagar.ladwa\Downloads\protractor-initial-project-master\protractor-initial-project-master\specs\user-groups-permission.js:57:45)
at process._tickCallback (internal/process/next_tick.js:68:7)
From asynchronous test:
Error
at Suite.describe (C:\Users\sagar.ladwa\Downloads\protractor-initial-project-master\protractor-initial-project-master\specs\user-groups-permission.js:49:5)
at Object.<anonymous> (C:\Users\sagar.ladwa\Downloads\protractor-initial-project-master\protractor-initial-project-master\specs\user-groups-permission.js:7:1)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
Getting similar issue when we tried to create a page-object.
It's your console.log which is causing the issue. If you want to print the text you will need to await uploadMessageText.getText() there also.
This will likely be easier for you
let uploadMessageText = await element(by.id('projects-upload-success-new')).getText()
console.log('-----------------------------------'+uploadMessageText);
expect(uploadMessageText).toEqual('1 new Document created sucessfully');
Related
Have following code:
import convert from 'heic2any'
try {
convertedImage = await convert({ blob: propsAndFile?.file })
} catch (error) {
console.error(error)
}
But got this error, though they promise it will run on client side: https://www.npmjs.com/package/heic2any
info - Collecting page data ..node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^
ReferenceError: window is not defined
at /Users/janoskukoda/Workspace/tikex/portal/team/node_modules/heic2any/dist/heic2any.js:23:1
at /Users/janoskukoda/Workspace/tikex/portal/team/node_modules/heic2any/dist/heic2any.js:11:26
at Object.<anonymous> (/Users/janoskukoda/Workspace/tikex/portal/team/node_modules/heic2any/dist/heic2any.js:20:2)
at Module._compile (node:internal/modules/cjs/loader:1205:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1259:10)
at Module.load (node:internal/modules/cjs/loader:1068:32)
at Module._load (node:internal/modules/cjs/loader:909:12)
at Module.require (node:internal/modules/cjs/loader:1092:19)
at require (node:internal/modules/cjs/helpers:103:18)
at 2233 (/Users/janoskukoda/Workspace/tikex/portal/team/.next/server/pages/_app.js:176:18) {
type: 'ReferenceError'
}
Node.js v19.1.0
i have some Problems with my Code that somehow none of my friends have ...
Some Code to see:
module.exports = {
data: new SlashCommandBuilder()
.setName('equipment')
.setDescription('Gives you Information about specific Equipments')
.addStringOption(option =>
option.setName('type')
.setDescription('Specify the Equipment')
.setRequired(true)
.addChoice('Flashlight', 'flashlight')
),
...
The Code is Cut here because its not necesery for it above to work.
My Error Code:
PS C:\Users\enric\Desktop\Ghosty Phasmo Help> node .
C:\Users\enric\Desktop\Ghosty Phasmo Help\commands\phasmo\equipment.js:15
.addChoice('Flashlight', 'flashlight')
^
TypeError: option.setName(...).setDescription(...).setRequired(...).addChoice is not a function
at C:\Users\enric\Desktop\Ghosty Phasmo Help\commands\phasmo\equipment.js:15:18
at MixedClass._sharedAddOptionMethod (C:\Users\enric\Desktop\Ghosty Phasmo Help\node_modules\#discordjs\builders\dist\index.js:1334:50)
at MixedClass.addStringOption (C:\Users\enric\Desktop\Ghosty Phasmo Help\node_modules\#discordjs\builders\dist\index.js:1323:17)
at Object.<anonymous> (C:\Users\enric\Desktop\Ghosty Phasmo Help\commands\phasmo\equipment.js:11:7)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
Somehow my Discord.js thinks that im using a Function. I copied the Code from other friends where this completely work. but somehow the same Error message appears.
.addChoice() is outdated. Now, there is only .addChoices() (with an s)
.addStringOption(option =>
option.setName('type')
.setDescription('Specify the Equipment')
.setRequired(true)
.addChoices({
name: 'Flashlight',
value: 'flashlight'
})
)
Im trying to make a discord music bot and i have to admit that i dont have much knowledge on javascript so im just following a tutorial. Now this is the code he wrote
const slashFiles = fs.readdirSync("./slash").filter(file => file.endsWith(".js"))
for (const file of slashFiles){
const slashcmd = require(`./slash/${file}`)
client.toLocaleLowerCase.set(slashcmd.data.name, slashcmd)
if (LOAD_SLASH) commands.push(slashcmd.data.toJSON())
}
and thats the error im getting
client.toLocaleLowerCase.set(slashcmd.data.name, slashcmd)
^
TypeError: Cannot read properties of undefined (reading 'set')
at Object.<anonymous> (C:\Users\stelj\Desktop\bot\main.js:31:30)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Pls help
I tried making a discord bot and I did the first steps and the command prompt when I type node . shows this:
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
at Client._validateOptions (C:\Users\giann\Desktop\BWKS\node_modules\discord.js\src\client\Client.js:548:13)
at new Client (C:\Users\giann\Desktop\BWKS\node_modules\discord.js\src\client\Client.js:76:10)
at Object. (C:\Users\giann\Desktop\BWKS\main.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
[Symbol(code)]: 'CLIENT_MISSING_INTENTS'
}
I tried almomst everything but this error is coming up all the time.
the code:
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready')
});
client.login('the token');
Discord needs to know what intents you want to use. So to fix your code, use:
const client = new Discord.Client({ intents: [<ARRAY WITH ALL INTENTS>] });
client.once('ready', () => {
console.log('Ready')
});
client.login('the token');
You can add intents in the array by using a string "GUILDS" or use the property Intents.FLAGS.GUILDS
A list of all intents can be found here: https://discord.js.org/#/docs/discord.js/stable/class/Intents
I am very new to coding and I tried coding my own discord bot and I got the "discord is not refined" in command prompt. I am currently just trying to turn on the bot to see if it works, anyways here is the code
const Discord = require("discord.js");
const client = new Discord.Client();
client.once('ready'), () => {
console.log('HelloMyFriend is online!');
};
client.login('<token>');
stack trace
events.js:131
throw new ERR_INVALID_ARG_TYPE('listener', 'Function', listener);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined
←[90m at checkListener (events.js:131:11)←[39m
←[90m at Client.once (events.js:496:3)←[39m
at Object.<anonymous> (C:\Users\jamie\Desktop\DiscordBot\main.js:7:8)
←[90m at Module._compile (internal/modules/cjs/loader.js:1068:30)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:933:32)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:774:14)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
←[90m at internal/main/run_main_module.js:17:47←[39m {
code: ←[32m'ERR_INVALID_ARG_TYPE'←[39m
}
The first event on ready is wrong. You shouldn't be closing the parentheses after the 'ready'.
You should also use on instead of once.
client.on('ready', () => {
console.log('HelloMyFriend is online!');
});
To overcome this error you can replace your ready event with the following:
client.once('ready', () => {
console.log('HelloMyFriend is online!');
});
I would also recommend an .env file to protect the token of the bot. Once it becomes public, it should be generated again in the Discord Developer Portal to prevent possible hijacking of the bot.