I just trying copy / paste text from gmail to another input, and realized that the cafe test doesn't support ctrl-c, ctrl-v.
Here's what I tried to do:
pom:
import { Selector, t} from 'testcafe';
class LoginPage {
copyStepCarrierPassword: Selector;
copyCarrierPassword: Selector;
emailInput: Selector;
constructor(){
this.copyStepCarrierPassword = Selector('[class="ams bkG"]');
this.copyCarrierPassword = Selector('[class="gmail_quote"]');
this.emailInput = Selector('[id="userEmail"]');
}
async copyPassword(){
await t
.selectText(this.copyCarrierPassword, 1, 10)
.pressKey('ctrl+c');
}
async navigateToCarrierPage(carrierPageUrl){
await t
.navigateTo(carrierPageUrl)
}
async setEmailInput(emailInput){
await t
.typeText(this.emailInput, emailInput)
.pressKey('ctrl+v');
}
}
test:
test('Copy/Paste password',
async t => {
await t
LoginPage.copyStepPassword();
await t.wait(1000);
LoginPage.copyPassword();
await t.wait(3000);
await t.openWindow(carrierUrl);
LoginPage.setEmailInput('');
await t.wait(3000);
}
I saw example here, but I don't know how to use it in my case. Who knows how to resolve this problem?